diff --git a/content/.metadata.json b/content/.metadata.json index 08ce4e0d2..2a15b3831 100644 --- a/content/.metadata.json +++ b/content/.metadata.json @@ -1,64 +1,22 @@ { "metadata": { "version": "1.0", - "fetch_date": "2026-04-08T11:44:17.716242Z" + "fetch_date": "2026-04-08T16:49:48.553323Z" }, "items": [ { "url": "https://platform.claude.com/docs/en/intro", "status": "success", "path": "en/intro.md", - "sha256": "f270042814a8c4a7c374311a10f3027d6cc319cd4384586c163c1a3626a46fdd", - "size": 3361 + "sha256": "bc97e117ec735d4acefa973cbc98be587d08271cc8aca6034c48435f692c9d6f", + "size": 3893 }, { "url": "https://platform.claude.com/docs/en/get-started", "status": "success", "path": "en/get-started.md", - "sha256": "daa19686eb1690fc82967c1dd3aad4c497c71d3178ab580383ae1f71d5be4b49", - "size": 11143 - }, - { - "url": "https://platform.claude.com/docs/en/about-claude/models/overview", - "status": "success", - "path": "en/about-claude/models/overview.md", - "sha256": "db4358115c019eb7eb23012ec34de4ba0683159aa25a96b626f8f0e5d565c560", - "size": 10037 - }, - { - "url": "https://platform.claude.com/docs/en/about-claude/models/choosing-a-model", - "status": "success", - "path": "en/about-claude/models/choosing-a-model.md", - "sha256": "96c928e062ca62bc43029b5b68166cb7c0e2e46a22f25ff3de68cc1c722813d2", - "size": 4348 - }, - { - "url": "https://platform.claude.com/docs/en/about-claude/models/whats-new-claude-4-6", - "status": "success", - "path": "en/about-claude/models/whats-new-claude-4-6.md", - "sha256": "7a98cfa1cc0875b8983e8811a50d94d61beee0a22ff217d9b70bbca5b8d8b555", - "size": 9804 - }, - { - "url": "https://platform.claude.com/docs/en/about-claude/models/migration-guide", - "status": "success", - "path": "en/about-claude/models/migration-guide.md", - "sha256": "c0ace79841921633737d6aeae292bc44a6decaecff19b49241aab904b8c10705", - "size": 45161 - }, - { - "url": "https://platform.claude.com/docs/en/about-claude/model-deprecations", - "status": "success", - "path": "en/about-claude/model-deprecations.md", - "sha256": "cebc827b87f099d1c5f132fb76e95cc707451139199787123018263346d1c403", - "size": 9176 - }, - { - "url": "https://platform.claude.com/docs/en/about-claude/pricing", - "status": "success", - "path": "en/about-claude/pricing.md", - "sha256": "acdade6d72307ed5f370d8cc01b8cda4c21ec38146e069b687cc5d920ab6e89e", - "size": 20885 + "sha256": "c173b9740127d9005f770160bfcc06afe490f5933b3a2b4b8c1d9532f5bb2676", + "size": 13809 }, { "url": "https://platform.claude.com/docs/en/build-with-claude/overview", @@ -71,92 +29,85 @@ "url": "https://platform.claude.com/docs/en/build-with-claude/working-with-messages", "status": "success", "path": "en/build-with-claude/working-with-messages.md", - "sha256": "1b0735cd3122c463926fc8898f9c3836a1d5459a7de79c9d0f603c1886286ca4", - "size": 32314 + "sha256": "b9e9b2d551201e2e519bd4e821397a22d15f27268698b909194ccde75ed68dc2", + "size": 34431 }, { "url": "https://platform.claude.com/docs/en/build-with-claude/handling-stop-reasons", "status": "success", "path": "en/build-with-claude/handling-stop-reasons.md", - "sha256": "e8c9fb62f2c4877fe6e3c6c580c694833959e0d89e9269aacd839eabd2cfca83", - "size": 24054 - }, - { - "url": "https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices", - "status": "success", - "path": "en/build-with-claude/prompt-engineering/claude-prompting-best-practices.md", - "sha256": "5387b42af4e10ee84c29d988fad36e4d8623f5c40eec34a682b8758c1f7daf90", - "size": 46827 + "sha256": "d8102d8b7c9cba1887f0a7b739e2e5887c23e051ccb88dd1be9ed178c635a2a4", + "size": 24559 }, { "url": "https://platform.claude.com/docs/en/build-with-claude/extended-thinking", "status": "success", "path": "en/build-with-claude/extended-thinking.md", - "sha256": "675f93e33dfaf7523de39df3f84b94894418dc37881335e9d834ea3cabdb3b92", - "size": 134777 + "sha256": "b75580d6218a6afa608d25ae431cf7e26dbf1dedca39c5555cc08a88aadcd06c", + "size": 141629 }, { "url": "https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking", "status": "success", "path": "en/build-with-claude/adaptive-thinking.md", - "sha256": "1090bb59f5f0beb2ec817338a91f55880952c4b0c0942c5c4ce0399ce5ba6818", - "size": 33409 + "sha256": "fa1242fa01a7fac4fbec229751ef734d5d2d4ea576f0dfd7d0497f2a0949a1be", + "size": 34320 }, { "url": "https://platform.claude.com/docs/en/build-with-claude/effort", "status": "success", "path": "en/build-with-claude/effort.md", - "sha256": "277a214b03c522810c58850a16f1c706941b58c012bb368bd3e0544beb2ad6f1", - "size": 12940 + "sha256": "2257478112eac890dacc5b48de8491cbcf2e7a7a8dad1ab3748c39d2bfc6346b", + "size": 13218 }, { "url": "https://platform.claude.com/docs/en/build-with-claude/fast-mode", "status": "success", "path": "en/build-with-claude/fast-mode.md", - "sha256": "df52ecbb0b0ffdcc743c33ebaf808f9d9f9ae4c6ad736a7c834781f68e4ea405", - "size": 23394 + "sha256": "cc2363876a07e1776314435e8db4d9b1cb3fbe6648f3172f665a1d4c1be9c74e", + "size": 25028 }, { "url": "https://platform.claude.com/docs/en/build-with-claude/structured-outputs", "status": "success", "path": "en/build-with-claude/structured-outputs.md", - "sha256": "c41d099e71a06cd378c225d088f9c275fceec3a8535e32bd45e48662a9b9fc5e", - "size": 86086 + "sha256": "6645a33caa9a4a27d4c8789be2bddd700ce85f5546ea1001958b5c476a26a65c", + "size": 91474 }, { "url": "https://platform.claude.com/docs/en/build-with-claude/citations", "status": "success", "path": "en/build-with-claude/citations.md", - "sha256": "6f2d7d294f11227f419e250912c750b83fd3ce62714b06883adc1bfb244d94ac", - "size": 20757 + "sha256": "6a34f028adf565d5ef7e48a26da5a1d317f1db2dd20b46dfd8b9d5805c56709b", + "size": 21694 }, { "url": "https://platform.claude.com/docs/en/build-with-claude/streaming", "status": "success", "path": "en/build-with-claude/streaming.md", - "sha256": "8d11b7e81e4d97c525395f4082b87e80e44a01934b8729b82981467174de06de", - "size": 51399 + "sha256": "9151ecbbeeb955b38f90087f427ee85627bb8c72ea7ba72f0cae66d87c0b36a6", + "size": 53335 }, { "url": "https://platform.claude.com/docs/en/build-with-claude/batch-processing", "status": "success", "path": "en/build-with-claude/batch-processing.md", - "sha256": "d7e9f58bcd5e7eec6054017e7ece4d6e184ef4ff69217f0f025ea75566e7f6e0", - "size": 69148 + "sha256": "4dc409ece243e46706d06b6cb167735c6ef3236490300a6041b3497c4a3665ba", + "size": 73096 }, { - "url": "https://platform.claude.com/docs/en/build-with-claude/pdf-support", + "url": "https://platform.claude.com/docs/en/build-with-claude/search-results", "status": "success", - "path": "en/build-with-claude/pdf-support.md", - "sha256": "0321058144ebb3999b13ddb92e504ff2831d9e03533388af2487355d28a7ee8d", - "size": 35078 + "path": "en/build-with-claude/search-results.md", + "sha256": "78a8c66b72b812cc86ae40bfed952d16e5e488596e56349b68bdc153f213d9aa", + "size": 51825 }, { - "url": "https://platform.claude.com/docs/en/build-with-claude/search-results", + "url": "https://platform.claude.com/docs/en/test-and-evaluate/strengthen-guardrails/handle-streaming-refusals", "status": "success", - "path": "en/build-with-claude/search-results.md", - "sha256": "f9a9f5839a09471c479579085303e8ef54d0f9b2f6508c8ce3d5366a1012b8a9", - "size": 50640 + "path": "en/test-and-evaluate/strengthen-guardrails/handle-streaming-refusals.md", + "sha256": "7e435c6d28bf7b3af668ca0052394f44b46ae0d15c075c5b11dba98c07545216", + "size": 10245 }, { "url": "https://platform.claude.com/docs/en/build-with-claude/multilingual-support", @@ -172,19 +123,12 @@ "sha256": "1e94a92de3d5332b1bebf9de4f9b2c250fc216a3b535038081a42231e831a3d0", "size": 16342 }, - { - "url": "https://platform.claude.com/docs/en/build-with-claude/vision", - "status": "success", - "path": "en/build-with-claude/vision.md", - "sha256": "1d03f0874e98554414d95f0060102f89d19582c29f78243517cd576e787832cf", - "size": 48774 - }, { "url": "https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview", "status": "success", "path": "en/agents-and-tools/tool-use/overview.md", - "sha256": "9cfae879402b619a5af59b98a76b6f47c8b3d797891c0c916a9d6fd5bc2390a0", - "size": 8292 + "sha256": "471c863cda26c756b77c7f8032cf753fe6597d2ad51bee2ebc01644800e3c65f", + "size": 8551 }, { "url": "https://platform.claude.com/docs/en/agents-and-tools/tool-use/how-tool-use-works", @@ -193,159 +137,75 @@ "sha256": "fdcca0c84400350cad257fd4be100f18d94e68ce0f78392f73637064209923b7", "size": 8562 }, - { - "url": "https://platform.claude.com/docs/en/agents-and-tools/tool-use/build-a-tool-using-agent", - "status": "success", - "path": "en/agents-and-tools/tool-use/build-a-tool-using-agent.md", - "sha256": "677f70f339b94a63e997c6d2ca271a95647ada90de17c8df94bc5becc77b177e", - "size": 48814 - }, - { - "url": "https://platform.claude.com/docs/en/agents-and-tools/tool-use/define-tools", - "status": "success", - "path": "en/agents-and-tools/tool-use/define-tools.md", - "sha256": "a4455dfae407bb148caaf5290f21a916be77185e1b654c94b0042e95633822c2", - "size": 23515 - }, - { - "url": "https://platform.claude.com/docs/en/agents-and-tools/tool-use/handle-tool-calls", - "status": "success", - "path": "en/agents-and-tools/tool-use/handle-tool-calls.md", - "sha256": "a979d8d08af1e9acff04b54f2fa7f5b6de2012a391c52f9ab53b1157f336bd9b", - "size": 9254 - }, - { - "url": "https://platform.claude.com/docs/en/agents-and-tools/tool-use/parallel-tool-use", - "status": "success", - "path": "en/agents-and-tools/tool-use/parallel-tool-use.md", - "sha256": "b39229b20635003c3b809fa91103f5ef1e196ac8faaa6c24cd0f2ae9afd36b8c", - "size": 30275 - }, - { - "url": "https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-runner", - "status": "success", - "path": "en/agents-and-tools/tool-use/tool-runner.md", - "sha256": "6778e207434743fa1b896d7581501c6389f6a617119326ada99eeb5cc9f561e1", - "size": 26686 - }, - { - "url": "https://platform.claude.com/docs/en/agents-and-tools/tool-use/strict-tool-use", - "status": "success", - "path": "en/agents-and-tools/tool-use/strict-tool-use.md", - "sha256": "5562fb8ea40a1dde2afcc748abee540ce27ffd1edbf00bac77069446737a50dd", - "size": 33859 - }, - { - "url": "https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-use-with-prompt-caching", - "status": "success", - "path": "en/agents-and-tools/tool-use/tool-use-with-prompt-caching.md", - "sha256": "a19f41d804915b99e89864c6b7f142a963009a0cb71558f621d1628e47f530bc", - "size": 4759 - }, - { - "url": "https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools", - "status": "success", - "path": "en/agents-and-tools/tool-use/server-tools.md", - "sha256": "7652d270450e6ef17736ee1c40167c0b3306810fa3eae4afab99e90c426280d6", - "size": 15958 - }, - { - "url": "https://platform.claude.com/docs/en/agents-and-tools/tool-use/troubleshooting-tool-use", - "status": "success", - "path": "en/agents-and-tools/tool-use/troubleshooting-tool-use.md", - "sha256": "e25c7591a5b27a96fab7d14b22f76ffe27e0a1bbfdb45bc2302c8d0251cb8fc2", - "size": 4247 - }, - { - "url": "https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-reference", - "status": "success", - "path": "en/agents-and-tools/tool-use/tool-reference.md", - "sha256": "be6fe8fb639afde02303365119ff2327c46edd378b7c6c6bd821443474603820", - "size": 7145 - }, { "url": "https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool", "status": "success", "path": "en/agents-and-tools/tool-use/web-search-tool.md", - "sha256": "05074f62a90c5d568241b3435feb5bb9f6ba5d7cfdda1b85aa31acee05e2c8e6", - "size": 20393 + "sha256": "f844f0fb43d570987b715115e6c8b472f67128174844fd7b9a610ce0ed70da73", + "size": 20936 }, { "url": "https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-fetch-tool", "status": "success", "path": "en/agents-and-tools/tool-use/web-fetch-tool.md", - "sha256": "f0622b4302ab52259d49ef938932038c7d84671b070a3a3d1c1976971a85e799", - "size": 23297 + "sha256": "4fb89733a07e946d8a2b39e3806cd30b524bb26878281c7c53fb24cbec6bbe7a", + "size": 23874 }, { "url": "https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool", "status": "success", "path": "en/agents-and-tools/tool-use/code-execution-tool.md", - "sha256": "d4856566311bc55bfe173b4fcec88846c854805b771cfc588c004ec7588800e9", - "size": 52124 + "sha256": "8d0dfbe0ae0185b2d0a6b75560d48bde836ff34aeaec8f2d5bbf206b484b09a6", + "size": 54618 }, { "url": "https://platform.claude.com/docs/en/agents-and-tools/tool-use/memory-tool", "status": "success", "path": "en/agents-and-tools/tool-use/memory-tool.md", - "sha256": "fa6652d55aca22cce187720e41493a194806eaf69f9566bbf64c848190c9229d", - "size": 22905 + "sha256": "358d94ffad5fcc97f65c3ec71706892a7a84f25870d3ce0c60845bb31d87fcb6", + "size": 23610 }, { "url": "https://platform.claude.com/docs/en/agents-and-tools/tool-use/bash-tool", "status": "success", "path": "en/agents-and-tools/tool-use/bash-tool.md", - "sha256": "c6c28eb2b4f1c494b504d349164a062a425fe187555b74e6d63f93939dca7d56", - "size": 13968 + "sha256": "c163b24480a6cad553a51a4bf6ac2f07d433c0d4012724a74992da170fc8e88c", + "size": 14189 }, { "url": "https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool", "status": "success", "path": "en/agents-and-tools/tool-use/computer-use-tool.md", - "sha256": "8d85c813bf43cd1d8bcb17a3eb02457f324e38be9ab815e9cb195874eb5361e5", - "size": 40726 + "sha256": "cb320e68dbdb0a4076456c8e070a0c67a78d443141effab78b79132d9fa7eb87", + "size": 41168 }, { "url": "https://platform.claude.com/docs/en/agents-and-tools/tool-use/text-editor-tool", "status": "success", "path": "en/agents-and-tools/tool-use/text-editor-tool.md", - "sha256": "d3cac90d00891dd7d15b46d1928ebd3ad775ea030f80341202340cf916ffbc73", - "size": 40797 - }, - { - "url": "https://platform.claude.com/docs/en/agents-and-tools/tool-use/manage-tool-context", - "status": "success", - "path": "en/agents-and-tools/tool-use/manage-tool-context.md", - "sha256": "ffb2d4526ad0516145446dec17caded0887a334ffe58ef540bbf58b0e2894917", - "size": 4606 - }, - { - "url": "https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-combinations", - "status": "success", - "path": "en/agents-and-tools/tool-use/tool-combinations.md", - "sha256": "9ef3cff9d6bb2d577f71f5b8da2a5bc25869c089db89f896282ebbb19eebd3c0", - "size": 4874 + "sha256": "d9db7b0aef16767d0e6d39d8512d549dd36dce32b4b1442a96df130da310a6d3", + "size": 44358 }, { "url": "https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool", "status": "success", "path": "en/agents-and-tools/tool-use/tool-search-tool.md", - "sha256": "5a0377fe589a543ba20760a4f0703a310b0c5a5373a957a8e03d89be93af3240", - "size": 29664 + "sha256": "4f5c5b8446026ebd4aa6870a9cbcb3e2d815369b81685b932053f8b7bee0f4a2", + "size": 30516 }, { "url": "https://platform.claude.com/docs/en/agents-and-tools/tool-use/programmatic-tool-calling", "status": "success", "path": "en/agents-and-tools/tool-use/programmatic-tool-calling.md", - "sha256": "16ac417efda0dba9b15528a5e86524504d01ec5ad9cb56196e5ecce2e175d931", - "size": 45454 + "sha256": "bb3dd7c985f8c8e33ebc93e3c4b947a19cceb2821532811692657e1bd76cfa2e", + "size": 47109 }, { "url": "https://platform.claude.com/docs/en/agents-and-tools/tool-use/fine-grained-tool-streaming", "status": "success", "path": "en/agents-and-tools/tool-use/fine-grained-tool-streaming.md", - "sha256": "fa8d20977ad9cd392f3a7e62ec969a42129bbadacec340110e7c0c56b1e99a13", - "size": 10836 + "sha256": "7655d35e839ae089521f5b8f641c30eb263f147e02c4b59e59037b900ebc0f75", + "size": 11528 }, { "url": "https://platform.claude.com/docs/en/build-with-claude/context-windows", @@ -358,78 +218,211 @@ "url": "https://platform.claude.com/docs/en/build-with-claude/compaction", "status": "success", "path": "en/build-with-claude/compaction.md", - "sha256": "5e63ea97fcbae8dcc4714e1e2c2d1e1f777a57cd074bf686ab20b12fce064368", - "size": 95723 + "sha256": "2e89d7d810212e19aa5e4fd1cbb320726eb9d3f98aa2004472937f046385b8c5", + "size": 100552 }, { "url": "https://platform.claude.com/docs/en/build-with-claude/context-editing", "status": "success", "path": "en/build-with-claude/context-editing.md", - "sha256": "ee16690987f0c061ce5f5aa69de8cb943a9073999f7aff3f739dcfcc1542202d", - "size": 76453 + "sha256": "8fbd0328f940abaa8e382dd4414780804b8a8753f57dfd86ba3c53e4520aef12", + "size": 79733 }, { "url": "https://platform.claude.com/docs/en/build-with-claude/prompt-caching", "status": "success", "path": "en/build-with-claude/prompt-caching.md", - "sha256": "88a84f107e1234efe53b61c0966e39c8900f0616474a4748a8f585bb8d13f8e6", - "size": 113085 + "sha256": "6701067cdaa580f900fdfa40763bbc7e30084ea38de52a4f2b80ef428e18301a", + "size": 117892 }, { "url": "https://platform.claude.com/docs/en/build-with-claude/token-counting", "status": "success", "path": "en/build-with-claude/token-counting.md", - "sha256": "c484adfe514ebb645ef12d535ad70d9ce68f1a1cc04d066e3917a6cb7961127d", - "size": 41549 + "sha256": "62a9fd208c940b247cf0b36e3831c73da34a04664e5eba460805e85322fcb1c5", + "size": 43759 }, { "url": "https://platform.claude.com/docs/en/build-with-claude/files", "status": "success", "path": "en/build-with-claude/files.md", - "sha256": "dd96f5b53d5bb408f8e8d456f8579b02b2fa3b1ab5fa3f4636e39c92f35514e0", - "size": 26624 + "sha256": "8f86a2e46a35c8ca2aacabe52da4f3eb09df3274b81a919d0bfc854b1cc2c7e8", + "size": 27867 + }, + { + "url": "https://platform.claude.com/docs/en/build-with-claude/pdf-support", + "status": "success", + "path": "en/build-with-claude/pdf-support.md", + "sha256": "ae0cf46a3bf8e1df0442f2a3dad9ab235aa76c91f9d75a19aa1aafcd4fc39de4", + "size": 38560 + }, + { + "url": "https://platform.claude.com/docs/en/build-with-claude/vision", + "status": "success", + "path": "en/build-with-claude/vision.md", + "sha256": "5d34bbc1299d32522b8bc35824e64629bba4b3d2f01d94107f6a6fcbc8a721bf", + "size": 50353 }, { "url": "https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview", "status": "success", "path": "en/agents-and-tools/agent-skills/overview.md", - "sha256": "a1a6238d0381c6ea66cb0d2b902b22f4e0f454207739fe1e2d270720f7543580", - "size": 18850 + "sha256": "a6ba167cbe3cd3d5464eaaad762d5b1ef8e17fca55b771fec376f740a7c4ed63", + "size": 18221 }, { "url": "https://platform.claude.com/docs/en/agents-and-tools/agent-skills/quickstart", "status": "success", "path": "en/agents-and-tools/agent-skills/quickstart.md", - "sha256": "da27b0b27a12d5ce700e94f7801d65a2fa4c716b5ebd1f0652f59dc69b9e96cd", - "size": 14494 + "sha256": "2131bf5438c9e1bf5360b8ae7edcfdc1330f0de327644e5b007e557c94f9e934", + "size": 16770 }, { "url": "https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices", "status": "success", "path": "en/agents-and-tools/agent-skills/best-practices.md", - "sha256": "a18fc6d0b3d803da50de339176bfc6a147f3bec350292bbd7f821899af5a18f3", - "size": 41544 + "sha256": "d1da876439d60b3c813f6fac53745a0b518a7cc4af7973e6e9318dda64bee23a", + "size": 41372 }, { "url": "https://platform.claude.com/docs/en/agents-and-tools/agent-skills/enterprise", "status": "success", "path": "en/agents-and-tools/agent-skills/enterprise.md", - "sha256": "99ba22e3083e4431ab1bc5c29197cb67cd89687d8e9f6045361a66a1a2034db6", - "size": 12762 + "sha256": "6168dda2cca527a98efb5609477325d9cd4b4f5f2e297eb9aad5e563d3f5d9b8", + "size": 12590 }, { - "url": "https://platform.claude.com/docs/en/agents-and-tools/agent-skills/claude-api-skill", + "url": "https://platform.claude.com/docs/en/build-with-claude/skills-guide", "status": "success", - "path": "en/agents-and-tools/agent-skills/claude-api-skill.md", - "sha256": "e9c9ec279e6a19bb1641a5b50907cf34fa5a10ff257b6da6d61abc729d6c920f", - "size": 5772 + "path": "en/build-with-claude/skills-guide.md", + "sha256": "b013a3cc251f20972d3f337fbbfdaa0f1ef5581689b916877e694d7a56fee79e", + "size": 153861 }, { - "url": "https://platform.claude.com/docs/en/build-with-claude/skills-guide", + "url": "https://platform.claude.com/docs/en/agents-and-tools/remote-mcp-servers", "status": "success", - "path": "en/build-with-claude/skills-guide.md", - "sha256": "4b465dc6cbe05bc7a5401a035fb0d26183fcbc9653a0db12bb96b19ccb69f729", - "size": 144532 + "path": "en/agents-and-tools/remote-mcp-servers.md", + "sha256": "42aeab377e3bd764a9661a58119f60b92a3da01cdcd96feefd935df1c4b47c98", + "size": 1271 + }, + { + "url": "https://platform.claude.com/docs/en/agents-and-tools/mcp-connector", + "status": "success", + "path": "en/agents-and-tools/mcp-connector.md", + "sha256": "3e2f7aa9524eebfb99133ff19548e1abd9b7ca568e6db726a4cd6aa38d134b26", + "size": 25256 + }, + { + "url": "https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/overview", + "status": "success", + "path": "en/build-with-claude/prompt-engineering/overview.md", + "sha256": "1ab62e934b9215243b1088059525048e47411f6758feb4ad397f50afcf53ed6b", + "size": 2392 + }, + { + "url": "https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices", + "status": "success", + "path": "en/build-with-claude/prompt-engineering/claude-prompting-best-practices.md", + "sha256": "6de2d20ca96d4d0886a33080dfc79e56a66b60f6409dbc77ebe3afc99cf1e43f", + "size": 46888 + }, + { + "url": "https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/prompting-tools", + "status": "success", + "path": "en/build-with-claude/prompt-engineering/prompting-tools.md", + "sha256": "91eb182b1eda6cfba521739fdfff08de17d773c224a735a66ec5f84e0ae7577f", + "size": 10236 + }, + { + "url": "https://platform.claude.com/docs/en/test-and-evaluate/develop-tests", + "status": "success", + "path": "en/test-and-evaluate/develop-tests.md", + "sha256": "f53d8f3ae7a46cae179b8b3472bf1de9e05060914a69baf5dc3579e3d08984cc", + "size": 27264 + }, + { + "url": "https://platform.claude.com/docs/en/test-and-evaluate/eval-tool", + "status": "success", + "path": "en/test-and-evaluate/eval-tool.md", + "sha256": "c4e35d37b91ddff07c53cb655c84cb1a13570de04328b3382dfeb96a65c4c614", + "size": 5418 + }, + { + "url": "https://platform.claude.com/docs/en/test-and-evaluate/strengthen-guardrails/reduce-latency", + "status": "success", + "path": "en/test-and-evaluate/strengthen-guardrails/reduce-latency.md", + "sha256": "322e8242bcffa4ca042bd15971e9d8b1b24b67ba86c98c1ad173d98f06b3872e", + "size": 5221 + }, + { + "url": "https://platform.claude.com/docs/en/test-and-evaluate/strengthen-guardrails/reduce-hallucinations", + "status": "success", + "path": "en/test-and-evaluate/strengthen-guardrails/reduce-hallucinations.md", + "sha256": "32760d421159fe18dc2c87912338efeab5582a43f66aa5a5d2adef3c7d834074", + "size": 3732 + }, + { + "url": "https://platform.claude.com/docs/en/test-and-evaluate/strengthen-guardrails/increase-consistency", + "status": "success", + "path": "en/test-and-evaluate/strengthen-guardrails/increase-consistency.md", + "sha256": "d52112e5bf7003f6f14a81bfcc6cd1ba4a012f3b4c394b3caf101bc25a1fcc43", + "size": 14351 + }, + { + "url": "https://platform.claude.com/docs/en/test-and-evaluate/strengthen-guardrails/mitigate-jailbreaks", + "status": "success", + "path": "en/test-and-evaluate/strengthen-guardrails/mitigate-jailbreaks.md", + "sha256": "19976860e0270df8f58366c46d9ac25e2f87b42d7ecf81d14c708508518aa110", + "size": 4699 + }, + { + "url": "https://platform.claude.com/docs/en/test-and-evaluate/strengthen-guardrails/reduce-prompt-leak", + "status": "success", + "path": "en/test-and-evaluate/strengthen-guardrails/reduce-prompt-leak.md", + "sha256": "8c621321a8b5942ce0ce990687a5973919c04482a300a7852f5dcaafcc74d41e", + "size": 3090 + }, + { + "url": "https://platform.claude.com/docs/en/about-claude/glossary", + "status": "success", + "path": "en/about-claude/glossary.md", + "sha256": "1405208f57672548ba8389fec2db9a8cd4ec5baa99ecb09a08956b7929a1c55b", + "size": 9009 + }, + { + "url": "https://platform.claude.com/docs/en/about-claude/use-case-guides/overview", + "status": "success", + "path": "en/about-claude/use-case-guides/overview.md", + "sha256": "43239e353a3665f7f27444745f3ff3b76094016a7948fb6de3b2565925404d0b", + "size": 1108 + }, + { + "url": "https://platform.claude.com/docs/en/about-claude/use-case-guides/ticket-routing", + "status": "success", + "path": "en/about-claude/use-case-guides/ticket-routing.md", + "sha256": "95526bdf0d535c79aaec136ed81f0ee05620a37d4c1c0cb168b1f39cc68935fa", + "size": 29672 + }, + { + "url": "https://platform.claude.com/docs/en/about-claude/use-case-guides/customer-support-chat", + "status": "success", + "path": "en/about-claude/use-case-guides/customer-support-chat.md", + "sha256": "9a135f75f371fe2595a34d32f83b8e396f7092f144911d5febed74503d566567", + "size": 33730 + }, + { + "url": "https://platform.claude.com/docs/en/about-claude/use-case-guides/content-moderation", + "status": "success", + "path": "en/about-claude/use-case-guides/content-moderation.md", + "sha256": "5ac9b36d2e8c4a555d348b5e72c211932939b3c2a79cef97aaa840f3cf15bc03", + "size": 25358 + }, + { + "url": "https://platform.claude.com/docs/en/about-claude/use-case-guides/legal-summarization", + "status": "success", + "path": "en/about-claude/use-case-guides/legal-summarization.md", + "sha256": "17cbb01d881b2990978dcfd55a5eb87183d36867a0243fb9c531fbd1d5a90b83", + "size": 21702 }, { "url": "https://platform.claude.com/docs/en/agent-sdk/overview", @@ -568,8 +561,8 @@ "url": "https://platform.claude.com/docs/en/agent-sdk/slash-commands", "status": "success", "path": "en/agent-sdk/slash-commands.md", - "sha256": "3be47dec9405284b44e1f23371e6ba1383f1bb494e8569b9832a24d1ec78da98", - "size": 13172 + "sha256": "cce1f0e2da800821a24b2aa5c70f13dd0337b35d657682c3690b84b103b2a219", + "size": 13300 }, { "url": "https://platform.claude.com/docs/en/agent-sdk/skills", @@ -582,8 +575,8 @@ "url": "https://platform.claude.com/docs/en/agent-sdk/cost-tracking", "status": "success", "path": "en/agent-sdk/cost-tracking.md", - "sha256": "c108031b0d7fb88b18856f041c484ec0198d3500cab29cfb50c2bc4fa9ae8530", - "size": 11381 + "sha256": "00c853737cadc054c4771887587df909bba67cfd98d420e0489dbe96904ac96b", + "size": 11388 }, { "url": "https://platform.claude.com/docs/en/agent-sdk/todo-tracking", @@ -599,12 +592,19 @@ "sha256": "4897e9b43e3bcc8c96487c7bd32f338c18de714486737b032aef343a1f994019", "size": 10685 }, + { + "url": "https://platform.claude.com/docs/en/agent-sdk/migration-guide", + "status": "success", + "path": "en/agent-sdk/migration-guide.md", + "sha256": "4636a4d6a837c51eaf4174af53c12fa7428b4a805afdbe75a9b349ca986004d3", + "size": 9080 + }, { "url": "https://platform.claude.com/docs/en/agent-sdk/typescript", "status": "success", "path": "en/agent-sdk/typescript.md", - "sha256": "e1d2216372120977e551bedf1aaef7438c617ec2c7c23660a18d3582e800abfa", - "size": 73223 + "sha256": "fcdda15a39c00c64dedf9a77e61683ad483fc5bee39b58ffef1059750de3eb57", + "size": 73230 }, { "url": "https://platform.claude.com/docs/en/agent-sdk/typescript-v2-preview", @@ -621,123 +621,137 @@ "size": 113246 }, { - "url": "https://platform.claude.com/docs/en/agent-sdk/migration-guide", + "url": "https://platform.claude.com/docs/en/release-notes/overview", "status": "success", - "path": "en/agent-sdk/migration-guide.md", - "sha256": "4636a4d6a837c51eaf4174af53c12fa7428b4a805afdbe75a9b349ca986004d3", - "size": 9080 + "path": "en/release-notes/overview.md", + "sha256": "7f09add846740c12ad2d22fa0cb6de05286759f833e1fa9717b8e7fdf574856d", + "size": 39224 }, { - "url": "https://platform.claude.com/docs/en/agents-and-tools/mcp-connector", + "url": "https://platform.claude.com/docs/en/managed-agents/overview", "status": "success", - "path": "en/agents-and-tools/mcp-connector.md", - "sha256": "2fbd7970a9b6097dfea30f617333e9e2fe1750f2ce71ec0e0ffbbe35db5644d1", - "size": 24944 + "path": "en/managed-agents/overview.md", + "sha256": "52ca456014fa9569533b03db76576d2eacd71135331ee46325384d32385dd23b", + "size": 5646 }, { - "url": "https://platform.claude.com/docs/en/agents-and-tools/remote-mcp-servers", + "url": "https://platform.claude.com/docs/en/managed-agents/quickstart", "status": "success", - "path": "en/agents-and-tools/remote-mcp-servers.md", - "sha256": "42aeab377e3bd764a9661a58119f60b92a3da01cdcd96feefd935df1c4b47c98", - "size": 1271 + "path": "en/managed-agents/quickstart.md", + "sha256": "7c0ab68a050fcb1b021ab57ff9e9d8fc05d54668ee2283257f66a387b3283a0b", + "size": 23663 }, { - "url": "https://platform.claude.com/docs/en/build-with-claude/claude-in-amazon-bedrock", + "url": "https://platform.claude.com/docs/en/managed-agents/onboarding", "status": "success", - "path": "en/build-with-claude/claude-in-amazon-bedrock.md", - "sha256": "27d2db331d9649a1e75de2dd31637db9d8fe6b64b0ff5cede008b0d8ef015923", - "size": 11412 + "path": "en/managed-agents/onboarding.md", + "sha256": "8df87205bd38cb099e205174476958cccef251455d096cf8f06a653c12360de8", + "size": 4025 }, { - "url": "https://platform.claude.com/docs/en/build-with-claude/claude-on-amazon-bedrock", + "url": "https://platform.claude.com/docs/en/managed-agents/agent-setup", "status": "success", - "path": "en/build-with-claude/claude-on-amazon-bedrock.md", - "sha256": "01ccd6388151bb8189a8c3514108af7f6091eb8386cad1cdceede1b8c57c9975", - "size": 28749 + "path": "en/managed-agents/agent-setup.md", + "sha256": "fff2d904bee918fc84baf11021558817b94eff7b0929fa95becc4235624ccef7", + "size": 13885 }, { - "url": "https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry", + "url": "https://platform.claude.com/docs/en/managed-agents/tools", "status": "success", - "path": "en/build-with-claude/claude-in-microsoft-foundry.md", - "sha256": "031d5f283e82e224f885c676db91d52071c200ae6c4102639374117327577a24", - "size": 20754 + "path": "en/managed-agents/tools.md", + "sha256": "21580e46b68fe6228271024f3f6ff39584d25b23fd088d58081c3485c3528ffc", + "size": 14484 }, { - "url": "https://platform.claude.com/docs/en/build-with-claude/claude-on-vertex-ai", + "url": "https://platform.claude.com/docs/en/managed-agents/mcp-connector", "status": "success", - "path": "en/build-with-claude/claude-on-vertex-ai.md", - "sha256": "3eec9a604ceb11bf980c2d48afd035963734b1a2933a8ffac7790926698901e8", - "size": 23407 + "path": "en/managed-agents/mcp-connector.md", + "sha256": "8401150371f4b464b65957e7751ed58c3838bfc35edd6db18bd4d983d0eed00c", + "size": 9724 }, { - "url": "https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/overview", + "url": "https://platform.claude.com/docs/en/managed-agents/permission-policies", "status": "success", - "path": "en/build-with-claude/prompt-engineering/overview.md", - "sha256": "1ab62e934b9215243b1088059525048e47411f6758feb4ad397f50afcf53ed6b", - "size": 2392 + "path": "en/managed-agents/permission-policies.md", + "sha256": "7f43690053ca80c01884703e05cbb7ab1076145190ff06b8b5330307525e9e34", + "size": 25580 }, { - "url": "https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/prompting-tools", + "url": "https://platform.claude.com/docs/en/managed-agents/skills", "status": "success", - "path": "en/build-with-claude/prompt-engineering/prompting-tools.md", - "sha256": "91eb182b1eda6cfba521739fdfff08de17d773c224a735a66ec5f84e0ae7577f", - "size": 10236 + "path": "en/managed-agents/skills.md", + "sha256": "6f5a9018995628e2f9de0fdf6ac419acc1f5511c85a4df3e11add145f9695689", + "size": 5971 }, { - "url": "https://platform.claude.com/docs/en/test-and-evaluate/develop-tests", + "url": "https://platform.claude.com/docs/en/managed-agents/environments", "status": "success", - "path": "en/test-and-evaluate/develop-tests.md", - "sha256": "f53d8f3ae7a46cae179b8b3472bf1de9e05060914a69baf5dc3579e3d08984cc", - "size": 27264 + "path": "en/managed-agents/environments.md", + "sha256": "8a675d3732d3cc83b01202691b254188e48344ea258442f31f887c53758562aa", + "size": 17133 }, { - "url": "https://platform.claude.com/docs/en/test-and-evaluate/eval-tool", + "url": "https://platform.claude.com/docs/en/managed-agents/cloud-containers", "status": "success", - "path": "en/test-and-evaluate/eval-tool.md", - "sha256": "c4e35d37b91ddff07c53cb655c84cb1a13570de04328b3382dfeb96a65c4c614", - "size": 5418 + "path": "en/managed-agents/cloud-containers.md", + "sha256": "18695a12bff72365ab03c88e350b3fd6cc6a5a880c3cbbdb2443c2d4dec8ec77", + "size": 2166 }, { - "url": "https://platform.claude.com/docs/en/test-and-evaluate/strengthen-guardrails/reduce-latency", + "url": "https://platform.claude.com/docs/en/managed-agents/sessions", "status": "success", - "path": "en/test-and-evaluate/strengthen-guardrails/reduce-latency.md", - "sha256": "b86133508a37ca5c48ef2762d671329b17c0a23c910fa6231793de80ac2c53bc", - "size": 5207 + "path": "en/managed-agents/sessions.md", + "sha256": "309763a513acee8a9987e88c4317e6bbd382fe9dc2bff98d3d3066e3ed91ec5b", + "size": 17271 }, { - "url": "https://platform.claude.com/docs/en/test-and-evaluate/strengthen-guardrails/reduce-hallucinations", + "url": "https://platform.claude.com/docs/en/managed-agents/events-and-streaming", "status": "success", - "path": "en/test-and-evaluate/strengthen-guardrails/reduce-hallucinations.md", - "sha256": "32760d421159fe18dc2c87912338efeab5582a43f66aa5a5d2adef3c7d834074", - "size": 3732 + "path": "en/managed-agents/events-and-streaming.md", + "sha256": "a74e7e8d362c6e80f9aa4fb67467e4b35cc51a5eef4913e952a11709c08ef83f", + "size": 51864 }, { - "url": "https://platform.claude.com/docs/en/test-and-evaluate/strengthen-guardrails/increase-consistency", + "url": "https://platform.claude.com/docs/en/managed-agents/define-outcomes", "status": "success", - "path": "en/test-and-evaluate/strengthen-guardrails/increase-consistency.md", - "sha256": "d52112e5bf7003f6f14a81bfcc6cd1ba4a012f3b4c394b3caf101bc25a1fcc43", - "size": 14351 + "path": "en/managed-agents/define-outcomes.md", + "sha256": "8d50c2a236b5121a8644f2dae78287086870ad1e91e2de5145d8b047f168ae16", + "size": 19751 }, { - "url": "https://platform.claude.com/docs/en/test-and-evaluate/strengthen-guardrails/mitigate-jailbreaks", + "url": "https://platform.claude.com/docs/en/managed-agents/vaults", "status": "success", - "path": "en/test-and-evaluate/strengthen-guardrails/mitigate-jailbreaks.md", - "sha256": "19976860e0270df8f58366c46d9ac25e2f87b42d7ecf81d14c708508518aa110", - "size": 4699 + "path": "en/managed-agents/vaults.md", + "sha256": "b3a92fd98d4397e2da1cbaee4832ce498196d6a6d640341d72328578cb11a0b1", + "size": 22217 }, { - "url": "https://platform.claude.com/docs/en/test-and-evaluate/strengthen-guardrails/handle-streaming-refusals", + "url": "https://platform.claude.com/docs/en/managed-agents/github", "status": "success", - "path": "en/test-and-evaluate/strengthen-guardrails/handle-streaming-refusals.md", - "sha256": "7e435c6d28bf7b3af668ca0052394f44b46ae0d15c075c5b11dba98c07545216", - "size": 10245 + "path": "en/managed-agents/github.md", + "sha256": "c6026d8ce2beacc7c282025cd9471fb57e2c514513a0cb9954fe778f366f5829", + "size": 23516 }, { - "url": "https://platform.claude.com/docs/en/test-and-evaluate/strengthen-guardrails/reduce-prompt-leak", + "url": "https://platform.claude.com/docs/en/managed-agents/files", "status": "success", - "path": "en/test-and-evaluate/strengthen-guardrails/reduce-prompt-leak.md", - "sha256": "8c621321a8b5942ce0ce990687a5973919c04482a300a7852f5dcaafcc74d41e", - "size": 3090 + "path": "en/managed-agents/files.md", + "sha256": "43ad1f8588da809c165dc706c9dd4e52cf912e8368dffc65a97bdae565859db6", + "size": 18117 + }, + { + "url": "https://platform.claude.com/docs/en/managed-agents/memory", + "status": "success", + "path": "en/managed-agents/memory.md", + "sha256": "b6e97841d5f0db2ae54a53dde0a04a76048ad8434315ddabddc90dd148958c38", + "size": 37029 + }, + { + "url": "https://platform.claude.com/docs/en/managed-agents/multi-agent", + "status": "success", + "path": "en/managed-agents/multi-agent.md", + "sha256": "f4632ec8ed31078f1247afcd7e81d9952cb0e7a50741153fbe936bc947135e7b", + "size": 24156 }, { "url": "https://platform.claude.com/docs/en/build-with-claude/administration-api", @@ -746,19 +760,33 @@ "sha256": "d23302bcb818d5fb7f2101d31f87831f46590234d23d6870e9c9f9ab8f2479b3", "size": 7811 }, + { + "url": "https://platform.claude.com/docs/en/build-with-claude/workspaces", + "status": "success", + "path": "en/build-with-claude/workspaces.md", + "sha256": "713ddcfccb42812a5501d80f2b0defa6df26f742ca022265a8a521b2730846c4", + "size": 12472 + }, { "url": "https://platform.claude.com/docs/en/build-with-claude/data-residency", "status": "success", "path": "en/build-with-claude/data-residency.md", - "sha256": "b1278fdee89d33ce96f3304086c34ee421d00ec1e541b9da746a842ae3d9ce6e", - "size": 8433 + "sha256": "d515a5238cb4e7c5676c5de9b86bff73c733899bc3c24ae8d7a877e51d4339ed", + "size": 8703 }, { - "url": "https://platform.claude.com/docs/en/build-with-claude/workspaces", + "url": "https://platform.claude.com/docs/en/build-with-claude/api-and-data-retention", "status": "success", - "path": "en/build-with-claude/workspaces.md", - "sha256": "7196ce596dea74eac1c5f58c9f9a14ef6184c777b4ea97657c131dda34e9f15a", - "size": 12313 + "path": "en/build-with-claude/api-and-data-retention.md", + "sha256": "f95c8db4938a1dd99c7b6f0ae4b52e001d805cb30549a816b8b8c33a2fc3ca37", + "size": 22288 + }, + { + "url": "https://platform.claude.com/docs/en/build-with-claude/claude-code-analytics-api", + "status": "success", + "path": "en/build-with-claude/claude-code-analytics-api.md", + "sha256": "8a6bec99447e6d2fa9928dcc4b63faf68c78bb4e081ec5c81d1e9ad64f5f4722", + "size": 11250 }, { "url": "https://platform.claude.com/docs/en/build-with-claude/usage-cost-api", @@ -768,46 +796,109 @@ "size": 13322 }, { - "url": "https://platform.claude.com/docs/en/build-with-claude/claude-code-analytics-api", + "url": "https://platform.claude.com/docs/en/build-with-claude/claude-on-amazon-bedrock", "status": "success", - "path": "en/build-with-claude/claude-code-analytics-api.md", - "sha256": "8a6bec99447e6d2fa9928dcc4b63faf68c78bb4e081ec5c81d1e9ad64f5f4722", - "size": 11250 + "path": "en/build-with-claude/claude-on-amazon-bedrock.md", + "sha256": "40d062923e5804bd5dd1a8c88fb72241f110f675ad311f7df0408e7c5a1e43e6", + "size": 28957 }, { - "url": "https://platform.claude.com/docs/en/build-with-claude/api-and-data-retention", + "url": "https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry", "status": "success", - "path": "en/build-with-claude/api-and-data-retention.md", - "sha256": "b40a6c17fb3bff3cbf719b0120b2421517f84967a5e82060a10490788dbd6b51", - "size": 22340 + "path": "en/build-with-claude/claude-in-microsoft-foundry.md", + "sha256": "2a7584e48b73fd7e2f96d7c044ae185dea1309a188d8e1df432cb1f44c8316d0", + "size": 21152 }, { - "url": "https://platform.claude.com/docs/en/api/overview", + "url": "https://platform.claude.com/docs/en/build-with-claude/claude-on-vertex-ai", "status": "success", - "path": "en/api/overview.md", - "sha256": "a20b9ab4a4731c8f7a049fc4d05c1e4f885b7f60b5ec83edd8298eab726ab023", - "size": 8848 + "path": "en/build-with-claude/claude-on-vertex-ai.md", + "sha256": "48f0fb6cc3854aba715c1a083b1c9cbe37a011e6700a823edecdeee243193b28", + "size": 23609 }, { - "url": "https://platform.claude.com/docs/en/api/beta-headers", + "url": "https://platform.claude.com/docs/en/managed-agents/migration", "status": "success", - "path": "en/api/beta-headers.md", - "sha256": "acbea77d44d7ffdff6d46fd8292d8db11dfd8323ed3ae8c7843c66fcc6eb4977", - "size": 2982 + "path": "en/managed-agents/migration.md", + "sha256": "0fa85ce009531c3253e4fee180f9b8f00e7ad234b2c3ce4feecb2f15fcdc42de", + "size": 27677 }, { - "url": "https://platform.claude.com/docs/en/api/errors", + "url": "https://platform.claude.com/docs/en/managed-agents/observability", "status": "success", - "path": "en/api/errors.md", - "sha256": "ec2bdfd204bc452f97839fde634e4edf14373b95a05d11a448aeca83fe6ef609", - "size": 6722 + "path": "en/managed-agents/observability.md", + "sha256": "4cebacf6c95de773d96a86ad458ff854fb6fe169f9cc9073faf7b74200181f9e", + "size": 13162 + }, + { + "url": "https://platform.claude.com/docs/en/about-claude/models/overview", + "status": "success", + "path": "en/about-claude/models/overview.md", + "sha256": "db4358115c019eb7eb23012ec34de4ba0683159aa25a96b626f8f0e5d565c560", + "size": 10037 + }, + { + "url": "https://platform.claude.com/docs/en/about-claude/models/choosing-a-model", + "status": "success", + "path": "en/about-claude/models/choosing-a-model.md", + "sha256": "96c928e062ca62bc43029b5b68166cb7c0e2e46a22f25ff3de68cc1c722813d2", + "size": 4348 + }, + { + "url": "https://platform.claude.com/docs/en/about-claude/models/whats-new-claude-4-6", + "status": "success", + "path": "en/about-claude/models/whats-new-claude-4-6.md", + "sha256": "da607a8b04577fae1d51236c8e917de343a6783b4858d95bc4473c88cb33b7af", + "size": 9825 + }, + { + "url": "https://platform.claude.com/docs/en/about-claude/models/migration-guide", + "status": "success", + "path": "en/about-claude/models/migration-guide.md", + "sha256": "2ced9168d6a1abc93e792020574330c580ae009a1e2a687bb668bf8dcf69a906", + "size": 46740 + }, + { + "url": "https://platform.claude.com/docs/en/about-claude/model-deprecations", + "status": "success", + "path": "en/about-claude/model-deprecations.md", + "sha256": "cebc827b87f099d1c5f132fb76e95cc707451139199787123018263346d1c403", + "size": 9176 + }, + { + "url": "https://platform.claude.com/docs/en/resources/overview", + "status": "success", + "path": "en/resources/overview.md", + "sha256": "68da2bcc5c51e039029dd8625879914a2671e5693762a7dcccc9a6ac76c3d5aa", + "size": 3177 + }, + { + "url": "https://platform.claude.com/docs/en/release-notes/system-prompts", + "status": "success", + "path": "en/release-notes/system-prompts.md", + "sha256": "688eebd75e8703bbe002655b7fbdb37215ea6d8276e5fff6c8370fe6b8c81d40", + "size": 369074 + }, + { + "url": "https://platform.claude.com/docs/en/about-claude/pricing", + "status": "success", + "path": "en/about-claude/pricing.md", + "sha256": "1ceb301eb46b4c8a5de640a7f5214fe39a30ed7682170086fd08539d5df5df01", + "size": 22439 }, { "url": "https://platform.claude.com/docs/en/api/client-sdks", "status": "success", "path": "en/api/client-sdks.md", - "sha256": "ccf1f17a782d130f28057df9eb9e7d7b9a08009dfde933b4ffe5e76e8eb51a65", - "size": 7967 + "sha256": "42500dbbe9330bbf917bd6bb50e5b7e951f91eab49340311f43467588112eb65", + "size": 8505 + }, + { + "url": "https://platform.claude.com/docs/en/api/sdks/cli", + "status": "success", + "path": "en/api/sdks/cli.md", + "sha256": "ac77b7ffd116473f867d74e34e0dd1e549f4eefdbf1d81ccff2b67e31424a3f2", + "size": 16236 }, { "url": "https://platform.claude.com/docs/en/api/sdks/python", @@ -827,7 +918,7 @@ "url": "https://platform.claude.com/docs/en/api/sdks/java", "status": "success", "path": "en/api/sdks/java.md", - "sha256": "4519bcce13f61361efe7fe8270557e45f43323a89c976ee16125c5009b3be728", + "sha256": "bcb3ce24ec026d3332b106154f744fb98c8ecc72b6a3fd36af3d57fd6cfae2c2", "size": 44196 }, { @@ -841,8 +932,8 @@ "url": "https://platform.claude.com/docs/en/api/sdks/ruby", "status": "success", "path": "en/api/sdks/ruby.md", - "sha256": "f07fc188220e79a2639236ffa08afc322552a3fea695a2d067cb582049a8ff44", - "size": 13362 + "sha256": "de860a0859e8270a7096425c827b146049fbfa04258155cdfc7a0a965778b307", + "size": 13318 }, { "url": "https://platform.claude.com/docs/en/api/sdks/csharp", @@ -858,41 +949,6 @@ "sha256": "d0496b4436ad3fd6619b40d89d196dce45fa829257e9bd00bc4658f6987cb4ec", "size": 7018 }, - { - "url": "https://platform.claude.com/docs/en/api/rate-limits", - "status": "success", - "path": "en/api/rate-limits.md", - "sha256": "6304190afaf410f39ada62498645207e126abdf15c9c996901e16107e9d22758", - "size": 26297 - }, - { - "url": "https://platform.claude.com/docs/en/api/service-tiers", - "status": "success", - "path": "en/api/service-tiers.md", - "sha256": "6f081b4bb132610e8cd9dbecbea8dc4c6f1a6b23131384125c8c6f84fd281fe4", - "size": 5575 - }, - { - "url": "https://platform.claude.com/docs/en/api/versioning", - "status": "success", - "path": "en/api/versioning.md", - "sha256": "426fd21267dbafb4f231f71fbb28ba3edc2d265fddab6b0ae7ee1c8538ecf2b6", - "size": 1639 - }, - { - "url": "https://platform.claude.com/docs/en/api/ip-addresses", - "status": "success", - "path": "en/api/ip-addresses.md", - "sha256": "cc3c763ed7e1903ab2e670e5cf9ef8a578ce59194dcf9b1e57626762c2eafec0", - "size": 913 - }, - { - "url": "https://platform.claude.com/docs/en/api/supported-regions", - "status": "success", - "path": "en/api/supported-regions.md", - "sha256": "efff04f8b82996c132cd66435bcaa55ec0066240de3d3e8222af1399988aea7c", - "size": 2241 - }, { "url": "https://platform.claude.com/docs/en/api/openai-sdk", "status": "success", @@ -901,116 +957,109 @@ "size": 12088 }, { - "url": "https://platform.claude.com/docs/en/resources/overview", - "status": "success", - "path": "en/resources/overview.md", - "sha256": "68da2bcc5c51e039029dd8625879914a2671e5693762a7dcccc9a6ac76c3d5aa", - "size": 3177 - }, - { - "url": "https://platform.claude.com/docs/en/about-claude/glossary", + "url": "https://platform.claude.com/docs/en/api/overview", "status": "success", - "path": "en/about-claude/glossary.md", - "sha256": "1405208f57672548ba8389fec2db9a8cd4ec5baa99ecb09a08956b7929a1c55b", - "size": 9009 + "path": "en/api/overview.md", + "sha256": "23fbbb5510eddc47986a5a65cb3ca74d5481f4443431a86899f26def34596c70", + "size": 7543 }, { - "url": "https://platform.claude.com/docs/en/release-notes/system-prompts", + "url": "https://platform.claude.com/docs/en/api/beta-headers", "status": "success", - "path": "en/release-notes/system-prompts.md", - "sha256": "688eebd75e8703bbe002655b7fbdb37215ea6d8276e5fff6c8370fe6b8c81d40", - "size": 369074 + "path": "en/api/beta-headers.md", + "sha256": "19103d593aea77c0ae69aa9e01385b93d91dded83b163d12f0e8bfc3039c5818", + "size": 3606 }, { - "url": "https://platform.claude.com/docs/en/about-claude/use-case-guides/overview", + "url": "https://platform.claude.com/docs/en/api/errors", "status": "success", - "path": "en/about-claude/use-case-guides/overview.md", - "sha256": "43239e353a3665f7f27444745f3ff3b76094016a7948fb6de3b2565925404d0b", - "size": 1108 + "path": "en/api/errors.md", + "sha256": "663e1ead08480e0a38a8e7dc85e80e49bab7c5fb6eff5c5d4b6f536ff0c23684", + "size": 6945 }, { - "url": "https://platform.claude.com/docs/en/about-claude/use-case-guides/ticket-routing", + "url": "https://platform.claude.com/docs/en/api/rate-limits", "status": "success", - "path": "en/about-claude/use-case-guides/ticket-routing.md", - "sha256": "56311f9bb3cd1f84a2bc088b626740ffe4a858065285a73d93212872993c1265", - "size": 29658 + "path": "en/api/rate-limits.md", + "sha256": "f55461470e4f0952eda3c20b533c6506e56abf29f72d8bc8034c6a05cb6e2b73", + "size": 26686 }, { - "url": "https://platform.claude.com/docs/en/about-claude/use-case-guides/customer-support-chat", + "url": "https://platform.claude.com/docs/en/api/service-tiers", "status": "success", - "path": "en/about-claude/use-case-guides/customer-support-chat.md", - "sha256": "9a135f75f371fe2595a34d32f83b8e396f7092f144911d5febed74503d566567", - "size": 33730 + "path": "en/api/service-tiers.md", + "sha256": "2e86065494139b593e4798f4b67e327653843379fec766c7767737e490477444", + "size": 5582 }, { - "url": "https://platform.claude.com/docs/en/about-claude/use-case-guides/content-moderation", + "url": "https://platform.claude.com/docs/en/api/versioning", "status": "success", - "path": "en/about-claude/use-case-guides/content-moderation.md", - "sha256": "e79bc43acaa889c4955f0c913b3cf8bacb9e2d52d788a3ceedbe9e0aeb9d5691", - "size": 25329 + "path": "en/api/versioning.md", + "sha256": "f7848bbf23822ff845b28fbe28f5c2ad26627d93f8fde03b7d48b6c7e254acac", + "size": 1657 }, { - "url": "https://platform.claude.com/docs/en/about-claude/use-case-guides/legal-summarization", + "url": "https://platform.claude.com/docs/en/api/ip-addresses", "status": "success", - "path": "en/about-claude/use-case-guides/legal-summarization.md", - "sha256": "56eadda92a6ff3441bcda9cbec2710a1f8aabbf21aa7f3954503177f6b35da53", - "size": 21688 + "path": "en/api/ip-addresses.md", + "sha256": "cc3c763ed7e1903ab2e670e5cf9ef8a578ce59194dcf9b1e57626762c2eafec0", + "size": 913 }, { - "url": "https://platform.claude.com/docs/en/release-notes/overview", + "url": "https://platform.claude.com/docs/en/api/supported-regions", "status": "success", - "path": "en/release-notes/overview.md", - "sha256": "701cb7908ba0c1b30ca959f08c696eb480e19b7a4946ee96c3872277842497cd", - "size": 38509 + "path": "en/api/supported-regions.md", + "sha256": "efff04f8b82996c132cd66435bcaa55ec0066240de3d3e8222af1399988aea7c", + "size": 2241 }, { "url": "https://platform.claude.com/docs/en/api/completions", "status": "success", "path": "en/api/completions.md", - "sha256": "172aea891cf5a1fd881b339103cceddd97dd507272d898bbc41f25613c68b1ef", - "size": 11541 + "sha256": "86667d7b7bf2d3118f4b6760c8cdb5675acacaaca374ca060ceb16557dcb5ea5", + "size": 11858 }, { "url": "https://platform.claude.com/docs/en/api/completions/create", "status": "success", "path": "en/api/completions/create.md", - "sha256": "a2dea0a4c840acce2bf49963c90bac3170c1a640292a81ac4ef9ea93cf44de7b", - "size": 8964 + "sha256": "232244d49370abb9a09078e4598fef802e6e072e2f6c59ae82d373b7f2113042", + "size": 9164 }, { "url": "https://platform.claude.com/docs/en/api/messages", "status": "success", "path": "en/api/messages.md", - "sha256": "bb0ff317904c110a9abe768ed5385e1ade18167ed10002a9c62879657a260bf3", - "size": 897401 + "sha256": "444d6858f3d62fa6e4058f3eff76fff40ccb0c222e70b8fb37dde95517cc2051", + "size": 898856 }, { "url": "https://platform.claude.com/docs/en/api/messages/create", "status": "success", "path": "en/api/messages/create.md", - "sha256": "533046bb19826e4cd7b0083c4624aeb056a5c4ceadd231ee677292c070613250", - "size": 122130 + "sha256": "aafae94a53651303c80eb77b1531d46ff6d92f5215a01a12743d9fe4f3f99136", + "size": 122360 }, { "url": "https://platform.claude.com/docs/en/api/messages/count_tokens", "status": "success", "path": "en/api/messages/count_tokens.md", - "sha256": "323cd2875b9ad11da145457900d2cf7fc0ebc16e16b3de535fe2f7adfc762ea4", - "size": 96728 + "sha256": "10be790030adbfb0c622fc846f8469431644392d82d8bac6d17fc3fa23b1b550", + "size": 96847 }, { "url": "https://platform.claude.com/docs/en/api/messages/batches", "status": "success", "path": "en/api/messages/batches.md", - "sha256": "601377e6e3ae4a4bffb6a68d0bd3f5a5c5948d7953b8fe5596c46a77ee3f37e4", - "size": 235604 + "sha256": "95729648967e950b904959a9f378de9cea716005aac2670b20aed34ac9d86fd9", + "size": 236229 }, { "url": "https://platform.claude.com/docs/en/api/messages/batches/create", "status": "success", "path": "en/api/messages/batches/create.md", - "sha256": "6ffaaaf4a0f3121244138600261f81ee91a1739f5c590128c8f3276cb7b808ba", - "size": 111363 + "sha256": "89b1dc1d5cbf4243142c8e23ef561a12348eed489f804cc8a22ed265a640bbaa", + "size": 111484 }, { "url": "https://platform.claude.com/docs/en/api/messages/batches/retrieve", @@ -1044,342 +1093,622 @@ "url": "https://platform.claude.com/docs/en/api/messages/batches/results", "status": "success", "path": "en/api/messages/batches/results.md", - "sha256": "d2e4da5349604b7b9e56fb915dedc4b639669143b681e623b22b99217e65a840", - "size": 28577 + "sha256": "d78446bfd805b16814c6aa1a910d1c7fd008c6c36fe8c363895878a949d4a681", + "size": 28706 }, { "url": "https://platform.claude.com/docs/en/api/models", "status": "success", "path": "en/api/models.md", - "sha256": "f86fad3c700a06dcfd10d8838c7c34d65d49c66038cef7f41afa37f23ee41d06", - "size": 23216 + "sha256": "78b104794e305ca2b79ac07ffa473f1f9b45ef92b2dec85d8a6d51d6aeab2c3d", + "size": 23144 }, { "url": "https://platform.claude.com/docs/en/api/models/list", "status": "success", "path": "en/api/models/list.md", - "sha256": "c09d807618785ff65ca01eb9b44585cf1befe2718c61676dcc6a9d0ac41ee344", - "size": 6469 + "sha256": "36b4a25a55529c9df47966dd289c014d697bdbc8ebb7082eaae7b736c865ef2b", + "size": 6433 }, { "url": "https://platform.claude.com/docs/en/api/models/retrieve", "status": "success", "path": "en/api/models/retrieve.md", - "sha256": "6a65e3554cabab2a1af71311d206de9d23dc17e6eb904b83774d76d3789b3756", - "size": 5818 + "sha256": "0f19a75c33720e90d80d4f35b92e3736bf10d7cae3adae9c9532a6c50d392a2f", + "size": 5782 }, { "url": "https://platform.claude.com/docs/en/api/beta", "status": "success", "path": "en/api/beta.md", - "sha256": "0a56c3fd7ccf2424d7efe3c7ca4f15e0c0dbe2382cc525d51ba5fdc3ec9cdedd", - "size": 1188825 + "sha256": "5a0dec8003effa8c821790f9e40ba34aa46a6f9a43ae62f454edb61b04655b6d", + "size": 1738643 }, { "url": "https://platform.claude.com/docs/en/api/beta/models", "status": "success", "path": "en/api/beta/models.md", - "sha256": "51dc5f5499e05437e2896227bdba34084e44075f28cfe6f97cf63ec69570f499", - "size": 23651 + "sha256": "af1874cefcd36cf680f59b28222cddc2d71a564f251b0132587721484db1564a", + "size": 23579 }, { "url": "https://platform.claude.com/docs/en/api/beta/models/list", "status": "success", "path": "en/api/beta/models/list.md", - "sha256": "4faa5b49a9cd85d2dcb3ad97b83ed4b94e535f142903dd856ede1e419509f60f", - "size": 6553 + "sha256": "5fe6d242b4d5be26655ccb839add218bbe2e4d25dbd55ce898c1176d17490eed", + "size": 6517 }, { "url": "https://platform.claude.com/docs/en/api/beta/models/retrieve", "status": "success", "path": "en/api/beta/models/retrieve.md", - "sha256": "d88760c7cbdb29b351c6677ad94d18c63f22db1352e80e2410a9af8d63d7a2c1", - "size": 5902 + "sha256": "8fd94f2b6b32b8339b294c85cd8abb663c780be894733c95b3f8a28baa540786", + "size": 5866 }, { "url": "https://platform.claude.com/docs/en/api/beta/messages", "status": "success", "path": "en/api/beta/messages.md", - "sha256": "0bb19b96d04020cb2607b64ce256c3695c7239ad0f3b6c04ae350e2e4f73dd97", - "size": 1112061 + "sha256": "62e5b4eb904f849b087a8747be6d511cf79be91700a7358de0727767d9216e6c", + "size": 1112786 }, { "url": "https://platform.claude.com/docs/en/api/beta/messages/create", "status": "success", "path": "en/api/beta/messages/create.md", - "sha256": "3f16b1363d0194eaa8bf94fee46b5f4303d3663cad427a39fde0d1b4db42e823", - "size": 153731 + "sha256": "5360225e03d7ac3c66c96f6e5a5971889288f4904169b96ac222a0819df63170", + "size": 153767 }, { "url": "https://platform.claude.com/docs/en/api/beta/messages/count_tokens", "status": "success", "path": "en/api/beta/messages/count_tokens.md", - "sha256": "9eab57d92b24cbe7f027da5acb6c9f737a0c56bf74465b63ea93d754fdeba416", - "size": 119322 + "sha256": "b2178b06a53f396a89ad73424ac16a74ebb20bb19a75c12e34d3b3cd3b0c1c3a", + "size": 119405 }, { "url": "https://platform.claude.com/docs/en/api/beta/messages/batches", "status": "success", "path": "en/api/beta/messages/batches.md", - "sha256": "4d22404990bb278be2178275c0e62ab2c78c4ccc98f774e62b0fb54b222aa185", - "size": 303525 + "sha256": "1dba2af461d12c9dc3747c10b878c6813e90cfd772792a7f9117d1b2b81520b2", + "size": 303768 }, { "url": "https://platform.claude.com/docs/en/api/beta/messages/batches/create", "status": "success", "path": "en/api/beta/messages/batches/create.md", - "sha256": "a4124411cfb44775d218a5e5b46d67552bfcbf972f283b1ac8b56a0491581e4c", - "size": 136234 + "sha256": "d5ee19d4610f51ccea5a32394f47d2a06bd8ce72c68a73dcae4db9c75ff5c1d9", + "size": 136153 }, { "url": "https://platform.claude.com/docs/en/api/beta/messages/batches/retrieve", "status": "success", "path": "en/api/beta/messages/batches/retrieve.md", - "sha256": "ec4b4c463cb4568760f56b3080adfd2bbd5b1bf1dbeb534e520be2f40e4076d2", - "size": 4608 + "sha256": "0da65451d23fc323bfa98db7c3b4eb4f7835eb8a56cce01acc891e49524767e5", + "size": 4572 }, { "url": "https://platform.claude.com/docs/en/api/beta/messages/batches/list", "status": "success", "path": "en/api/beta/messages/batches/list.md", - "sha256": "be943a5c8ec4f1743e8ac1fb553cecc1768a1f83af25d9444f2af96b12593418", - "size": 5120 + "sha256": "92e88a94a522d0d7ec99991f3c862fc51090e320b31db304f9cdc27f9dd909da", + "size": 5084 }, { "url": "https://platform.claude.com/docs/en/api/beta/messages/batches/cancel", "status": "success", "path": "en/api/beta/messages/batches/cancel.md", - "sha256": "6107448f700894cc1d05cdd8489b233548743488b701fd951cc0aba5753a2b55", - "size": 4945 + "sha256": "03420745a264a8dd76376d027b1670a23410e84507797118280ad03168a1d48a", + "size": 4909 }, { "url": "https://platform.claude.com/docs/en/api/beta/messages/batches/delete", "status": "success", "path": "en/api/beta/messages/batches/delete.md", - "sha256": "74834f88895232bfcd441fa20f7774fea8cab97c1e5535d2ccf95f00507672c1", - "size": 2063 + "sha256": "d91afc4abf2fbb795e1ca7be44a91166960b334deb52c03a8c70076d302bdfc8", + "size": 2027 }, { "url": "https://platform.claude.com/docs/en/api/beta/messages/batches/results", "status": "success", "path": "en/api/beta/messages/batches/results.md", - "sha256": "26367ab9fc5ad3d468ae1b0a8f52ad9c2c624e372508c657fad0f7e650b78af3", - "size": 39262 + "sha256": "9fb6469e2cc3f92630455c25adfc75ede65d666ec2e693cf3c5c289913f3e08b", + "size": 39355 }, { - "url": "https://platform.claude.com/docs/en/api/beta/files", + "url": "https://platform.claude.com/docs/en/api/beta/agents", "status": "success", - "path": "en/api/beta/files.md", - "sha256": "087a774ac9f313d9360450426736730ea0cbdedcec3a658f89fe19aa040eb70f", - "size": 10817 + "path": "en/api/beta/agents.md", + "sha256": "069edcb785439a9718b1cde3d4b6ebd0cdd4d0bd005e6aaf015075a6946d1cb2", + "size": 105416 }, { - "url": "https://platform.claude.com/docs/en/api/beta/files/upload", + "url": "https://platform.claude.com/docs/en/api/beta/agents/create", "status": "success", - "path": "en/api/beta/files/upload.md", - "sha256": "d60fac3d5af65aa69c42c50fcbc1007052db0c0ce1dc9b2e77260fe784512420", - "size": 2048 + "path": "en/api/beta/agents/create.md", + "sha256": "32c35c08000d73af4f840ae9710538085762734e10dccc916e197e0bee50cc9e", + "size": 19091 }, { - "url": "https://platform.claude.com/docs/en/api/beta/files/list", + "url": "https://platform.claude.com/docs/en/api/beta/agents/list", "status": "success", - "path": "en/api/beta/files/list.md", - "sha256": "8fd406de7d4840e001381d3819e60c1a25361b1615d3438650865bc2456c9269", - "size": 2665 + "path": "en/api/beta/agents/list.md", + "sha256": "6db8b045e978fa98765bbdd71431545709767de86156f5644255280c2668bb0c", + "size": 9028 }, { - "url": "https://platform.claude.com/docs/en/api/beta/files/download", + "url": "https://platform.claude.com/docs/en/api/beta/agents/retrieve", "status": "success", - "path": "en/api/beta/files/download.md", - "sha256": "942f577b25dcd6e886f309be7bd577b2724e170c3cbdae600314179f869f5e90", - "size": 1439 + "path": "en/api/beta/agents/retrieve.md", + "sha256": "0d677fd4febc15ca321ca35d4539e05a0a46b4cae15b425a1d6e0f4ff735275d", + "size": 8688 }, { - "url": "https://platform.claude.com/docs/en/api/beta/files/retrieve_metadata", + "url": "https://platform.claude.com/docs/en/api/beta/agents/update", "status": "success", - "path": "en/api/beta/files/retrieve_metadata.md", - "sha256": "266093eb24bb0e8d71e70c6e7ee526be82026e5664c6ba9de0265bc5d3128b10", - "size": 2068 + "path": "en/api/beta/agents/update.md", + "sha256": "9fadd4168bca7d680865b8b022991697adcb29500e72d52e95b01c189e8386ae", + "size": 19720 }, { - "url": "https://platform.claude.com/docs/en/api/beta/files/delete", + "url": "https://platform.claude.com/docs/en/api/beta/agents/archive", "status": "success", - "path": "en/api/beta/files/delete.md", - "sha256": "83c59b4a72977c24892cc7f1f608b30138365ed059e7b516335a4c6360c879f4", - "size": 1681 + "path": "en/api/beta/agents/archive.md", + "sha256": "0dc7fbf1c49091d43e860855a014a8eb1ca4dd078015f03f063fa4480365ea07", + "size": 8585 }, { - "url": "https://platform.claude.com/docs/en/api/beta/skills", + "url": "https://platform.claude.com/docs/en/api/beta/agents/versions", "status": "success", - "path": "en/api/beta/skills.md", - "sha256": "ec8d6162e784ff398f03c6367ba155031ca41fd1dc6929d8230ee76343b0fa20", - "size": 26346 + "path": "en/api/beta/agents/versions.md", + "sha256": "05606144266683b03602fce9b121830cfb9e9af1882afc47c8e3050f074974fe", + "size": 8806 }, { - "url": "https://platform.claude.com/docs/en/api/beta/skills/create", + "url": "https://platform.claude.com/docs/en/api/beta/agents/versions/list", "status": "success", - "path": "en/api/beta/skills/create.md", - "sha256": "e5be729d0312312dcd3f67ee10545e1f78a08fcbde857780038ed589bb593431", - "size": 2200 + "path": "en/api/beta/agents/versions/list.md", + "sha256": "00eac1a44ea85b4464254d77b6e9bc13bb8023bf9266e4c796403fe1ef1fd618", + "size": 8794 }, { - "url": "https://platform.claude.com/docs/en/api/beta/skills/list", + "url": "https://platform.claude.com/docs/en/api/beta/environments", "status": "success", - "path": "en/api/beta/skills/list.md", - "sha256": "231840aa4f0fe004d84bccd314136eded80ab44ba84912c431f40647dc49891e", - "size": 3232 + "path": "en/api/beta/environments.md", + "sha256": "536704a977b1081128cfad46ecdd2ee7780fb701916abb99ab79f77d1cd6999a", + "size": 37911 }, { - "url": "https://platform.claude.com/docs/en/api/beta/skills/retrieve", + "url": "https://platform.claude.com/docs/en/api/beta/environments/create", "status": "success", - "path": "en/api/beta/skills/retrieve.md", - "sha256": "3f3134ae00cfb70b9653f21eb397d709682454a253c0543a3fc8804bb263382f", - "size": 2338 + "path": "en/api/beta/environments/create.md", + "sha256": "d9762779c973f861ea3f12cad5853894ede95e8ec46f4125179f1490ac9eca32", + "size": 6925 }, { - "url": "https://platform.claude.com/docs/en/api/beta/skills/delete", + "url": "https://platform.claude.com/docs/en/api/beta/environments/list", "status": "success", - "path": "en/api/beta/skills/delete.md", - "sha256": "0e20fc3ff1501f59ce5ec7874379871ffab4c49388fc23b20981c355fe1ac8ed", - "size": 1722 + "path": "en/api/beta/environments/list.md", + "sha256": "a384cb85a99cacd8701dd7028c5895f6918619628b17f8e1e18a6f5520b5c6e3", + "size": 4304 }, { - "url": "https://platform.claude.com/docs/en/api/beta/skills/versions", + "url": "https://platform.claude.com/docs/en/api/beta/environments/retrieve", "status": "success", - "path": "en/api/beta/skills/versions.md", - "sha256": "f0c309756dc9e0eed11d8fbdda70aef1ddeaced9ab3213a62d2f6cf1aba8bafa", - "size": 13606 + "path": "en/api/beta/environments/retrieve.md", + "sha256": "e992866883fa7d921c85760b0423f5624437cc38b07ca1a1f58015d5b83de0b1", + "size": 3960 }, { - "url": "https://platform.claude.com/docs/en/api/beta/skills/versions/create", + "url": "https://platform.claude.com/docs/en/api/beta/environments/update", "status": "success", - "path": "en/api/beta/skills/versions/create.md", - "sha256": "f9934b49e021653159e1a42c51859a508fb83644932a0517b8970e86d068fff6", - "size": 2461 + "path": "en/api/beta/environments/update.md", + "sha256": "7b134f244b7d42f2238c413af4bf5ceca51e08ba83785825f5d9fbed5295769c", + "size": 7011 }, { - "url": "https://platform.claude.com/docs/en/api/beta/skills/versions/list", + "url": "https://platform.claude.com/docs/en/api/beta/environments/delete", "status": "success", - "path": "en/api/beta/skills/versions/list.md", - "sha256": "e5cc2369e694fe57705a4c15489d2baa7c2a907c5cfd06f79ba96cdd5964b6a8", - "size": 3028 + "path": "en/api/beta/environments/delete.md", + "sha256": "92e30f6916093135a8f158c20831e34234138567ffa3a59b649dcffe134ec8d9", + "size": 1787 }, { - "url": "https://platform.claude.com/docs/en/api/beta/skills/versions/retrieve", + "url": "https://platform.claude.com/docs/en/api/beta/environments/archive", "status": "success", - "path": "en/api/beta/skills/versions/retrieve.md", - "sha256": "3fb8ecdf51ebed03fa634c51a9b638f855ec707382e0a007e64520543a557c2a", - "size": 2606 + "path": "en/api/beta/environments/archive.md", + "sha256": "22c4fc28d1fcb48efc67bacf8a836a54b52326ac46be65fc30a31291267e1b7e", + "size": 4042 }, { - "url": "https://platform.claude.com/docs/en/api/beta/skills/versions/delete", + "url": "https://platform.claude.com/docs/en/api/beta/sessions", "status": "success", - "path": "en/api/beta/skills/versions/delete.md", - "sha256": "4183c41d34f3d122dba12c0b63c7fcab407bb944ab66b72b24a8ed98a5d2bba4", - "size": 1956 + "path": "en/api/beta/sessions.md", + "sha256": "2cb6d5b232c909ec8863289f0c8ef63172ffaa45fd2df741fd033cb9997a7af2", + "size": 356070 }, { - "url": "https://platform.claude.com/docs/en/api/beta/user_profiles", + "url": "https://platform.claude.com/docs/en/api/beta/sessions/create", "status": "success", - "path": "en/api/beta/user_profiles.md", - "sha256": "ce200a1a9d0303db4ba72501e42c39dd1e36d64ba7507d914f1f6f5e724128f2", - "size": 10455 + "path": "en/api/beta/sessions/create.md", + "sha256": "b843bcc309ca5517df1d4cf93f49b0e333f3bf5dd2abd35f826fcd3e04039618", + "size": 14492 }, { - "url": "https://platform.claude.com/docs/en/api/beta/user_profiles/create", + "url": "https://platform.claude.com/docs/en/api/beta/sessions/list", "status": "success", - "path": "en/api/beta/user_profiles/create.md", - "sha256": "a65fa336bf46be02ad6058f50d8c92c8d081f2647a0c2f40145cf3a5a567a588", - "size": 2072 + "path": "en/api/beta/sessions/list.md", + "sha256": "287940708226c77e02bb8214c8f9182f7cc7e042e21ec887933f6b4e360e37cf", + "size": 12725 }, { - "url": "https://platform.claude.com/docs/en/api/beta/user_profiles/list", + "url": "https://platform.claude.com/docs/en/api/beta/sessions/retrieve", "status": "success", - "path": "en/api/beta/user_profiles/list.md", - "sha256": "929957f5928e16872463b7ee6939b0aa84256d90457677950cff45c882cf818f", - "size": 1975 + "path": "en/api/beta/sessions/retrieve.md", + "sha256": "43476d95b271956a20e6532e7358f93366a41127ac2408a3ca7aa9ec55061a37", + "size": 11704 }, { - "url": "https://platform.claude.com/docs/en/api/beta/user_profiles/retrieve", + "url": "https://platform.claude.com/docs/en/api/beta/sessions/update", "status": "success", - "path": "en/api/beta/user_profiles/retrieve.md", - "sha256": "020d9734138d8caa2c299c32f9ffec84ed6ab8df997dcc4d8288c7b15ad46ef5", - "size": 1795 + "path": "en/api/beta/sessions/update.md", + "sha256": "6f9ed61040d6b40d5844a6298c30bbd4a2bc66a6af5157bc285e69d5b055bb11", + "size": 12164 }, { - "url": "https://platform.claude.com/docs/en/api/beta/user_profiles/update", + "url": "https://platform.claude.com/docs/en/api/beta/sessions/delete", "status": "success", - "path": "en/api/beta/user_profiles/update.md", - "sha256": "a668cac16338837049265a7d26429a33d879410d3b04102dc10bc428d261e9fe", - "size": 2208 + "path": "en/api/beta/sessions/delete.md", + "sha256": "b29e0ba057e5096596e3502a30775b58e04184f7a34690dd80c1c4b7dd440c6e", + "size": 1617 }, { - "url": "https://platform.claude.com/docs/en/api/beta/user_profiles/create_enrollment_url", + "url": "https://platform.claude.com/docs/en/api/beta/sessions/archive", "status": "success", - "path": "en/api/beta/user_profiles/create_enrollment_url.md", - "sha256": "0e0d18e49fcef63b99dea3f45df8cee8f04cbc84cffedc81a80cb9c3050c8b43", - "size": 1658 + "path": "en/api/beta/sessions/archive.md", + "sha256": "84f4a8439570d94fe3637d63c29f9cc12fc7d664190f83a380f09ca772401a57", + "size": 11738 }, { - "url": "https://platform.claude.com/docs/en/api/typescript/completions", + "url": "https://platform.claude.com/docs/en/api/beta/sessions/events", "status": "success", - "path": "en/api/typescript/completions.md", - "sha256": "c3a4e6f18f8d30379663bfa910a4b4dea6638ddf3678ce62d7303b157c6ffcd6", - "size": 12168 + "path": "en/api/beta/sessions/events.md", + "sha256": "3b9c2b4aa5f9e897af538526096d448ea3eff9797f8ca1a25e9e1b0c180038e8", + "size": 252367 }, { - "url": "https://platform.claude.com/docs/en/api/typescript/completions/create", + "url": "https://platform.claude.com/docs/en/api/beta/sessions/events/list", "status": "success", - "path": "en/api/typescript/completions/create.md", - "sha256": "6a5fabec438558c76d8eef437ac211e68f8655e7016f8ec225048d434f2d5069", - "size": 9810 + "path": "en/api/beta/sessions/events/list.md", + "sha256": "22ac7ffd26607d0815041a48d106a61e3c0e5ce834ae56ffa28adaf47365e6de", + "size": 38293 }, { - "url": "https://platform.claude.com/docs/en/api/typescript/messages", + "url": "https://platform.claude.com/docs/en/api/beta/sessions/events/send", "status": "success", - "path": "en/api/typescript/messages.md", - "sha256": "fc4f6170bbec73dbdb30bc07792635b2e66575bee1ec026325c6df48fa47b7d2", - "size": 840569 + "path": "en/api/beta/sessions/events/send.md", + "sha256": "575b9cf443e91b28a1678b114bbcaba4fb3ec28b1d1d1bf4461f11f8c3f82540", + "size": 21195 }, { - "url": "https://platform.claude.com/docs/en/api/typescript/messages/create", + "url": "https://platform.claude.com/docs/en/api/beta/sessions/events/stream", "status": "success", - "path": "en/api/typescript/messages/create.md", - "sha256": "4388da4bf4b129d7bf53309c1f1a48ebdf4db779a8ee0dd8f7782ccfef14fac9", - "size": 121078 + "path": "en/api/beta/sessions/events/stream.md", + "sha256": "6bc2ac6f29d782f3d72485af335dfe2fc85d63d1d2b21b39da0b4d3eba9f90d6", + "size": 38000 }, { - "url": "https://platform.claude.com/docs/en/api/typescript/messages/count_tokens", + "url": "https://platform.claude.com/docs/en/api/beta/sessions/resources", "status": "success", - "path": "en/api/typescript/messages/count_tokens.md", - "sha256": "7c22c072f5fa2012f395d85599dab3ffd4945004de93941244ce3300d7b73189", - "size": 92868 + "path": "en/api/beta/sessions/resources.md", + "sha256": "45141ee7877b34c444410a01d35b005cc7d967e7c3cd81e56d1992a2eeb961ce", + "size": 17655 }, { - "url": "https://platform.claude.com/docs/en/api/typescript/messages/batches", + "url": "https://platform.claude.com/docs/en/api/beta/sessions/resources/add", "status": "success", - "path": "en/api/typescript/messages/batches.md", - "sha256": "299d6fcb97a4ea0a7d2db0fc95cee91692b3805c9b8c69e05cfc252b7b2fbd69", - "size": 224172 + "path": "en/api/beta/sessions/resources/add.md", + "sha256": "b7de55ef9e25792e9ae3325a75124c881ce0e016871a832d508449fea872470f", + "size": 2097 }, { - "url": "https://platform.claude.com/docs/en/api/typescript/messages/batches/create", + "url": "https://platform.claude.com/docs/en/api/beta/sessions/resources/list", "status": "success", - "path": "en/api/typescript/messages/batches/create.md", - "sha256": "5986e866636ad3f2f70e0f0175dd09ae1a3174ad7bf044a757ac1ac986f0fda0", - "size": 107323 + "path": "en/api/beta/sessions/resources/list.md", + "sha256": "7b60fc43c5dd1d60aa053a3e39d2d8b64b09a31e48a3d22f59c977937be31369", + "size": 3016 }, { - "url": "https://platform.claude.com/docs/en/api/typescript/messages/batches/retrieve", + "url": "https://platform.claude.com/docs/en/api/beta/sessions/resources/retrieve", "status": "success", - "path": "en/api/typescript/messages/batches/retrieve.md", - "sha256": "a46e305636c3469ef0de4772ddbf94a7047b36ff62dde8ea939b0d65e8f43634", - "size": 3637 + "path": "en/api/beta/sessions/resources/retrieve.md", + "sha256": "78694cab9e1880e7907c2c49b490fc3bcd89cdcd4ec34bfaed3c1c8ba9f354f3", + "size": 2570 }, { - "url": "https://platform.claude.com/docs/en/api/typescript/messages/batches/list", + "url": "https://platform.claude.com/docs/en/api/beta/sessions/resources/update", "status": "success", - "path": "en/api/typescript/messages/batches/list.md", + "path": "en/api/beta/sessions/resources/update.md", + "sha256": "4b4115652bed69839a9288394c55d02ac2bd50e1c81822aa3bf1b48433de37e4", + "size": 2857 + }, + { + "url": "https://platform.claude.com/docs/en/api/beta/sessions/resources/delete", + "status": "success", + "path": "en/api/beta/sessions/resources/delete.md", + "sha256": "d5a1896fb32d0e7ddbb107f754f97b0407ce291368feb1e4ecde533027e8effd", + "size": 1698 + }, + { + "url": "https://platform.claude.com/docs/en/api/beta/vaults", + "status": "success", + "path": "en/api/beta/vaults.md", + "sha256": "04d42ca03c05c4bd9be37fbff5b49cfbcedd76ac16893e78046a33f5e88e347d", + "size": 59143 + }, + { + "url": "https://platform.claude.com/docs/en/api/beta/vaults/create", + "status": "success", + "path": "en/api/beta/vaults/create.md", + "sha256": "355666e88235f2fc1370b2f1f7e4448a1adb0cdf7698bc65a08ed5167c54484a", + "size": 2209 + }, + { + "url": "https://platform.claude.com/docs/en/api/beta/vaults/list", + "status": "success", + "path": "en/api/beta/vaults/list.md", + "sha256": "4dccc0e3c3c81f4200d3a13218781acc8d8479277fea18afa8018eecdf66924d", + "size": 2241 + }, + { + "url": "https://platform.claude.com/docs/en/api/beta/vaults/retrieve", + "status": "success", + "path": "en/api/beta/vaults/retrieve.md", + "sha256": "422652151889622460b5b3ca302c7e4c9268b9bf08c1b317dd0236cffe2582b7", + "size": 1969 + }, + { + "url": "https://platform.claude.com/docs/en/api/beta/vaults/update", + "status": "success", + "path": "en/api/beta/vaults/update.md", + "sha256": "29bccb2e83e690bdd1cc0ef5d9c3d50d72ec1d2899a7252e633c4f60276f7241", + "size": 2291 + }, + { + "url": "https://platform.claude.com/docs/en/api/beta/vaults/delete", + "status": "success", + "path": "en/api/beta/vaults/delete.md", + "sha256": "3220a53caebb38c1940766e7ccaf839655b165e57584e3244864c2379cefc674", + "size": 1617 + }, + { + "url": "https://platform.claude.com/docs/en/api/beta/vaults/archive", + "status": "success", + "path": "en/api/beta/vaults/archive.md", + "sha256": "f316d1ee0a97b54ac5e268838ef7d9ea8299bc80007c30e6add02da5ed3c7e39", + "size": 2003 + }, + { + "url": "https://platform.claude.com/docs/en/api/beta/vaults/credentials", + "status": "success", + "path": "en/api/beta/vaults/credentials.md", + "sha256": "a79a230c33f214ff9d198ba54c4adfb429c8b21cc4b4f04bd9039e83c07495e0", + "size": 45918 + }, + { + "url": "https://platform.claude.com/docs/en/api/beta/vaults/credentials/create", + "status": "success", + "path": "en/api/beta/vaults/credentials/create.md", + "sha256": "710ea3fee0d39d6f9f7fe675ff8feb582f57b03631cd68b4fc4894c857bfc5b7", + "size": 7410 + }, + { + "url": "https://platform.claude.com/docs/en/api/beta/vaults/credentials/list", + "status": "success", + "path": "en/api/beta/vaults/credentials/list.md", + "sha256": "29b511f2b247f3b9557fdaed6d753b060341e2edfe83efaa366e5fb4f74d685f", + "size": 4740 + }, + { + "url": "https://platform.claude.com/docs/en/api/beta/vaults/credentials/retrieve", + "status": "success", + "path": "en/api/beta/vaults/credentials/retrieve.md", + "sha256": "d58e07f6a042f61efde661ca1361e4b9f6b0b08c65057597786d4d4e6fdd29ce", + "size": 4451 + }, + { + "url": "https://platform.claude.com/docs/en/api/beta/vaults/credentials/update", + "status": "success", + "path": "en/api/beta/vaults/credentials/update.md", + "sha256": "72971c1d211e067e4b3397ebc1f041d1c7392e1e112786e66ed6343fe09d5726", + "size": 6842 + }, + { + "url": "https://platform.claude.com/docs/en/api/beta/vaults/credentials/delete", + "status": "success", + "path": "en/api/beta/vaults/credentials/delete.md", + "sha256": "bdb7754b939d830edd0d0df5da5cbf72b754fc492fdc4a99c08c9b92f043bda2", + "size": 1741 + }, + { + "url": "https://platform.claude.com/docs/en/api/beta/vaults/credentials/archive", + "status": "success", + "path": "en/api/beta/vaults/credentials/archive.md", + "sha256": "97f09ef5b642332be4f6888dbf8e39a2c21951cf3a39c9c648390705d63ae72b", + "size": 4485 + }, + { + "url": "https://platform.claude.com/docs/en/api/beta/files", + "status": "success", + "path": "en/api/beta/files.md", + "sha256": "a19b6aa7f5c48f1bc9687922bc94940aee342c0469d55d4f298c052bc005010c", + "size": 12218 + }, + { + "url": "https://platform.claude.com/docs/en/api/beta/files/upload", + "status": "success", + "path": "en/api/beta/files/upload.md", + "sha256": "63027d4b8d10f7fb7919d98aaa9194e2a462bcb54b478e7c7ff6128f066f613a", + "size": 2318 + }, + { + "url": "https://platform.claude.com/docs/en/api/beta/files/list", + "status": "success", + "path": "en/api/beta/files/list.md", + "sha256": "5ac9caa7357edffd63684b2eea7685483da5f0df9c4704f4b27ec6409ebc36a6", + "size": 3066 + }, + { + "url": "https://platform.claude.com/docs/en/api/beta/files/download", + "status": "success", + "path": "en/api/beta/files/download.md", + "sha256": "6aa513b2e4bf4a9111bcd3ea3f0b5832565dc29c4615a5b57e5102abca18f14a", + "size": 1403 + }, + { + "url": "https://platform.claude.com/docs/en/api/beta/files/retrieve_metadata", + "status": "success", + "path": "en/api/beta/files/retrieve_metadata.md", + "sha256": "067cd0c02456befb6641ad787d6a2b217961604753b5fd31fd6d41e3b0084138", + "size": 2338 + }, + { + "url": "https://platform.claude.com/docs/en/api/beta/files/delete", + "status": "success", + "path": "en/api/beta/files/delete.md", + "sha256": "6a36344e16917bcd64dc7050f598b35c10638e5778badc5bb2bf1ece216b3c60", + "size": 1645 + }, + { + "url": "https://platform.claude.com/docs/en/api/beta/skills", + "status": "success", + "path": "en/api/beta/skills.md", + "sha256": "e5d9a490cd547eb60824c8189f78656ea1ec46c53ee66cc77f8e43bdda03b164", + "size": 26058 + }, + { + "url": "https://platform.claude.com/docs/en/api/beta/skills/create", + "status": "success", + "path": "en/api/beta/skills/create.md", + "sha256": "dfe2d047e2aa964d922286f2cffd2ff9b074a9ec7a77c2253a2a9471a021cfaa", + "size": 2164 + }, + { + "url": "https://platform.claude.com/docs/en/api/beta/skills/list", + "status": "success", + "path": "en/api/beta/skills/list.md", + "sha256": "1fe2a2121a7ad30a70d5f2aee123c2ba2ea9dd1fdaf70c8301b61d341d3fab3b", + "size": 3196 + }, + { + "url": "https://platform.claude.com/docs/en/api/beta/skills/retrieve", + "status": "success", + "path": "en/api/beta/skills/retrieve.md", + "sha256": "e9bfff9dc5ee45b86267919efbd5b38061df93e8a43f9b43b1a37b16e34b849f", + "size": 2302 + }, + { + "url": "https://platform.claude.com/docs/en/api/beta/skills/delete", + "status": "success", + "path": "en/api/beta/skills/delete.md", + "sha256": "f1a5824d31df5fdf6ec6955258c5e94f6bbcd235877060d81c4a8f400e798407", + "size": 1686 + }, + { + "url": "https://platform.claude.com/docs/en/api/beta/skills/versions", + "status": "success", + "path": "en/api/beta/skills/versions.md", + "sha256": "be37e633a5b303d0b03a3f7af6783fb7fbe38d497eafd2cf62758aa21ba18cc0", + "size": 13462 + }, + { + "url": "https://platform.claude.com/docs/en/api/beta/skills/versions/create", + "status": "success", + "path": "en/api/beta/skills/versions/create.md", + "sha256": "72cb19c3f55ea8918bd082242bbd01dacc5f8248887f65c00a402416f9afc9ca", + "size": 2425 + }, + { + "url": "https://platform.claude.com/docs/en/api/beta/skills/versions/list", + "status": "success", + "path": "en/api/beta/skills/versions/list.md", + "sha256": "f045641bd1322f002396e5e2fc3a3a3c7f31094989f13c563ae384698d2988d5", + "size": 2992 + }, + { + "url": "https://platform.claude.com/docs/en/api/beta/skills/versions/retrieve", + "status": "success", + "path": "en/api/beta/skills/versions/retrieve.md", + "sha256": "6b6566b9505fe9b04dee1b4179d3b2464bbda2c69b8bc76ee56c1fac9e604a15", + "size": 2570 + }, + { + "url": "https://platform.claude.com/docs/en/api/beta/skills/versions/delete", + "status": "success", + "path": "en/api/beta/skills/versions/delete.md", + "sha256": "6abee4aa497897e6ac2e0c34f758843dce2a3c0cc9c23b95cea8d3e0daa1ae49", + "size": 1920 + }, + { + "url": "https://platform.claude.com/docs/en/api/typescript/completions", + "status": "success", + "path": "en/api/typescript/completions.md", + "sha256": "f403009e1087c651b4f9405f5eb6b4c50f6d8d8b1df9e3ed6decc692d8a35d3e", + "size": 12489 + }, + { + "url": "https://platform.claude.com/docs/en/api/typescript/completions/create", + "status": "success", + "path": "en/api/typescript/completions/create.md", + "sha256": "c0843117692cf677e917989ff82408676ec00c75fd59e8a70e1f3ac55902f421", + "size": 10014 + }, + { + "url": "https://platform.claude.com/docs/en/api/typescript/messages", + "status": "success", + "path": "en/api/typescript/messages.md", + "sha256": "8dc219d1932037cc249a1127bb397b8ebb903a9f4299d4249feb1efddffc3f42", + "size": 842040 + }, + { + "url": "https://platform.claude.com/docs/en/api/typescript/messages/create", + "status": "success", + "path": "en/api/typescript/messages/create.md", + "sha256": "66250dc8e54c47a7438ffa5f0e448e073a5a66e258c963dea6c88179de73b538", + "size": 121316 + }, + { + "url": "https://platform.claude.com/docs/en/api/typescript/messages/count_tokens", + "status": "success", + "path": "en/api/typescript/messages/count_tokens.md", + "sha256": "57c715746b7bbef937a9b02d6329aa65e5012c29990a3ca358cab60166f7d5dc", + "size": 92991 + }, + { + "url": "https://platform.claude.com/docs/en/api/typescript/messages/batches", + "status": "success", + "path": "en/api/typescript/messages/batches.md", + "sha256": "fd63aaf7d2ca0f16aaf30f6da92013c8713fc1c2252d87414e8d150c3aa31ee0", + "size": 224801 + }, + { + "url": "https://platform.claude.com/docs/en/api/typescript/messages/batches/create", + "status": "success", + "path": "en/api/typescript/messages/batches/create.md", + "sha256": "89e68fe2bf621138738929fc221e4b66058000f0fc8a7fc4c4d3f26bb4734a1b", + "size": 107448 + }, + { + "url": "https://platform.claude.com/docs/en/api/typescript/messages/batches/retrieve", + "status": "success", + "path": "en/api/typescript/messages/batches/retrieve.md", + "sha256": "a46e305636c3469ef0de4772ddbf94a7047b36ff62dde8ea939b0d65e8f43634", + "size": 3637 + }, + { + "url": "https://platform.claude.com/docs/en/api/typescript/messages/batches/list", + "status": "success", + "path": "en/api/typescript/messages/batches/list.md", "sha256": "f08b6a4ebd48b6f1b3867e11374ac83f89ab802efbf4cf1ed05b42f9d0abbd8c", "size": 3964 }, @@ -1401,2780 +1730,5020 @@ "url": "https://platform.claude.com/docs/en/api/typescript/messages/batches/results", "status": "success", "path": "en/api/typescript/messages/batches/results.md", - "sha256": "7b46f643f5c2a52fb7d51181cae3fcebb175e4de235a3d2cc2069bcb477f6b5c", - "size": 26832 + "sha256": "85c03089e3f37816a8a7ba328a7ee4b79f4dcd3cebeebdf4deb3eda172744cf7", + "size": 26961 }, { "url": "https://platform.claude.com/docs/en/api/typescript/models", "status": "success", "path": "en/api/typescript/models.md", - "sha256": "bb205f61bf328904b8d3903f45782a94e685a5f13bd799ef95d7a2ff55ac7d72", - "size": 23255 + "sha256": "f29ada5ac94221d598d188cc44d9bcd50f1dbe308e3f11362f205a9966f58427", + "size": 23179 }, { "url": "https://platform.claude.com/docs/en/api/typescript/models/list", "status": "success", "path": "en/api/typescript/models/list.md", - "sha256": "f2b9c02a90fec89fa3a086f0a965002473802dbef5b59f09d2577acc46026d38", - "size": 6508 + "sha256": "58815286613b06fcc21829fa4485aa4f49d2dac1ff8876dde5321825e5be0602", + "size": 6470 }, { "url": "https://platform.claude.com/docs/en/api/typescript/models/retrieve", "status": "success", "path": "en/api/typescript/models/retrieve.md", - "sha256": "4f3cc381ef7ccc98386b65238c2845d2c6eba7b5b73c65de58193982b9d4d18a", - "size": 6050 + "sha256": "bcaa5e76f21bd7618e0c2f75afe7655421a743f860164bede2fe104e789c3bfa", + "size": 6012 }, { "url": "https://platform.claude.com/docs/en/api/typescript/beta", "status": "success", "path": "en/api/typescript/beta.md", - "sha256": "a0894f076ae7564a06bc6c114cd227144d88301a8655b01df23967350ce762d2", - "size": 1121295 + "sha256": "5ad61062e7d5756952c32685565368f7f46d1ff3365050c192525e263181d4fc", + "size": 1641080 }, { "url": "https://platform.claude.com/docs/en/api/typescript/beta/models", "status": "success", "path": "en/api/typescript/beta/models.md", - "sha256": "9905ee8d39832b6e3976b13ae13e88c8b8d8522a47a8a68de2bc12bfd453b441", - "size": 23734 + "sha256": "ed93599e4419cabd377fb297bb70a2fc56c9aeebb1138eb7df6cf21745e2526f", + "size": 23658 }, { "url": "https://platform.claude.com/docs/en/api/typescript/beta/models/list", "status": "success", "path": "en/api/typescript/beta/models/list.md", - "sha256": "b6f8b02fc55828aecb12a1620156fe414e4d056f7f71e1944fc1943293be013c", - "size": 6614 + "sha256": "5041520be905414b72ac4c2e757fee104718cf24843ac2d8a4283bfb603e843c", + "size": 6576 }, { "url": "https://platform.claude.com/docs/en/api/typescript/beta/models/retrieve", "status": "success", "path": "en/api/typescript/beta/models/retrieve.md", - "sha256": "2d57558c0e24310642126a93b98a69d882c41a4ad2fc3e54ebcfe3662d65d3b9", - "size": 6156 + "sha256": "4e9800cce34b51113467a3e1e70ae538e644e54634744ca6e67b5d9e151e7973", + "size": 6118 }, { "url": "https://platform.claude.com/docs/en/api/typescript/beta/messages", "status": "success", "path": "en/api/typescript/beta/messages.md", - "sha256": "b57cdb575db97c6742afb9a13abf83ad4bac7c0b8520a24fdb04fd4d584207af", - "size": 1041514 + "sha256": "6354b9f0ed7bcfdb1ab3304d9365223eecb162f9446448dabc1e1a499af3fcb3", + "size": 1042215 }, { "url": "https://platform.claude.com/docs/en/api/typescript/beta/messages/create", "status": "success", "path": "en/api/typescript/beta/messages/create.md", - "sha256": "6d036ecd707125b395f6689b883842e19bfab103b17b979ec9f3d701e1898a0c", - "size": 152363 + "sha256": "e89e85896e598ee8c1a00a6fce7dfc9c39cbfe52ad2be86fe170ddb9ee316800", + "size": 152384 }, { "url": "https://platform.claude.com/docs/en/api/typescript/beta/messages/count_tokens", "status": "success", "path": "en/api/typescript/beta/messages/count_tokens.md", - "sha256": "29b8c2aae9b19b725048ef31888264d9a0bde0fb891191691b8dd2326cc1628a", - "size": 114782 + "sha256": "2a1c93c1de263230bf45cd2db469aca8dca4e842da88faf066269caed70caff7", + "size": 114867 }, { "url": "https://platform.claude.com/docs/en/api/typescript/beta/messages/batches", "status": "success", "path": "en/api/typescript/beta/messages/batches.md", - "sha256": "cc041e336ae57820894a42eb6c73f7234f4523b65346aa09c942e5f274512c7f", - "size": 288425 + "sha256": "d779914278ff70be419b77d1ba01233fa3a9ce9014bbf7134bda8bcd4daf5c0e", + "size": 288657 }, { "url": "https://platform.claude.com/docs/en/api/typescript/beta/messages/batches/create", "status": "success", "path": "en/api/typescript/beta/messages/batches/create.md", - "sha256": "6a5c85e1e8035892ef7961539f97d493e91f4e9050bd1ad59dd2ea651e3c3178", - "size": 131318 + "sha256": "e8b0c169f446ab5407b71f5b6add39555f65fd0a682ac09ee3f32707baf6f847", + "size": 131236 }, { "url": "https://platform.claude.com/docs/en/api/typescript/beta/messages/batches/retrieve", "status": "success", "path": "en/api/typescript/beta/messages/batches/retrieve.md", - "sha256": "69074a74be215b9ea4939f2db29d9317f09a0fa662a939f7b8ca7ed538bf051f", - "size": 4809 + "sha256": "d2374bc003c6e7d359511df96cffb867217d77c515bb9f396b3573bcdd20e089", + "size": 4771 }, { "url": "https://platform.claude.com/docs/en/api/typescript/beta/messages/batches/list", "status": "success", "path": "en/api/typescript/beta/messages/batches/list.md", - "sha256": "e90ac1c58cd82ae51d94d83ceb69bfc15829102218e0a86c5c135a0911f7ac55", - "size": 5130 + "sha256": "2f7016be35799e0388a3fdddc596f410cef7f6bb8fb00a055b66851e8ade2b3a", + "size": 5092 }, { "url": "https://platform.claude.com/docs/en/api/typescript/beta/messages/batches/cancel", "status": "success", "path": "en/api/typescript/beta/messages/batches/cancel.md", - "sha256": "7bab1ae3086de09d28c49c87ef3f7becf28d19d3fbdd4b74686598ec9bfe70bf", - "size": 5117 + "sha256": "3b31ca85276d51bc66ac0f18b81b60b8e56208890b581df06160cc4d13dcf8a3", + "size": 5079 }, { "url": "https://platform.claude.com/docs/en/api/typescript/beta/messages/batches/delete", "status": "success", "path": "en/api/typescript/beta/messages/batches/delete.md", - "sha256": "c011dad0e5718f22226631962b4e8a10b629c008ed51d73de372580c4fcf256b", - "size": 2271 + "sha256": "e507a5c7b33dca4330a2972d6d2a8f7faa05859a31e7e44483c3ff0a1b7e8cbf", + "size": 2233 }, { "url": "https://platform.claude.com/docs/en/api/typescript/beta/messages/batches/results", "status": "success", "path": "en/api/typescript/beta/messages/batches/results.md", - "sha256": "cf6ffdc486238b6a25bedd1f9f60739082b4cd4ab2fc526eee7ac8d45ebf53ee", - "size": 36825 + "sha256": "444d5193a7874e3b1cf6f5022df1d5f641401d77cfe38b46a48e612134df1168", + "size": 36916 }, { - "url": "https://platform.claude.com/docs/en/api/typescript/beta/files", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/agents", "status": "success", - "path": "en/api/typescript/beta/files.md", - "sha256": "bd27307c62fa1f6ce78b044a71c9ff4d83427dc08a827e34366f5b256776f756", - "size": 11547 + "path": "en/api/typescript/beta/agents.md", + "sha256": "65e76f23fe29b61188bd075a9beb98199f2584eb7ab90b29a28b491c6ed65ab5", + "size": 99501 }, { - "url": "https://platform.claude.com/docs/en/api/typescript/beta/files/upload", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/agents/create", "status": "success", - "path": "en/api/typescript/beta/files/upload.md", - "sha256": "d4e4090121a934a5104667093bdb7fca8cfb9ee2c25166cea5949ed773edd857", - "size": 2243 + "path": "en/api/typescript/beta/agents/create.md", + "sha256": "9bdd507dc0e3de6ca816302f9162428ea9256cc44105d628570beff9a3ea6653", + "size": 18248 }, { - "url": "https://platform.claude.com/docs/en/api/typescript/beta/files/list", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/agents/list", "status": "success", - "path": "en/api/typescript/beta/files/list.md", - "sha256": "8f3864a0d343bb18bd3c3fc64500b30319cdff06dab1c77eb599010e89af8fee", - "size": 2657 + "path": "en/api/typescript/beta/agents/list.md", + "sha256": "5770324510714aaecc65aedb6d77431a3f1ba64e9087f345a822f9f36533bdaa", + "size": 8681 }, { - "url": "https://platform.claude.com/docs/en/api/typescript/beta/files/download", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/agents/retrieve", "status": "success", - "path": "en/api/typescript/beta/files/download.md", - "sha256": "17fe55152e649aa40107afafd79c319c59fadc05fe44c6aa0346f09ef5e13da3", - "size": 1731 + "path": "en/api/typescript/beta/agents/retrieve.md", + "sha256": "21af9c198398c99e43cb9522dfa85c51d17fbb2bc7f4b80b5a76bd574b2d0919", + "size": 8335 }, { - "url": "https://platform.claude.com/docs/en/api/typescript/beta/files/retrieve_metadata", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/agents/update", "status": "success", - "path": "en/api/typescript/beta/files/retrieve_metadata.md", - "sha256": "e582dbb4eab92d5457f947360014927a60fe5a50609f0d4fd91caceb6fce3b11", - "size": 2253 + "path": "en/api/typescript/beta/agents/update.md", + "sha256": "e26de92f5642ac1b05d7d21b283ace1f921fd43a6a568003ae99419be92e833b", + "size": 18939 }, { - "url": "https://platform.claude.com/docs/en/api/typescript/beta/files/delete", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/agents/archive", "status": "success", - "path": "en/api/typescript/beta/files/delete.md", - "sha256": "7cac6a05c2eac6a556945b2c207c41f48761a8a5b4b32ad4992e5b19b1e2715d", - "size": 1831 + "path": "en/api/typescript/beta/agents/archive.md", + "sha256": "1082505965cef2daeaf6fe4b6f653f6306227cfac4fab3a0b92c932256e0708c", + "size": 8205 }, { - "url": "https://platform.claude.com/docs/en/api/typescript/beta/skills", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/agents/versions", "status": "success", - "path": "en/api/typescript/beta/skills.md", - "sha256": "4e8f14b094682f9b5ed8b058bc784aaeb4bf577dd60611c2ccd95df846d9cee7", - "size": 28316 + "path": "en/api/typescript/beta/agents/versions.md", + "sha256": "cfa60837e1107cd1e603a30dc394dc6497c639ba007084d588db2a3c87458f3c", + "size": 8475 }, { - "url": "https://platform.claude.com/docs/en/api/typescript/beta/skills/create", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/agents/versions/list", "status": "success", - "path": "en/api/typescript/beta/skills/create.md", - "sha256": "e0eeb1db457cd6362c5732fa13de6f6bfc91f6a26006ad6c6fa7b8b6681d31b3", - "size": 2867 + "path": "en/api/typescript/beta/agents/versions/list.md", + "sha256": "dafd0300ddae54013e03236a5de68fc9af16bc3c4d20641e10f4c32d2b988547", + "size": 8463 }, { - "url": "https://platform.claude.com/docs/en/api/typescript/beta/skills/list", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/environments", "status": "success", - "path": "en/api/typescript/beta/skills/list.md", - "sha256": "000f1ce237972c0d27d6b6183dc5949947b4843331104040c59fe5aaf8b5e474", - "size": 3144 + "path": "en/api/typescript/beta/environments.md", + "sha256": "724e72f79e84718881c67e0704daabb8e72441a72682fa716df017686ae7ee1e", + "size": 36583 }, { - "url": "https://platform.claude.com/docs/en/api/typescript/beta/skills/retrieve", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/environments/create", "status": "success", - "path": "en/api/typescript/beta/skills/retrieve.md", - "sha256": "b5a93189097faadfd629e603b673ff7c735adb9cf750c0c80ec49ecd6462e929", - "size": 2630 + "path": "en/api/typescript/beta/environments/create.md", + "sha256": "dac51ea3a6d58ce6f2f50d869debe0138689330fdd7b2e0bf2abec4a1a77fb54", + "size": 6498 }, { - "url": "https://platform.claude.com/docs/en/api/typescript/beta/skills/delete", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/environments/list", "status": "success", - "path": "en/api/typescript/beta/skills/delete.md", - "sha256": "c2ef5cd187a7ed2cd0081bf5109518b985f2a1952b03e78767ed15015ef9b094", - "size": 1942 + "path": "en/api/typescript/beta/environments/list.md", + "sha256": "114dfb585cac247af36624eb0444f3693b9f1dcb02d607ef0738161dc93ea335", + "size": 4317 }, { - "url": "https://platform.claude.com/docs/en/api/typescript/beta/skills/versions", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/environments/retrieve", "status": "success", - "path": "en/api/typescript/beta/skills/versions.md", - "sha256": "22f8450eb84a5d0421309929a23dc677ac45d5dfd6256c50b122f00d39923839", - "size": 14618 + "path": "en/api/typescript/beta/environments/retrieve.md", + "sha256": "bff2f69a64f761a10de23f36fff8375cdf37f57b7bb0cdb587ee2eaabbe507dd", + "size": 4011 }, { - "url": "https://platform.claude.com/docs/en/api/typescript/beta/skills/versions/create", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/environments/update", "status": "success", - "path": "en/api/typescript/beta/skills/versions/create.md", - "sha256": "bc59c6ab0a4ebee2410b843a491910862b57518bfa02076d38b33ab7f7998519", - "size": 2957 + "path": "en/api/typescript/beta/environments/update.md", + "sha256": "e0c1046e4a52ad5b0c1d802754ac930a6edf6be54cb5069d154b43e8683be906", + "size": 6613 }, { - "url": "https://platform.claude.com/docs/en/api/typescript/beta/skills/versions/list", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/environments/delete", "status": "success", - "path": "en/api/typescript/beta/skills/versions/list.md", - "sha256": "156005e2ac083058987d298a02a646a8baed9e443ecce3bfc51de2fa5717d397", - "size": 3075 + "path": "en/api/typescript/beta/environments/delete.md", + "sha256": "69b0175ff4751408ab2c89d463a5583aeb6b510e1ca305e8c8aebfd028c6d80f", + "size": 1983 }, { - "url": "https://platform.claude.com/docs/en/api/typescript/beta/skills/versions/retrieve", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/environments/archive", "status": "success", - "path": "en/api/typescript/beta/skills/versions/retrieve.md", - "sha256": "bc1d1cea1e728474cb47c462248e26ee68a0054833c6c4fee2d3a46493bddf1a", - "size": 2955 + "path": "en/api/typescript/beta/environments/archive.md", + "sha256": "f217661d48a5ba4860d82de846684f7beec45d9aa8e06e30da84c1954b846e53", + "size": 4067 }, { - "url": "https://platform.claude.com/docs/en/api/typescript/beta/skills/versions/delete", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/sessions", "status": "success", - "path": "en/api/typescript/beta/skills/versions/delete.md", - "sha256": "c6fdb5801d1a6b3195e3a5387d63bd6a2bf2c6d4c103f52ffb5654917f2968f5", - "size": 2245 + "path": "en/api/typescript/beta/sessions.md", + "sha256": "f70256aec22e036683b31c33e4562a0429bc888768ecc65c83cad56e62c9f803", + "size": 333460 }, { - "url": "https://platform.claude.com/docs/en/api/typescript/beta/user_profiles", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/sessions/create", "status": "success", - "path": "en/api/typescript/beta/user_profiles.md", - "sha256": "3ad2a44879e7dd5c6b1844312edd2ec0eeee0d1ae87758d44d257f4232fec00b", - "size": 11474 + "path": "en/api/typescript/beta/sessions/create.md", + "sha256": "a0c33aadbc3efaa2c905a634847561acb2023ab0db02a8e7dba5ef9dcb9aa5a8", + "size": 13791 }, { - "url": "https://platform.claude.com/docs/en/api/typescript/beta/user_profiles/create", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/sessions/list", "status": "success", - "path": "en/api/typescript/beta/user_profiles/create.md", - "sha256": "fb063f616bc8da71754117172860dcc0484624ab0a7f2e070d3fa852defa7767", - "size": 2251 + "path": "en/api/typescript/beta/sessions/list.md", + "sha256": "7e3d739b801bcc8ce4451d65e3051b5d64d2a8c2991e8c837983507d5c3d5ef5", + "size": 12218 }, { - "url": "https://platform.claude.com/docs/en/api/typescript/beta/user_profiles/list", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/sessions/retrieve", "status": "success", - "path": "en/api/typescript/beta/user_profiles/list.md", - "sha256": "22cece3a2f52b2db49abc45d69f5ff84996fcd2b6fa31955ede5bd4a5cc89b3a", - "size": 2267 + "path": "en/api/typescript/beta/sessions/retrieve.md", + "sha256": "92edf2b9f0c3fff2ceee8661501f0b1312aae4acecad000444f5817a6f2e82f8", + "size": 11161 }, { - "url": "https://platform.claude.com/docs/en/api/typescript/beta/user_profiles/retrieve", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/sessions/update", "status": "success", - "path": "en/api/typescript/beta/user_profiles/retrieve.md", - "sha256": "e016ebb736cae7a8515daf853f95bb6f362bbe927e1c905a8819dff0a5560c3c", - "size": 1999 + "path": "en/api/typescript/beta/sessions/update.md", + "sha256": "dd9d02cdc3ecdee0823c9aec6219094764a1dc955520a8772a62cfd50521ae02", + "size": 11598 }, { - "url": "https://platform.claude.com/docs/en/api/typescript/beta/user_profiles/update", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/sessions/delete", "status": "success", - "path": "en/api/typescript/beta/user_profiles/update.md", - "sha256": "525eaa21bc2232ac6725a7979a2bc123bd3a3737b5831999471fa632aa68c994", - "size": 2376 + "path": "en/api/typescript/beta/sessions/delete.md", + "sha256": "2b740c1523175f1859c8cd7674d779e68e1449ea1fb4feb9ff0c2a226812f0b9", + "size": 1864 }, { - "url": "https://platform.claude.com/docs/en/api/typescript/beta/user_profiles/create_enrollment_url", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/sessions/archive", "status": "success", - "path": "en/api/typescript/beta/user_profiles/create_enrollment_url.md", - "sha256": "e3a89df43ea995924e93a200ee8ab9e8fb7bfe5fe28a1c55c185cec7e0a1f14a", - "size": 1914 + "path": "en/api/typescript/beta/sessions/archive.md", + "sha256": "04cbf88dac7924f731fae58d1f995afb926ba9b0f0c0d8f53b0eace09bf94b3b", + "size": 11169 }, { - "url": "https://platform.claude.com/docs/en/api/python/completions", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/sessions/events", "status": "success", - "path": "en/api/python/completions.md", - "sha256": "7d9e0f7b0bdccc3d6018c5ae4ef9a5b79b72d8315968d3d7bffaffdeb574aeab", - "size": 15442 + "path": "en/api/typescript/beta/sessions/events.md", + "sha256": "e1d74bfa7fc224ac9c93fe30082f44df89959f8ac59f046d0764b9e2ec27b037", + "size": 233527 }, { - "url": "https://platform.claude.com/docs/en/api/python/completions/create", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/sessions/events/list", "status": "success", - "path": "en/api/python/completions/create.md", - "sha256": "a6d5ed3b0d58b1a6a104c9dd331a774433d8d1fdd4e5c29043d83553d4863992", - "size": 11565 + "path": "en/api/typescript/beta/sessions/events/list.md", + "sha256": "4d922402c582e5d26af53e75545bc5365427fc2e3fbe99dd669330de290d98b6", + "size": 35765 }, { - "url": "https://platform.claude.com/docs/en/api/python/messages", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/sessions/events/send", "status": "success", - "path": "en/api/python/messages.md", - "sha256": "6d2228f3767cc55c4d6d381fa00a2fbb81b1e8aec7f6061480d69b9c2e6b26c2", - "size": 867414 + "path": "en/api/typescript/beta/sessions/events/send.md", + "sha256": "2bc5d226fdcd86a562a7bb8c0330b165ba72f8ccebd58c59b7f6e356efbc28d5", + "size": 20002 }, { - "url": "https://platform.claude.com/docs/en/api/python/messages/create", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/sessions/events/stream", "status": "success", - "path": "en/api/python/messages/create.md", - "sha256": "89d7762d3c783b56a9759e2e93002294de6724d0c98be9627b7ae9eead11b5e7", - "size": 119329 + "path": "en/api/typescript/beta/sessions/events/stream.md", + "sha256": "41f50357bb5336b66fc874793160c4e0297a3429d39db3c028dbaa76fa221254", + "size": 35440 }, { - "url": "https://platform.claude.com/docs/en/api/python/messages/count_tokens", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/sessions/resources", "status": "success", - "path": "en/api/python/messages/count_tokens.md", - "sha256": "6bb99cfc051c268b3bcfd5362c9016559b6201123e49d1434abd74e3312e226d", - "size": 93904 + "path": "en/api/typescript/beta/sessions/resources.md", + "sha256": "fb6f493e0d9a94ff7843a01b0279f3e68ef3abe2ff35350d04fbf07a76f7bf39", + "size": 18491 }, { - "url": "https://platform.claude.com/docs/en/api/python/messages/batches", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/sessions/resources/add", "status": "success", - "path": "en/api/python/messages/batches.md", - "sha256": "8a2128ab4986ebecff44b11ff506d7abae32c1b7e311009b0222bea91f8d9436", - "size": 233317 + "path": "en/api/typescript/beta/sessions/resources/add.md", + "sha256": "c62345617466ad169e69db639e904c9d22d994c35d4fa0d797b16d8ccff4e21e", + "size": 2292 }, { - "url": "https://platform.claude.com/docs/en/api/python/messages/batches/create", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/sessions/resources/list", "status": "success", - "path": "en/api/python/messages/batches/create.md", - "sha256": "62852e117b399d73da052d7f0f610f5924dac0462ba3e28c333df2795998239f", - "size": 108471 + "path": "en/api/typescript/beta/sessions/resources/list.md", + "sha256": "045ef825efa6416486fa20a2a52dd4abc66cc8724d3d845ecd84cad2fb0717b7", + "size": 3154 }, { - "url": "https://platform.claude.com/docs/en/api/python/messages/batches/retrieve", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/sessions/resources/retrieve", "status": "success", - "path": "en/api/python/messages/batches/retrieve.md", - "sha256": "0d277d480739f911ab4376e600949bf82f01633bc39154d07f28846a77d72010", - "size": 3609 + "path": "en/api/typescript/beta/sessions/resources/retrieve.md", + "sha256": "483aea3847dac5f708f964dccf92551c228d6f4a5f5b292a9a38419d561b7d34", + "size": 2975 }, { - "url": "https://platform.claude.com/docs/en/api/python/messages/batches/list", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/sessions/resources/update", "status": "success", - "path": "en/api/python/messages/batches/list.md", - "sha256": "6de85ce7f5d2a44c1d8e815a67e552cc88ce58aea737221c67e614905d46ebc9", - "size": 3857 + "path": "en/api/typescript/beta/sessions/resources/update.md", + "sha256": "19dc03fb4229e9f4ca7390363fd6b946a663bec44c39e15770aff2e6e12528c6", + "size": 3169 }, { - "url": "https://platform.claude.com/docs/en/api/python/messages/batches/cancel", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/sessions/resources/delete", "status": "success", - "path": "en/api/python/messages/batches/cancel.md", - "sha256": "17492c90948f23ad1f8ad17d33ab20e32d1bf14c9b65da102827a8e31ce7f79c", - "size": 3921 + "path": "en/api/typescript/beta/sessions/resources/delete.md", + "sha256": "8cea447c0c2eedd5e893f5a514eb7ba0356745255133fa1b83bd525d40528b8a", + "size": 2077 }, { - "url": "https://platform.claude.com/docs/en/api/python/messages/batches/delete", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/vaults", "status": "success", - "path": "en/api/python/messages/batches/delete.md", - "sha256": "74cd4bbe006b91b26d57aac7a654f489294abe32b24f440a8465c45cb3977acf", - "size": 1070 + "path": "en/api/typescript/beta/vaults.md", + "sha256": "5591fee5d5addf73ad22e6b87088cba5cf66246233e7f072c2e7cea7d8487c0b", + "size": 60053 }, { - "url": "https://platform.claude.com/docs/en/api/python/messages/batches/results", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/vaults/create", "status": "success", - "path": "en/api/python/messages/batches/results.md", - "sha256": "58be8ffb4c6a2bc1d15287f5211d2eef049daa068139eb19f9a17bda135c3020", - "size": 28816 + "path": "en/api/typescript/beta/vaults/create.md", + "sha256": "de6239277ae3fa842269db2ba315f491ed8decb0992d858a13ab48f5f8d2351e", + "size": 2364 }, { - "url": "https://platform.claude.com/docs/en/api/python/models", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/vaults/list", "status": "success", - "path": "en/api/python/models.md", - "sha256": "09f716822cdf4b1bbef632c88a19c0ca27043d50a363fe2618ebf0a6e56d10a2", - "size": 22811 + "path": "en/api/typescript/beta/vaults/list.md", + "sha256": "6c85be214bb3bcb16db18d1126d516e98bdc0d86146d13dca63d9b5e9e2578df", + "size": 2501 }, { - "url": "https://platform.claude.com/docs/en/api/python/models/list", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/vaults/retrieve", "status": "success", - "path": "en/api/python/models/list.md", - "sha256": "a9dac0f74d273aec3a9a8bbb901c523ac07469377056fbab4c6bedc61af7ab7a", - "size": 6255 + "path": "en/api/typescript/beta/vaults/retrieve.md", + "sha256": "90f930f2a109e868fae7c683c688d9e521771959794dc6f227d11fabf8c40285", + "size": 2192 }, { - "url": "https://platform.claude.com/docs/en/api/python/models/retrieve", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/vaults/update", "status": "success", - "path": "en/api/python/models/retrieve.md", - "sha256": "cd8844a34c43c65c0ec327b126350fb92e0f5e0829c971ce798a4914e1e6ef0f", - "size": 5900 + "path": "en/api/typescript/beta/vaults/update.md", + "sha256": "b98a4ae62f4b2572b5af7aa60bed4f5ba6e15465fece5f4175edd213bf80aedf", + "size": 2490 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/vaults/delete", "status": "success", - "path": "en/api/python/beta.md", - "sha256": "bf661345da428258d1713754258e4898d6888dd7786b610e91dd24ff37a060de", - "size": 1141294 + "path": "en/api/typescript/beta/vaults/delete.md", + "sha256": "c0bd58d9bbad30e00459177d08decd94f7170d37efe43fad052737cf627d1f46", + "size": 1851 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/models", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/vaults/archive", "status": "success", - "path": "en/api/python/beta/models.md", - "sha256": "25b6631528efcfa7947a4e0de005a8aedff680b80f1197dd7b114323e23f7939", - "size": 23284 + "path": "en/api/typescript/beta/vaults/archive.md", + "sha256": "78c2ac06c14c7254ebb78c62f3a70bff14db76581d6eb76f4abb703bd398162b", + "size": 2200 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/models/list", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/vaults/credentials", "status": "success", - "path": "en/api/python/beta/models/list.md", - "sha256": "eb4ad02e164fc363b195e84b0e012efcf2ec0b4846bc8d490e92e79a164f0c7d", - "size": 6353 + "path": "en/api/typescript/beta/vaults/credentials.md", + "sha256": "8eece22bd763c7d6d9183cb346f97da9765e79238cd0e2c90a9707ebae13eaa0", + "size": 45613 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/models/retrieve", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/vaults/credentials/create", "status": "success", - "path": "en/api/python/beta/models/retrieve.md", - "sha256": "fb5634f9e0bdb64b252e172bc5e5793576b167800eb6156bfc9025791e0224dc", - "size": 6008 + "path": "en/api/typescript/beta/vaults/credentials/create.md", + "sha256": "e46bf7a25b40cbe167f60e40875bd1f2000522470bca6775648887949c3d0f7e", + "size": 7380 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/messages", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/vaults/credentials/list", "status": "success", - "path": "en/api/python/beta/messages.md", - "sha256": "9af1ad1a19bf2a258ce86fb4f96ce17882a46338658226477df00a9bb7d7c355", - "size": 1064660 + "path": "en/api/typescript/beta/vaults/credentials/list.md", + "sha256": "25a3f3cbb515484563e1135c4d82c86b610fd211ae8010b64050ae555ec35c7b", + "size": 4914 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/messages/create", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/vaults/credentials/retrieve", "status": "success", - "path": "en/api/python/beta/messages/create.md", - "sha256": "a24c4e1befe9e9da1a7574ef52ad9720bccb1a7ed2e84c493529993b637f59c6", - "size": 149045 + "path": "en/api/typescript/beta/vaults/credentials/retrieve.md", + "sha256": "713fe93bb78a355ae42c13c372b35b5ddf4e0c49ad1c947fbec13c761e8d37b6", + "size": 4666 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/messages/count_tokens", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/vaults/credentials/update", "status": "success", - "path": "en/api/python/beta/messages/count_tokens.md", - "sha256": "2ada295308b73bc56ca9c5d29dfdbe667296923adb76612e8084d31c7b4150af", - "size": 115275 + "path": "en/api/typescript/beta/vaults/credentials/update.md", + "sha256": "0c0c477b22d4724cfd34417b20b25769aafcca2791220fbe50b700dfc4fd29e1", + "size": 6934 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/messages/batches", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/vaults/credentials/delete", "status": "success", - "path": "en/api/python/beta/messages/batches.md", - "sha256": "d177901d881f2aa11d7d3d6b74f800d2aa994a3563e2864d848e4c9db69796af", - "size": 296985 + "path": "en/api/typescript/beta/vaults/credentials/delete.md", + "sha256": "62cc46e1f8f7870392f7faa93074595e87a9e19191ca8a27b67701ce096304d5", + "size": 2107 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/messages/batches/create", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/vaults/credentials/archive", "status": "success", - "path": "en/api/python/beta/messages/batches/create.md", - "sha256": "fda5bebd8d3c6f233a593773af1619e26fe6a8058ba9611a1e3a3aa9d165a1cd", - "size": 132101 + "path": "en/api/typescript/beta/vaults/credentials/archive.md", + "sha256": "7260029c69168fce99371bd91b3b18782c8158e3e63e96a6ee38229946104247", + "size": 4674 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/messages/batches/retrieve", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/files", "status": "success", - "path": "en/api/python/beta/messages/batches/retrieve.md", - "sha256": "e64fee6dfb88bb40186c4964dcd87b194ae481a7a501294c9aae1236f80e2236", - "size": 4725 + "path": "en/api/typescript/beta/files.md", + "sha256": "c90167589627b8ef73680dcdab64ba49a40532973355811d12845bd2c20ab4fd", + "size": 12921 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/messages/batches/list", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/files/upload", "status": "success", - "path": "en/api/python/beta/messages/batches/list.md", - "sha256": "334d1f6983f58d27e2978584e8f1d6a7f9fc199bfe4921b8adbab00b0ee36a73", - "size": 4917 + "path": "en/api/typescript/beta/files/upload.md", + "sha256": "fd79f23e26b25b651531bd24a46140f9ebb585c98994fe6b175d98fbbf829f82", + "size": 2510 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/messages/batches/cancel", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/files/list", "status": "success", - "path": "en/api/python/beta/messages/batches/cancel.md", - "sha256": "9597153ad24ffcd0e595f341cffbc8dc71f76bfbdf485f2e698c81099d520c20", - "size": 5035 + "path": "en/api/typescript/beta/files/list.md", + "sha256": "61df7a0460e73190971df373091ade8b37d670b30fedea75f333937247cfa355", + "size": 3064 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/messages/batches/delete", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/files/download", "status": "success", - "path": "en/api/python/beta/messages/batches/delete.md", - "sha256": "9164efd8d3df730ed6ab5dbb09e50d084c09ed20c338e80552f5ad9b8dc0efa5", - "size": 2180 + "path": "en/api/typescript/beta/files/download.md", + "sha256": "955c90ec69b3c8a8deeb076dd1bc45181538ebbc6b535126cb18fbc9014d8298", + "size": 1693 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/messages/batches/results", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/files/retrieve_metadata", "status": "success", - "path": "en/api/python/beta/messages/batches/results.md", - "sha256": "c4c33ae312c60a4a362cae87ea049f092ec9517e4039fc2defd3b9a139efb0ee", - "size": 38770 + "path": "en/api/typescript/beta/files/retrieve_metadata.md", + "sha256": "2574ed26ec0997f79b4ad058317071eec3a735c02e5f4c057b662ab8ed113e1b", + "size": 2520 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/files", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/files/delete", "status": "success", - "path": "en/api/python/beta/files.md", - "sha256": "1340804bc87f66ac44bb739f0ac60dd4a55ea6f375eedbe020706b4a53575d0d", - "size": 10858 + "path": "en/api/typescript/beta/files/delete.md", + "sha256": "26fb66e08105df117d9e7900209d3aa5e2c4490c9241f3671702d143e94e1b07", + "size": 1793 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/files/upload", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/skills", "status": "success", - "path": "en/api/python/beta/files/upload.md", - "sha256": "a825a89332f9da3970b5dceae3a3838d914f18b25f4e3fc81ac1a3ff65e5d4bc", - "size": 2078 + "path": "en/api/typescript/beta/skills.md", + "sha256": "35b51c8defe2f2b6e17e14eb48de73c8e693184b8a85ad5e4b1d769964fa909e", + "size": 28012 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/files/list", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/skills/create", "status": "success", - "path": "en/api/python/beta/files/list.md", - "sha256": "5cf946fa05f1e7c5b8009eba25016bd47fe58e619f85965d4fe09e9e490454b6", - "size": 2441 + "path": "en/api/typescript/beta/skills/create.md", + "sha256": "d713c37df22354ac838a30f415ca8d4ea03910039a3b85b3c3d9e518337adef3", + "size": 2829 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/files/download", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/skills/list", "status": "success", - "path": "en/api/python/beta/files/download.md", - "sha256": "d749f9f5e073fe464d703fb744ef3bad631f38fd8f63d49a6614460ebd564691", - "size": 1591 + "path": "en/api/typescript/beta/skills/list.md", + "sha256": "4167f29645351507a6b864179c96a214c69fdb7174b933ebb7a25c150f63521f", + "size": 3106 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/files/retrieve_metadata", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/skills/retrieve", "status": "success", - "path": "en/api/python/beta/files/retrieve_metadata.md", - "sha256": "2dee0f5a621a6cf0381ff736e080afdbe8774ff575d42fe99a8ee675fae007dc", - "size": 2139 + "path": "en/api/typescript/beta/skills/retrieve.md", + "sha256": "c75a79d740e0927c27a5766d32d6d3b5ce9b9bfb227af0b8e0718db07a606c6d", + "size": 2592 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/files/delete", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/skills/delete", "status": "success", - "path": "en/api/python/beta/files/delete.md", - "sha256": "2c7f56ba4582bf4aa150c7468f6e051db7d51db5f26dbf9a7166b8d8b967536a", - "size": 1735 + "path": "en/api/typescript/beta/skills/delete.md", + "sha256": "3cf8d64e3ecdbe91f4d2c50d275d22343ae2c8c8a93cb4e714f436136b065cdd", + "size": 1904 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/skills", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/skills/versions", "status": "success", - "path": "en/api/python/beta/skills.md", - "sha256": "5f8a903d4e8e42053c6fbbdb2b3e9ee70d25b783c05aadbe525e9a0fd207fc6b", - "size": 26812 + "path": "en/api/typescript/beta/skills/versions.md", + "sha256": "dc1c389b70537a6173cf7be4b0af3d30d024fcbaf071857871b536282d8fc3c2", + "size": 14466 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/skills/create", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/skills/versions/create", "status": "success", - "path": "en/api/python/beta/skills/create.md", - "sha256": "d2efeafa149a06a154bc6e254872339dd99f898917f4b7ac1c2fae7f6105ddad", - "size": 2680 + "path": "en/api/typescript/beta/skills/versions/create.md", + "sha256": "fcce9f941cddc35c9303bb8ec124442fbcabd9c8b99c01299912267b451b621e", + "size": 2919 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/skills/list", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/skills/versions/list", "status": "success", - "path": "en/api/python/beta/skills/list.md", - "sha256": "c4ebd42c04f780a128205df33e29e95c658a11ea08ca2bde53f3b3656b0ff9b1", - "size": 2875 + "path": "en/api/typescript/beta/skills/versions/list.md", + "sha256": "c1c2843ac4738cce415c99200a4b4e686368ca34afee5733446fef8ef9818edb", + "size": 3037 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/skills/retrieve", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/skills/versions/retrieve", "status": "success", - "path": "en/api/python/beta/skills/retrieve.md", - "sha256": "ae33c90427d1b975db5f7ea345dad30bd1425889410e5c43378c3edd02c071eb", - "size": 2500 + "path": "en/api/typescript/beta/skills/versions/retrieve.md", + "sha256": "1bfd800865c924d3436a7a482718d0131c6b37afa8f2e804e8ddc4f0906d9cd7", + "size": 2917 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/skills/delete", + "url": "https://platform.claude.com/docs/en/api/typescript/beta/skills/versions/delete", "status": "success", - "path": "en/api/python/beta/skills/delete.md", - "sha256": "35e74b9c89f37406053f2932ee15abebe2ddc9ab717d0e7ff38d32bdb860d79c", - "size": 1823 + "path": "en/api/typescript/beta/skills/versions/delete.md", + "sha256": "c3b888b5a2a5b4ed2b0fb86702832c40c6f0c37193bc84fca5568acd234b6ba9", + "size": 2207 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/skills/versions", + "url": "https://platform.claude.com/docs/en/api/python/completions", "status": "success", - "path": "en/api/python/beta/skills/versions.md", - "sha256": "35db706d65535f789f0260d1a5a50f891bd7563ac8263549726feef26bd3f9b9", - "size": 13826 + "path": "en/api/python/completions.md", + "sha256": "6b3a7835c6c4a0fcae3a534ba9dc4820c8a4434c4b1e17ff244820d6e6585e5e", + "size": 16063 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/skills/versions/create", + "url": "https://platform.claude.com/docs/en/api/python/completions/create", "status": "success", - "path": "en/api/python/beta/skills/versions/create.md", - "sha256": "2add11e637f68875c3e055878fdba0e5a7218eb4142b3e89c54f2ffb70a47c6f", - "size": 2790 + "path": "en/api/python/completions/create.md", + "sha256": "97859080eb4c710cb707b5c33b071f338d08ad98e2db987ea8b4118312434fff", + "size": 11967 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/skills/versions/list", + "url": "https://platform.claude.com/docs/en/api/python/messages", "status": "success", - "path": "en/api/python/beta/skills/versions/list.md", - "sha256": "97ca5d6d566293ef6da1c0544ee3ff7f82a6ed9f0364dadc92c527ad8a485910", - "size": 2822 + "path": "en/api/python/messages.md", + "sha256": "a5d3344c3d1f269a80cdc9e51c1cb7c37bc824b233f35bea038ed64c3ea31f7e", + "size": 870113 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/skills/versions/retrieve", + "url": "https://platform.claude.com/docs/en/api/python/messages/create", "status": "success", - "path": "en/api/python/beta/skills/versions/retrieve.md", - "sha256": "6d3e2e6c054b2adf3e4b37ffc6893d01dfd548d884e15f6446f6b2811004cb73", - "size": 2776 + "path": "en/api/python/messages/create.md", + "sha256": "12199547486fdec68a0d00e0d52cb460131fe2314e259ca221470eefd16412ec", + "size": 119761 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/skills/versions/delete", + "url": "https://platform.claude.com/docs/en/api/python/messages/count_tokens", "status": "success", - "path": "en/api/python/beta/skills/versions/delete.md", - "sha256": "85eee7f9031f994b58ca91deb5f70ca749111ae810f65a1502d9eaafbe6cf217", - "size": 2086 + "path": "en/api/python/messages/count_tokens.md", + "sha256": "327daaeeff0dde9b3cd4609e45ba7a22feaae3b89f2a74f203e853a1a220c70a", + "size": 94123 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/user_profiles", + "url": "https://platform.claude.com/docs/en/api/python/messages/batches", "status": "success", - "path": "en/api/python/beta/user_profiles.md", - "sha256": "336b13663820ea5e051ad2091b66bd515f821600932a790bbd3737cdeb14c297", - "size": 10589 + "path": "en/api/python/messages/batches.md", + "sha256": "f250ea9593bfaa4947582a1d5da3b8933f0f83cdef7f6f40392dc796aa2ac2fa", + "size": 234472 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/user_profiles/create", + "url": "https://platform.claude.com/docs/en/api/python/messages/batches/create", "status": "success", - "path": "en/api/python/beta/user_profiles/create.md", - "sha256": "93f69bbec96df09274185dda11a57a2f0ada14cc0149b6087acee0f57b5b48ff", - "size": 2060 + "path": "en/api/python/messages/batches/create.md", + "sha256": "29116c88d473863e8631e0aca01c427caae94034f392a874adb90007bd13481a", + "size": 108696 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/user_profiles/list", + "url": "https://platform.claude.com/docs/en/api/python/messages/batches/retrieve", "status": "success", - "path": "en/api/python/beta/user_profiles/list.md", - "sha256": "6b63681ced10ed5826d4fafa4b5f1ec3c2310af912e535f0f7922e8baad65ca9", - "size": 2025 + "path": "en/api/python/messages/batches/retrieve.md", + "sha256": "0d277d480739f911ab4376e600949bf82f01633bc39154d07f28846a77d72010", + "size": 3609 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/user_profiles/retrieve", + "url": "https://platform.claude.com/docs/en/api/python/messages/batches/list", "status": "success", - "path": "en/api/python/beta/user_profiles/retrieve.md", - "sha256": "11905b3075f3836f3dc34934fff883915a9151c8293257fa2ba91913a88a99f6", - "size": 1857 + "path": "en/api/python/messages/batches/list.md", + "sha256": "6de85ce7f5d2a44c1d8e815a67e552cc88ce58aea737221c67e614905d46ebc9", + "size": 3857 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/user_profiles/update", + "url": "https://platform.claude.com/docs/en/api/python/messages/batches/cancel", "status": "success", - "path": "en/api/python/beta/user_profiles/update.md", - "sha256": "ea5373607ed6c032b7f89181b274a12ea43668abd402227b6e3bdb97bfa753db", - "size": 2189 + "path": "en/api/python/messages/batches/cancel.md", + "sha256": "17492c90948f23ad1f8ad17d33ab20e32d1bf14c9b65da102827a8e31ce7f79c", + "size": 3921 }, { - "url": "https://platform.claude.com/docs/en/api/python/beta/user_profiles/create_enrollment_url", + "url": "https://platform.claude.com/docs/en/api/python/messages/batches/delete", "status": "success", - "path": "en/api/python/beta/user_profiles/create_enrollment_url.md", - "sha256": "28aa9359e5a53bbe77db1a6d835944481e0b0fa5feb75400d1f65fcaabb818a4", - "size": 1784 + "path": "en/api/python/messages/batches/delete.md", + "sha256": "74cd4bbe006b91b26d57aac7a654f489294abe32b24f440a8465c45cb3977acf", + "size": 1070 }, { - "url": "https://platform.claude.com/docs/en/api/java/completions", + "url": "https://platform.claude.com/docs/en/api/python/messages/batches/results", "status": "success", - "path": "en/api/java/completions.md", - "sha256": "094172215ca0cb3be34c83e0127af8c95363c63365eb4ba55f5f2f2ee055b354", - "size": 10463 + "path": "en/api/python/messages/batches/results.md", + "sha256": "722094a88d1c1376165d1ea96c8583be6135bf569f641fa20e3d6a53a80c2c94", + "size": 29053 }, { - "url": "https://platform.claude.com/docs/en/api/java/completions/create", + "url": "https://platform.claude.com/docs/en/api/python/models", "status": "success", - "path": "en/api/java/completions/create.md", - "sha256": "fd3bff7322dc0f78c98c160e80ffdc895a1cce5722362fd02760ffa83128e855", - "size": 7908 + "path": "en/api/python/models.md", + "sha256": "2074d6a451e9d06ae504b423325e328e93fd321aa69f7713784c7155d8e9c270", + "size": 22739 }, { - "url": "https://platform.claude.com/docs/en/api/java/messages", + "url": "https://platform.claude.com/docs/en/api/python/models/list", "status": "success", - "path": "en/api/java/messages.md", - "sha256": "f2c77cd02fceec0065b341846e2620ec610a56c4054abe61b142feed2d3def48", - "size": 919087 + "path": "en/api/python/models/list.md", + "sha256": "05a3303e8c28d6077d0eca81e80edff17aadc5cdae6abda58da922e48d2791a0", + "size": 6219 }, { - "url": "https://platform.claude.com/docs/en/api/java/messages/create", + "url": "https://platform.claude.com/docs/en/api/python/models/retrieve", "status": "success", - "path": "en/api/java/messages/create.md", - "sha256": "31053f1e246ece648883755c5d493da0adb22357523109f957b49e6cdda8b698", - "size": 122522 + "path": "en/api/python/models/retrieve.md", + "sha256": "cfbf64fbc4cddf8b65cf99bef2aae188dc7401671611ae3cafa09ba01a808204", + "size": 5864 }, { - "url": "https://platform.claude.com/docs/en/api/java/messages/count_tokens", + "url": "https://platform.claude.com/docs/en/api/python/beta", "status": "success", - "path": "en/api/java/messages/count_tokens.md", - "sha256": "68be31a803aeae8d38432220628051f2e65a94c8d0acc9dbf1ccfce04b9053cd", - "size": 96644 + "path": "en/api/python/beta.md", + "sha256": "c7b88ed780f715cb3f5425f60db620ffa14a4261d60ebea553b6d5dfb837ef93", + "size": 1665959 }, { - "url": "https://platform.claude.com/docs/en/api/java/messages/batches", + "url": "https://platform.claude.com/docs/en/api/python/beta/models", "status": "success", - "path": "en/api/java/messages/batches.md", - "sha256": "8fec18621022ffb1cbab40f0f10c0f0ba47bc155fa1d04d462b84ab8b89b26f9", - "size": 248314 + "path": "en/api/python/beta/models.md", + "sha256": "3e1900e00573a02e3433aef701c97a9ea3d1236983145a961b2227649d2cdb10", + "size": 23212 }, { - "url": "https://platform.claude.com/docs/en/api/java/messages/batches/create", + "url": "https://platform.claude.com/docs/en/api/python/beta/models/list", "status": "success", - "path": "en/api/java/messages/batches/create.md", - "sha256": "ce5d431a1bfc2b02bd617b110554e29d414eaffa91725f9338788a3f97e69e36", - "size": 116529 + "path": "en/api/python/beta/models/list.md", + "sha256": "fa6be151678b3cc4e4ab27126d54fd792096d8a88e8cdecec292e8056dd29688", + "size": 6317 }, { - "url": "https://platform.claude.com/docs/en/api/java/messages/batches/retrieve", + "url": "https://platform.claude.com/docs/en/api/python/beta/models/retrieve", "status": "success", - "path": "en/api/java/messages/batches/retrieve.md", - "sha256": "31ef3a6186ee81e8555c194abe39c78c319e393924dbe81bfe547c07af936232", - "size": 4046 + "path": "en/api/python/beta/models/retrieve.md", + "sha256": "00c56eb0381fd7aabea748a91062064e2eead43fb4dee2ef6d90d27b9a7cdb51", + "size": 5972 }, { - "url": "https://platform.claude.com/docs/en/api/java/messages/batches/list", + "url": "https://platform.claude.com/docs/en/api/python/beta/messages", "status": "success", - "path": "en/api/java/messages/batches/list.md", - "sha256": "4c72371fbbc0ea3a4862f11ad8557966466adb6dd7385e02e0f6740e0bae0e0e", - "size": 4266 + "path": "en/api/python/beta/messages.md", + "sha256": "f90d457bd9c83a718d34613d8d689b268adbd48a2e302475171d95e7c692e7c6", + "size": 1066533 }, { - "url": "https://platform.claude.com/docs/en/api/java/messages/batches/cancel", + "url": "https://platform.claude.com/docs/en/api/python/beta/messages/create", "status": "success", - "path": "en/api/java/messages/batches/cancel.md", - "sha256": "1839e1ce519275e06452a811f7eb16628dba51fee26deb770677aa8894b7a5b3", - "size": 4350 + "path": "en/api/python/beta/messages/create.md", + "sha256": "fb1fd1ea8125113c43295ddf205227f978b22903dd076764d4c82b485e07d5da", + "size": 149285 }, { - "url": "https://platform.claude.com/docs/en/api/java/messages/batches/delete", + "url": "https://platform.claude.com/docs/en/api/python/beta/messages/count_tokens", "status": "success", - "path": "en/api/java/messages/batches/delete.md", - "sha256": "e0b8f507d75c528ba15e08056989139d14e0f70172ce518ec9105b5a2cfbb48d", - "size": 1498 + "path": "en/api/python/beta/messages/count_tokens.md", + "sha256": "6a249047842cb0816b8a3799a0bb7b9b533043ee445f330c42e0bf90fa8e9da7", + "size": 115458 }, { - "url": "https://platform.claude.com/docs/en/api/java/messages/batches/results", + "url": "https://platform.claude.com/docs/en/api/python/beta/messages/batches", "status": "success", - "path": "en/api/java/messages/batches/results.md", - "sha256": "2b7d45a99474a2e7ec57ab7ab3bb27e58575a0017b53834353b71d4fa3274030", - "size": 30472 + "path": "en/api/python/beta/messages/batches.md", + "sha256": "c45130e0ab42b9876a54679c481d8497bd8732cf0d867ac95f00610c960a8311", + "size": 297760 }, { - "url": "https://platform.claude.com/docs/en/api/java/models", + "url": "https://platform.claude.com/docs/en/api/python/beta/messages/batches/create", "status": "success", - "path": "en/api/java/models.md", - "sha256": "fbeaf7ac96e5a6e39d87659c132e8953288d149b2a167ab1127cb4e1fc39100e", - "size": 24482 + "path": "en/api/python/beta/messages/batches/create.md", + "sha256": "264ab08bf19919b45cfe130b79e14b7a046e91b79b93b355171ea509d056b633", + "size": 132126 }, { - "url": "https://platform.claude.com/docs/en/api/java/models/list", + "url": "https://platform.claude.com/docs/en/api/python/beta/messages/batches/retrieve", "status": "success", - "path": "en/api/java/models/list.md", - "sha256": "50cdfdf1b1a5eb9577a77cffa7644aca1fccf2bbb72e0d52a0e5bbb5cc442570", - "size": 7087 + "path": "en/api/python/beta/messages/batches/retrieve.md", + "sha256": "8a7b091ee014b8ae25f42817ba0e7aab03d06cda2d6a55c0430e79aa8476733f", + "size": 4689 }, { - "url": "https://platform.claude.com/docs/en/api/java/models/retrieve", + "url": "https://platform.claude.com/docs/en/api/python/beta/messages/batches/list", "status": "success", - "path": "en/api/java/models/retrieve.md", - "sha256": "e783d88a291934cd7c2421abf17b0adb8b0a3fd41d0acff11aef4564e1f24826", - "size": 6725 + "path": "en/api/python/beta/messages/batches/list.md", + "sha256": "7f8aef7f0b4c12930f46006c813d6328c92e2b38e9310d539a573900bfadffe3", + "size": 4881 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta", + "url": "https://platform.claude.com/docs/en/api/python/beta/messages/batches/cancel", "status": "success", - "path": "en/api/java/beta.md", - "sha256": "0d2c16b59c9e1f321b93462d9548bad8061b2bc9845c68f3f70bf2a28f6994b6", - "size": 1207081 + "path": "en/api/python/beta/messages/batches/cancel.md", + "sha256": "12caabd93ba49bff32bb2bb0ece4f22133d0cadf464c978dc0fe7fdea7157aa5", + "size": 4999 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/models", + "url": "https://platform.claude.com/docs/en/api/python/beta/messages/batches/delete", "status": "success", - "path": "en/api/java/beta/models.md", - "sha256": "e6795265860633374e0516d76819656472ae5f1adbbb9f578d04ab386ba23775", - "size": 24981 + "path": "en/api/python/beta/messages/batches/delete.md", + "sha256": "a36da88e8710e69b1f397908db7a2c932f8a81bce75e25841b5e6ba7b9faed07", + "size": 2144 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/models/list", + "url": "https://platform.claude.com/docs/en/api/python/beta/messages/batches/results", "status": "success", - "path": "en/api/java/beta/models/list.md", - "sha256": "cab2d4602dcab3b625f8bb55220d6bb66e46fa41643a834d06d644782d8697e8", - "size": 7195 + "path": "en/api/python/beta/messages/batches/results.md", + "sha256": "c2a7fd2771aa253c0290d21ee091eb939079e38bfc5c7822fc549f9d30c1dad3", + "size": 38971 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/models/retrieve", + "url": "https://platform.claude.com/docs/en/api/python/beta/agents", "status": "success", - "path": "en/api/java/beta/models/retrieve.md", - "sha256": "0d076cd83d56fc0a88e10796c58a3243a80fed93a3b39aa74c42ab242978a1c2", - "size": 6849 + "path": "en/api/python/beta/agents.md", + "sha256": "a23bdc8884d76d4a61a45fb35146ebc35439c0caef37f149fced1f8d1fdb5224", + "size": 108530 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/messages", + "url": "https://platform.claude.com/docs/en/api/python/beta/agents/create", "status": "success", - "path": "en/api/java/beta/messages.md", - "sha256": "2161e74f6399f81669a499549d87ff240587fcb732814136ada4e942701a234e", - "size": 1119999 + "path": "en/api/python/beta/agents/create.md", + "sha256": "8a3419279870d8d9ca4d9f9fe2ba451069c2a5713b735517562fdf01cf777c21", + "size": 19895 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/messages/create", + "url": "https://platform.claude.com/docs/en/api/python/beta/agents/list", "status": "success", - "path": "en/api/java/beta/messages/create.md", - "sha256": "9f6c66f81e399757404ddfd6a055992ffbe5a1caa741fadc01d67c1aa7ee4a43", - "size": 151133 + "path": "en/api/python/beta/agents/list.md", + "sha256": "5da0cf8921f30ffa5525fecbee01c717ab5380073fac549d8a4e49be9128d39c", + "size": 9214 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/messages/count_tokens", + "url": "https://platform.claude.com/docs/en/api/python/beta/agents/retrieve", "status": "success", - "path": "en/api/java/beta/messages/count_tokens.md", - "sha256": "f044d2ecd009cc1a996bc1bf60a77e3bee52254aaac7e021ee8bd6dcf36a986d", - "size": 116815 + "path": "en/api/python/beta/agents/retrieve.md", + "sha256": "bc0f8d5001f9a00b6b876c894e355e75b2cf1c2c3a7fe955a22c4f381f4b3a64", + "size": 8958 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/messages/batches", + "url": "https://platform.claude.com/docs/en/api/python/beta/agents/update", "status": "success", - "path": "en/api/java/beta/messages/batches.md", - "sha256": "aeac9b26458820441ecfcb37ac53c84dce651c09fbe95d18199b6c23c0f4e071", - "size": 316406 + "path": "en/api/python/beta/agents/update.md", + "sha256": "0495405e5d2eba78034930db48cb9f970f67c0dcba60ecbcd0196088b47a4f2f", + "size": 20568 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/messages/batches/create", + "url": "https://platform.claude.com/docs/en/api/python/beta/agents/archive", "status": "success", - "path": "en/api/java/beta/messages/batches/create.md", - "sha256": "cf7e1791a139105925b08b16044b4c89644d08fcb3677d13f655bff01a11141f", - "size": 142162 + "path": "en/api/python/beta/agents/archive.md", + "sha256": "85fc4e78eb7df5b3f376a86d33b2c922fef6c9f52482e8da742236b5ddc7ab73", + "size": 8854 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/messages/batches/retrieve", + "url": "https://platform.claude.com/docs/en/api/python/beta/agents/versions", "status": "success", - "path": "en/api/java/beta/messages/batches/retrieve.md", - "sha256": "c265b929ed6a0d6ad00de81812d02d5d8e7c2b6473352a6c110b9bc9a5b07d71", - "size": 5592 + "path": "en/api/python/beta/agents/versions.md", + "sha256": "d2d3846731546403863c1a4a785815f48f8d51a02daa177cdbec763f7857854c", + "size": 9008 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/messages/batches/list", + "url": "https://platform.claude.com/docs/en/api/python/beta/agents/versions/list", "status": "success", - "path": "en/api/java/beta/messages/batches/list.md", - "sha256": "6c70571ebb5051939a1301640bf63f352337165c7b8b0e7677922cd59b854602", - "size": 5796 + "path": "en/api/python/beta/agents/versions/list.md", + "sha256": "3ab39f90a6b03c3e772af07902a7a14512bc15d7709fd5469a186d77a765e89b", + "size": 8996 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/messages/batches/cancel", + "url": "https://platform.claude.com/docs/en/api/python/beta/environments", "status": "success", - "path": "en/api/java/beta/messages/batches/cancel.md", - "sha256": "de25b9555672c29c6e1d883d7f6a819344da0e48db5b3a52fd05ab31869b2f8c", - "size": 5896 + "path": "en/api/python/beta/environments.md", + "sha256": "0514b616b50cf20eae742e1ec77aa651a68d75f721fadf5d028b4d11db3a78f3", + "size": 35536 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/messages/batches/delete", + "url": "https://platform.claude.com/docs/en/api/python/beta/environments/create", "status": "success", - "path": "en/api/java/beta/messages/batches/delete.md", - "sha256": "2edfbf0efa5528511a256a52dde839cc3fddf05ab6988bdc1c3975eb9d09a77d", - "size": 3040 + "path": "en/api/python/beta/environments/create.md", + "sha256": "133af60984b5dc37127f5d70b6b634a828307a5c666b714f22eacd977d2f2e11", + "size": 6209 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/messages/batches/results", + "url": "https://platform.claude.com/docs/en/api/python/beta/environments/list", "status": "success", - "path": "en/api/java/beta/messages/batches/results.md", - "sha256": "9222cd0fb25a91bdad32c60be3eef5dc93920b4112bf8d4c832c935108e79619", - "size": 40921 + "path": "en/api/python/beta/environments/list.md", + "sha256": "4486983945ff606726d06eb98af5f0bb0724ad9b4fb31f50c102537bef9e609a", + "size": 4065 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/files", + "url": "https://platform.claude.com/docs/en/api/python/beta/environments/retrieve", "status": "success", - "path": "en/api/java/beta/files.md", - "sha256": "a360e5431c518dd98b4a5604d9a52e64b1404566f199fed42ba120d4878fdb91", - "size": 15089 + "path": "en/api/python/beta/environments/retrieve.md", + "sha256": "46a9e49fa3ac7ab55625f876b0529390f25982b7a665f78c201943f0b5f31661", + "size": 3885 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/files/upload", + "url": "https://platform.claude.com/docs/en/api/python/beta/environments/update", "status": "success", - "path": "en/api/java/beta/files/upload.md", - "sha256": "60d0f8ff35b8541035fe43f300fab84e3e6b5653858113023136e828e7d6b197", - "size": 3067 + "path": "en/api/python/beta/environments/update.md", + "sha256": "64841e00f9d5685bc41eed66d0d5990d23dc72b9c95d4d03f75c648f916c11aa", + "size": 6345 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/files/list", + "url": "https://platform.claude.com/docs/en/api/python/beta/environments/delete", "status": "success", - "path": "en/api/java/beta/files/list.md", - "sha256": "1db339de8db95d6b5517f69ffc0d84deca7afe78e93c3c52ba67db7308081dd0", - "size": 3276 + "path": "en/api/python/beta/environments/delete.md", + "sha256": "2b9a9ca06318191e82fdd7b249bb74f219fe6dac3a9dbbca8368d2e1de366c49", + "size": 1879 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/files/download", + "url": "https://platform.claude.com/docs/en/api/python/beta/environments/archive", "status": "success", - "path": "en/api/java/beta/files/download.md", - "sha256": "74472ae26d5130936ef6c73cb9445ed611059a6ac1d06b780ba3bd4e9a4de7d7", - "size": 2321 + "path": "en/api/python/beta/environments/archive.md", + "sha256": "80c5ef072bdccfe36e91b2d7a363bfc11b452fc09b78df5d0698b9ffb92edc22", + "size": 3942 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/files/retrieve_metadata", + "url": "https://platform.claude.com/docs/en/api/python/beta/sessions", "status": "success", - "path": "en/api/java/beta/files/retrieve_metadata.md", - "sha256": "bea2c6095eb02dcb0f66c176e6a2b18249f06e2030d65251360c8130176a35a0", - "size": 3000 + "path": "en/api/python/beta/sessions.md", + "sha256": "c1f765b3070ff26cec3f968f228e6fa376ee1daba2580758cf6a755ea8f72ca2", + "size": 331265 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/files/delete", + "url": "https://platform.claude.com/docs/en/api/python/beta/sessions/create", "status": "success", - "path": "en/api/java/beta/files/delete.md", - "sha256": "92dfca5a9c737757ab31de30f94f3275afc36655b9d91601d65be47a5fdcc063", - "size": 2539 + "path": "en/api/python/beta/sessions/create.md", + "sha256": "ab53c992fc07b313e583036247239200160035c2aadaea7d9cf4b150e1140df9", + "size": 14265 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/skills", + "url": "https://platform.claude.com/docs/en/api/python/beta/sessions/list", "status": "success", - "path": "en/api/java/beta/skills.md", - "sha256": "c712267b317f71f0489f905a9436dbce9e1d1a629164a6c97b09eb27dcac799c", - "size": 27466 + "path": "en/api/python/beta/sessions/list.md", + "sha256": "b773165c17290e8b2bbd608a6b1b7609d47447e7ee5f5b4da90f5e97c37f9e10", + "size": 12823 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/skills/create", + "url": "https://platform.claude.com/docs/en/api/python/beta/sessions/retrieve", "status": "success", - "path": "en/api/java/beta/skills/create.md", - "sha256": "53326ceebeaba8a3c6f09dad26acd3ea2666788e14ce2122d57bbe68f1e618da", - "size": 3544 + "path": "en/api/python/beta/sessions/retrieve.md", + "sha256": "84437d623582fd7a5c8733b4e0bdef56952540747cb779e30e92eafc9073ab15", + "size": 11892 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/skills/list", + "url": "https://platform.claude.com/docs/en/api/python/beta/sessions/update", "status": "success", - "path": "en/api/java/beta/skills/list.md", - "sha256": "f3bfbbe9e5f625ab29a45d1f715f2978865a32c72c3f02fc9a518280968ea738", - "size": 3703 + "path": "en/api/python/beta/sessions/update.md", + "sha256": "6cce1a8ee3ed14fe8e0c9f7f0d623919fb59cbd539396ccfd27c728c7b097bb5", + "size": 12280 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/skills/retrieve", + "url": "https://platform.claude.com/docs/en/api/python/beta/sessions/delete", "status": "success", - "path": "en/api/java/beta/skills/retrieve.md", - "sha256": "484f3e112c5b0e7d27328dc8b5f1178bd352cc10163606fc5f19c31b55234d46", - "size": 3357 + "path": "en/api/python/beta/sessions/delete.md", + "sha256": "09e23f591f2892101f156ea87cad3458cdbe701643852de776b8bcd7b1c8bb0b", + "size": 1762 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/skills/delete", + "url": "https://platform.claude.com/docs/en/api/python/beta/sessions/archive", "status": "success", - "path": "en/api/java/beta/skills/delete.md", - "sha256": "3a6e8a84c857209f40866a9936a13c5f0d96d58f19e1498c5e52122032b1d604", - "size": 2664 + "path": "en/api/python/beta/sessions/archive.md", + "sha256": "157b5e270fb4df29bdce7fd180769958b0e345ced1fa4b2be6bcfd5c12d2ea67", + "size": 11901 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/skills/versions", + "url": "https://platform.claude.com/docs/en/api/python/beta/sessions/events", "status": "success", - "path": "en/api/java/beta/skills/versions.md", - "sha256": "0bbe5cd2714ca58cd003416ba35f1986ad56671c35a055a38ce02fd2dd5e02d3", - "size": 14184 + "path": "en/api/python/beta/sessions/events.md", + "sha256": "02332c7f743acdc85da940d3879537703a8bb6fd5c578d7d77ad6b07221872ad", + "size": 227757 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/skills/versions/create", + "url": "https://platform.claude.com/docs/en/api/python/beta/sessions/events/list", "status": "success", - "path": "en/api/java/beta/skills/versions/create.md", - "sha256": "7c218ca01f1e191947806c711c7495117ee640b4f070c67810c650e4235940cc", - "size": 3669 + "path": "en/api/python/beta/sessions/events/list.md", + "sha256": "c375173516aa383dbb21d3d88ee254bc8713bb648350fd462e6aaccd44e40cf4", + "size": 34832 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/skills/versions/list", + "url": "https://platform.claude.com/docs/en/api/python/beta/sessions/events/send", "status": "success", - "path": "en/api/java/beta/skills/versions/list.md", - "sha256": "62b78395c4b77606a57b6ace75a45ae399abfbb5a678adcd29f5212b9ab11ee5", - "size": 3660 + "path": "en/api/python/beta/sessions/events/send.md", + "sha256": "4826469d317554bf7ad72f221f83897517090b5f1e5ca0239a7952fd945a08cd", + "size": 18990 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/skills/versions/retrieve", + "url": "https://platform.claude.com/docs/en/api/python/beta/sessions/events/stream", "status": "success", - "path": "en/api/java/beta/skills/versions/retrieve.md", - "sha256": "76a25bf9bcfcdd406891b0b960c59779987c5771aff8727fe25f3d56cc0e0759", - "size": 3776 + "path": "en/api/python/beta/sessions/events/stream.md", + "sha256": "0079331d024c098d128ec10a2e1e358c30e61509f20757342393cd36d24ddf43", + "size": 34528 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/skills/versions/delete", + "url": "https://platform.claude.com/docs/en/api/python/beta/sessions/resources", "status": "success", - "path": "en/api/java/beta/skills/versions/delete.md", - "sha256": "107e78e5d518b798f145cf990574d3bfb89587b07e3c99d6a98afa94cdc15a43", - "size": 3064 + "path": "en/api/python/beta/sessions/resources.md", + "sha256": "6500a2f3bbdc3a53425a38b5929dd526a8137b8a68220b1a83d2b9e8d7ffe563", + "size": 17143 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/user_profiles", + "url": "https://platform.claude.com/docs/en/api/python/beta/sessions/resources/add", "status": "success", - "path": "en/api/java/beta/user_profiles.md", - "sha256": "047bbee9504f26847da9da62280fe7777ca7233eea56d0d7f7cd21ae05f60c34", - "size": 14790 + "path": "en/api/python/beta/sessions/resources/add.md", + "sha256": "b3b9eff21d8279e28c8f3ef063355dbbf60bcfff6049353ef22be21baddf91a6", + "size": 2130 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/user_profiles/create", + "url": "https://platform.claude.com/docs/en/api/python/beta/sessions/resources/list", "status": "success", - "path": "en/api/java/beta/user_profiles/create.md", - "sha256": "73b6c3f3f91b7294fbf9b47b0994e7df719aec670a00931a174a5887030eec78", - "size": 2894 + "path": "en/api/python/beta/sessions/resources/list.md", + "sha256": "ce9d4baf7e3ff41ffcae224751441299add30e662e197589d7399f11cfae0b12", + "size": 2835 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/user_profiles/list", + "url": "https://platform.claude.com/docs/en/api/python/beta/sessions/resources/retrieve", "status": "success", - "path": "en/api/java/beta/user_profiles/list.md", - "sha256": "5f84fb66814fd8056515b57800b7f2e6595641100ee083869b1ad89b5917ea14", - "size": 2853 + "path": "en/api/python/beta/sessions/resources/retrieve.md", + "sha256": "469b1acdb543a3f94ffb26d7c30f7d18174efdcf86c8d3be60912719503fd4e3", + "size": 2719 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/user_profiles/retrieve", + "url": "https://platform.claude.com/docs/en/api/python/beta/sessions/resources/update", "status": "success", - "path": "en/api/java/beta/user_profiles/retrieve.md", - "sha256": "825bda62fce2272ab0f8a812cdd2207883783802ad7293987566d69667a10402", - "size": 2694 + "path": "en/api/python/beta/sessions/resources/update.md", + "sha256": "4704da90d8402ccd2a25939d719c05c94ce63f391ec0eae31138c5736d7925d9", + "size": 2897 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/user_profiles/update", + "url": "https://platform.claude.com/docs/en/api/python/beta/sessions/resources/delete", "status": "success", - "path": "en/api/java/beta/user_profiles/update.md", - "sha256": "4b99c3c6145279edc006185a3a38a3d5b269d62b658f73cf17062a1faad2baa5", - "size": 3020 + "path": "en/api/python/beta/sessions/resources/delete.md", + "sha256": "1fd791cdc1ac13ddb38b777c524a4bdebbb9a3ca7a904cfb3d144bd258d8c841", + "size": 1913 }, { - "url": "https://platform.claude.com/docs/en/api/java/beta/user_profiles/create_enrollment_url", + "url": "https://platform.claude.com/docs/en/api/python/beta/vaults", "status": "success", - "path": "en/api/java/beta/user_profiles/create_enrollment_url.md", - "sha256": "cbb373297c7ec30601fd81587524219d251c467f8e643065d569aded9e7b637c", - "size": 2679 + "path": "en/api/python/beta/vaults.md", + "sha256": "72a860098bb004bbb43e65b60974a1b397f65f1a95f4dcff6740baa9b629f390", + "size": 57021 }, { - "url": "https://platform.claude.com/docs/en/api/go/completions", + "url": "https://platform.claude.com/docs/en/api/python/beta/vaults/create", "status": "success", - "path": "en/api/go/completions.md", - "sha256": "59503fde3d089d8c31a585ec37e7d9a968bb086b8c5d79bf1b6167bfbae2e2e6", - "size": 12155 + "path": "en/api/python/beta/vaults/create.md", + "sha256": "d1b95b4ec1dc8d5750654f883a31425d9aee87d8b70287966a587637333efbd9", + "size": 2206 }, { - "url": "https://platform.claude.com/docs/en/api/go/completions/create", + "url": "https://platform.claude.com/docs/en/api/python/beta/vaults/list", "status": "success", - "path": "en/api/go/completions/create.md", - "sha256": "98366cf044bf37a7106a634d608eea40268e6a76690db9a167bb9ea8dca4c744", - "size": 9091 + "path": "en/api/python/beta/vaults/list.md", + "sha256": "b7b4459c2049c862e80577dd5f06cdb5b6f6bbd06d15fc90b676ceb7e25b4a90", + "size": 2267 }, { - "url": "https://platform.claude.com/docs/en/api/go/messages", + "url": "https://platform.claude.com/docs/en/api/python/beta/vaults/retrieve", "status": "success", - "path": "en/api/go/messages.md", - "sha256": "6d1291b8603e7b94434e0e780d5713b94dd2aecf1adaeaba04526127bb0ad064", - "size": 1096821 + "path": "en/api/python/beta/vaults/retrieve.md", + "sha256": "ec6239c8af0bef891281d9cac7d9b11260b69b4c691784bf3b4c1a219c69ccba", + "size": 2089 }, { - "url": "https://platform.claude.com/docs/en/api/go/messages/create", + "url": "https://platform.claude.com/docs/en/api/python/beta/vaults/update", "status": "success", - "path": "en/api/go/messages/create.md", - "sha256": "5fb6c4c9c3fc29ab14ff97f9283eca5d305c8dc2a8758913d92f2a1fa8851853", - "size": 144211 + "path": "en/api/python/beta/vaults/update.md", + "sha256": "ba256e75bac2ae4a2c4339be8238ddccf414b58ae9f715a5183e7a940f7f5812", + "size": 2340 }, { - "url": "https://platform.claude.com/docs/en/api/go/messages/count_tokens", + "url": "https://platform.claude.com/docs/en/api/python/beta/vaults/delete", "status": "success", - "path": "en/api/go/messages/count_tokens.md", - "sha256": "4b76269bb382fbcd104dbf6b790322d2a57e5613a3366abd74928354fbcbf166", - "size": 112866 + "path": "en/api/python/beta/vaults/delete.md", + "sha256": "25fd3c304561a7991ab1563cbdaf69a4b494f3b9d585c64735a599d7c74ef40e", + "size": 1749 }, { - "url": "https://platform.claude.com/docs/en/api/go/messages/batches", + "url": "https://platform.claude.com/docs/en/api/python/beta/vaults/archive", "status": "success", - "path": "en/api/go/messages/batches.md", - "sha256": "5c8b47fd2e2822f217b6354f095171a6f8282579241227758b94c081df16b976", - "size": 287749 + "path": "en/api/python/beta/vaults/archive.md", + "sha256": "dfc14bc6230621e39071897a240da91e6e6f2503333d61f31dad876708874607", + "size": 2098 }, { - "url": "https://platform.claude.com/docs/en/api/go/messages/batches/create", + "url": "https://platform.claude.com/docs/en/api/python/beta/vaults/credentials", "status": "success", - "path": "en/api/go/messages/batches/create.md", - "sha256": "153e429cc0b36233463a249933b61a33fe1a89e705c5c38c34aba0851fe7fa50", - "size": 133943 + "path": "en/api/python/beta/vaults/credentials.md", + "sha256": "51e4700b4e6b0005c86659fece4205e9be3df1e903a9084fe39b546cfa294f64", + "size": 43398 }, { - "url": "https://platform.claude.com/docs/en/api/go/messages/batches/retrieve", + "url": "https://platform.claude.com/docs/en/api/python/beta/vaults/credentials/create", "status": "success", - "path": "en/api/go/messages/batches/retrieve.md", - "sha256": "bdc366efbc71476c7dc058e4d19442d5db0216f412475fee3101f3ed5884a943", - "size": 3946 + "path": "en/api/python/beta/vaults/credentials/create.md", + "sha256": "92899a0a4ccfcf0358d89d344272b5bc685fd1afa0e3bee71273c6d357bafbf4", + "size": 6881 }, { - "url": "https://platform.claude.com/docs/en/api/go/messages/batches/list", + "url": "https://platform.claude.com/docs/en/api/python/beta/vaults/credentials/list", "status": "success", - "path": "en/api/go/messages/batches/list.md", - "sha256": "13803b84761d4e03026bfa836b268d1f58ebf2708efa4815f72c762dd11cb110", - "size": 4271 + "path": "en/api/python/beta/vaults/credentials/list.md", + "sha256": "b9bc1e22ca4154f951f9725b77cd5a371dce2b64b0151c400a510b73ab5ba84c", + "size": 4558 }, { - "url": "https://platform.claude.com/docs/en/api/go/messages/batches/cancel", + "url": "https://platform.claude.com/docs/en/api/python/beta/vaults/credentials/retrieve", "status": "success", - "path": "en/api/go/messages/batches/cancel.md", - "sha256": "6a096b0fc9b9b960628e7930aa2196cb7b7145e55a77b008a554f0c28afc1358", - "size": 4268 + "path": "en/api/python/beta/vaults/credentials/retrieve.md", + "sha256": "cf76c0a46d6b34c3011d0ec92dd50dc041de3eaddac0a9628942221dae34e2c7", + "size": 4382 }, { - "url": "https://platform.claude.com/docs/en/api/go/messages/batches/delete", + "url": "https://platform.claude.com/docs/en/api/python/beta/vaults/credentials/update", "status": "success", - "path": "en/api/go/messages/batches/delete.md", - "sha256": "646f74b47911415e5bf68f98faf63b3195123369f63ff9ea9d47029de680a535", - "size": 1298 + "path": "en/api/python/beta/vaults/credentials/update.md", + "sha256": "95a0773052516a37c297b2ad6a2be698cb33cb009bc2f74bb1080545146f1d49", + "size": 6468 }, { - "url": "https://platform.claude.com/docs/en/api/go/messages/batches/results", + "url": "https://platform.claude.com/docs/en/api/python/beta/vaults/credentials/delete", "status": "success", - "path": "en/api/go/messages/batches/results.md", - "sha256": "b5bac6e09cb6a028f9b7589d991bfee2b8c1f1e305c06f0972d05797bfd1f4fb", - "size": 35809 + "path": "en/api/python/beta/vaults/credentials/delete.md", + "sha256": "e7b6843a6a73ea93a6b1090e829507a1865ffcf4820fa5337c5a3ab1af079ea4", + "size": 1943 }, { - "url": "https://platform.claude.com/docs/en/api/go/models", + "url": "https://platform.claude.com/docs/en/api/python/beta/vaults/credentials/archive", "status": "success", - "path": "en/api/go/models.md", - "sha256": "8429d69a3e857638d74963033564d3104fa3ec06f3754301c7bb323c7e11ad1e", - "size": 25418 + "path": "en/api/python/beta/vaults/credentials/archive.md", + "sha256": "a450afb4df0ac62bd348b27903247ad551c8575e59bd8930a2505801c962df3a", + "size": 4391 }, { - "url": "https://platform.claude.com/docs/en/api/go/models/list", + "url": "https://platform.claude.com/docs/en/api/python/beta/files", "status": "success", - "path": "en/api/go/models/list.md", - "sha256": "0571cba13a2b7b09a3333076375a0e9a94f4f6f97621a9f7753ae6ddc8fe6fb8", - "size": 7693 + "path": "en/api/python/beta/files.md", + "sha256": "06b007afd4bbd87f3cfb676060ed9bd109782e5f0557183c7f9eaaf1ca150053", + "size": 12280 }, { - "url": "https://platform.claude.com/docs/en/api/go/models/retrieve", + "url": "https://platform.claude.com/docs/en/api/python/beta/files/upload", "status": "success", - "path": "en/api/go/models/retrieve.md", - "sha256": "4fae89ea093a5ac46adb98381f662d0010731ea837272548b219296d57795a5b", - "size": 7268 + "path": "en/api/python/beta/files/upload.md", + "sha256": "0a7dcc432eaccdc52e211870e47660902d250b2e5f62251ddc4d9f3357ee9798", + "size": 2355 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta", + "url": "https://platform.claude.com/docs/en/api/python/beta/files/list", "status": "success", - "path": "en/api/go/beta.md", - "sha256": "295bc3032061a29ede1a9a790c82fbce4c0448500d1efe5002b5a238da629dac", - "size": 1446713 + "path": "en/api/python/beta/files/list.md", + "sha256": "015dffcad9b518709f34b568b3c4e19bc24b388f82792c11fbd8d02f29110cee", + "size": 2847 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/models", + "url": "https://platform.claude.com/docs/en/api/python/beta/files/download", "status": "success", - "path": "en/api/go/beta/models.md", - "sha256": "a31b5605ca82acc356637db766f8e57504f780ceb94317b6bb2d701234067429", - "size": 25905 + "path": "en/api/python/beta/files/download.md", + "sha256": "eb70712de91a9fd0946b28264518e16f5b7a23ed8323fd9dc3fb88871b077986", + "size": 1555 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/models/list", + "url": "https://platform.claude.com/docs/en/api/python/beta/files/retrieve_metadata", "status": "success", - "path": "en/api/go/beta/models/list.md", - "sha256": "c35ceecb048ec8cc89a97329245d2e0b62725266aaa31093d21d2e5bb92e216d", - "size": 7799 + "path": "en/api/python/beta/files/retrieve_metadata.md", + "sha256": "74473c8f6b7c653d06e780afbae803b900b0ffa2e40a02f689d09b271e9e023b", + "size": 2416 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/models/retrieve", + "url": "https://platform.claude.com/docs/en/api/python/beta/files/delete", "status": "success", - "path": "en/api/go/beta/models/retrieve.md", - "sha256": "38de992f281de9b94b74e3c695e25e8697d1bfa40a0dbdfd557d11d0195673c0", - "size": 7382 + "path": "en/api/python/beta/files/delete.md", + "sha256": "181b842c6950d0da30157a0a2cacfe00364c7eba4b1e13976ed7e767bfa99f8b", + "size": 1699 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/messages", + "url": "https://platform.claude.com/docs/en/api/python/beta/skills", "status": "success", - "path": "en/api/go/beta/messages.md", - "sha256": "ab2aa648632ebcb7024104766475165a2dc329d332876f73c0dbf9500f17419b", - "size": 1343750 + "path": "en/api/python/beta/skills.md", + "sha256": "b9e09948929aeea5b010ebf520b013e1cf119928e439ce79dd532dcdd760d01c", + "size": 26524 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/messages/create", + "url": "https://platform.claude.com/docs/en/api/python/beta/skills/create", "status": "success", - "path": "en/api/go/beta/messages/create.md", - "sha256": "17e11f7a7332ccc7b0b65868c169bea1a522a1901a35aced7a6d7eeb732f9f6d", - "size": 180326 + "path": "en/api/python/beta/skills/create.md", + "sha256": "ed3c448e455b31e73ebad3e923e96e65e7ece5c8faefa901eaaebf41f860aaf3", + "size": 2644 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/messages/count_tokens", + "url": "https://platform.claude.com/docs/en/api/python/beta/skills/list", "status": "success", - "path": "en/api/go/beta/messages/count_tokens.md", - "sha256": "ce94bbc4f02380f7272ba21a278bcfb2ba911d4788e2f561974c2bb72263e3f2", - "size": 139177 + "path": "en/api/python/beta/skills/list.md", + "sha256": "0c5aeaa79178cd8f7b034af13f2345638133e0ad75155aa1deee6cb97bd31662", + "size": 2839 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/messages/batches", + "url": "https://platform.claude.com/docs/en/api/python/beta/skills/retrieve", "status": "success", - "path": "en/api/go/beta/messages/batches.md", - "sha256": "038b0cbf3157bf93aa192fde1d89a608705bf5588c02985e1f2f295022ab3104", - "size": 371465 + "path": "en/api/python/beta/skills/retrieve.md", + "sha256": "d65894207987446f653a77e01e0e277d5cd44c88b340cbc66ac7e11eac44ec2f", + "size": 2464 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/messages/batches/create", + "url": "https://platform.claude.com/docs/en/api/python/beta/skills/delete", "status": "success", - "path": "en/api/go/beta/messages/batches/create.md", - "sha256": "b76ff8f6927fb70fd0404eb026f52075ca5c3861b7700ca4fd7bd54a274e1b17", - "size": 166004 + "path": "en/api/python/beta/skills/delete.md", + "sha256": "ad7cc20bfa294647bd1bcc313de16b6813e39a85d349cf50546b07b13c4a8345", + "size": 1787 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/messages/batches/retrieve", + "url": "https://platform.claude.com/docs/en/api/python/beta/skills/versions", "status": "success", - "path": "en/api/go/beta/messages/batches/retrieve.md", - "sha256": "70a3f4f19f8373adbc15ff880511cf4f655ea7854f3b5b04b220f46685e7d790", - "size": 6403 + "path": "en/api/python/beta/skills/versions.md", + "sha256": "6b632e52122ca6ae7c1232224d0ac323d8e3b39f8ca70a9bf18548d3eb3ac2cf", + "size": 13682 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/messages/batches/list", + "url": "https://platform.claude.com/docs/en/api/python/beta/skills/versions/create", "status": "success", - "path": "en/api/go/beta/messages/batches/list.md", - "sha256": "685b56ad69475cbd5c0df3730cee15bc6f19a2be8a9b835934846e32eae147f1", - "size": 6677 + "path": "en/api/python/beta/skills/versions/create.md", + "sha256": "915e9e44acb3540346086146b210cbff5427876a0ce11f7116282433f9a1e3ee", + "size": 2754 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/messages/batches/cancel", + "url": "https://platform.claude.com/docs/en/api/python/beta/skills/versions/list", "status": "success", - "path": "en/api/go/beta/messages/batches/cancel.md", - "sha256": "c06f7f3a8b2467c5d0304322c4b0449a3af95886c68688a91fb56b085fe8d06c", - "size": 6729 + "path": "en/api/python/beta/skills/versions/list.md", + "sha256": "5b31be83fb2ba37c383f86454eab6cf7aa3cc0678df131d2ccacd2860babe1f1", + "size": 2786 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/messages/batches/delete", + "url": "https://platform.claude.com/docs/en/api/python/beta/skills/versions/retrieve", "status": "success", - "path": "en/api/go/beta/messages/batches/delete.md", - "sha256": "d9876fd6c2f63fc91fc61f6731f56b84b425be29e5142f2d794071b35f5d9151", - "size": 3727 + "path": "en/api/python/beta/skills/versions/retrieve.md", + "sha256": "f1d38f4c0e08ac475c2080f6b9fd48e0a723cc6ce19268d51ce34ed4856593cc", + "size": 2740 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/messages/batches/results", + "url": "https://platform.claude.com/docs/en/api/python/beta/skills/versions/delete", "status": "success", - "path": "en/api/go/beta/messages/batches/results.md", - "sha256": "7af2d1e8802469198d061892b91f112997b15f9c235b08e60cf33d3c38b714a5", - "size": 48315 + "path": "en/api/python/beta/skills/versions/delete.md", + "sha256": "63c5d593e79efaf09ab40ac7ea17ec0136cb599942f7e671517d3de946ab3e4c", + "size": 2050 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/files", + "url": "https://platform.claude.com/docs/en/api/java/completions", "status": "success", - "path": "en/api/go/beta/files.md", - "sha256": "77034cf1b8975999fcc63ba8c80dc48f64404f77cba17e2d78b1a2cbef48895a", - "size": 18493 + "path": "en/api/java/completions.md", + "sha256": "db609b543e0d3cc145a523888d4a27888986739b8a93a2de39cf4a390f11e3bf", + "size": 10669 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/files/upload", + "url": "https://platform.claude.com/docs/en/api/java/completions/create", "status": "success", - "path": "en/api/go/beta/files/upload.md", - "sha256": "85b1f5eff0d948b4af355c743d779862c129095bf31b72dddb104dfa383ba92f", - "size": 3659 + "path": "en/api/java/completions/create.md", + "sha256": "5260e7c8d5115c3c29d4a16d49723079a7a72e37d27b260803466b6aa38028e5", + "size": 7983 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/files/list", + "url": "https://platform.claude.com/docs/en/api/java/messages", "status": "success", - "path": "en/api/go/beta/files/list.md", - "sha256": "7bdca38f109e5f5dfe67565b45cdea5347699282b3f0eadca6dab99dd5f08f75", - "size": 3984 + "path": "en/api/java/messages.md", + "sha256": "d7dae04be912753534fbc17ae675927ef565c63920b12ee08b2d8029014cc3ea", + "size": 920322 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/files/download", + "url": "https://platform.claude.com/docs/en/api/java/messages/create", "status": "success", - "path": "en/api/go/beta/files/download.md", - "sha256": "9c042b40a520c63240db41f6efbb35b396075ed75e7a013a1d1b25e86b22e33b", - "size": 3052 + "path": "en/api/java/messages/create.md", + "sha256": "d1d9baf83396373c03e16d546425198b69e49e984c5513ecdc8a748401390878", + "size": 122653 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/files/retrieve_metadata", + "url": "https://platform.claude.com/docs/en/api/java/messages/count_tokens", "status": "success", - "path": "en/api/go/beta/files/retrieve_metadata.md", - "sha256": "be297dfa313b64c74bd1c1669c08222cc22aa5169634b9552bedfcf5d01051e8", - "size": 3619 + "path": "en/api/java/messages/count_tokens.md", + "sha256": "68be31a803aeae8d38432220628051f2e65a94c8d0acc9dbf1ccfce04b9053cd", + "size": 96644 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/files/delete", + "url": "https://platform.claude.com/docs/en/api/java/messages/batches", "status": "success", - "path": "en/api/go/beta/files/delete.md", - "sha256": "9371ef05d6e7ed1471e9be3a6acb9d132f0f2232a42825916751432b80821a46", - "size": 3261 + "path": "en/api/java/messages/batches.md", + "sha256": "2f4dd1b1dc5e08ff28f21e59a0894581f772fbf1284a84feb07e258af78419d4", + "size": 249013 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/skills", + "url": "https://platform.claude.com/docs/en/api/java/messages/batches/create", "status": "success", - "path": "en/api/go/beta/skills.md", - "sha256": "caff12e86fc2bf24527eade364b0613a2f9e95d4f83b6d8cffa921bd355e3540", - "size": 32693 + "path": "en/api/java/messages/batches/create.md", + "sha256": "b2d63285ef581fab59d0e77f0b7c8ed8e6b86c9dd8effbc79dd202b334124f9f", + "size": 116668 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/skills/create", + "url": "https://platform.claude.com/docs/en/api/java/messages/batches/retrieve", "status": "success", - "path": "en/api/go/beta/skills/create.md", - "sha256": "b6b6318cea1688140935c3a9c865dddad70395d537ec4a69ae7bcc3f49770723", - "size": 4201 + "path": "en/api/java/messages/batches/retrieve.md", + "sha256": "31ef3a6186ee81e8555c194abe39c78c319e393924dbe81bfe547c07af936232", + "size": 4046 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/skills/list", + "url": "https://platform.claude.com/docs/en/api/java/messages/batches/list", "status": "success", - "path": "en/api/go/beta/skills/list.md", - "sha256": "22626cc502ad898e57ff340d4604baa72ee4ea404ffa7ee56df4c309e5fd80e0", - "size": 4429 + "path": "en/api/java/messages/batches/list.md", + "sha256": "4c72371fbbc0ea3a4862f11ad8557966466adb6dd7385e02e0f6740e0bae0e0e", + "size": 4266 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/skills/retrieve", + "url": "https://platform.claude.com/docs/en/api/java/messages/batches/cancel", "status": "success", - "path": "en/api/go/beta/skills/retrieve.md", - "sha256": "dd6337154a4c789d2350cdeb04234759cbfb1a79950856a9ebacc769810717ba", - "size": 3966 + "path": "en/api/java/messages/batches/cancel.md", + "sha256": "1839e1ce519275e06452a811f7eb16628dba51fee26deb770677aa8894b7a5b3", + "size": 4350 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/skills/delete", + "url": "https://platform.claude.com/docs/en/api/java/messages/batches/delete", "status": "success", - "path": "en/api/go/beta/skills/delete.md", - "sha256": "36c14b5c2a4ae46381766a65e5671d061cc5e517066deaea750a1294a4f6bdf9", - "size": 3329 + "path": "en/api/java/messages/batches/delete.md", + "sha256": "e0b8f507d75c528ba15e08056989139d14e0f70172ce518ec9105b5a2cfbb48d", + "size": 1498 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/skills/versions", + "url": "https://platform.claude.com/docs/en/api/java/messages/batches/results", "status": "success", - "path": "en/api/go/beta/skills/versions.md", - "sha256": "9ca984a37b70d27f15d8a6dfb5b70d65968d2ef511f736c0f25b44016e779830", - "size": 16754 + "path": "en/api/java/messages/batches/results.md", + "sha256": "c19a37d789c91d5188a586635b6b32793a553f7dae8a3495d5f8e3d979f38ac2", + "size": 30615 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/skills/versions/create", + "url": "https://platform.claude.com/docs/en/api/java/models", "status": "success", - "path": "en/api/go/beta/skills/versions/create.md", - "sha256": "99013949cc614f798dd56d6436d3e8733b662d1cdce2ec5de2edb30b6bc806b1", - "size": 4337 + "path": "en/api/java/models.md", + "sha256": "2836a564d4084b7758854d159e95db66946c1dc097992845229a793a614e37d6", + "size": 24358 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/skills/versions/list", + "url": "https://platform.claude.com/docs/en/api/java/models/list", "status": "success", - "path": "en/api/go/beta/skills/versions/list.md", - "sha256": "86d26523fca63ec7b97d267675b815af883e9924e930f2e0d0f10a0e681d2cdf", - "size": 4394 + "path": "en/api/java/models/list.md", + "sha256": "0502660a1dfae1c5017dd80764120a50834e69dc828a574c6eadfa64c51fc7ab", + "size": 7025 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/skills/versions/retrieve", + "url": "https://platform.claude.com/docs/en/api/java/models/retrieve", "status": "success", - "path": "en/api/go/beta/skills/versions/retrieve.md", - "sha256": "6ccb63e1f62709d752e930e6cb8630a09631abd6830d27020469945adc8efde8", - "size": 4340 + "path": "en/api/java/models/retrieve.md", + "sha256": "7637a1ef9032e6eec20597c33c38f3c737ab8c121e42f03862b82a51e162b038", + "size": 6663 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/skills/versions/delete", + "url": "https://platform.claude.com/docs/en/api/java/beta", "status": "success", - "path": "en/api/go/beta/skills/versions/delete.md", - "sha256": "7ff09f8a7f41c4acac851cbbe146b06f7958cf5bd5dcbce918568418c2c8d479", - "size": 3668 + "path": "en/api/java/beta.md", + "sha256": "594f6343729ab6ceafe820f6ffab41aa6a5bc4101c2d512abb59315f9aaa655b", + "size": 91183 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/user_profiles", + "url": "https://platform.claude.com/docs/en/api/java/beta/models", "status": "success", - "path": "en/api/go/beta/user_profiles.md", - "sha256": "2c31f6bf798c5912c988e15b753b36c9a152fbaa54a9132067c6149817c11c1a", - "size": 18344 + "path": "en/api/java/beta/models.md", + "sha256": "b7a5fe31adea3be109a31decfcfcf5ba6bacb78a1da5c0d0df0227e708b96f9d", + "size": 24857 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/user_profiles/create", + "url": "https://platform.claude.com/docs/en/api/java/beta/models/list", "status": "success", - "path": "en/api/go/beta/user_profiles/create.md", - "sha256": "3ce254c211aaaa022f4d1df1fd4be14decd6f2304f9cccca21dc3863122de92e", - "size": 3592 + "path": "en/api/java/beta/models/list.md", + "sha256": "f8008adf0b6556ad1ecb6a01a04cceadc272d4a8d91b9543782440a569cd2e85", + "size": 7133 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/user_profiles/list", + "url": "https://platform.claude.com/docs/en/api/java/beta/models/retrieve", "status": "success", - "path": "en/api/go/beta/user_profiles/list.md", - "sha256": "c0923abe56005e88dbce50d291b4e04c6a4aed6f71eada040001fb12629f14c8", - "size": 3720 + "path": "en/api/java/beta/models/retrieve.md", + "sha256": "cc402170d87188ff50a9f88129c586556d9b384055915c7792451d0bf1ddf170", + "size": 6787 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/user_profiles/retrieve", + "url": "https://platform.claude.com/docs/en/api/java/beta/messages", "status": "success", - "path": "en/api/go/beta/user_profiles/retrieve.md", - "sha256": "251e45eb64cd687037e607d2ea38f612fcb228235e275123461b68f644ea1e75", - "size": 3332 + "path": "en/api/java/beta/messages.md", + "sha256": "c22761d33110f920fc5a86dce46220d703315e4c098ce4d06de8394ab101c41f", + "size": 1120410 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/user_profiles/update", + "url": "https://platform.claude.com/docs/en/api/java/beta/messages/create", "status": "success", - "path": "en/api/go/beta/user_profiles/update.md", - "sha256": "e13f9645942c208f8dc599c5a76f028a5db7f261d3194b3cffe89d75697a5150", - "size": 3743 + "path": "en/api/java/beta/messages/create.md", + "sha256": "1d8fbe5dcf07b45c9be5c71cfe5a2e144532cb290b05b391fc3ec6f1c8fd45e8", + "size": 151042 }, { - "url": "https://platform.claude.com/docs/en/api/go/beta/user_profiles/create_enrollment_url", + "url": "https://platform.claude.com/docs/en/api/java/beta/messages/count_tokens", "status": "success", - "path": "en/api/go/beta/user_profiles/create_enrollment_url.md", - "sha256": "6f92983fa847fbf6e2788383f886afa91a483764eff941e823ec38bcb7821f57", - "size": 3276 + "path": "en/api/java/beta/messages/count_tokens.md", + "sha256": "18ab59769c3aa065f8fba7d5563e3f1a47a40fc5e16f4b26661f84287cbfd70d", + "size": 116753 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/completions", + "url": "https://platform.claude.com/docs/en/api/java/beta/messages/batches", "status": "success", - "path": "en/api/ruby/completions.md", - "sha256": "55ab13d9e199c646e1ad2eb5f862ac9405e8c6b99e2cba79bd53dacc0375d189", - "size": 11246 + "path": "en/api/java/beta/messages/batches.md", + "sha256": "b42d5978f08ecdedbbab3d1d1b956a9d5d12750a43598c9aa4e93a7cd40b4702", + "size": 316565 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/completions/create", + "url": "https://platform.claude.com/docs/en/api/java/beta/messages/batches/create", "status": "success", - "path": "en/api/ruby/completions/create.md", - "sha256": "0d76f1a8265f52f42d6e64c26c73073181c92fa476102fc1e8a4875dc67d18f7", - "size": 8723 + "path": "en/api/java/beta/messages/batches/create.md", + "sha256": "92309f57a0fa6fdc4bc7ce1def076047e77ea8bc18d601b0170b2b50387047c8", + "size": 142071 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/messages", + "url": "https://platform.claude.com/docs/en/api/java/beta/messages/batches/retrieve", "status": "success", - "path": "en/api/ruby/messages.md", - "sha256": "37e938263d1434bc91a13b99a593bc0119faa8c613dd40063183b5b3b49a97b7", - "size": 818551 + "path": "en/api/java/beta/messages/batches/retrieve.md", + "sha256": "cf574904c2c1e42e1867a969fb2322e89b3a11633dc0c5c5cdaf7def932eeecb", + "size": 5530 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/messages/create", + "url": "https://platform.claude.com/docs/en/api/java/beta/messages/batches/list", "status": "success", - "path": "en/api/ruby/messages/create.md", - "sha256": "50353a7a6f3a7ae5fc2e428ca476de9471b761d31ba0e4dc377fe49f32ca0353", - "size": 111712 + "path": "en/api/java/beta/messages/batches/list.md", + "sha256": "6ae8f6a6c0454b151b030ec6eb2338c77e31df767029394c05f853b62b493fde", + "size": 5734 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/messages/count_tokens", + "url": "https://platform.claude.com/docs/en/api/java/beta/messages/batches/cancel", "status": "success", - "path": "en/api/ruby/messages/count_tokens.md", - "sha256": "454842e7ead1f964d612d3881b4a12119966ce2171cdeac02b128c7bb9ace1e5", - "size": 88135 + "path": "en/api/java/beta/messages/batches/cancel.md", + "sha256": "7ad326d61657c42b76452acaca4c3a5ca5fc43fbe40e1f9e2835ccee9e970f49", + "size": 5834 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/messages/batches", + "url": "https://platform.claude.com/docs/en/api/java/beta/messages/batches/delete", "status": "success", - "path": "en/api/ruby/messages/batches.md", - "sha256": "2b77b0d9d97712781028e775a70da1ab3ec44a2c395f956fabedce250f454036", - "size": 218761 + "path": "en/api/java/beta/messages/batches/delete.md", + "sha256": "d1058a5e4b093dba440abad7fcff8b5da210e58cd5b73f850ab180e93e5c2f43", + "size": 2978 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/messages/batches/create", + "url": "https://platform.claude.com/docs/en/api/java/beta/messages/batches/results", "status": "success", - "path": "en/api/ruby/messages/batches/create.md", - "sha256": "52a683406a3a58d90729c58129188755f6d73e85af6ad9af7188229826135f94", - "size": 102465 + "path": "en/api/java/beta/messages/batches/results.md", + "sha256": "8595d2a672d287eafcfbb941b9bbe446ac2e3a16229217da5097a5d8aca4bdb5", + "size": 41002 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/messages/batches/retrieve", + "url": "https://platform.claude.com/docs/en/api/java/beta/agents", "status": "success", - "path": "en/api/ruby/messages/batches/retrieve.md", - "sha256": "2792a2109abb099151501bf269e767895dc3e80e1d8a8362cb73367ee34b6948", - "size": 3469 + "path": "en/api/java/beta/agents.md", + "sha256": "c9331e53be0c1437e9305978a0502cdf727eecd44703dcd6f25eefff2b1b799a", + "size": 91208 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/messages/batches/list", + "url": "https://platform.claude.com/docs/en/api/java/beta/agents/create", "status": "success", - "path": "en/api/ruby/messages/batches/list.md", - "sha256": "a51fbb8269d344d6ddcf0f92c4b2a5849e94a4fde37714cf83fc7a5254262e61", - "size": 3663 + "path": "en/api/java/beta/agents/create.md", + "sha256": "81810581b56442173497caa7408efbf2567fd7e53c3b5ca17f60a47e1c3eb617", + "size": 91233 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/messages/batches/cancel", + "url": "https://platform.claude.com/docs/en/api/java/beta/agents/list", "status": "success", - "path": "en/api/ruby/messages/batches/cancel.md", - "sha256": "c95b6e6aab5e4af187c2e0060fdcfecc71acd179499bf1b56c8e0c3b78db9b1f", - "size": 3781 + "path": "en/api/java/beta/agents/list.md", + "sha256": "78e36e93990914c9f004cbcf798d0bf0d4e37fa37853f5cc64e3b099f4844d4f", + "size": 9034 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/messages/batches/delete", + "url": "https://platform.claude.com/docs/en/api/java/beta/agents/retrieve", "status": "success", - "path": "en/api/ruby/messages/batches/delete.md", - "sha256": "58810ae26925e085742e6cc18a21a0c5b45ad8de4cea42d7828dfb3ff0a97e7f", - "size": 980 + "path": "en/api/java/beta/agents/retrieve.md", + "sha256": "e5314b3baab24be78adf61cb40bc3fad4efbe9450da27ad385c75006c886c536", + "size": 8814 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/messages/batches/results", + "url": "https://platform.claude.com/docs/en/api/java/beta/agents/update", "status": "success", - "path": "en/api/ruby/messages/batches/results.md", - "sha256": "4a9e660e591ce459cf1e867a094de078ceb981dbeb3ee1e99de1e5bfd398a631", - "size": 26763 + "path": "en/api/java/beta/agents/update.md", + "sha256": "f2b734b84e56b96c784fb77fcb907cd5a8c66d30b2a7921e7ca4dd5c1d998b0d", + "size": 91233 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/models", + "url": "https://platform.claude.com/docs/en/api/java/beta/agents/archive", "status": "success", - "path": "en/api/ruby/models.md", - "sha256": "60fc859dace3b5661822dcee745c7c2c2a82225250e397f3e6fb93c0f889a5da", - "size": 22303 + "path": "en/api/java/beta/agents/archive.md", + "sha256": "82bea28a510f2d2022290edd87235e3cef53893e5fdc014bb89d2e7a80edd099", + "size": 8703 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/models/list", + "url": "https://platform.claude.com/docs/en/api/java/beta/agents/versions", "status": "success", - "path": "en/api/ruby/models/list.md", - "sha256": "4ced60416d908e8ef2286c95dad130abe68d352bbb78112b160c3c3b3762db4d", - "size": 6066 + "path": "en/api/java/beta/agents/versions.md", + "sha256": "bddf02aa5841123289962f0ff9cc62cff2f418cc0604b33fac1d206f56a41bc0", + "size": 8853 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/models/retrieve", + "url": "https://platform.claude.com/docs/en/api/java/beta/agents/versions/list", "status": "success", - "path": "en/api/ruby/models/retrieve.md", - "sha256": "11a3bcdf16cd009b2b45fc5f2d586a3c424dcb169e2c3c0edad117c485b4c1b0", - "size": 5737 + "path": "en/api/java/beta/agents/versions/list.md", + "sha256": "2c49c5ba0cd64eef181c0507d7b14a3d33f88da6a4934b65be0e11d1ea8e5424", + "size": 8841 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta", + "url": "https://platform.claude.com/docs/en/api/java/beta/environments", "status": "success", - "path": "en/api/ruby/beta.md", - "sha256": "03af74df8881e2324e0def7af4ae51136e5819e33de75dd15f9a31c64caa2196", - "size": 1087233 + "path": "en/api/java/beta/environments.md", + "sha256": "31776d7c27665655abec6f5fc69c5b6a6bd4ad43dfdc97fc950751fa11bd2ec3", + "size": 37232 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/models", + "url": "https://platform.claude.com/docs/en/api/java/beta/environments/create", "status": "success", - "path": "en/api/ruby/beta/models.md", - "sha256": "14b821d04dc2699cccf9a840a03eda6e190970eec39e02cf317bf5921cb73d65", - "size": 22776 + "path": "en/api/java/beta/environments/create.md", + "sha256": "c61e5db9e56333dd6095cbc04072c4bd1f01d652786f3d987b979825ba2a29bd", + "size": 5224 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/models/list", + "url": "https://platform.claude.com/docs/en/api/java/beta/environments/list", "status": "success", - "path": "en/api/ruby/beta/models/list.md", - "sha256": "5dfe1f301ab8a05cc0e732961788e5738e8273775aa59f1e9c52a14c9fc9553f", - "size": 6164 + "path": "en/api/java/beta/environments/list.md", + "sha256": "e70c8f622236c4035dec55775fe856d4342c50e14b146778587a7709c1d3bfab", + "size": 4973 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/models/retrieve", + "url": "https://platform.claude.com/docs/en/api/java/beta/environments/retrieve", "status": "success", - "path": "en/api/ruby/beta/models/retrieve.md", - "sha256": "071a384cb6b33691536c5b374bbe5b1c520e634929fb3e022a67c3a7cde719d9", - "size": 5845 + "path": "en/api/java/beta/environments/retrieve.md", + "sha256": "c0e0b4d980ed486c843948a7b85a12a6afd29228701f6f07fd49a9a007b3c7d5", + "size": 4773 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/messages", + "url": "https://platform.claude.com/docs/en/api/java/beta/environments/update", "status": "success", - "path": "en/api/ruby/beta/messages.md", - "sha256": "bceabf88487bbd9b50f4ca03464c82e35f90c02582e11993dd15d3b925a3ee5f", - "size": 1013377 + "path": "en/api/java/beta/environments/update.md", + "sha256": "f149ab4369a006ecab07824a78cdb35d70cf7258d685ae231e77f4fee2fe0b19", + "size": 5244 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/messages/create", + "url": "https://platform.claude.com/docs/en/api/java/beta/environments/delete", "status": "success", - "path": "en/api/ruby/beta/messages/create.md", - "sha256": "74cf23d6a9d566fb2513276b4a8c9dda33b47fe77f1fe0f077a95e53e1b165d3", - "size": 140477 + "path": "en/api/java/beta/environments/delete.md", + "sha256": "fa85b537e4e5ddcd3c54a8845fadd1d92fd80e2de654cc39b506a466a4e8f2c6", + "size": 2726 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/messages/count_tokens", + "url": "https://platform.claude.com/docs/en/api/java/beta/environments/archive", "status": "success", - "path": "en/api/ruby/beta/messages/count_tokens.md", - "sha256": "4abe48483ebee5f75c8935f171c51a82f95567765a92461db5f9de576ff5cdae", - "size": 108731 + "path": "en/api/java/beta/environments/archive.md", + "sha256": "9081ef1b889111c717d9d3243a22edd61e6f4944d60e0f64a8ae84566fc290c5", + "size": 4827 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/messages/batches", + "url": "https://platform.claude.com/docs/en/api/java/beta/sessions", "status": "success", - "path": "en/api/ruby/beta/messages/batches.md", - "sha256": "3d4f218a3a52ef503a206ccb6ad612f3e85be40aa8c72b8208df4f3cd4f2cd1d", - "size": 281076 + "path": "en/api/java/beta/sessions.md", + "sha256": "220b056df26125e6d50156d777d3ef5a33637c75603b279368fbbdd690c86b40", + "size": 329756 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/messages/batches/create", + "url": "https://platform.claude.com/docs/en/api/java/beta/sessions/create", "status": "success", - "path": "en/api/ruby/beta/messages/batches/create.md", - "sha256": "a0869ab7b1cd6dc36eada50fb1b50afd8e7199d3c02c67e2af3eb55922c0b977", - "size": 125223 + "path": "en/api/java/beta/sessions/create.md", + "sha256": "9036cba14a601f426dc9998bba72269f75c936d588755787f44969946dc1beca", + "size": 14205 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/messages/batches/retrieve", + "url": "https://platform.claude.com/docs/en/api/java/beta/sessions/list", "status": "success", - "path": "en/api/ruby/beta/messages/batches/retrieve.md", - "sha256": "566367f8552cea57741d1e9b847f72b2c1bea0fe588074e56f72b968236eee6c", - "size": 4557 + "path": "en/api/java/beta/sessions/list.md", + "sha256": "1de7038da368311fa47885bc856342324184845ca98bd02ee94f95010731448c", + "size": 12585 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/messages/batches/list", + "url": "https://platform.claude.com/docs/en/api/java/beta/sessions/retrieve", "status": "success", - "path": "en/api/ruby/beta/messages/batches/list.md", - "sha256": "5962d80833f8293b894b1af73c9f6e17cd82fb5135fd58f3be22d10a7a4835e1", - "size": 4731 + "path": "en/api/java/beta/sessions/retrieve.md", + "sha256": "da1b5ebc7e63747fef4271b4ea47c74fba94aa69758b2719c7e71c2e7d5ad230", + "size": 11683 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/messages/batches/cancel", + "url": "https://platform.claude.com/docs/en/api/java/beta/sessions/update", "status": "success", - "path": "en/api/ruby/beta/messages/batches/cancel.md", - "sha256": "683cc517dec83b8c16243ce65696c6bb61168fe577a3737658b593cabacc8993", - "size": 4869 + "path": "en/api/java/beta/sessions/update.md", + "sha256": "e14d51cf899a7d624306d94a28bf95b056b950b5db833c2f01aa39d0e9696cd8", + "size": 12059 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/messages/batches/delete", + "url": "https://platform.claude.com/docs/en/api/java/beta/sessions/delete", "status": "success", - "path": "en/api/ruby/beta/messages/batches/delete.md", - "sha256": "7dd803dad1195a75e9f23e40925ef5630813dd7aa0db98ad87e6b1de4aee8919", - "size": 2064 + "path": "en/api/java/beta/sessions/delete.md", + "sha256": "b881c6f7be65af9c6c407abdec11d78f03826bc30989c83d83cd581f6fb31828", + "size": 2561 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/messages/batches/results", + "url": "https://platform.claude.com/docs/en/api/java/beta/sessions/archive", "status": "success", - "path": "en/api/ruby/beta/messages/batches/results.md", - "sha256": "68f7fe20a12efb54b684ab327af5ab65fdf9c7f97b8cc9f8d07f84dd8fd9539d", - "size": 36598 + "path": "en/api/java/beta/sessions/archive.md", + "sha256": "118442309bd586c057f2168033ed24460d3cd729237ae9ddb8f63df24049c076", + "size": 11689 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/files", + "url": "https://platform.claude.com/docs/en/api/java/beta/sessions/events", "status": "success", - "path": "en/api/ruby/beta/files.md", - "sha256": "f28d82294b7e99f71a68cb54e8b609a4a22684039f370d52d9fc3f3dea5cca1a", - "size": 10193 + "path": "en/api/java/beta/sessions/events.md", + "sha256": "4c044e1d4cb2977007d77fb4e4cc2b2e4d49f49fbcce3e4e7292b647f7bf1ed4", + "size": 225769 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/files/upload", + "url": "https://platform.claude.com/docs/en/api/java/beta/sessions/events/list", "status": "success", - "path": "en/api/ruby/beta/files/upload.md", - "sha256": "c1f3e45e1485d2f976089416d85e3ae17273651bd1d0abeca6385f3ebcb368b4", - "size": 1987 + "path": "en/api/java/beta/sessions/events/list.md", + "sha256": "e91256530ec90bbfcf4b4045ed9e82a4ec297a6bf0eeda4849daf6d442c1866b", + "size": 34860 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/files/list", + "url": "https://platform.claude.com/docs/en/api/java/beta/sessions/events/send", "status": "success", - "path": "en/api/ruby/beta/files/list.md", - "sha256": "31c6f205d0a6e7302c692668d9276d40583eacbd5b73d1bb430fd9d7b8268e4c", - "size": 2302 + "path": "en/api/java/beta/sessions/events/send.md", + "sha256": "b85257a41afb66350f9d1f1c09c788c5eae19b18163ad848c5daea17e3ec5ce6", + "size": 20118 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/files/download", + "url": "https://platform.claude.com/docs/en/api/java/beta/sessions/events/stream", "status": "success", - "path": "en/api/ruby/beta/files/download.md", - "sha256": "b24ba891341b98acb90d1b241e4a3b0c37924551b6a8e1f8abc62f6ed8d27422", - "size": 1432 + "path": "en/api/java/beta/sessions/events/stream.md", + "sha256": "1fdab2a465d0af37363bdee8593790d406b4742a00b63787ad59165bd9097a8b", + "size": 34752 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/files/retrieve_metadata", + "url": "https://platform.claude.com/docs/en/api/java/beta/sessions/resources", "status": "success", - "path": "en/api/ruby/beta/files/retrieve_metadata.md", - "sha256": "bff45ef370f258a7bf1e0adea836d7e9f345cce68c74603f7c99ca6203af3bea", - "size": 2019 + "path": "en/api/java/beta/sessions/resources.md", + "sha256": "cdab8f6e8b91ed0cc5b6383f2cfa2f0dcc973735ece1a74ef41d263f524782b0", + "size": 19826 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/files/delete", + "url": "https://platform.claude.com/docs/en/api/java/beta/sessions/resources/add", "status": "success", - "path": "en/api/ruby/beta/files/delete.md", - "sha256": "ebee7e937fcf30e5f1a5a0eba4fdad3e1f96ca6e5af7a7352d7808680408deeb", - "size": 1619 + "path": "en/api/java/beta/sessions/resources/add.md", + "sha256": "21b5c2cb8f8ed986391f251aea7a76f57af9bd4b6c8133d00af57e997db55167", + "size": 3243 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/skills", + "url": "https://platform.claude.com/docs/en/api/java/beta/sessions/resources/list", "status": "success", - "path": "en/api/ruby/beta/skills.md", - "sha256": "204953f3172a3303e7d739724d53ad5d63430bb1c7448009c40ada6d25867ff2", - "size": 26048 + "path": "en/api/java/beta/sessions/resources/list.md", + "sha256": "8b260c616a9fcf3a6106e4f38a51a50fadcf6acf1600f90c22c555dd859536bc", + "size": 3670 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/skills/create", + "url": "https://platform.claude.com/docs/en/api/java/beta/sessions/resources/retrieve", "status": "success", - "path": "en/api/ruby/beta/skills/create.md", - "sha256": "37b10923510435674ddb5cc2279e0e62066fd72a61a1bdea5d544392815a33c1", - "size": 2572 + "path": "en/api/java/beta/sessions/resources/retrieve.md", + "sha256": "4e92cdabf956f6fe1aa5f1c4d624a75b0e1168d7a302f501996a89b69503a14c", + "size": 3724 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/skills/list", + "url": "https://platform.claude.com/docs/en/api/java/beta/sessions/resources/update", "status": "success", - "path": "en/api/ruby/beta/skills/list.md", - "sha256": "9fd3d3c58685134308468a6b508da42d6e3a663796ad507940f84bb89957dafe", - "size": 2748 + "path": "en/api/java/beta/sessions/resources/update.md", + "sha256": "ebd533b3ce265dc8bf791921ba0674eb19061f21bf1a569520b988a26fe20ac2", + "size": 3903 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/skills/retrieve", + "url": "https://platform.claude.com/docs/en/api/java/beta/sessions/resources/delete", "status": "success", - "path": "en/api/ruby/beta/skills/retrieve.md", - "sha256": "bc3c590734007f10202c10f349f92b6fa6fa3864f3a1c63005a048c62f8aa4e7", - "size": 2399 + "path": "en/api/java/beta/sessions/resources/delete.md", + "sha256": "c447bd2f3cf5273b6f3ee322e2e33b88b2400aada8672be4614556ef6c2b55d7", + "size": 2846 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/skills/delete", + "url": "https://platform.claude.com/docs/en/api/java/beta/vaults", "status": "success", - "path": "en/api/ruby/beta/skills/delete.md", - "sha256": "86cb76d854f1b05906285aa199bb28f96e60253b97ad103f734e0fb3dfdf1821", - "size": 1729 + "path": "en/api/java/beta/vaults.md", + "sha256": "0343c4c567a3e454e707cb2d8aa8e8f55cb1e1764a9298bda23437b769ca43ba", + "size": 67084 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/skills/versions", + "url": "https://platform.claude.com/docs/en/api/java/beta/vaults/create", "status": "success", - "path": "en/api/ruby/beta/skills/versions.md", - "sha256": "15dba608e8a8b57f89f444bdc573aee310d86ae7fece14e0b7fc10c7d7d7ad09", - "size": 13503 + "path": "en/api/java/beta/vaults/create.md", + "sha256": "158f700151c4c48f9ed936923292da30dd0949e7dbea9010dfb92c8dce024380", + "size": 3084 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/skills/versions/create", + "url": "https://platform.claude.com/docs/en/api/java/beta/vaults/list", "status": "success", - "path": "en/api/ruby/beta/skills/versions/create.md", - "sha256": "0c79efb2951d95feee19c4365cac8e24697519b4ae793fe4212cb4d58853beda", - "size": 2696 + "path": "en/api/java/beta/vaults/list.md", + "sha256": "9f5c70eb5957a14ce23f03ce650e23a8d0ba4ca4b252ceccf3735e5fa29a8a07", + "size": 3042 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/skills/versions/list", + "url": "https://platform.claude.com/docs/en/api/java/beta/vaults/retrieve", "status": "success", - "path": "en/api/ruby/beta/skills/versions/list.md", - "sha256": "b8c696d598618b3106b16c0c9c6cda506825acbf05616b8cf335f788cde19375", - "size": 2709 + "path": "en/api/java/beta/vaults/retrieve.md", + "sha256": "ef3a328027691caca00c93f2edfba9d67ef1e818073d79ba81dba8db8ed9b1f8", + "size": 2884 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/skills/versions/retrieve", + "url": "https://platform.claude.com/docs/en/api/java/beta/vaults/update", "status": "success", - "path": "en/api/ruby/beta/skills/versions/retrieve.md", - "sha256": "1a686446bdf27a7d115513754e7a744be1ae4dab818c2283e43e7c6411d576f0", - "size": 2697 + "path": "en/api/java/beta/vaults/update.md", + "sha256": "343e185b2a930bb5ead417e1919cac643440930ac04b73ab5f62c7ecc4d1b99d", + "size": 3121 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/skills/versions/delete", + "url": "https://platform.claude.com/docs/en/api/java/beta/vaults/delete", "status": "success", - "path": "en/api/ruby/beta/skills/versions/delete.md", - "sha256": "fba18b492aafa54d7adae0230038415e9d644dbb85513344bf5a47fecaa5bfff", - "size": 1991 + "path": "en/api/java/beta/vaults/delete.md", + "sha256": "8d04c71753c7b0eca8451930257da4bc754c0c3a0d127d1181837ec2eb8e4ad1", + "size": 2540 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/user_profiles", + "url": "https://platform.claude.com/docs/en/api/java/beta/vaults/archive", "status": "success", - "path": "en/api/ruby/beta/user_profiles.md", - "sha256": "79f471b20b18d96dc9c34a36fe0bc5e05f37b40c0fc279209881c1bd784f084d", - "size": 10010 + "path": "en/api/java/beta/vaults/archive.md", + "sha256": "a3c37b89d231f1c2830e66ca54e59327dbb64e2c23da26a541a48e13802995c2", + "size": 2890 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/user_profiles/create", + "url": "https://platform.claude.com/docs/en/api/java/beta/vaults/credentials", "status": "success", - "path": "en/api/ruby/beta/user_profiles/create.md", - "sha256": "943657d08d5e83c83f94db5a6d1a4e71a9b7e9f8bda2c5763ecc78c5cbe434e8", - "size": 1960 + "path": "en/api/java/beta/vaults/credentials.md", + "sha256": "f47d594f386cd674bffd97eef2d9e826f3f288d58602c77fecc3d01042e6fba8", + "size": 48662 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/user_profiles/list", + "url": "https://platform.claude.com/docs/en/api/java/beta/vaults/credentials/create", "status": "success", - "path": "en/api/ruby/beta/user_profiles/list.md", - "sha256": "ec80d444b1dac84d66f53871efc6e7b32b9d3036640b858dd31322045fcdc013", - "size": 1879 + "path": "en/api/java/beta/vaults/credentials/create.md", + "sha256": "aae064c7da87a16f27a6d2ca297314472988f0f2488132c1c787e12d91d46dde", + "size": 8061 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/user_profiles/retrieve", + "url": "https://platform.claude.com/docs/en/api/java/beta/vaults/credentials/list", "status": "success", - "path": "en/api/ruby/beta/user_profiles/retrieve.md", - "sha256": "2809fe1281946c8200c6bfb44cf67f6b5c748917e8e60c7d3d125f2c4ce40471", - "size": 1758 + "path": "en/api/java/beta/vaults/credentials/list.md", + "sha256": "8198addc59b505c40c9ae1c0a6496bd7a6fe7f2dfcde761c6bc890fd23232b17", + "size": 5325 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/user_profiles/update", + "url": "https://platform.claude.com/docs/en/api/java/beta/vaults/credentials/retrieve", "status": "success", - "path": "en/api/ruby/beta/user_profiles/update.md", - "sha256": "b0b4badf5a0b1f1f25be45a5a43704250ab903cc0a956aaa5761d0d6bd288868", - "size": 2081 + "path": "en/api/java/beta/vaults/credentials/retrieve.md", + "sha256": "6ee8f4412190c6b8761eb69419c7465d920ba5da0513f2582394f160e14c59ad", + "size": 5280 }, { - "url": "https://platform.claude.com/docs/en/api/ruby/beta/user_profiles/create_enrollment_url", + "url": "https://platform.claude.com/docs/en/api/java/beta/vaults/credentials/update", "status": "success", - "path": "en/api/ruby/beta/user_profiles/create_enrollment_url.md", - "sha256": "781a98856d1386d7a4af5435d4a9584c5b3ae4cf8a7813ec662a609f99a52bec", - "size": 1665 + "path": "en/api/java/beta/vaults/credentials/update.md", + "sha256": "7a75f68769dccf2c39fe323384b5520a4cc50faa0ca90cf2395b716f270f0bac", + "size": 7388 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/completions", + "url": "https://platform.claude.com/docs/en/api/java/beta/vaults/credentials/delete", "status": "success", - "path": "en/api/terraform/completions.md", - "sha256": "6678c94d32a5c4320cc37cd3357050f89c30c09ce707583070525aa71caa8470", - "size": 91179 + "path": "en/api/java/beta/vaults/credentials/delete.md", + "sha256": "96b9b0afcaef832763545914318b40081895e190ecb29cf568ef64d027ad9ba2", + "size": 2880 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/completions/create", + "url": "https://platform.claude.com/docs/en/api/java/beta/vaults/credentials/archive", "status": "success", - "path": "en/api/terraform/completions/create.md", - "sha256": "fcd219f162f4fab53f2e8f786c6bdaa9032bcb23ab9c394017a9807dceed8960", - "size": 91204 + "path": "en/api/java/beta/vaults/credentials/archive.md", + "sha256": "f5d96ef55b118fb53aac4182c9953fae938b114e5eccfd9168e8c2a1333532e1", + "size": 5285 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/messages", + "url": "https://platform.claude.com/docs/en/api/java/beta/files", "status": "success", - "path": "en/api/terraform/messages.md", - "sha256": "762239bf84e511ea341620e48c2e24202b7e1b2fc61aac1e7775e02687bf9c4f", - "size": 91170 + "path": "en/api/java/beta/files.md", + "sha256": "23002b6ed568b674c669ec60db8b5a26838932a99f213a6b3236b6007e1d9c70", + "size": 16478 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/messages/create", + "url": "https://platform.claude.com/docs/en/api/java/beta/files/upload", "status": "success", - "path": "en/api/terraform/messages/create.md", - "sha256": "7555cbf37b7db79760d68cdcc6c7364002c4e23369828df5bbc0fb1f71f243a5", - "size": 91195 + "path": "en/api/java/beta/files/upload.md", + "sha256": "61a590511c16064f5d60957a0eb13874efffb0b2e27cb7117687e2dc1d588bb9", + "size": 3337 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/messages/count_tokens", + "url": "https://platform.claude.com/docs/en/api/java/beta/files/list", "status": "success", - "path": "en/api/terraform/messages/count_tokens.md", - "sha256": "d1b98380dbff4cca5924ac3307223a25fc7bbde562e304235f767da100b26e56", - "size": 91213 + "path": "en/api/java/beta/files/list.md", + "sha256": "278ffa42eadeb9b940bb2a0f819601a2de1cd0271e92237fbccfc16698a5f5a0", + "size": 3680 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/messages/batches", + "url": "https://platform.claude.com/docs/en/api/java/beta/files/download", "status": "success", - "path": "en/api/terraform/messages/batches.md", - "sha256": "242ae268638d10fa4a63714f50306ac9bf3ea3252e729586436b70b72174bb27", - "size": 91198 + "path": "en/api/java/beta/files/download.md", + "sha256": "873efda662622539f6628aabdc997213d05ca3e2c9a18f7c62282b7a9c989038", + "size": 2259 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/messages/batches/create", + "url": "https://platform.claude.com/docs/en/api/java/beta/files/retrieve_metadata", "status": "success", - "path": "en/api/terraform/messages/batches/create.md", - "sha256": "6f88ae79018ffa3f136109dd075821588bf1991f2cc6b8d624e9d5c014b2cad9", - "size": 91223 + "path": "en/api/java/beta/files/retrieve_metadata.md", + "sha256": "22f07e237067f5d2a8aa9c5dac2bd81d57c1fdb35c55e15bb53c933809df38a2", + "size": 3270 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/messages/batches/retrieve", + "url": "https://platform.claude.com/docs/en/api/java/beta/files/delete", "status": "success", - "path": "en/api/terraform/messages/batches/retrieve.md", - "sha256": "cb49609109b00263dd709e47c3fce1b5d1c5f07a5080316be5cf93caf3bba5ac", - "size": 91229 + "path": "en/api/java/beta/files/delete.md", + "sha256": "62814002bd38bb7e1303b97aaa8df0b350676fc7f514d768bc9265b84501e3c6", + "size": 2477 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/messages/batches/list", + "url": "https://platform.claude.com/docs/en/api/java/beta/skills", "status": "success", - "path": "en/api/terraform/messages/batches/list.md", - "sha256": "6f3f48a6a9c62c47f362008d9325c0cc06fcfbe8bdfda9d444eab9486ebb29f9", - "size": 91217 + "path": "en/api/java/beta/skills.md", + "sha256": "dddd8e74a9c947461f2665d4b981c22cb3bc9054e357b00ba9734ae6a1a8171d", + "size": 26970 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/messages/batches/cancel", + "url": "https://platform.claude.com/docs/en/api/java/beta/skills/create", "status": "success", - "path": "en/api/terraform/messages/batches/cancel.md", - "sha256": "2b80a0940506974d7f64b9efd078308003f779a0992d8f2eeaed7a3a27a79b1e", - "size": 91223 + "path": "en/api/java/beta/skills/create.md", + "sha256": "d51bf0e72c9fa81e174363c81c6992c98d540e7d43304feec731c22d4b9a1d8d", + "size": 3482 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/messages/batches/delete", + "url": "https://platform.claude.com/docs/en/api/java/beta/skills/list", "status": "success", - "path": "en/api/terraform/messages/batches/delete.md", - "sha256": "b951c996f42ba5e27b960e7f4b8481f846ca4af51e8325dc4a8f6d7453c9c390", - "size": 91223 + "path": "en/api/java/beta/skills/list.md", + "sha256": "f049b386e2bc5b4e8ea7e3886fce8f599869eff7864fafe91ef56c86bfe56a82", + "size": 3641 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/messages/batches/results", + "url": "https://platform.claude.com/docs/en/api/java/beta/skills/retrieve", "status": "success", - "path": "en/api/terraform/messages/batches/results.md", - "sha256": "6307c31cc6b6ff6a019048725a4783de084bdb7699d208bd89c13e0e9caa94c4", - "size": 91226 + "path": "en/api/java/beta/skills/retrieve.md", + "sha256": "80bf2ed26b08ea407f228269217989007e78927cf33d45527905d32c83e7e3bd", + "size": 3295 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/models", + "url": "https://platform.claude.com/docs/en/api/java/beta/skills/delete", "status": "success", - "path": "en/api/terraform/models.md", - "sha256": "db425a8bc331e03c382a125997ce1c3942b655a75537fe36fa3a24be0f313461", - "size": 91164 + "path": "en/api/java/beta/skills/delete.md", + "sha256": "2c3845d492a212064f735594cbb4879d57e404749fe6ba3a71e5b58f7f1fc234", + "size": 2602 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/models/list", + "url": "https://platform.claude.com/docs/en/api/java/beta/skills/versions", "status": "success", - "path": "en/api/terraform/models/list.md", - "sha256": "a5e7d86db9597949b88e0b5b695ef61d76fc59911dc8098f2950e7101ad6f5db", - "size": 91183 + "path": "en/api/java/beta/skills/versions.md", + "sha256": "3c2a1a0eb11ffd3da61ad111518b7c45c80724a10c60387994cd1b09e91ab53a", + "size": 13936 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/models/retrieve", + "url": "https://platform.claude.com/docs/en/api/java/beta/skills/versions/create", "status": "success", - "path": "en/api/terraform/models/retrieve.md", - "sha256": "3fa53d6a2be359d09d17a4ea26007407cd3fd45d69881e2dab500e53696f1e5a", - "size": 91195 + "path": "en/api/java/beta/skills/versions/create.md", + "sha256": "a76ec77245bd8b4f2157358cc4bfbf3feacfd1f72bfd4e8716776126ae64087a", + "size": 3607 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta", + "url": "https://platform.claude.com/docs/en/api/java/beta/skills/versions/list", "status": "success", - "path": "en/api/terraform/beta.md", - "sha256": "a61864a161c1b335a3b7c64b87e3b000928b157492cdc7c9328b9d4e6114eca7", - "size": 91158 + "path": "en/api/java/beta/skills/versions/list.md", + "sha256": "77ef95f1dd8c7cd3d15bf62d8d498f7848f01de6e6e21d1c43b0480edcc6bdc4", + "size": 3598 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/models", + "url": "https://platform.claude.com/docs/en/api/java/beta/skills/versions/retrieve", "status": "success", - "path": "en/api/terraform/beta/models.md", - "sha256": "81a6d2a78345503a107a3e92dc27684cc83eb50b887c53b5fbc310285e9a62ba", - "size": 91183 + "path": "en/api/java/beta/skills/versions/retrieve.md", + "sha256": "5e01bd747e6a1dd67837e20b04406e54df40991d010437b57f4658ffad3b1374", + "size": 3714 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/models/list", + "url": "https://platform.claude.com/docs/en/api/java/beta/skills/versions/delete", "status": "success", - "path": "en/api/terraform/beta/models/list.md", - "sha256": "b9f61e33f9d1f1013438d7ae925533462f25ceb1807488c3c56b49ba6af087fd", - "size": 91202 + "path": "en/api/java/beta/skills/versions/delete.md", + "sha256": "5c33eeda7969b5fb84cb0ceadfd49c2a29fe58df3e8542960f65a333b8c489b6", + "size": 3002 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/models/retrieve", + "url": "https://platform.claude.com/docs/en/api/go/completions", "status": "success", - "path": "en/api/terraform/beta/models/retrieve.md", - "sha256": "17c2a0aa3b90061bd7c1cff42ac7fe98adeae958e481a916baec866369c45dac", - "size": 91214 + "path": "en/api/go/completions.md", + "sha256": "258eb4473ea8934052c5c5f8f2fbc843dcfa7f87c4bb2a490d25ff774d528d6b", + "size": 12367 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/messages", + "url": "https://platform.claude.com/docs/en/api/go/completions/create", "status": "success", - "path": "en/api/terraform/beta/messages.md", - "sha256": "2047f58f066161609e7b7bed8a60d424d578318b9e92506111252a511d63fa5e", - "size": 91189 + "path": "en/api/go/completions/create.md", + "sha256": "4872a24cd14cc5a670b11b8b5f412a34bf0676fa75e57145f327321ac9221ac5", + "size": 9152 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/messages/create", + "url": "https://platform.claude.com/docs/en/api/go/messages", "status": "success", - "path": "en/api/terraform/beta/messages/create.md", - "sha256": "744ff7b27eb9e4049b2823ce0df0cb17c79d80ba003ab9c2f2c4579f72f75e61", - "size": 91214 + "path": "en/api/go/messages.md", + "sha256": "9ba4681b22eae2cd038bce4d2088b0ba7b70cc5e8896846f3a191c6885246651", + "size": 1098389 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/messages/count_tokens", + "url": "https://platform.claude.com/docs/en/api/go/messages/create", "status": "success", - "path": "en/api/terraform/beta/messages/count_tokens.md", - "sha256": "9e911be1803655b6ccd5f18a43b33c7c93acc13545bd2572fa291d259be6fc25", - "size": 91232 + "path": "en/api/go/messages/create.md", + "sha256": "432bdd02e18bbfdde2140fa3c7b5bbe7ab468186dd47d0572050677578e80edd", + "size": 144362 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/messages/batches", + "url": "https://platform.claude.com/docs/en/api/go/messages/count_tokens", "status": "success", - "path": "en/api/terraform/beta/messages/batches.md", - "sha256": "4ea7bc3d71e0a23a3b90ff033184075aea965112879f8cb0a4b373c7f4abdb8e", - "size": 91217 + "path": "en/api/go/messages/count_tokens.md", + "sha256": "2170126f9cfa73c768b1df3c7089d08fc452b313404a3178bcec4f813b5e5b05", + "size": 112872 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/messages/batches/create", + "url": "https://platform.claude.com/docs/en/api/go/messages/batches", "status": "success", - "path": "en/api/terraform/beta/messages/batches/create.md", - "sha256": "5d28720281c2c46c933acf5170085d893aee6deb757efff6f906e8e1607622b7", - "size": 91242 + "path": "en/api/go/messages/batches.md", + "sha256": "8b60f4e4d98052aab92341a551ea9945f6fe4a4e5646676e71226f3421a43293", + "size": 288548 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/messages/batches/retrieve", + "url": "https://platform.claude.com/docs/en/api/go/messages/batches/create", "status": "success", - "path": "en/api/terraform/beta/messages/batches/retrieve.md", - "sha256": "eec62699e83c2ddb3be66a7cfb91bf5a95a7dce6e7c133c81a682eb64a1b3f61", - "size": 91248 + "path": "en/api/go/messages/batches/create.md", + "sha256": "5267aeeff2162eb8285464aeff2aff400a39823327b2fc480e7af518afecc5a0", + "size": 134102 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/messages/batches/list", + "url": "https://platform.claude.com/docs/en/api/go/messages/batches/retrieve", "status": "success", - "path": "en/api/terraform/beta/messages/batches/list.md", - "sha256": "fad0525ae9ee2e3689b25b8687cbb2838ca9ad916db7547e839f73db931e0c56", - "size": 91236 + "path": "en/api/go/messages/batches/retrieve.md", + "sha256": "bdc366efbc71476c7dc058e4d19442d5db0216f412475fee3101f3ed5884a943", + "size": 3946 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/messages/batches/cancel", + "url": "https://platform.claude.com/docs/en/api/go/messages/batches/list", "status": "success", - "path": "en/api/terraform/beta/messages/batches/cancel.md", - "sha256": "7eeb361c2bd5373db0dd02214c04eac71cc864e9e1dc52c02b6b1fe3b86e54c0", - "size": 91242 + "path": "en/api/go/messages/batches/list.md", + "sha256": "13803b84761d4e03026bfa836b268d1f58ebf2708efa4815f72c762dd11cb110", + "size": 4271 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/messages/batches/delete", + "url": "https://platform.claude.com/docs/en/api/go/messages/batches/cancel", "status": "success", - "path": "en/api/terraform/beta/messages/batches/delete.md", - "sha256": "fb0e5e85a7e0aee71da4a3e1f0c9fa8def3b0fb54380cb7541574b4d9d4be482", - "size": 91242 + "path": "en/api/go/messages/batches/cancel.md", + "sha256": "6a096b0fc9b9b960628e7930aa2196cb7b7145e55a77b008a554f0c28afc1358", + "size": 4268 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/messages/batches/results", + "url": "https://platform.claude.com/docs/en/api/go/messages/batches/delete", "status": "success", - "path": "en/api/terraform/beta/messages/batches/results.md", - "sha256": "ba8e5985f08c3bd2d3b9191323502276a3cd5533cff0fa11eca7f1ae4278cbf6", - "size": 91245 + "path": "en/api/go/messages/batches/delete.md", + "sha256": "646f74b47911415e5bf68f98faf63b3195123369f63ff9ea9d47029de680a535", + "size": 1298 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/files", + "url": "https://platform.claude.com/docs/en/api/go/messages/batches/results", "status": "success", - "path": "en/api/terraform/beta/files.md", - "sha256": "f2a9076b63e48cfb8632ba5fbc02c9dd1e3dfc198c2ed64c9803ed5861ab0fcf", - "size": 91180 + "path": "en/api/go/messages/batches/results.md", + "sha256": "9390494cfc7cf813a722ed8237a6ed44348964bc8d1a1a2bbadaf07e9dba5cc6", + "size": 35972 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/files/upload", + "url": "https://platform.claude.com/docs/en/api/go/models", "status": "success", - "path": "en/api/terraform/beta/files/upload.md", - "sha256": "1e3bdf5f5b26d7c31d4cd04313ae4fc41db94a75556079f4846f949b166395fa", - "size": 91205 + "path": "en/api/go/models.md", + "sha256": "865e16ed0847614e83a4b368797500b2a28c5f002408a17a0edd54a88f4e6213", + "size": 25226 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/files/list", + "url": "https://platform.claude.com/docs/en/api/go/models/list", "status": "success", - "path": "en/api/terraform/beta/files/list.md", - "sha256": "d106a278dac839487256c1c7f8af0f5247781659458be53ec0216570992d53b5", - "size": 91199 + "path": "en/api/go/models/list.md", + "sha256": "5be3c40932480aec3a544793fc6a7afd902e3bc9f1f9193fe4b0225319093890", + "size": 7597 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/files/download", + "url": "https://platform.claude.com/docs/en/api/go/models/retrieve", "status": "success", - "path": "en/api/terraform/beta/files/download.md", - "sha256": "eba899b90051b53e2d847464b5bafe09dd29ec07b7155b2314d569a4c01586a1", - "size": 91211 + "path": "en/api/go/models/retrieve.md", + "sha256": "e73d1a9941819fc6d592c79ffb7babce0c2a7136dc1e8ae6935690f2a5f41ff0", + "size": 7172 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/files/retrieve_metadata", + "url": "https://platform.claude.com/docs/en/api/go/beta", "status": "success", - "path": "en/api/terraform/beta/files/retrieve_metadata.md", - "sha256": "8a08483febd9368cc2cb8de5b431310e4a1d22c0c02245f90134f76441592f6f", - "size": 91238 + "path": "en/api/go/beta.md", + "sha256": "6356e59bef0f4abe30a4e9c473f4925150f01bb271e0f5d5de37078f94d1343e", + "size": 2175479 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/files/delete", + "url": "https://platform.claude.com/docs/en/api/go/beta/models", "status": "success", - "path": "en/api/terraform/beta/files/delete.md", - "sha256": "277ce0affe1e84fdb393bf7ff222dc6f7008ba14ff0f1d09067edd79ecd0000d", - "size": 91205 + "path": "en/api/go/beta/models.md", + "sha256": "1091a3ecbab244ccf24335545b035b5639fe1fdf5198b5c1688358042ac678df", + "size": 25713 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/skills", + "url": "https://platform.claude.com/docs/en/api/go/beta/models/list", "status": "success", - "path": "en/api/terraform/beta/skills.md", - "sha256": "8f10b430f6bd7eb623fccd0142f0fc000cfee7a6f04f33504a0a6d3ae3f13fb1", - "size": 91183 + "path": "en/api/go/beta/models/list.md", + "sha256": "ac5061f3e287a0027c7aa1000f0d91d62cd03d60c500424b8cd1d9f9adbd590f", + "size": 7703 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/skills/create", + "url": "https://platform.claude.com/docs/en/api/go/beta/models/retrieve", "status": "success", - "path": "en/api/terraform/beta/skills/create.md", - "sha256": "db3942313f6bf2665c43728a5d0a87a51dfe768c0fa12e807d0f285ef0983a7e", - "size": 91208 + "path": "en/api/go/beta/models/retrieve.md", + "sha256": "41c9f34d88f32d266b10fe3a3a33be9bf0bfea5b2c91efeb3c0fe227f2ccca43", + "size": 7286 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/skills/list", + "url": "https://platform.claude.com/docs/en/api/go/beta/messages", "status": "success", - "path": "en/api/terraform/beta/skills/list.md", - "sha256": "4fac4877cd62db64ed841c2da11b559133e4d2aee6ed8611df647e957084fa0d", - "size": 91202 + "path": "en/api/go/beta/messages.md", + "sha256": "a1a6692a2074fe979403937d6fda78b8066d1f33ab996922e3f7443a76af7e53", + "size": 1344070 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/skills/retrieve", + "url": "https://platform.claude.com/docs/en/api/go/beta/messages/create", "status": "success", - "path": "en/api/terraform/beta/skills/retrieve.md", - "sha256": "3b03fa7fd0164fb80b2478018d23f771c1b4e53244c299a00646f0653fd644ce", - "size": 91214 + "path": "en/api/go/beta/messages/create.md", + "sha256": "6ae45df6144f951246b837324ba1559d684315ee1fce0db61dacdbbf93f5041e", + "size": 180206 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/skills/delete", + "url": "https://platform.claude.com/docs/en/api/go/beta/messages/count_tokens", "status": "success", - "path": "en/api/terraform/beta/skills/delete.md", - "sha256": "f5332d7de31f376dd4135aa7b9c51fbc2b772638e426bd3e90a4260c9262d267", - "size": 91208 + "path": "en/api/go/beta/messages/count_tokens.md", + "sha256": "748c7d0e31e86febf5d708f4fddddf317c1e0b5aa0d8068d799731dd0033f9a1", + "size": 139087 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/skills/versions", + "url": "https://platform.claude.com/docs/en/api/go/beta/messages/batches", "status": "success", - "path": "en/api/terraform/beta/skills/versions.md", - "sha256": "39f3636aa80f73a8abd1b35edfce2c507d2f116ac12afd0866638d5ef3146dfb", - "size": 91214 + "path": "en/api/go/beta/messages/batches.md", + "sha256": "7e546d13fb30fdba790b266cdd323fe75a31e57320681f6f9c95fff7b1bd369c", + "size": 371530 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/skills/versions/create", + "url": "https://platform.claude.com/docs/en/api/go/beta/messages/batches/create", "status": "success", - "path": "en/api/terraform/beta/skills/versions/create.md", - "sha256": "d1c9c848de2c65c6b0f652143e8a4aea686e77b8773dae7983cab0d66075fcfc", - "size": 91239 + "path": "en/api/go/beta/messages/batches/create.md", + "sha256": "511fc56a29944a59af71aea8dd4ae838f1c573107dfdca09e1a7af23c2984b30", + "size": 165909 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/skills/versions/list", + "url": "https://platform.claude.com/docs/en/api/go/beta/messages/batches/retrieve", "status": "success", - "path": "en/api/terraform/beta/skills/versions/list.md", - "sha256": "780d0abdbc9550a822fbee056576abd4ae133f337bd480ccb0f083396d0b7863", - "size": 91233 + "path": "en/api/go/beta/messages/batches/retrieve.md", + "sha256": "ce6581e54d021d0c07e6fd38cd54f5282b11f8de9522569e56c514ac4d159871", + "size": 6307 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/skills/versions/retrieve", + "url": "https://platform.claude.com/docs/en/api/go/beta/messages/batches/list", "status": "success", - "path": "en/api/terraform/beta/skills/versions/retrieve.md", - "sha256": "354db4f17ab1aedc9cabe1421766746bbadc8e02a8015692199564cd2ed741f5", - "size": 91245 + "path": "en/api/go/beta/messages/batches/list.md", + "sha256": "38077f4677214a6adf94ae166ff5557013e81dc1df7b6a257f1ecb6761c7546a", + "size": 6581 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/skills/versions/delete", + "url": "https://platform.claude.com/docs/en/api/go/beta/messages/batches/cancel", "status": "success", - "path": "en/api/terraform/beta/skills/versions/delete.md", - "sha256": "b7798f49ba86dfad63e04085129ee7724be94da7d93d90d35c3f818a70cdbe34", - "size": 91239 + "path": "en/api/go/beta/messages/batches/cancel.md", + "sha256": "c63295ebed755b6013db49bc6564e28de96a13b2f73a66edfe791654a1d12586", + "size": 6633 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/user_profiles", + "url": "https://platform.claude.com/docs/en/api/go/beta/messages/batches/delete", "status": "success", - "path": "en/api/terraform/beta/user_profiles.md", - "sha256": "2da529334ce13ada8a384922c1a6eb25c75cfd9f3ed95add0635533760f35e5f", - "size": 91204 + "path": "en/api/go/beta/messages/batches/delete.md", + "sha256": "a4f6b39690fe48603a984ec9ced9e3b32d0fa780c81c676e8592e197788f7518", + "size": 3631 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/user_profiles/create", + "url": "https://platform.claude.com/docs/en/api/go/beta/messages/batches/results", "status": "success", - "path": "en/api/terraform/beta/user_profiles/create.md", - "sha256": "1adc1ceac90ea6efedc53d277875dea46aa7bab7c72c9585f8171cc92e2f163c", - "size": 91229 + "path": "en/api/go/beta/messages/batches/results.md", + "sha256": "02a99b135ac92f5827a0a00fc01164da60a9a8ad57e85288f1c136c2a5cb967f", + "size": 48382 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/user_profiles/list", + "url": "https://platform.claude.com/docs/en/api/go/beta/agents", "status": "success", - "path": "en/api/terraform/beta/user_profiles/list.md", - "sha256": "335e57b44d95fdb66ade559723c1500698157c17e63004f34e2e947c90ca07e8", - "size": 91223 + "path": "en/api/go/beta/agents.md", + "sha256": "fdf8236079daaae6221901c1499d0a2b5f2586695dc31f2f39b89c8c47a559da", + "size": 147355 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/user_profiles/retrieve", + "url": "https://platform.claude.com/docs/en/api/go/beta/agents/create", "status": "success", - "path": "en/api/terraform/beta/user_profiles/retrieve.md", - "sha256": "760c216c1c79abda66f24f1157f43166967557098b9a713e2c721c7167714521", - "size": 91235 + "path": "en/api/go/beta/agents/create.md", + "sha256": "e6cf08f44d77687d7991fd1a727beb7a95cde9d2426513c4fb6bb688ae47b11e", + "size": 25361 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/user_profiles/update", + "url": "https://platform.claude.com/docs/en/api/go/beta/agents/list", "status": "success", - "path": "en/api/terraform/beta/user_profiles/update.md", - "sha256": "134c2385b1da9135a1142beecfe863363a3abfccdd4aeb918742eb7016414102", - "size": 91229 + "path": "en/api/go/beta/agents/list.md", + "sha256": "59f614cf4446edd08d15487a83b787effbf0f92d577a65a5e16f01dd975a2fe0", + "size": 13270 }, { - "url": "https://platform.claude.com/docs/en/api/terraform/beta/user_profiles/create_enrollment_url", + "url": "https://platform.claude.com/docs/en/api/go/beta/agents/retrieve", "status": "success", - "path": "en/api/terraform/beta/user_profiles/create_enrollment_url.md", - "sha256": "bca4d94675e3dd94f1783734ebebb9b66c6c16650b6d721afa941a747c30ccfc", - "size": 91274 + "path": "en/api/go/beta/agents/retrieve.md", + "sha256": "a315cd868f72c5685bb3337069bf99c962b320c66a1311d9203bf841a14e2ce8", + "size": 12979 }, { - "url": "https://platform.claude.com/docs/en/api/cli/completions", + "url": "https://platform.claude.com/docs/en/api/go/beta/agents/update", "status": "success", - "path": "en/api/cli/completions.md", - "sha256": "c8d0825b0bd07a08575248bba5568dfc624c657eaa531d87f27b54c5ab354933", - "size": 91161 + "path": "en/api/go/beta/agents/update.md", + "sha256": "c1291b161334e9bb6ab42c56f97c20d4d77d0557fdd1535f6e98beb88be5318d", + "size": 25964 }, { - "url": "https://platform.claude.com/docs/en/api/cli/completions/create", + "url": "https://platform.claude.com/docs/en/api/go/beta/agents/archive", "status": "success", - "path": "en/api/cli/completions/create.md", - "sha256": "7c42effbc990e1a7f3fc1a68e1c9af491642f741b84abd1d586e0fc1a923842d", - "size": 91186 + "path": "en/api/go/beta/agents/archive.md", + "sha256": "d2c043ca37e580ce6aa124f59a52a1bb88df2f60e2f94ed89b129aec6d4c4d42", + "size": 12855 }, { - "url": "https://platform.claude.com/docs/en/api/cli/messages", + "url": "https://platform.claude.com/docs/en/api/go/beta/agents/versions", "status": "success", - "path": "en/api/cli/messages.md", - "sha256": "e1ed202a207010b5e39376b4e3230ab8af873ea0e6601d70cdf2bddea55b60dd", - "size": 91152 + "path": "en/api/go/beta/agents/versions.md", + "sha256": "32ce5f6a1df30c724160fc920c543f5b32d8e17f0b66d51681d988974098a3b1", + "size": 13058 }, { - "url": "https://platform.claude.com/docs/en/api/cli/messages/create", + "url": "https://platform.claude.com/docs/en/api/go/beta/agents/versions/list", "status": "success", - "path": "en/api/cli/messages/create.md", - "sha256": "fc8d57dcd0f61dcea55af0416555aa3eed0c0167cc34c9adbc86f8de6d33a1d2", - "size": 91177 + "path": "en/api/go/beta/agents/versions/list.md", + "sha256": "c04809a74281bda047aa5b7bc9fdcb1fb80791034deb6cc8436543704152a2da", + "size": 13046 }, { - "url": "https://platform.claude.com/docs/en/api/cli/messages/count_tokens", + "url": "https://platform.claude.com/docs/en/api/go/beta/environments", "status": "success", - "path": "en/api/cli/messages/count_tokens.md", - "sha256": "df60b371353b3df5882ed7dbc3f6d7d38417ba66f654bbccdb6b79e108efac46", - "size": 91195 + "path": "en/api/go/beta/environments.md", + "sha256": "fb0950982ed2e4cff1d5654d66041a1703fcf2ecc485db3a269ba18b02bcad8d", + "size": 41610 }, { - "url": "https://platform.claude.com/docs/en/api/cli/messages/batches", + "url": "https://platform.claude.com/docs/en/api/go/beta/environments/create", "status": "success", - "path": "en/api/cli/messages/batches.md", - "sha256": "69450338a613357f840029bb5134be0ce58e981db41e115c543e972dac73db99", - "size": 91180 + "path": "en/api/go/beta/environments/create.md", + "sha256": "9840e14195ca4679045ce2683ca54e8d35e4f752a80065704e86e97ba5bf199d", + "size": 5906 }, { - "url": "https://platform.claude.com/docs/en/api/cli/messages/batches/create", + "url": "https://platform.claude.com/docs/en/api/go/beta/environments/list", "status": "success", - "path": "en/api/cli/messages/batches/create.md", - "sha256": "89340efb5976e3e5245ef14aac70ae60ca7103eee48851136864f9dc6203c8ad", - "size": 91205 + "path": "en/api/go/beta/environments/list.md", + "sha256": "875590489b8556067aacaf10fcba2cd29341419d2ada11699b62cdcfa1c8983f", + "size": 5697 }, { - "url": "https://platform.claude.com/docs/en/api/cli/messages/batches/retrieve", + "url": "https://platform.claude.com/docs/en/api/go/beta/environments/retrieve", "status": "success", - "path": "en/api/cli/messages/batches/retrieve.md", - "sha256": "2e76f84474b7597cacfb5423bab568117967cd22fcc75ce3a06a7f95960ec927", - "size": 91211 + "path": "en/api/go/beta/environments/retrieve.md", + "sha256": "385ea2be975ff746584e0d73d7ab90c5ed6591a3115a03fe8f591f70a91273f4", + "size": 5445 }, { - "url": "https://platform.claude.com/docs/en/api/cli/messages/batches/list", + "url": "https://platform.claude.com/docs/en/api/go/beta/environments/update", "status": "success", - "path": "en/api/cli/messages/batches/list.md", - "sha256": "178a758b95978d1a1d9e81d1244bbec03138a33c149eddce209166e3e7c0a7d0", - "size": 91199 + "path": "en/api/go/beta/environments/update.md", + "sha256": "7393f252a26facd7e7ecc2e68fd2440984d63b23df884fff4980fd7b11afa912", + "size": 6031 }, { - "url": "https://platform.claude.com/docs/en/api/cli/messages/batches/cancel", + "url": "https://platform.claude.com/docs/en/api/go/beta/environments/delete", "status": "success", - "path": "en/api/cli/messages/batches/cancel.md", - "sha256": "b168447f0e5acd273a7abb97bd98c4a2ea0f3d645a578a7f1eaf7b46dbd19c9f", - "size": 91205 + "path": "en/api/go/beta/environments/delete.md", + "sha256": "dda626798415d003465d9071573b57b9adacf7197480d3bb3a49dd629e0b2462", + "size": 3360 }, { - "url": "https://platform.claude.com/docs/en/api/cli/messages/batches/delete", + "url": "https://platform.claude.com/docs/en/api/go/beta/environments/archive", "status": "success", - "path": "en/api/cli/messages/batches/delete.md", - "sha256": "9440746b111a0fa527de711ba34b9d415ecba65e5458efffeb97ddd2f0704c2d", - "size": 91205 + "path": "en/api/go/beta/environments/archive.md", + "sha256": "e67de5d5a2b15e2fa0ca86c51a5c5e4115f851bd390f203c48cd7f4380e537aa", + "size": 5519 }, { - "url": "https://platform.claude.com/docs/en/api/cli/messages/batches/results", + "url": "https://platform.claude.com/docs/en/api/go/beta/sessions", "status": "success", - "path": "en/api/cli/messages/batches/results.md", - "sha256": "128c7a672ac52bd2c63d431391cc05e5d97c6bbf7fa54bf33a8c1ac718b3c958", - "size": 91208 + "path": "en/api/go/beta/sessions.md", + "sha256": "28be817b31b70cef4e96331a4d685923537a92b23cc23df7c0e5854018d6bc1b", + "size": 470844 }, { - "url": "https://platform.claude.com/docs/en/api/cli/models", + "url": "https://platform.claude.com/docs/en/api/go/beta/sessions/create", "status": "success", - "path": "en/api/cli/models.md", - "sha256": "3b2c6801c7979c37a89a67811782bee26f39747eae790e7f44ff368463098afa", - "size": 91146 + "path": "en/api/go/beta/sessions/create.md", + "sha256": "25b11b7c49f9204da4b3131961353ae6b18a745fb2c4568c4cc4cbd5f03a7253", + "size": 20014 }, { - "url": "https://platform.claude.com/docs/en/api/cli/models/list", + "url": "https://platform.claude.com/docs/en/api/go/beta/sessions/list", "status": "success", - "path": "en/api/cli/models/list.md", - "sha256": "74d16546b94974a13e25824a69c40353d5c0e8521db27f0ece17606de4ed6264", - "size": 91165 + "path": "en/api/go/beta/sessions/list.md", + "sha256": "f4b4b907aa8d3700cb5020d128c8ea1f86f9ceec02777591cc67ac29ba8a99a3", + "size": 17853 }, { - "url": "https://platform.claude.com/docs/en/api/cli/models/retrieve", + "url": "https://platform.claude.com/docs/en/api/go/beta/sessions/retrieve", "status": "success", - "path": "en/api/cli/models/retrieve.md", - "sha256": "8c8f6e17a302f16a9135fc49e1786a8a9febcd95d40ce151b4934e2aa8bcad83", - "size": 91177 + "path": "en/api/go/beta/sessions/retrieve.md", + "sha256": "54a81b5220744f7755c93a13096c9ff9e6bdace374959d6bfe328ee62e4b664c", + "size": 16647 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta", + "url": "https://platform.claude.com/docs/en/api/go/beta/sessions/update", "status": "success", - "path": "en/api/cli/beta.md", - "sha256": "115c7ae3fdc62876a7dc89e9b067f97964b96321c4f0c04abe363fda52a3f15e", - "size": 91140 + "path": "en/api/go/beta/sessions/update.md", + "sha256": "f2b1996c1a7df943d5c0ffe2b8db30e3917c83325691d08fe0d3a19d76bf0af3", + "size": 17115 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/models", + "url": "https://platform.claude.com/docs/en/api/go/beta/sessions/delete", "status": "success", - "path": "en/api/cli/beta/models.md", - "sha256": "7f05feb0987c08a9c1689ce5406afd670df0904eda5102b472f292510d7c8a95", - "size": 91165 + "path": "en/api/go/beta/sessions/delete.md", + "sha256": "b9a7eef093edd90a07658d206bd4b1195f34791ecf2433191db1a0121bf8c4f7", + "size": 3292 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/models/list", + "url": "https://platform.claude.com/docs/en/api/go/beta/sessions/archive", "status": "success", - "path": "en/api/cli/beta/models/list.md", - "sha256": "26cf5f3d92dc3f0c91988b49605faa95d241ebe7e30e73e5de4fe736bb61dba3", - "size": 91184 + "path": "en/api/go/beta/sessions/archive.md", + "sha256": "403fa5b8b300e729708b92b3da283db09d6fdc9a1f7902e3c7b8942a0e6cee85", + "size": 16673 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/models/retrieve", + "url": "https://platform.claude.com/docs/en/api/go/beta/sessions/events", "status": "success", - "path": "en/api/cli/beta/models/retrieve.md", - "sha256": "af220fd52b1fb2d01b052865e911bfdc49738a6ab1bb64cf7f4f62b3d291b8d6", - "size": 91196 + "path": "en/api/go/beta/sessions/events.md", + "sha256": "c18bab9d5a9e6711ee6d7cf40189913e96cbf1d1adeb0c6fbabac990bfb159df", + "size": 325501 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/messages", + "url": "https://platform.claude.com/docs/en/api/go/beta/sessions/events/list", "status": "success", - "path": "en/api/cli/beta/messages.md", - "sha256": "8985d61e9fafca70e2e7b25ea4082d0da301e70d65c11991b4e82485de2f8fbc", - "size": 91171 + "path": "en/api/go/beta/sessions/events/list.md", + "sha256": "ef186a6cae36ac551f7f13773b762646f6b8a495bd6a17495753ee226da65645", + "size": 49976 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/messages/create", + "url": "https://platform.claude.com/docs/en/api/go/beta/sessions/events/send", "status": "success", - "path": "en/api/cli/beta/messages/create.md", - "sha256": "f3f2632472289cd2cf687a8ab9dc0b56dedeabcfe1ccd5b6b2ea2149bc5abcb6", - "size": 91196 + "path": "en/api/go/beta/sessions/events/send.md", + "sha256": "8771df85c3e73734477b097385f79f9bef797393a8dcf7f2c55de1fb05f43f95", + "size": 28380 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/messages/count_tokens", + "url": "https://platform.claude.com/docs/en/api/go/beta/sessions/events/stream", "status": "success", - "path": "en/api/cli/beta/messages/count_tokens.md", - "sha256": "389d16b6afe8222c903543c20367f371dfea0ec491ef15f6f7661caa043b7c26", - "size": 91214 + "path": "en/api/go/beta/sessions/events/stream.md", + "sha256": "3376de6f490e389053220281e0a96ca447489a1a46f8c01e6c7ba7f4727b62a1", + "size": 49509 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/messages/batches", + "url": "https://platform.claude.com/docs/en/api/go/beta/sessions/resources", "status": "success", - "path": "en/api/cli/beta/messages/batches.md", - "sha256": "24bdda7d15a3c3053b03a4f86e06d376cdaa3cdd897c1f84e24c20a1b76fc758", - "size": 91199 + "path": "en/api/go/beta/sessions/resources.md", + "sha256": "7d4c3ebc2dfcef1b57bde7eb059efe1ee4a80d8c2d6a29156157a890b81d51ca", + "size": 25448 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/messages/batches/create", + "url": "https://platform.claude.com/docs/en/api/go/beta/sessions/resources/add", "status": "success", - "path": "en/api/cli/beta/messages/batches/create.md", - "sha256": "da54ddbb4e7ab2e0ebfec5d502eb8e044665e010f69d6bf4b0bc139d2e70019d", - "size": 91224 + "path": "en/api/go/beta/sessions/resources/add.md", + "sha256": "1dc056cf901548327270ebbf43c4ed2a5b88e1583294397e152a129925cedd12", + "size": 3795 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/messages/batches/retrieve", + "url": "https://platform.claude.com/docs/en/api/go/beta/sessions/resources/list", "status": "success", - "path": "en/api/cli/beta/messages/batches/retrieve.md", - "sha256": "8f0c59778e09aec086f58cbfeb38dbcd1c0a6880b4c1ba718eae6282ff8046e1", - "size": 91230 + "path": "en/api/go/beta/sessions/resources/list.md", + "sha256": "108288d855ed4f4cff90d6126b5863e70395fb5d0db98cd5ff5ac3820583b297", + "size": 4826 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/messages/batches/list", + "url": "https://platform.claude.com/docs/en/api/go/beta/sessions/resources/retrieve", "status": "success", - "path": "en/api/cli/beta/messages/batches/list.md", - "sha256": "db288c7b8e8c622480d6f67c39d2a33a9a2444e077a8c28a453aeca2f6a2a573", - "size": 91218 + "path": "en/api/go/beta/sessions/resources/retrieve.md", + "sha256": "c2f7112269f70d4319c5c61b0190f8bea0761890cc717f3e4ef5b357b7d8e811", + "size": 4746 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/messages/batches/cancel", + "url": "https://platform.claude.com/docs/en/api/go/beta/sessions/resources/update", "status": "success", - "path": "en/api/cli/beta/messages/batches/cancel.md", - "sha256": "d3b5ca7c9f7b50ef665f2922924839cceae940eaeb5500d69093ccf0f3c0c409", - "size": 91224 + "path": "en/api/go/beta/sessions/resources/update.md", + "sha256": "3e09d2bf49b7e98fec04d3a5b3019b349e98e115326ace7295c9daf1edc52b56", + "size": 4984 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/messages/batches/delete", + "url": "https://platform.claude.com/docs/en/api/go/beta/sessions/resources/delete", "status": "success", - "path": "en/api/cli/beta/messages/batches/delete.md", - "sha256": "c3c37601c563dc7b1962ce660fc857dedbe17f569d617bb530c4dcb04f192d27", - "size": 91224 + "path": "en/api/go/beta/sessions/resources/delete.md", + "sha256": "3b1a2e7be322d3020d8523561e5f60bd50f010de859cc07faaf4ecc25aacd164", + "size": 3553 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/messages/batches/results", + "url": "https://platform.claude.com/docs/en/api/go/beta/vaults", "status": "success", - "path": "en/api/cli/beta/messages/batches/results.md", - "sha256": "e75bb81785e43c132bf7b1d2c154504ec97a725f18ad9ab6e994b88d0446b7d4", - "size": 91227 + "path": "en/api/go/beta/vaults.md", + "sha256": "11459be8cd873173214aa66bf5581f976b3b80607702baaf56515b5e60114182", + "size": 86822 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/files", + "url": "https://platform.claude.com/docs/en/api/go/beta/vaults/create", "status": "success", - "path": "en/api/cli/beta/files.md", - "sha256": "bb29b785076839f7e3ba3d2f6599e21dfc4eb2325173e7582f9ed4187367221e", - "size": 91162 + "path": "en/api/go/beta/vaults/create.md", + "sha256": "1ac5527ff326198ac5c9527abbaa6c8d20502bf8ca23a3708e8c5bcc90036308", + "size": 3744 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/files/upload", + "url": "https://platform.claude.com/docs/en/api/go/beta/vaults/list", "status": "success", - "path": "en/api/cli/beta/files/upload.md", - "sha256": "7cb3010ed52652b645b1526f826c9664c889f13843f5a1b7fde1242e8c4ea995", - "size": 91187 + "path": "en/api/go/beta/vaults/list.md", + "sha256": "7d0d832bbabf75b745f564cd1f327ff8d26b2c57f2e41f29e89f22e40fcd197f", + "size": 3804 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/files/list", + "url": "https://platform.claude.com/docs/en/api/go/beta/vaults/retrieve", "status": "success", - "path": "en/api/cli/beta/files/list.md", - "sha256": "cf7140d915c593444c32f8403579dbdf0bfd33a1eca65a3000bb2c5949be95b7", - "size": 91181 + "path": "en/api/go/beta/vaults/retrieve.md", + "sha256": "14f0cfc3e14bd60be5868ce82699ed2d58a4b39c8f6708ae1f691362bc605f5b", + "size": 3556 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/files/download", + "url": "https://platform.claude.com/docs/en/api/go/beta/vaults/update", "status": "success", - "path": "en/api/cli/beta/files/download.md", - "sha256": "ccaf4b59ee968f0468567947003b49206166a4415ca24287e07c33667b6b7d16", - "size": 91193 + "path": "en/api/go/beta/vaults/update.md", + "sha256": "81c204e04ea0f428f10036a3637f67256e1bf1d64fa08dd3e951769dd2828e92", + "size": 3874 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/files/retrieve_metadata", + "url": "https://platform.claude.com/docs/en/api/go/beta/vaults/delete", "status": "success", - "path": "en/api/cli/beta/files/retrieve_metadata.md", - "sha256": "547bc03546010da113f0262215d852bfbe9817ac38621196515d0300d1af46ad", - "size": 91220 + "path": "en/api/go/beta/vaults/delete.md", + "sha256": "edc9f9a28b9c76d00e2314e2fba21ccc8ba546b5b164be1963dc840cadff04dc", + "size": 3273 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/files/delete", + "url": "https://platform.claude.com/docs/en/api/go/beta/vaults/archive", "status": "success", - "path": "en/api/cli/beta/files/delete.md", - "sha256": "69afdeea5b6089f8e17b3f3672356f48bba9acb66b183374b23289eabf887d65", - "size": 91187 + "path": "en/api/go/beta/vaults/archive.md", + "sha256": "756424b98eebd5fff9837ad7cca80f3854b1796af2a73f99fbcddf6920ea2aa8", + "size": 3582 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/skills", + "url": "https://platform.claude.com/docs/en/api/go/beta/vaults/credentials", "status": "success", - "path": "en/api/cli/beta/skills.md", - "sha256": "0db6e5cf8022bd4b23a9037d8b3ed195e474edb4496c705f80210f8a01b9cc28", - "size": 91165 + "path": "en/api/go/beta/vaults/credentials.md", + "sha256": "2d6a967ee310697b6b890396540b1fff112822769e38bf338bd2e74a14e3c50c", + "size": 63950 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/skills/create", + "url": "https://platform.claude.com/docs/en/api/go/beta/vaults/credentials/create", "status": "success", - "path": "en/api/cli/beta/skills/create.md", - "sha256": "9e1619862e0c066f32744494cdc7f244156509b36d0df7f143af0514b020ffc7", - "size": 91190 + "path": "en/api/go/beta/vaults/credentials/create.md", + "sha256": "55eedf073399d5264d22b3ded1d02bea93108232c95be977034ec738df9fbd90", + "size": 10268 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/skills/list", + "url": "https://platform.claude.com/docs/en/api/go/beta/vaults/credentials/list", "status": "success", - "path": "en/api/cli/beta/skills/list.md", - "sha256": "7e049ef345d832692b7bc0ab1125b47566f87fc30747f66d952141721bf345d8", - "size": 91184 + "path": "en/api/go/beta/vaults/credentials/list.md", + "sha256": "9ddad81fa89f7b9811ab13a5e3a1fd2136baf166ddec274b772ad28372c866cc", + "size": 6874 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/skills/retrieve", + "url": "https://platform.claude.com/docs/en/api/go/beta/vaults/credentials/retrieve", "status": "success", - "path": "en/api/cli/beta/skills/retrieve.md", - "sha256": "40a156112035d70358463e36efe5422d220840c29108176099d3585014af5867", - "size": 91196 + "path": "en/api/go/beta/vaults/credentials/retrieve.md", + "sha256": "83f8100aeee746fb2edf8ad40f0c3ddd6fda2f3895d6d49b6ec0548f7e958a96", + "size": 6695 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/skills/delete", + "url": "https://platform.claude.com/docs/en/api/go/beta/vaults/credentials/update", "status": "success", - "path": "en/api/cli/beta/skills/delete.md", - "sha256": "07572b8c2bbf34fbcc135d26b2050995951a0618a1c2e2711a5dafeaa4fde6e4", - "size": 91190 + "path": "en/api/go/beta/vaults/credentials/update.md", + "sha256": "7a1d43235933d3c269384b42e15df3ce65bc78f09a8d8565c340ce148695ddf7", + "size": 9524 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/skills/versions", + "url": "https://platform.claude.com/docs/en/api/go/beta/vaults/credentials/delete", "status": "success", - "path": "en/api/cli/beta/skills/versions.md", - "sha256": "429ceb718d9db6b03c836e57ebdde5cec101fff4ef0344832757e4c2b1284dcb", - "size": 91196 + "path": "en/api/go/beta/vaults/credentials/delete.md", + "sha256": "b01e5b5471c49e9599268136c7d74fc7832b91b961c26bfc948a94a109ac3c61", + "size": 3567 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/skills/versions/create", + "url": "https://platform.claude.com/docs/en/api/go/beta/vaults/credentials/archive", "status": "success", - "path": "en/api/cli/beta/skills/versions/create.md", - "sha256": "68ec43bc39c3872c29c73fd9751c385a553bbbb02ee34ec48d3b5c135b7ecb72", - "size": 91221 + "path": "en/api/go/beta/vaults/credentials/archive.md", + "sha256": "60249c3faf4a5b3a69a6d4fbd1cb1abd65e4de07ad2ce3c29d1ea21a10a9c453", + "size": 6723 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/skills/versions/list", + "url": "https://platform.claude.com/docs/en/api/go/beta/files", "status": "success", - "path": "en/api/cli/beta/skills/versions/list.md", - "sha256": "da8f4b2f5d7a41226b5db7088d85c481211129f2d12efae76f3da82fbf6005c3", - "size": 91215 + "path": "en/api/go/beta/files.md", + "sha256": "5b7bbc4f2bb2c2feba802641d668a3106de10ea0c471f6636d6211d5ce31a52f", + "size": 19703 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/skills/versions/retrieve", + "url": "https://platform.claude.com/docs/en/api/go/beta/files/upload", "status": "success", - "path": "en/api/cli/beta/skills/versions/retrieve.md", - "sha256": "85349c21dd0734430e48e43ac5aa54db34ec4109feb294b0fa8f94e168492d73", - "size": 91227 + "path": "en/api/go/beta/files/upload.md", + "sha256": "b5094d86aed2c8bc0e52f2355f7106268c362f0b600e99923a6fb16bc6e6c5c1", + "size": 3886 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/skills/versions/delete", + "url": "https://platform.claude.com/docs/en/api/go/beta/files/list", "status": "success", - "path": "en/api/cli/beta/skills/versions/delete.md", - "sha256": "5a84553158683ba14c324f119979034736624135e3699223f65885587908a429", - "size": 91221 + "path": "en/api/go/beta/files/list.md", + "sha256": "a227e06b8d9f0cd7b028df9e4d7b173425c56df14ac1602f09478244a5fe5e1e", + "size": 4361 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/user_profiles", + "url": "https://platform.claude.com/docs/en/api/go/beta/files/download", "status": "success", - "path": "en/api/cli/beta/user_profiles.md", - "sha256": "8708690c4159aa07021ad6007146be19c7ede095477ada3f8da5e9056b02c6df", - "size": 91186 + "path": "en/api/go/beta/files/download.md", + "sha256": "df267357f6aba887df220e3fe76e0859d46896d6343b37f9ecd77e78abd9b37b", + "size": 2956 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/user_profiles/create", + "url": "https://platform.claude.com/docs/en/api/go/beta/files/retrieve_metadata", "status": "success", - "path": "en/api/cli/beta/user_profiles/create.md", - "sha256": "43ecba256a96b7f079441cd94fa223b8aa2866948b0340b98ba9b7a0ffb8be02", - "size": 91211 + "path": "en/api/go/beta/files/retrieve_metadata.md", + "sha256": "b3f0e02fc2aa300230cc384d2c8c57826503c007e8f168e27296e39b90830f1c", + "size": 3846 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/user_profiles/list", + "url": "https://platform.claude.com/docs/en/api/go/beta/files/delete", "status": "success", - "path": "en/api/cli/beta/user_profiles/list.md", - "sha256": "7a03c3595bab119d8b86ceb97cbbfb8896aabeb2df7e7f3bbcbc47fb53617d57", - "size": 91205 + "path": "en/api/go/beta/files/delete.md", + "sha256": "3a171bd89154b720a2b8917da6a2ba0064fa000771507b56a46477421c1bef3f", + "size": 3165 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/user_profiles/retrieve", + "url": "https://platform.claude.com/docs/en/api/go/beta/skills", "status": "success", - "path": "en/api/cli/beta/user_profiles/retrieve.md", - "sha256": "29fb867b949e638f7aa6e5255a84d3fd4bbb0b82b59315fb3ad25d5703cf9453", - "size": 91217 + "path": "en/api/go/beta/skills.md", + "sha256": "51485499a1d553072fc5d5dee57d53c6581ae3d88370903ce878a618570169dd", + "size": 31925 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/user_profiles/update", + "url": "https://platform.claude.com/docs/en/api/go/beta/skills/create", "status": "success", - "path": "en/api/cli/beta/user_profiles/update.md", - "sha256": "5b2fda9f9153b3ebe3ce1820bc5d88eba29ba8127cd1176a64b9febd96d9dfdf", - "size": 91211 + "path": "en/api/go/beta/skills/create.md", + "sha256": "2f57b96ec258957dd1f7204386dab12e1b07677bd62ef5ada8b5f55436a59877", + "size": 4105 }, { - "url": "https://platform.claude.com/docs/en/api/cli/beta/user_profiles/create_enrollment_url", + "url": "https://platform.claude.com/docs/en/api/go/beta/skills/list", "status": "success", - "path": "en/api/cli/beta/user_profiles/create_enrollment_url.md", - "sha256": "fc691039ae10d0a2bee01edc65b7c402314369f3b36bab54c22175d61e8dd6a3", - "size": 91256 + "path": "en/api/go/beta/skills/list.md", + "sha256": "6863500288e9acb50132d7e9ed6d61cf4e4ba8ad3c817b299d13abd33693a123", + "size": 4333 }, { - "url": "https://platform.claude.com/docs/en/api/php/completions", + "url": "https://platform.claude.com/docs/en/api/go/beta/skills/retrieve", "status": "success", - "path": "en/api/php/completions.md", - "sha256": "df97fed0b0c45534b2f9102c59aec226e501b6be48b54561c47346bc64b27581", - "size": 91161 + "path": "en/api/go/beta/skills/retrieve.md", + "sha256": "94c0d35e9ede93c6a259651a32909715be3ef28a318f858ef1cc20580ae25ea4", + "size": 3870 }, { - "url": "https://platform.claude.com/docs/en/api/php/completions/create", + "url": "https://platform.claude.com/docs/en/api/go/beta/skills/delete", "status": "success", - "path": "en/api/php/completions/create.md", - "sha256": "33ac77e98c6ed73b23dcbd309be168b0fd8266b905ed721457836a9f23b1c90f", - "size": 91186 + "path": "en/api/go/beta/skills/delete.md", + "sha256": "e87ea128ed1552d42d576860063343a88bda0501618eb85aacc94f440428e210", + "size": 3233 }, { - "url": "https://platform.claude.com/docs/en/api/php/messages", + "url": "https://platform.claude.com/docs/en/api/go/beta/skills/versions", "status": "success", - "path": "en/api/php/messages.md", - "sha256": "511975f8f90ac285f06c1b0e71f62370e81b3c18a190485b80ce32c9ab7d9f78", - "size": 91152 + "path": "en/api/go/beta/skills/versions.md", + "sha256": "679144dc532fc43757d520be14ac8bf5bf424646786d4382517aee2c9162327f", + "size": 16370 }, { - "url": "https://platform.claude.com/docs/en/api/php/messages/create", + "url": "https://platform.claude.com/docs/en/api/go/beta/skills/versions/create", "status": "success", - "path": "en/api/php/messages/create.md", - "sha256": "e064df018b427fa0dd9df62fe5cc743b22ab09fde982abcb4b45382f93f1ae77", - "size": 91177 + "path": "en/api/go/beta/skills/versions/create.md", + "sha256": "13f82099c996eacee47b4dd79c12ee1a2d9ffef8c890986628079059e965aa21", + "size": 4241 }, { - "url": "https://platform.claude.com/docs/en/api/php/messages/count_tokens", + "url": "https://platform.claude.com/docs/en/api/go/beta/skills/versions/list", "status": "success", - "path": "en/api/php/messages/count_tokens.md", - "sha256": "13ca11d9a5c6af5d344b4b4de79dd7682896439f46c4f0be70f4f1ae14fde5dd", - "size": 91195 + "path": "en/api/go/beta/skills/versions/list.md", + "sha256": "2947c6090bbc5dec285f5ed52a2a9a86f035ee991559170c028cc00a4b2501fd", + "size": 4298 }, { - "url": "https://platform.claude.com/docs/en/api/php/messages/batches", + "url": "https://platform.claude.com/docs/en/api/go/beta/skills/versions/retrieve", "status": "success", - "path": "en/api/php/messages/batches.md", - "sha256": "0633d6b63ce45f35d64f00d3d22d413869f49067c849b2b27d016352a083eaf4", - "size": 91180 + "path": "en/api/go/beta/skills/versions/retrieve.md", + "sha256": "0e07e198f9f55fb1472d6e16a90a142e056012b99cbd605ab60e3b2f45405c16", + "size": 4244 }, { - "url": "https://platform.claude.com/docs/en/api/php/messages/batches/create", + "url": "https://platform.claude.com/docs/en/api/go/beta/skills/versions/delete", "status": "success", - "path": "en/api/php/messages/batches/create.md", - "sha256": "9f0af90b60d5b265bc64e4eb5c5bae4711f0571ee5360e0437054c0ebf7c4b1f", - "size": 91205 + "path": "en/api/go/beta/skills/versions/delete.md", + "sha256": "ecd67ec472621fe2d366a1d54dc74af6219c090a4a0dfc6595e5f769ff9e2942", + "size": 3572 }, { - "url": "https://platform.claude.com/docs/en/api/php/messages/batches/retrieve", + "url": "https://platform.claude.com/docs/en/api/ruby/completions", "status": "success", - "path": "en/api/php/messages/batches/retrieve.md", - "sha256": "748492844892c433a6de5769837f6a670f24b2141df4b483f631e090d4fc28fb", - "size": 91211 + "path": "en/api/ruby/completions.md", + "sha256": "e3c172a6ec3cee6de705912dd7cb25a68c760dad918542fcca45224e2c59aa56", + "size": 11565 }, { - "url": "https://platform.claude.com/docs/en/api/php/messages/batches/list", + "url": "https://platform.claude.com/docs/en/api/ruby/completions/create", + "status": "success", + "path": "en/api/ruby/completions/create.md", + "sha256": "40f7f289cb3fa31dcfd00cb9fa92eff2d0b19debdb9bf9da706fdf414e8bcac7", + "size": 8924 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/messages", + "status": "success", + "path": "en/api/ruby/messages.md", + "sha256": "757af1306959b9337aac7331c0584869076ce2037995c4170b40231ba454815e", + "size": 820024 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/messages/create", + "status": "success", + "path": "en/api/ruby/messages/create.md", + "sha256": "e64c5e94b9c0080e3091f336b4e30de11cece234289d442fe4f3615bafd5a7fa", + "size": 111944 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/messages/count_tokens", + "status": "success", + "path": "en/api/ruby/messages/count_tokens.md", + "sha256": "0e36c1795af358eb5c45ccae6c5919e8ee202b9fe83949944764fad4485985b9", + "size": 88261 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/messages/batches", + "status": "success", + "path": "en/api/ruby/messages/batches.md", + "sha256": "4644de0fabb88393a14ecdf5bc9801c3803cbec988889beab6683b7f0b01253f", + "size": 219391 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/messages/batches/create", + "status": "success", + "path": "en/api/ruby/messages/batches/create.md", + "sha256": "9fe7e3f190d2341b28e3796ced6135abf21b9d1e6696ec7c587d4f3f36e145b8", + "size": 102587 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/messages/batches/retrieve", + "status": "success", + "path": "en/api/ruby/messages/batches/retrieve.md", + "sha256": "2792a2109abb099151501bf269e767895dc3e80e1d8a8362cb73367ee34b6948", + "size": 3469 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/messages/batches/list", + "status": "success", + "path": "en/api/ruby/messages/batches/list.md", + "sha256": "a51fbb8269d344d6ddcf0f92c4b2a5849e94a4fde37714cf83fc7a5254262e61", + "size": 3663 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/messages/batches/cancel", + "status": "success", + "path": "en/api/ruby/messages/batches/cancel.md", + "sha256": "c95b6e6aab5e4af187c2e0060fdcfecc71acd179499bf1b56c8e0c3b78db9b1f", + "size": 3781 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/messages/batches/delete", + "status": "success", + "path": "en/api/ruby/messages/batches/delete.md", + "sha256": "58810ae26925e085742e6cc18a21a0c5b45ad8de4cea42d7828dfb3ff0a97e7f", + "size": 980 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/messages/batches/results", + "status": "success", + "path": "en/api/ruby/messages/batches/results.md", + "sha256": "c127ce7e2b4abbb080cc040fae881c83aaa462b369b6d2ce4bfd4a32c63c8160", + "size": 26893 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/models", + "status": "success", + "path": "en/api/ruby/models.md", + "sha256": "34a791f60893cf93855d6fbeda27da226a91ba6968bbd24710d4fa72abcd5fa3", + "size": 22229 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/models/list", + "status": "success", + "path": "en/api/ruby/models/list.md", + "sha256": "a9ec01ef83c2e2aeecd30ff83558f9e702ef0ad0faef6e08fa968334fd170a41", + "size": 6029 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/models/retrieve", + "status": "success", + "path": "en/api/ruby/models/retrieve.md", + "sha256": "b458095d57e2abe4e69543d578c25a37d32dfb695eb19b84f90cf032ac73e653", + "size": 5700 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta", + "status": "success", + "path": "en/api/ruby/beta.md", + "sha256": "3f0457677f93da510b856229b3b5d5dfc72da4df6fdfe5a6c93b23c0e89d7780", + "size": 1599144 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/models", + "status": "success", + "path": "en/api/ruby/beta/models.md", + "sha256": "9591a2161e4be1ef29617b47f82208a19a39ca65a4ed711b619ddb6acd1c781b", + "size": 22702 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/models/list", + "status": "success", + "path": "en/api/ruby/beta/models/list.md", + "sha256": "6650a1dd1bfcdb8e80832e9c5a3b4c287772fc464e607d7ebdcabe1e02dd5e9a", + "size": 6127 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/models/retrieve", + "status": "success", + "path": "en/api/ruby/beta/models/retrieve.md", + "sha256": "b72ff648c7433ea6170ffd7f5daca8e0aa35d6702743a2af45b734c1ab4ef1b2", + "size": 5808 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/messages", + "status": "success", + "path": "en/api/ruby/beta/messages.md", + "sha256": "f9bcba1814fa5ab8e27248220cb6b40fc092606d36b3ee93e1adc2ed6aead3ff", + "size": 1014123 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/messages/create", + "status": "success", + "path": "en/api/ruby/beta/messages/create.md", + "sha256": "f35ca366f2c805b3266b4f17e1d1e2709852f787696306309b155dcfed6d5c67", + "size": 140523 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/messages/count_tokens", + "status": "success", + "path": "en/api/ruby/beta/messages/count_tokens.md", + "sha256": "0e232501f3e1c9425fef3c92b3caf6d5623bed1b8df50a9d9d69376ec221c476", + "size": 108814 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/messages/batches", + "status": "success", + "path": "en/api/ruby/beta/messages/batches.md", + "sha256": "e656db963a6096c131d2b89977beeaa5332f823f6763b4210ba08fc4460c5bf1", + "size": 281327 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/messages/batches/create", + "status": "success", + "path": "en/api/ruby/beta/messages/batches/create.md", + "sha256": "418a307d4abd91292e2958101116e79b7268d34ba651b24844431c8f1461e160", + "size": 125151 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/messages/batches/retrieve", + "status": "success", + "path": "en/api/ruby/beta/messages/batches/retrieve.md", + "sha256": "37d7ef9101ea4125d2fadd0026a1c4a68ed2c3dfa0e3d231b6b4713cded42ae6", + "size": 4520 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/messages/batches/list", + "status": "success", + "path": "en/api/ruby/beta/messages/batches/list.md", + "sha256": "bc2e47acd7e8720cbd2ecb4fb0922189a42a6d9ac673666894c79732a7880534", + "size": 4694 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/messages/batches/cancel", + "status": "success", + "path": "en/api/ruby/beta/messages/batches/cancel.md", + "sha256": "25aad8cfbf8a9da7c9ca64195ed67eb95711869ed0d1f8f7885d6284f9e0e66e", + "size": 4832 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/messages/batches/delete", + "status": "success", + "path": "en/api/ruby/beta/messages/batches/delete.md", + "sha256": "7a1d5737c3446c87021ac739e45e1c51f5d189574ffd2dbfa57b43d63f4dcc75", + "size": 2027 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/messages/batches/results", + "status": "success", + "path": "en/api/ruby/beta/messages/batches/results.md", + "sha256": "7f45fa4d84cbc872c5b3039b9e1b8ee9d77eabdf2ebcd03382f2d4ee5981a303", + "size": 36691 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/agents", + "status": "success", + "path": "en/api/ruby/beta/agents.md", + "sha256": "79a0598e7f8b5820a286d681ef45b0f6f100638a1c0a93527b5e761088da2116", + "size": 98651 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/agents/create", + "status": "success", + "path": "en/api/ruby/beta/agents/create.md", + "sha256": "87c9767940c103c9055d3090bf6e8da6faa265e1c5dcd034e57c59a7c755f292", + "size": 17909 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/agents/list", + "status": "success", + "path": "en/api/ruby/beta/agents/list.md", + "sha256": "99698b878b6c561ec3b337021b931f808e578ca18e5fe22b900886035bb35009", + "size": 8415 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/agents/retrieve", + "status": "success", + "path": "en/api/ruby/beta/agents/retrieve.md", + "sha256": "9c32ed5861bedcd0dbf01a3cbb2a560c7674109795083a5650d244658b9ecf8c", + "size": 8234 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/agents/update", + "status": "success", + "path": "en/api/ruby/beta/agents/update.md", + "sha256": "2660beec3953d2c0ce2583c058bc256888bd68bb36ad95b2f4c1fbc7340eb712", + "size": 18545 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/agents/archive", + "status": "success", + "path": "en/api/ruby/beta/agents/archive.md", + "sha256": "d30bb9c8017f91e3e9529e3305d43bebd7bd70e6f2c9c0bc543d204cc4bf0e0d", + "size": 8137 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/agents/versions", + "status": "success", + "path": "en/api/ruby/beta/agents/versions.md", + "sha256": "a26051b2f28de391d198af11cbc70f214654612498b465f539214a75eebd926b", + "size": 8255 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/agents/versions/list", + "status": "success", + "path": "en/api/ruby/beta/agents/versions/list.md", + "sha256": "b916e48a62841a1173bb6c3627c5673f96ca7dfe2bebefab139231f88974d1cf", + "size": 8243 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/environments", + "status": "success", + "path": "en/api/ruby/beta/environments.md", + "sha256": "c1acab4aaee716baf46e2c369c8ae4bd7448c81d9730a280ff5b5687240de689", + "size": 34318 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/environments/create", + "status": "success", + "path": "en/api/ruby/beta/environments/create.md", + "sha256": "ecc151688c29d8da0b04f83f2da3260555ae0004773f55d073d268d425fb92b0", + "size": 5991 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/environments/list", + "status": "success", + "path": "en/api/ruby/beta/environments/list.md", + "sha256": "beb4e9f70607fe567768a2fbd2e89a4366f60968e937fdc23ed375e83e334004", + "size": 3929 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/environments/retrieve", + "status": "success", + "path": "en/api/ruby/beta/environments/retrieve.md", + "sha256": "a3385edee7398c69267ae2589349d827e3fa490d17ee03609b7e30589f9beb65", + "size": 3772 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/environments/update", + "status": "success", + "path": "en/api/ruby/beta/environments/update.md", + "sha256": "cbd44a41ac5ef8ccd57dd5733b4b0c6a8c2544a9be90540097cbf2c329418209", + "size": 6091 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/environments/delete", + "status": "success", + "path": "en/api/ruby/beta/environments/delete.md", + "sha256": "495c1b50050a3790b765ae1ef2de8e3def30fa0fff4694cd8b8ba870ed660752", + "size": 1758 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/environments/archive", + "status": "success", + "path": "en/api/ruby/beta/environments/archive.md", + "sha256": "38de126bae003431e76caf3d0c93aa39abed2af3216039d418893f30ba8c63cb", + "size": 3830 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/sessions", + "status": "success", + "path": "en/api/ruby/beta/sessions.md", + "sha256": "1e917b22c760e15be0a366afe256d61c49a0fb4c4d4a5f9e1f8aff43043d7b5a", + "size": 331279 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/sessions/create", + "status": "success", + "path": "en/api/ruby/beta/sessions/create.md", + "sha256": "c1cbba609a241300bf822b73d8423ebae0ce819ec4d6926f09ae9b02106a4f5c", + "size": 13500 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/sessions/list", + "status": "success", + "path": "en/api/ruby/beta/sessions/list.md", + "sha256": "870ee171e4d5cd6281ad531c3b8d72c75eb29e2b7ab5192e03895cc3c0abb5e8", + "size": 11829 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/sessions/retrieve", + "status": "success", + "path": "en/api/ruby/beta/sessions/retrieve.md", + "sha256": "60772995115323962578b4d839346c444dadb579741a5cb194d89841efb4c40d", + "size": 11064 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/sessions/update", + "status": "success", + "path": "en/api/ruby/beta/sessions/update.md", + "sha256": "38de0608faf138c0d3b27b22e169a8843a475a77ec65f1bc02967eef6f3d3aa0", + "size": 11423 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/sessions/delete", + "status": "success", + "path": "en/api/ruby/beta/sessions/delete.md", + "sha256": "ab67f391e596295f69ffc455092ac6c442d4620a99d92b6e7320d70f91639a2b", + "size": 1649 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/sessions/archive", + "status": "success", + "path": "en/api/ruby/beta/sessions/archive.md", + "sha256": "3153b52ebae57002df1d7474662dbf363be7ee61ea4fd079f97c70908203128d", + "size": 11074 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/sessions/events", + "status": "success", + "path": "en/api/ruby/beta/sessions/events.md", + "sha256": "b0d44151857e7b2963bdbbef7072b14d87561c87133fe128d1ffd226b2c940f3", + "size": 233821 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/sessions/events/list", + "status": "success", + "path": "en/api/ruby/beta/sessions/events/list.md", + "sha256": "dbcc40c66b056cc2d82255f1f835443b1392fa6f6649d02961950aa4cf271c11", + "size": 35594 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/sessions/events/send", + "status": "success", + "path": "en/api/ruby/beta/sessions/events/send.md", + "sha256": "4564ce9e2f53c58a797dd60aca2a5c796a0690584837c20c5aeb2516d3987ac2", + "size": 19477 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/sessions/events/stream", + "status": "success", + "path": "en/api/ruby/beta/sessions/events/stream.md", + "sha256": "59770b32002a12a99879e0fb98a928489161f539694b82db0dddca44f6cdd458", + "size": 35411 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/sessions/resources", + "status": "success", + "path": "en/api/ruby/beta/sessions/resources.md", + "sha256": "e747dd0b8d364b3f5db169ffc32080489aa0358e373e61631213e78676437085", + "size": 16968 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/sessions/resources/add", + "status": "success", + "path": "en/api/ruby/beta/sessions/resources/add.md", + "sha256": "82b170778df0bf88f9b0b7389a57a560b35a33a1b1b70b96e844b145e762194c", + "size": 2003 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/sessions/resources/list", + "status": "success", + "path": "en/api/ruby/beta/sessions/resources/list.md", + "sha256": "685a56abc4afb749450d6ab580429fe9aa5b94cce4904d4009b9b9072a875ef1", + "size": 2769 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/sessions/resources/retrieve", + "status": "success", + "path": "en/api/ruby/beta/sessions/resources/retrieve.md", + "sha256": "2970c33d50a71180f6ee07b0276f6d6bde9545dcc4d6ace493f62810233689e3", + "size": 2691 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/sessions/resources/update", + "status": "success", + "path": "en/api/ruby/beta/sessions/resources/update.md", + "sha256": "150c11064db9daaeb29eaa5d147cdac51b9164f99a957f029e434b3a6d2a6ebc", + "size": 2873 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/sessions/resources/delete", + "status": "success", + "path": "en/api/ruby/beta/sessions/resources/delete.md", + "sha256": "ceaa41502010f433016242edbfff9a722f8934b10c5061ba9105d2325d93891b", + "size": 1804 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/vaults", + "status": "success", + "path": "en/api/ruby/beta/vaults.md", + "sha256": "8bf32f23379e1f0e3d3ac04fe08ac04790cc76a84813bd21cf1c7a4569eb1510", + "size": 56006 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/vaults/create", + "status": "success", + "path": "en/api/ruby/beta/vaults/create.md", + "sha256": "8c12f96d5d753a74fc8e39adb41dfa9702deaabd5788960ef4a0fe6837bc2aec", + "size": 2093 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/vaults/list", + "status": "success", + "path": "en/api/ruby/beta/vaults/list.md", + "sha256": "cd972eb2a71e6f41a43d00c665bd24f8ef4667de09f3f7d21c17b2055bb609fd", + "size": 2114 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/vaults/retrieve", + "status": "success", + "path": "en/api/ruby/beta/vaults/retrieve.md", + "sha256": "6ea90fae5fe575670fa8af58fd98ce3268c65af2d6a2745cd15b914caedc083d", + "size": 1965 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/vaults/update", + "status": "success", + "path": "en/api/ruby/beta/vaults/update.md", + "sha256": "3369c3f7baf0bc9b9f2dff356f07d9ff7aeae181a210d33393679e0cc5e722be", + "size": 2197 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/vaults/delete", + "status": "success", + "path": "en/api/ruby/beta/vaults/delete.md", + "sha256": "07d740133e1e2123a76036d6b62c3f4e2a3de591fa71f84d02e1c9713cb5042b", + "size": 1640 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/vaults/archive", + "status": "success", + "path": "en/api/ruby/beta/vaults/archive.md", + "sha256": "60a764ee80d38ea0b939a262d09ef6cae9664cb25e3789daa90ac72d21c14869", + "size": 1975 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/vaults/credentials", + "status": "success", + "path": "en/api/ruby/beta/vaults/credentials.md", + "sha256": "951515aeec60d7f49eda47ad4e4d56840ef577edba1d1ed6562dc9de9b773d80", + "size": 43187 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/vaults/credentials/create", + "status": "success", + "path": "en/api/ruby/beta/vaults/credentials/create.md", + "sha256": "8526c8c88c5c309250b152a70963c1c0d03e68522354a19b2867266ab94f5d97", + "size": 6921 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/vaults/credentials/list", + "status": "success", + "path": "en/api/ruby/beta/vaults/credentials/list.md", + "sha256": "71635b32193df68726b26734703c7320655bdc706b0fc88e2e82dbd975e7c085", + "size": 4478 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/vaults/credentials/retrieve", + "status": "success", + "path": "en/api/ruby/beta/vaults/credentials/retrieve.md", + "sha256": "7b6588026a34f98b4114656d5aca6399969f9e8f8a5ee1a0bc1e1e1c1e639220", + "size": 4346 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/vaults/credentials/update", + "status": "success", + "path": "en/api/ruby/beta/vaults/credentials/update.md", + "sha256": "2efc2746f0cfd04d7a7e47e6cf2e853ac4c5e87e8feffac1bda1b31fed0b4bb8", + "size": 6425 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/vaults/credentials/delete", + "status": "success", + "path": "en/api/ruby/beta/vaults/credentials/delete.md", + "sha256": "8acf4d9b94998b7ed1469dd6222e6e232cc726f57ced03bb19a88b55494df545", + "size": 1830 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/vaults/credentials/archive", + "status": "success", + "path": "en/api/ruby/beta/vaults/credentials/archive.md", + "sha256": "c628cf3c921b595c115fb79fe6c363abcb4aa89aab482c8a93d7acd7c016fcd7", + "size": 4356 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/files", + "status": "success", + "path": "en/api/ruby/beta/files.md", + "sha256": "ccbc639c3730eef75812ec99408a7a60d2f2e24d451217890333b46e5c3061a7", + "size": 11518 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/files/upload", + "status": "success", + "path": "en/api/ruby/beta/files/upload.md", + "sha256": "8aaa9b2c3dd49231899a1364367246f1242c1af82550da9c9ec4e8c763428125", + "size": 2245 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/files/list", + "status": "success", + "path": "en/api/ruby/beta/files/list.md", + "sha256": "ab35b44f5e6a0b984cf17d6bf1aefd805149c9586576559e93c61b3085a5177c", + "size": 2682 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/files/download", + "status": "success", + "path": "en/api/ruby/beta/files/download.md", + "sha256": "2ce6e08b5748e5919a091e616fb2fd708d9ad99b5dd9dffb0abc4d8f7a539ea3", + "size": 1395 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/files/retrieve_metadata", + "status": "success", + "path": "en/api/ruby/beta/files/retrieve_metadata.md", + "sha256": "3b94dd6f947947acdd59b66536f363f15af354c8b61be6d50be0b9d40ed6129b", + "size": 2277 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/files/delete", + "status": "success", + "path": "en/api/ruby/beta/files/delete.md", + "sha256": "be2dedb313867db41482ffb1f44c27cec0a0018810ff740decf6d3ac080c024e", + "size": 1582 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/skills", + "status": "success", + "path": "en/api/ruby/beta/skills.md", + "sha256": "a1aa7504520cb79853df6b84d4e6c7fb9d6448681effd77c9b0b27f669c361aa", + "size": 25752 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/skills/create", + "status": "success", + "path": "en/api/ruby/beta/skills/create.md", + "sha256": "de0032b23f239c592eb3ccaa350779269259b91d7e5abd0eb0c66ca7fd1a5290", + "size": 2535 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/skills/list", + "status": "success", + "path": "en/api/ruby/beta/skills/list.md", + "sha256": "815332cf94cc75a0d16758e3a3587dc853d6c765f9a1c95d5220aaf65047be51", + "size": 2711 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/skills/retrieve", + "status": "success", + "path": "en/api/ruby/beta/skills/retrieve.md", + "sha256": "72ad936c5d18bbfc73421035e76f171e33a121079e0d50a5e64b21f0a73115bf", + "size": 2362 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/skills/delete", + "status": "success", + "path": "en/api/ruby/beta/skills/delete.md", + "sha256": "81cb6d58d9a8bb91fa235a9677c062f8d14f430318f5e63ae271bdf68d5c1db2", + "size": 1692 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/skills/versions", + "status": "success", + "path": "en/api/ruby/beta/skills/versions.md", + "sha256": "91fed1ceda2af1b9a51aa4e8aa6fd3293eaabd505b79193a87f5a5538cc34cd1", + "size": 13355 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/skills/versions/create", + "status": "success", + "path": "en/api/ruby/beta/skills/versions/create.md", + "sha256": "e299e7412322d06e068a53d90d7a2d41d0bb01a7d34dfe6608efc4b0d503de22", + "size": 2659 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/skills/versions/list", + "status": "success", + "path": "en/api/ruby/beta/skills/versions/list.md", + "sha256": "a414866805c8c81aa81067c274babf9309840b3926a22b301d2d7fd92cd46f40", + "size": 2672 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/skills/versions/retrieve", + "status": "success", + "path": "en/api/ruby/beta/skills/versions/retrieve.md", + "sha256": "284bf501f80f88d65dd99c6e1fcfd1304f1dcb39dcd5ca0f2bb5b01ab2d75051", + "size": 2660 + }, + { + "url": "https://platform.claude.com/docs/en/api/ruby/beta/skills/versions/delete", + "status": "success", + "path": "en/api/ruby/beta/skills/versions/delete.md", + "sha256": "fd7196f1136264ac149b7c3abb736a3d5f2c3b085a8af4ad657d41484531e3db", + "size": 1954 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/completions", + "status": "success", + "path": "en/api/terraform/completions.md", + "sha256": "24f199a805efdbd3a4f3ae294c9072c6f98254c5aac08f3a4e4eb4faaa9206e3", + "size": 91219 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/completions/create", + "status": "success", + "path": "en/api/terraform/completions/create.md", + "sha256": "a2c3776a5581242a65f8cf9ad901a4bcbd0b990c6cbae36b5d79779cb145b999", + "size": 91244 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/messages", + "status": "success", + "path": "en/api/terraform/messages.md", + "sha256": "b56a5e1fbe05e9774bd141232ddafbedcdfd2529835823ef9ce3f6e3fc68c101", + "size": 91210 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/messages/create", + "status": "success", + "path": "en/api/terraform/messages/create.md", + "sha256": "d72b36dfdbf579aeec6f1f5e9d3f568a0704552d50d36bb308b834627ad3f27d", + "size": 91235 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/messages/count_tokens", + "status": "success", + "path": "en/api/terraform/messages/count_tokens.md", + "sha256": "58316f77bbfaacbd8d14f3ee6e07ee76f92787071576e5523e30f6ce86ab89ef", + "size": 91253 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/messages/batches", + "status": "success", + "path": "en/api/terraform/messages/batches.md", + "sha256": "252a94aefbbc669877f12cc96f23f6cf19423ae82f2de1703c7787b585115094", + "size": 91238 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/messages/batches/create", + "status": "success", + "path": "en/api/terraform/messages/batches/create.md", + "sha256": "d3d7dea1146ab24e30210ae01576f0ff3d06ad8dbdaaa000bc990920b554fd10", + "size": 91263 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/messages/batches/retrieve", + "status": "success", + "path": "en/api/terraform/messages/batches/retrieve.md", + "sha256": "6c457b92bac98af88fb34df6c6077b91521c0e02c62072599026c28b5858afdf", + "size": 91269 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/messages/batches/list", + "status": "success", + "path": "en/api/terraform/messages/batches/list.md", + "sha256": "a6adcf6363ece412d06e260fb876601073a5045a6137d0fb4ff471d5f72c97b2", + "size": 91257 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/messages/batches/cancel", + "status": "success", + "path": "en/api/terraform/messages/batches/cancel.md", + "sha256": "2c3f130d770b16db5e53fb7bf7a1417fb71a1b75f97d7db903984294c928ccd9", + "size": 91263 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/messages/batches/delete", + "status": "success", + "path": "en/api/terraform/messages/batches/delete.md", + "sha256": "223ee79da8cae6a7a0f81f03f17f1ee26bec1c94e89b814db8c2fbe4f51505b4", + "size": 91263 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/messages/batches/results", + "status": "success", + "path": "en/api/terraform/messages/batches/results.md", + "sha256": "7f32e9dd40ea01980729ab189a87051ecc2ef2531b60b2bd41d7ecf74464d507", + "size": 91266 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/models", + "status": "success", + "path": "en/api/terraform/models.md", + "sha256": "e555e6da3cffe0bbf7b427bfffdb8e0cac330f993e30e270b27f32d97e9bd6a9", + "size": 91204 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/models/list", + "status": "success", + "path": "en/api/terraform/models/list.md", + "sha256": "8077b49e52dfb3b0091a588e1f9eace78eb69036ad94d8577fff206667d87353", + "size": 91223 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/models/retrieve", + "status": "success", + "path": "en/api/terraform/models/retrieve.md", + "sha256": "027940d6adaadd4089b4eb94186471334e0e285d01611c6ce7a57605a0c2e4a3", + "size": 91235 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta", + "status": "success", + "path": "en/api/terraform/beta.md", + "sha256": "76f5a8ce309f0bb6285261077f75172aeb700e1ebd3cd4f665ef5672b69aca56", + "size": 91198 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/models", + "status": "success", + "path": "en/api/terraform/beta/models.md", + "sha256": "d13714ef7d660fd8837740f1d079c5dd4a37335d8fbbebd507b6180f33556123", + "size": 91223 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/models/list", + "status": "success", + "path": "en/api/terraform/beta/models/list.md", + "sha256": "6dc8a58a52d2ba7c11cc160a44ebb14a277a83d743c52a8579f79e0629e3efb9", + "size": 91242 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/models/retrieve", + "status": "success", + "path": "en/api/terraform/beta/models/retrieve.md", + "sha256": "380131e6eaaafe99f54a1d0243bd65ef2c91a3f6a22abd2b2ff1fc5b2d78bf56", + "size": 91254 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/messages", + "status": "success", + "path": "en/api/terraform/beta/messages.md", + "sha256": "363eed3ed3176096c0c46372864b7e633f969d68ee613bb2afbae1846c95519c", + "size": 91229 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/messages/create", + "status": "success", + "path": "en/api/terraform/beta/messages/create.md", + "sha256": "f6751ec6644db604a3c637ef55c9a95cf2ead6cc63bd30b4adf4f45b92625346", + "size": 91254 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/messages/count_tokens", + "status": "success", + "path": "en/api/terraform/beta/messages/count_tokens.md", + "sha256": "e889212281bee2e4d34053d908240698b4f01e3ede74e987a8675af68252b86e", + "size": 91272 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/messages/batches", + "status": "success", + "path": "en/api/terraform/beta/messages/batches.md", + "sha256": "c76d396d1b2d91ca7bc09b98854e6b0e5d9e4f391c77ec9fba9dfb5da40e02a3", + "size": 91257 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/messages/batches/create", + "status": "success", + "path": "en/api/terraform/beta/messages/batches/create.md", + "sha256": "63a908f9be7585dcb905a45c5bf3033cb84a48c653d6de0ee7e650c99abd5cf7", + "size": 91282 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/messages/batches/retrieve", + "status": "success", + "path": "en/api/terraform/beta/messages/batches/retrieve.md", + "sha256": "c27c0e2fc3ae76a804e9e755ed57dec91539624655d4bb34660f6b70a6f44bba", + "size": 91288 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/messages/batches/list", + "status": "success", + "path": "en/api/terraform/beta/messages/batches/list.md", + "sha256": "25bb418911fa5c5e5aaf60b2a801af530a514d89ad7ce6612a0c2798ea042bdb", + "size": 91276 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/messages/batches/cancel", + "status": "success", + "path": "en/api/terraform/beta/messages/batches/cancel.md", + "sha256": "517de102c46c73ce21763cc3f6b51053c11c786ff2be418d43243e81388bc1bb", + "size": 91282 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/messages/batches/delete", + "status": "success", + "path": "en/api/terraform/beta/messages/batches/delete.md", + "sha256": "a3482eac5d30a8c4cf529651cec78b2f923e08d96edd75ba555976b1265a2928", + "size": 91282 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/messages/batches/results", + "status": "success", + "path": "en/api/terraform/beta/messages/batches/results.md", + "sha256": "5b2885c67bf33cea0efb5aa6592690dcf53b4840164a6b709351e9d52647a739", + "size": 91285 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/agents", + "status": "success", + "path": "en/api/terraform/beta/agents.md", + "sha256": "2384c4ca8717a99a54584a561f81be0c3673da77cfcea547ed856051b29ef937", + "size": 91223 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/agents/create", + "status": "success", + "path": "en/api/terraform/beta/agents/create.md", + "sha256": "62b06a6a7b81b095ba301ef83d61439136e2241df811bea9213b923a37c43d07", + "size": 91248 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/agents/list", + "status": "success", + "path": "en/api/terraform/beta/agents/list.md", + "sha256": "74be1b75ebb71deda292aa6c2ad9751ce55bb0d50c10b3f90821187edd6b4652", + "size": 91242 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/agents/retrieve", + "status": "success", + "path": "en/api/terraform/beta/agents/retrieve.md", + "sha256": "d3b080c39b0fd9feff66f359993992f77a540a32d0ad57159e610f7360999a8b", + "size": 91254 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/agents/update", + "status": "success", + "path": "en/api/terraform/beta/agents/update.md", + "sha256": "d59bb199ebfd26694872dfde4bb40cd8f5bdf96f4f576d9ca815c4b11d4b6b0c", + "size": 91248 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/agents/archive", + "status": "success", + "path": "en/api/terraform/beta/agents/archive.md", + "sha256": "f463e8e11c39b1c5b983d7c560fa9f30dab4a97e03c8638f671f0a9c764ee8f7", + "size": 91251 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/agents/versions", + "status": "success", + "path": "en/api/terraform/beta/agents/versions.md", + "sha256": "9d97eca7a6585d6f7f3fcd8c8efbdbf8cfa9f3bbb70d0dd7a35b074ff27e1395", + "size": 91254 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/agents/versions/list", + "status": "success", + "path": "en/api/terraform/beta/agents/versions/list.md", + "sha256": "36dfbc89255e399614014b3787f63c41fc1813b902f1a9c33801a1a414f61f09", + "size": 91273 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/environments", + "status": "success", + "path": "en/api/terraform/beta/environments.md", + "sha256": "f08b1ba90c3820879bb2ec13aded26dbd2f5f1a5483655c5b031c6a2dac0f149", + "size": 91241 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/environments/create", + "status": "success", + "path": "en/api/terraform/beta/environments/create.md", + "sha256": "a86b65a24fe53b6de9eb2c476acd9d1d40f9120ebe5f070cf565d9d331c9190a", + "size": 91266 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/environments/list", + "status": "success", + "path": "en/api/terraform/beta/environments/list.md", + "sha256": "ef58549230c8be84b89be1a163fc2171deaeb9fb0c83ae582143e1b422f01700", + "size": 91260 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/environments/retrieve", + "status": "success", + "path": "en/api/terraform/beta/environments/retrieve.md", + "sha256": "60e30cd5485261cedc05f9ad5e99f08dcb4483ecc9ad1f04eabdfe52784c64ed", + "size": 91272 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/environments/update", + "status": "success", + "path": "en/api/terraform/beta/environments/update.md", + "sha256": "19d8d4d2a37b822c5d9715815f1c61964008bd3f5645857a602651b09a0ee89b", + "size": 91266 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/environments/delete", + "status": "success", + "path": "en/api/terraform/beta/environments/delete.md", + "sha256": "4dc19d4d8cae11a0459c1fb29e3826f15921d49a113e6cf02054674981ed37d1", + "size": 91266 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/environments/archive", + "status": "success", + "path": "en/api/terraform/beta/environments/archive.md", + "sha256": "7c1f09f357a1d6d00b2326895a41ab1268cfbd2a98482b6b78adb9caefa01d6a", + "size": 91269 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/sessions", + "status": "success", + "path": "en/api/terraform/beta/sessions.md", + "sha256": "43e8f1742d695f1d97415c1b1b8d11ea7f4916df46df3e1b5fe2be35df68e4bf", + "size": 91229 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/sessions/create", + "status": "success", + "path": "en/api/terraform/beta/sessions/create.md", + "sha256": "bd21e1c6215269fcac36048a9087404a4b703a89cb30dbd1567aafa1410c286f", + "size": 91254 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/sessions/list", + "status": "success", + "path": "en/api/terraform/beta/sessions/list.md", + "sha256": "68db1f0c42f558cbf6ca8d4f2bd60a002d6d402d04eb6054929b54e5ad5a73b6", + "size": 91248 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/sessions/retrieve", + "status": "success", + "path": "en/api/terraform/beta/sessions/retrieve.md", + "sha256": "8c0835fbc81c95372f4831a7bd9e8583d94c0a2f86136d9a476f69468ddc03c0", + "size": 91260 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/sessions/update", + "status": "success", + "path": "en/api/terraform/beta/sessions/update.md", + "sha256": "cdbbc83a3236b9800ee19693277c1c11aea1c5cf988c97fdfd100e1cb67306a2", + "size": 91254 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/sessions/delete", + "status": "success", + "path": "en/api/terraform/beta/sessions/delete.md", + "sha256": "a9b84442647367a76d646d880bbbec942df288c1c4f69005d459132932ba9c7c", + "size": 91254 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/sessions/archive", + "status": "success", + "path": "en/api/terraform/beta/sessions/archive.md", + "sha256": "bdf18e87141d887b43b91244a82acce56b14b4fbbbc884c91f452158edf56852", + "size": 91257 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/sessions/events", + "status": "success", + "path": "en/api/terraform/beta/sessions/events.md", + "sha256": "e3894e9564165775b7e027da89c9c6cf7fa14f77f3e5a03c243af3ffedc14156", + "size": 91254 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/sessions/events/list", + "status": "success", + "path": "en/api/terraform/beta/sessions/events/list.md", + "sha256": "010b1024e28561c359f007542c53562c737a01172aaca4a750abafda8b65f374", + "size": 91273 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/sessions/events/send", + "status": "success", + "path": "en/api/terraform/beta/sessions/events/send.md", + "sha256": "007d7351bab3f91d062274cc7dd01ea4073a4c15e4e990dc733717a2dcaa8ca3", + "size": 91273 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/sessions/events/stream", + "status": "success", + "path": "en/api/terraform/beta/sessions/events/stream.md", + "sha256": "1fc8522f8cead06c49a06dbe8eeb1af79a355877a7a3cd04373220b4aaed9926", + "size": 91279 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/sessions/resources", + "status": "success", + "path": "en/api/terraform/beta/sessions/resources.md", + "sha256": "8a650bd0975434103f785e0e6ad62dae23d463f8882099dc4b473b5810bcef48", + "size": 91263 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/sessions/resources/add", + "status": "success", + "path": "en/api/terraform/beta/sessions/resources/add.md", + "sha256": "b5853300c975de50ae125f437daa3cb9758e96d3e2c0d021ed111030098fd0dc", + "size": 91279 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/sessions/resources/list", + "status": "success", + "path": "en/api/terraform/beta/sessions/resources/list.md", + "sha256": "224a36d4eb6b120a194654667e3389453c3733c97e3ec04832808c0d9e0c98e6", + "size": 91282 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/sessions/resources/retrieve", + "status": "success", + "path": "en/api/terraform/beta/sessions/resources/retrieve.md", + "sha256": "081d800ac2a2366295d7c489190c8a95ebe71666885793d9d9b716b2680e4020", + "size": 91294 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/sessions/resources/update", + "status": "success", + "path": "en/api/terraform/beta/sessions/resources/update.md", + "sha256": "b16713ffe47931112dcfaaac299d7387d7471c8eb72a2d17c8e25ed308e8d464", + "size": 91288 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/sessions/resources/delete", + "status": "success", + "path": "en/api/terraform/beta/sessions/resources/delete.md", + "sha256": "32426bf64c327fb67aa7efa90856b8e802c971ac0305d53a8427267b1418fb0c", + "size": 91288 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/vaults", + "status": "success", + "path": "en/api/terraform/beta/vaults.md", + "sha256": "e58106e5e5af2df91ebc238db59288fbf595c45e737707dcdf8bc1444c6e123e", + "size": 91223 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/vaults/create", + "status": "success", + "path": "en/api/terraform/beta/vaults/create.md", + "sha256": "dd0c2831348fb1ff326cd898d4dbd43bf9209e2fc4f55eabec7dd99df8c1aa79", + "size": 91248 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/vaults/list", + "status": "success", + "path": "en/api/terraform/beta/vaults/list.md", + "sha256": "0962546ec2893304c241d9a4dbdf0a85e07ab9ab98235de99a01e6babaca91bc", + "size": 91242 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/vaults/retrieve", + "status": "success", + "path": "en/api/terraform/beta/vaults/retrieve.md", + "sha256": "3e1a8eaf3a5761c1af5ef992a63410d31e21bbb1d8944caaa22bbe74b4ce6771", + "size": 91254 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/vaults/update", + "status": "success", + "path": "en/api/terraform/beta/vaults/update.md", + "sha256": "179cb65d4b58c6137fa919748aec268875af08a1636082943bace16330bd6dde", + "size": 91248 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/vaults/delete", + "status": "success", + "path": "en/api/terraform/beta/vaults/delete.md", + "sha256": "44067004464ac98098c87c28322079b02eb02dfa4a8a07be7c5d6ad5fdabcdf4", + "size": 91248 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/vaults/archive", + "status": "success", + "path": "en/api/terraform/beta/vaults/archive.md", + "sha256": "016004d91c318d8082c1a5a6da9560d5fc7b7a01abbb20eecae51fbd94e7bb5f", + "size": 91251 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/vaults/credentials", + "status": "success", + "path": "en/api/terraform/beta/vaults/credentials.md", + "sha256": "e3c7d5f55a3e4bbd33873ead9af3d5f42e9ffa8e291f8a98a40653eaa1cb3e8e", + "size": 91263 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/vaults/credentials/create", + "status": "success", + "path": "en/api/terraform/beta/vaults/credentials/create.md", + "sha256": "7ee5b6d42a0415ffe83d25b27ae62ad95b53c820373f2f07a1147051694109bb", + "size": 91288 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/vaults/credentials/list", + "status": "success", + "path": "en/api/terraform/beta/vaults/credentials/list.md", + "sha256": "acd56c45b8681eeb4964a9ddbc5c9abf04911e5f597568d006aaa8442bd64c0c", + "size": 91282 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/vaults/credentials/retrieve", + "status": "success", + "path": "en/api/terraform/beta/vaults/credentials/retrieve.md", + "sha256": "35157efb21c3a04ad45bb6b73b1fee5726ec42c9b29a2ea0a9455d7bff4b2636", + "size": 91294 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/vaults/credentials/update", + "status": "success", + "path": "en/api/terraform/beta/vaults/credentials/update.md", + "sha256": "3249087dade0a807294445748df5c9f6c5c585e687c8c0414d49dbbd3fd9ade4", + "size": 91288 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/vaults/credentials/delete", + "status": "success", + "path": "en/api/terraform/beta/vaults/credentials/delete.md", + "sha256": "6b1fb7c4a37fdcd243119624ab29741222af0f52ee62a6d643fdbb08aca1d180", + "size": 91288 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/vaults/credentials/archive", + "status": "success", + "path": "en/api/terraform/beta/vaults/credentials/archive.md", + "sha256": "55e48589848bd687ebeb48c9bfb893b0745ec00286c8fb0c0348dae587c4e45c", + "size": 91291 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/files", + "status": "success", + "path": "en/api/terraform/beta/files.md", + "sha256": "c0b16bf5ada04635b0bc986ef8f4a5ebbdf45a1a5b65cd99324f68d669f6157a", + "size": 91220 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/files/upload", + "status": "success", + "path": "en/api/terraform/beta/files/upload.md", + "sha256": "93044de90240f6fa6aa81f0967d1481523253f4ddfc3e6cedbf79197e73ecc49", + "size": 91245 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/files/list", + "status": "success", + "path": "en/api/terraform/beta/files/list.md", + "sha256": "b0b7bba8317db37dfde8742225c8562a071064d6170608875b2ae46f4c645f68", + "size": 91239 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/files/download", + "status": "success", + "path": "en/api/terraform/beta/files/download.md", + "sha256": "04bc5b1bcca1b9ecbaa87ac0ba56eaabffaef8944b261117327a2e4e0609336a", + "size": 91251 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/files/retrieve_metadata", + "status": "success", + "path": "en/api/terraform/beta/files/retrieve_metadata.md", + "sha256": "e7d7a06cadc56c66f6eae19452f9a02cde74e19112275357f76d50a373b184d0", + "size": 91278 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/files/delete", + "status": "success", + "path": "en/api/terraform/beta/files/delete.md", + "sha256": "41f62bd7270fe6d88311cdc4c323851544100480f09778402e3577fb1fac7080", + "size": 91245 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/skills", + "status": "success", + "path": "en/api/terraform/beta/skills.md", + "sha256": "b08cf5104fbffb6eb07f875a4e3aacf93012f378193d3083a5982daa3f21790f", + "size": 91223 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/skills/create", + "status": "success", + "path": "en/api/terraform/beta/skills/create.md", + "sha256": "8c3dcfdcd17b6f64af04a66d7b6b1228f52c512c56881fbe73f373057698545b", + "size": 91248 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/skills/list", + "status": "success", + "path": "en/api/terraform/beta/skills/list.md", + "sha256": "7c1ef0921819d6bf97f318747aa9483fe461ce34934152d44a8eace20497a4ec", + "size": 91242 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/skills/retrieve", + "status": "success", + "path": "en/api/terraform/beta/skills/retrieve.md", + "sha256": "da209c2e60ac759d36a68178f85e9d280b07669dfc428e490338a18cb67480d8", + "size": 91254 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/skills/delete", + "status": "success", + "path": "en/api/terraform/beta/skills/delete.md", + "sha256": "11539a19d742f858b06173db8da188ab6119a8173fbdef4167d6e25077b6432b", + "size": 91248 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/skills/versions", + "status": "success", + "path": "en/api/terraform/beta/skills/versions.md", + "sha256": "da9ed148ff56b206ff69571e7d5cb21da5c161bfd2045d1448432838e2e47bcf", + "size": 91254 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/skills/versions/create", + "status": "success", + "path": "en/api/terraform/beta/skills/versions/create.md", + "sha256": "f6c51639b72db1fb8c0eb2a444cb94723a14fea6c4348d500e97c4bf70fc1b00", + "size": 91279 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/skills/versions/list", + "status": "success", + "path": "en/api/terraform/beta/skills/versions/list.md", + "sha256": "b7586989dac8d4f7644a71017c79d56a3ed5a10c0d88d079dda61ee581fa635c", + "size": 91273 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/skills/versions/retrieve", + "status": "success", + "path": "en/api/terraform/beta/skills/versions/retrieve.md", + "sha256": "538235ba2fd15959a0ed61cdc9411278d984469a46f54170021df7a9e5e37415", + "size": 91285 + }, + { + "url": "https://platform.claude.com/docs/en/api/terraform/beta/skills/versions/delete", + "status": "success", + "path": "en/api/terraform/beta/skills/versions/delete.md", + "sha256": "72ff039e376fd174853adb07241d2ae93982e12ba9a08ef6ab67c99ca39ff641", + "size": 91279 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/completions", + "status": "success", + "path": "en/api/cli/completions.md", + "sha256": "f9524831e9dd58858e90095eea2ef692bab2eb6d3df50748d1a2f2687830179d", + "size": 8201 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/completions/create", + "status": "success", + "path": "en/api/cli/completions/create.md", + "sha256": "bc91dabfe458359566d83e2621b90265d492cdd5b5158d695f6ab01c849a7cb9", + "size": 5802 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/messages", + "status": "success", + "path": "en/api/cli/messages.md", + "sha256": "31c7ed25987f97db1f27534987a9cc11d943311b3fe2bf8f34e1c8019768ddfa", + "size": 557697 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/messages/create", + "status": "success", + "path": "en/api/cli/messages/create.md", + "sha256": "2fa5d01cade2dc0d88486b8efcbc7422f7b73a625c641eaef4f4c5689cc2538a", + "size": 30178 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/messages/count_tokens", + "status": "success", + "path": "en/api/cli/messages/count_tokens.md", + "sha256": "3d5b6299d305ceda639355f47a43204ff19c4e1a4a0e387e57882cb267da56e5", + "size": 6983 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/messages/batches", + "status": "success", + "path": "en/api/cli/messages/batches.md", + "sha256": "8fadacea02f6cd713fa10cf69d76b05c163d57783ef3dfb21cd75758f8dad855", + "size": 119148 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/messages/batches/create", + "status": "success", + "path": "en/api/cli/messages/batches/create.md", + "sha256": "8944e8b5443ce4fd3f852ef7f895deeaa820c723482e773902bf17454a1aae72", + "size": 3667 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/messages/batches/retrieve", + "status": "success", + "path": "en/api/cli/messages/batches/retrieve.md", + "sha256": "0cba952f88c24c0659e6ae42d778aedd48eb676081ed59eae8fdaea5f59178d8", + "size": 3427 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/messages/batches/list", + "status": "success", + "path": "en/api/cli/messages/batches/list.md", + "sha256": "f900790450bfc351e437900c71f86ad3cd4f4dcba2a3f0162391e6c93e4e8de5", + "size": 4088 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/messages/batches/cancel", + "status": "success", + "path": "en/api/cli/messages/batches/cancel.md", + "sha256": "55b774905556254ab22c0c5873980544fa6552d320125c338566d7abb26b3eac", + "size": 3739 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/messages/batches/delete", + "status": "success", + "path": "en/api/cli/messages/batches/delete.md", + "sha256": "7668b24b941d2ce6d50676ce6aa046b5ac48ab67a0b670141123e1513eb4eb36", + "size": 839 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/messages/batches/results", + "status": "success", + "path": "en/api/cli/messages/batches/results.md", + "sha256": "b510a3c30fbe81957449baf2ff01da9067676014515013e5f7088d3897da34cc", + "size": 26319 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/models", + "status": "success", + "path": "en/api/cli/models.md", + "sha256": "3936ae0c6e68effff4dfb9120f8bf13886d5b4f0cb9efa6aa494d4a8f1355f22", + "size": 22169 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/models/list", + "status": "success", + "path": "en/api/cli/models/list.md", + "sha256": "e974eb880835cd623fa2537e6fc8fd25b864089d5877686a56c5e8239e4fd8d9", + "size": 5915 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/models/retrieve", + "status": "success", + "path": "en/api/cli/models/retrieve.md", + "sha256": "88d62a23096c43ff101df9bc264e0f30818aabae61d43caf96df4af7f2ca71e9", + "size": 4963 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta", + "status": "success", + "path": "en/api/cli/beta.md", + "sha256": "3e0d7d1f7d3603080757f1e5c94ea8639727aedc38aeb66dd648303f7790dcfc", + "size": 1221715 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/models", + "status": "success", + "path": "en/api/cli/beta/models.md", + "sha256": "385ff34a985419069fb011cd7489b161d1b8dbaf856df9beac38784f2158f000", + "size": 22272 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/models/list", + "status": "success", + "path": "en/api/cli/beta/models/list.md", + "sha256": "5ec77a878ac157492e27f9afdf6277299424ee48854f8be48a4aaf04ec9352af", + "size": 5933 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/models/retrieve", + "status": "success", + "path": "en/api/cli/beta/models/retrieve.md", + "sha256": "dbbcb4692adbd68f5932caaeeb99d56ed6311af59d0d5344bb7957d5128637d2", + "size": 4978 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/messages", + "status": "success", + "path": "en/api/cli/beta/messages.md", + "sha256": "61490983d6ad378d475ce727d78742bdcce73b4d855207391b8ada6d8db418c5", + "size": 693001 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/messages/create", + "status": "success", + "path": "en/api/cli/beta/messages/create.md", + "sha256": "e90f974a815c5a0a467016536eeaf21870d0ebd97ea4b755325f36309c0315ba", + "size": 39587 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/messages/count_tokens", + "status": "success", + "path": "en/api/cli/beta/messages/count_tokens.md", + "sha256": "bd26ee4ac028c5af1c382a377269ff111c9c8e6437352f45371b4d673bebb12f", + "size": 8409 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/messages/batches", + "status": "success", + "path": "en/api/cli/beta/messages/batches.md", + "sha256": "28ddb4f4b9219d40a25f479a8df1b2527e0ae409e24b5974720818ecfc9cdc15", + "size": 155556 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/messages/batches/create", + "status": "success", + "path": "en/api/cli/beta/messages/batches/create.md", + "sha256": "334c15f2b78aaad433dcb1436803156de9df3b50a0be27c59db8a2f7522d27a7", + "size": 3820 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/messages/batches/retrieve", + "status": "success", + "path": "en/api/cli/beta/messages/batches/retrieve.md", + "sha256": "08ecbfd6afb427400990a03e6532d20a30f20aa660ffb42e4bfd41916aea7581", + "size": 3554 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/messages/batches/list", + "status": "success", + "path": "en/api/cli/beta/messages/batches/list.md", + "sha256": "c6ef13fa77b5b094f1e09a77574881cdad3c428cf1bbfababb3484c2ca2d7db0", + "size": 4271 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/messages/batches/cancel", + "status": "success", + "path": "en/api/cli/beta/messages/batches/cancel.md", + "sha256": "5f2508da1ca9906ac68fa76f851ac067730c9ad85ca761cc9e267e2661af60fc", + "size": 3866 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/messages/batches/delete", + "status": "success", + "path": "en/api/cli/beta/messages/batches/delete.md", + "sha256": "00d17c475dba95e4903b39db5fd8eb4e9f770fb028c8c3aff178fd9bccc608eb", + "size": 966 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/messages/batches/results", + "status": "success", + "path": "en/api/cli/beta/messages/batches/results.md", + "sha256": "305bbd9a506c3d308e11a8bd1da0a8ccd42f39396c23c2f7032b302f1b38b70a", + "size": 35538 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/agents", + "status": "success", + "path": "en/api/cli/beta/agents.md", + "sha256": "be5773e1e8020949ab2d736e7f1d8b113fcd6ef03f05383aff32fbf05af77a2b", + "size": 78677 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/agents/create", + "status": "success", + "path": "en/api/cli/beta/agents/create.md", + "sha256": "680366fac3ab1ddc48fd26711ffe63a0563e8128c8e5940aebf89987a3fc8b64", + "size": 8598 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/agents/list", + "status": "success", + "path": "en/api/cli/beta/agents/list.md", + "sha256": "411152079ae8bf2f20a1776de18da702759353d9b45e8964f733d32d36a81a5e", + "size": 8210 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/agents/retrieve", + "status": "success", + "path": "en/api/cli/beta/agents/retrieve.md", + "sha256": "88d1fef65a29c88a6cc513b96fa5a7ebdfe970624bbf997e6a91b0546654815d", + "size": 7500 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/agents/update", + "status": "success", + "path": "en/api/cli/beta/agents/update.md", + "sha256": "783932565a8dda4e5770c2f80f2b60478757a0401c7bc9da6d34e5030d1ebe8c", + "size": 9301 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/agents/archive", + "status": "success", + "path": "en/api/cli/beta/agents/archive.md", + "sha256": "1976a444f8a9db8a560b629b05f9492704d49ed892b78d4e2b8f15e2a1e74f16", + "size": 7354 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/agents/versions", + "status": "success", + "path": "en/api/cli/beta/agents/versions.md", + "sha256": "e85655ff9ae416933f42403aa5135fc9b40708cff3695df2dcfa5d122e1e35c2", + "size": 8029 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/agents/versions/list", + "status": "success", + "path": "en/api/cli/beta/agents/versions/list.md", + "sha256": "f418019f97de37f6027853d8d63b0ea9bf4fa8cd37a4637e01b0e0b660047f52", + "size": 8017 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/environments", + "status": "success", + "path": "en/api/cli/beta/environments.md", + "sha256": "0bb5efafae69bd81d9faad0a15ef417613db5a366c7273625f68426cfda700c4", + "size": 26374 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/environments/create", + "status": "success", + "path": "en/api/cli/beta/environments/create.md", + "sha256": "95c9050cef72fe23911b73f6042b6503b9cdc4d753306cc7fb09ccc2b80fe15b", + "size": 3289 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/environments/list", + "status": "success", + "path": "en/api/cli/beta/environments/list.md", + "sha256": "6731b616a561ba0e7184ebb25076af025cd24a68216ccfb0a531e375fa04ee88", + "size": 3573 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/environments/retrieve", + "status": "success", + "path": "en/api/cli/beta/environments/retrieve.md", + "sha256": "b1cea8a77d98830184054330e7a4299e8b36fd2c7591888df6e19d5ab109ad00", + "size": 2852 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/environments/update", + "status": "success", + "path": "en/api/cli/beta/environments/update.md", + "sha256": "d78c270b79eed2a9b34485d4f0ccf7e0de2df8484846a560e34f4ca97c8e4b21", + "size": 3414 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/environments/delete", + "status": "success", + "path": "en/api/cli/beta/environments/delete.md", + "sha256": "c517e564e3f32013663fc411666e3552a216c0976a0fbdb06c225f4f9c1ade4a", + "size": 681 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/environments/archive", + "status": "success", + "path": "en/api/cli/beta/environments/archive.md", + "sha256": "671d7c4962724f81fe558fbc56b41a1ab2700185dc4d18a160afe394ce0ff9cb", + "size": 2910 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/sessions", + "status": "success", + "path": "en/api/cli/beta/sessions.md", + "sha256": "6b973b9f793dd32e616a13672dbf6e900977696bb05e20b614cc2ff94cce7d85", + "size": 333479 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/sessions/create", + "status": "success", + "path": "en/api/cli/beta/sessions/create.md", + "sha256": "e2bbff0c12865725d823bc672611c5eebb2798246e59b9e77c868e995fbfd87d", + "size": 11473 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/sessions/list", + "status": "success", + "path": "en/api/cli/beta/sessions/list.md", + "sha256": "8cef3b6445d7af0250068e81f922f9c3ec4ae67195ccae9bc32e536439f2ebb1", + "size": 12202 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/sessions/retrieve", + "status": "success", + "path": "en/api/cli/beta/sessions/retrieve.md", + "sha256": "d3ac2a479ff03f5e17914298e7a005aecb4140211d692258dbc783e8e6e71a39", + "size": 10615 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/sessions/update", + "status": "success", + "path": "en/api/cli/beta/sessions/update.md", + "sha256": "95ca9252e804372e24efe865f30cc8a59f7869857c6af0bb973f032b9a4bd268", + "size": 11061 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/sessions/delete", + "status": "success", + "path": "en/api/cli/beta/sessions/delete.md", + "sha256": "8e627406a19efed22c9962e3046c1657bc7c3be12e329444328662bf9d55744d", + "size": 625 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/sessions/archive", + "status": "success", + "path": "en/api/cli/beta/sessions/archive.md", + "sha256": "1ef9c3628534874b6d15a986b5ba75b6e3ec12c1fb7a75196b9f1eb598cb0946", + "size": 10625 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/sessions/events", + "status": "success", + "path": "en/api/cli/beta/sessions/events.md", + "sha256": "522fe555e16ec20d424a915851f2d17f4d8c5eb580710afebefdec869b4c2fed", + "size": 244487 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/sessions/events/list", + "status": "success", + "path": "en/api/cli/beta/sessions/events/list.md", + "sha256": "a9343f872e1836547e6ef4a44985d5f0a42d6175e7f24311d060bf5dbfd7f014", + "size": 39257 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/sessions/events/send", + "status": "success", + "path": "en/api/cli/beta/sessions/events/send.md", + "sha256": "1855105335ffa7445f2696e04c5c3cc8e9c0c63bfadb4e532e7c82583c5250e3", + "size": 11078 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/sessions/events/stream", + "status": "success", + "path": "en/api/cli/beta/sessions/events/stream.md", + "sha256": "e9bb0a41602dafc4c0e313b2c633e31dc5dcd8ae7f2af84d81f8122530031b07", + "size": 37458 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/sessions/resources", + "status": "success", + "path": "en/api/cli/beta/sessions/resources.md", + "sha256": "6eedc29a15b6e31a6e932db393800c8b9721f64be42e6569f9613c1f60d987bb", + "size": 11060 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/sessions/resources/add", + "status": "success", + "path": "en/api/cli/beta/sessions/resources/add.md", + "sha256": "1a6a99445e3b566ed0453fcabf4baa68bb03df367fdf8e5524c5452c44648988", + "size": 1076 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/sessions/resources/list", + "status": "success", + "path": "en/api/cli/beta/sessions/resources/list.md", + "sha256": "27007e7fa6fe41eed7e2a9eb9ca6f0d46993f63be56fc48d89fc1635f4780bb5", + "size": 2285 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/sessions/resources/retrieve", + "status": "success", + "path": "en/api/cli/beta/sessions/resources/retrieve.md", + "sha256": "50731264e315acbb0f7adea9154a79ca79b611e94be62ab1327fc4414df71e6b", + "size": 1934 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/sessions/resources/update", + "status": "success", + "path": "en/api/cli/beta/sessions/resources/update.md", + "sha256": "9b545ddf98ddc6a839e8d3c357945f5fca050c1648569ddca3b001046d2e8f0a", + "size": 2137 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/sessions/resources/delete", + "status": "success", + "path": "en/api/cli/beta/sessions/resources/delete.md", + "sha256": "3b1c71ebc944de47fc103acfab6515dec1fef66e783b6752bce5856aef67e4a4", + "size": 824 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/vaults", + "status": "success", + "path": "en/api/cli/beta/vaults.md", + "sha256": "8868e2068a66b46a400c9350831dc4782d7c6e2b99ae0f90abf9eb10258407d0", + "size": 44281 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/vaults/create", + "status": "success", + "path": "en/api/cli/beta/vaults/create.md", + "sha256": "8af0a88a59a12f966f21d54139fb4d99e3e859f08386884c2aa0fdd0e1e0d8d7", + "size": 1134 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/vaults/list", + "status": "success", + "path": "en/api/cli/beta/vaults/list.md", + "sha256": "13d2dea190fcb12bf4e68ff107d357ea6acbb64324fd8a595ea13ab02ac4f8d6", + "size": 1404 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/vaults/retrieve", + "status": "success", + "path": "en/api/cli/beta/vaults/retrieve.md", + "sha256": "8bb9d888a5e077bc2aad983953cd2c286b4c45e382743583a85858a509940c87", + "size": 991 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/vaults/update", + "status": "success", + "path": "en/api/cli/beta/vaults/update.md", + "sha256": "146f123e8137e233114ebbc8e32cb15cff0a973ebb99ba0c97f180dcf0b1f506", + "size": 1286 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/vaults/delete", + "status": "success", + "path": "en/api/cli/beta/vaults/delete.md", + "sha256": "fc20c485b600a9ff1c684085305852dabd6c8618b191ef23347999170824b34d", + "size": 620 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/vaults/archive", + "status": "success", + "path": "en/api/cli/beta/vaults/archive.md", + "sha256": "fb33b123f3dd4d1ddc7527d5bb950b3333ec996294d1ccc2ab00aa39e0d68dd8", + "size": 1001 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/vaults/credentials", + "status": "success", + "path": "en/api/cli/beta/vaults/credentials.md", + "sha256": "5a36da6e49d0bcbca2623342c60b8549461db31f83a9fcb24a25fb0133965614", + "size": 36945 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/vaults/credentials/create", + "status": "success", + "path": "en/api/cli/beta/vaults/credentials/create.md", + "sha256": "04e9615c9cae83f8b63a5d43c0bda356b0620409cf9d7b6ed1c1668379d4ff6f", + "size": 4021 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/vaults/credentials/list", + "status": "success", + "path": "en/api/cli/beta/vaults/credentials/list.md", + "sha256": "fac330d176984ab9dc7739ed67d86429c52f8dc5c7735e47b628511d5fecb54f", + "size": 4116 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/vaults/credentials/retrieve", + "status": "success", + "path": "en/api/cli/beta/vaults/credentials/retrieve.md", + "sha256": "199b5e8b19196fe643e8604a367c3aebd1948db5437e972b9b9d148744545b3e", + "size": 3645 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/vaults/credentials/update", + "status": "success", + "path": "en/api/cli/beta/vaults/credentials/update.md", + "sha256": "5a003a3913c65e7dc99f1d973f1b19dc163b14513caac0c2189bb90317e27081", + "size": 4088 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/vaults/credentials/delete", + "status": "success", + "path": "en/api/cli/beta/vaults/credentials/delete.md", + "sha256": "9b8d5c30f37b01e891756cfffe1188242033c335d210965a7392b5c95c4c0174", + "size": 863 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/vaults/credentials/archive", + "status": "success", + "path": "en/api/cli/beta/vaults/credentials/archive.md", + "sha256": "f0deab75d34d81c789356537246b4f153f3d582affed2adec5e1b8f065ea4b9a", + "size": 3655 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/files", + "status": "success", + "path": "en/api/cli/beta/files.md", + "sha256": "7d1f431d0f29883a3a3ad1982995741c79ee6bb17b0b7d8d4cdacdb77658bf26", + "size": 7194 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/files/upload", + "status": "success", + "path": "en/api/cli/beta/files/upload.md", + "sha256": "dbe80d4a4c51d0f3fa231dde0338c3f86f6ba1acd7bce9c08068d7283784d4c5", + "size": 1283 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/files/list", + "status": "success", + "path": "en/api/cli/beta/files/list.md", + "sha256": "be1465bc8a05ff8226f545c8663fdc73c0920fbce5191608c8f8159c041793b3", + "size": 2193 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/files/download", + "status": "success", + "path": "en/api/cli/beta/files/download.md", + "sha256": "c3f94484cd1c23d8c3b1b04dba6feef0e5b20c2acea8bcd4d43c5f26333c3cb0", + "size": 417 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/files/retrieve_metadata", + "status": "success", + "path": "en/api/cli/beta/files/retrieve_metadata.md", + "sha256": "9eddf253740d0778325b557fbc9d39ca4a990de8f481b79b074bb56333e6d6ce", + "size": 1301 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/files/delete", + "status": "success", + "path": "en/api/cli/beta/files/delete.md", + "sha256": "c02f26c5212ae8da02ca65103c5d7888adce4950ce7cc1e87a53764b696d7854", + "size": 601 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/skills", + "status": "success", + "path": "en/api/cli/beta/skills.md", + "sha256": "6f5dd1254ed808d66df672f2c629f38aad6c917259d54637b161bbd181b82976", + "size": 12745 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/skills/create", + "status": "success", + "path": "en/api/cli/beta/skills/create.md", + "sha256": "cca94e3dae7e858d91a1ebbbc741533ea5f94492f0be063b171a71bc941e94f7", + "size": 1635 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/skills/list", + "status": "success", + "path": "en/api/cli/beta/skills/list.md", + "sha256": "8f25a728c06b5ec690aeffc3a935f2c86681fae20d161fee3d534355ccb54dc3", + "size": 2335 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/skills/retrieve", + "status": "success", + "path": "en/api/cli/beta/skills/retrieve.md", + "sha256": "f0d1d64d5680062d28ab7eb64b9d2af35bb66c5538dbfbe4b9bb7dc48a625bd0", + "size": 1401 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/skills/delete", + "status": "success", + "path": "en/api/cli/beta/skills/delete.md", + "sha256": "504871ca400a1b6790177235cbf84722468ed820eda734c385bacec70d9747ba", + "size": 709 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/skills/versions", + "status": "success", + "path": "en/api/cli/beta/skills/versions.md", + "sha256": "9f0e17a5ba14d03aec5d7486719c5240192dbf8df857450a3a72b315798e3b13", + "size": 6651 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/skills/versions/create", + "status": "success", + "path": "en/api/cli/beta/skills/versions/create.md", + "sha256": "3e91a54c1fa92b907c699bef6be89e61ac19c5fbdee5a24654f03f979fc827e0", + "size": 1749 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/skills/versions/list", + "status": "success", + "path": "en/api/cli/beta/skills/versions/list.md", + "sha256": "ed1a396d969e14e1bf275e06836ab036d1334f6457a4482d0ad16d9105244171", + "size": 2137 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/skills/versions/retrieve", + "status": "success", + "path": "en/api/cli/beta/skills/versions/retrieve.md", + "sha256": "494dfec345521d1c781e547046e94627723414b83019687aadb48f7f901e53e6", + "size": 1738 + }, + { + "url": "https://platform.claude.com/docs/en/api/cli/beta/skills/versions/delete", + "status": "success", + "path": "en/api/cli/beta/skills/versions/delete.md", + "sha256": "75496fd34da360eafb2c74e603a1374ec1bda86a5d4f96dd18196143cc49d7f6", + "size": 1012 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/completions", + "status": "success", + "path": "en/api/php/completions.md", + "sha256": "72d044c64a25f4e416ca12b79d48b5f458790d511275ae95ccc368837ab52d11", + "size": 91201 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/completions/create", + "status": "success", + "path": "en/api/php/completions/create.md", + "sha256": "84b65029bcc1fd3c00591307205c17001b55930181f3323015b3a9473123f90d", + "size": 91226 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/messages", + "status": "success", + "path": "en/api/php/messages.md", + "sha256": "a081ba99c2173d0830d54151bbe07b6298ce877c9fd7c6c4c81014d6abada9d2", + "size": 91192 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/messages/create", + "status": "success", + "path": "en/api/php/messages/create.md", + "sha256": "9e38624be724b1d5653865e38185fc2d458a655b5e366cf362a957e54acd1287", + "size": 91217 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/messages/count_tokens", + "status": "success", + "path": "en/api/php/messages/count_tokens.md", + "sha256": "6046230d4fdd34affe64c01650e2e96cd59f8b16610e856ef64870db40a50723", + "size": 91235 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/messages/batches", + "status": "success", + "path": "en/api/php/messages/batches.md", + "sha256": "b676999e479a623c48b3ce86a726a88777e1963458cc65c7796aa3a27ac2575d", + "size": 91220 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/messages/batches/create", + "status": "success", + "path": "en/api/php/messages/batches/create.md", + "sha256": "a34ee812043c593616ad2bb917ae2b6dc6c00f54ada31b38c8fc520a7952f1d2", + "size": 91245 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/messages/batches/retrieve", + "status": "success", + "path": "en/api/php/messages/batches/retrieve.md", + "sha256": "e163936fb3d76e2be07d447fe4f3edd26e9f64daaf43f118e6721b97fddc3466", + "size": 91251 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/messages/batches/list", + "status": "success", + "path": "en/api/php/messages/batches/list.md", + "sha256": "c4bd05c6a8a2aca6c23a8849ae90207153e82ef545b35a955f54573b4f4ab0f0", + "size": 91239 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/messages/batches/cancel", + "status": "success", + "path": "en/api/php/messages/batches/cancel.md", + "sha256": "91c5f013a1091a5a192cf01dfd854306e737af608a86135056e777ff805a2dfe", + "size": 91245 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/messages/batches/delete", + "status": "success", + "path": "en/api/php/messages/batches/delete.md", + "sha256": "131c1fe3eb8d200dc746d76af76ea6e0653449ee24306f2e0f9e4bceeb89f092", + "size": 91245 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/messages/batches/results", + "status": "success", + "path": "en/api/php/messages/batches/results.md", + "sha256": "1ee6a627765cdf57e4c8c6571e66ab33d37f05640ba6ec00be8fe506732bee8a", + "size": 91248 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/models", + "status": "success", + "path": "en/api/php/models.md", + "sha256": "c181395f68ecdf8212c67580a27cd5845079437a5c8481f6f4a3af0dc5ea99d2", + "size": 91186 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/models/list", + "status": "success", + "path": "en/api/php/models/list.md", + "sha256": "8c8e17067dbb4ebb6b1e3b3e9cdc79110b3d532ce91de68e23201d2c6e6f915e", + "size": 91205 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/models/retrieve", + "status": "success", + "path": "en/api/php/models/retrieve.md", + "sha256": "9ed02d3de8ca052872ed6f6d0b2d26caa163741bcf888bb55805bc50e4909063", + "size": 91217 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta", + "status": "success", + "path": "en/api/php/beta.md", + "sha256": "17dad2b83a236d3a6faac38d8bc467202e49f762457e8f7a5bc03227531a4ae8", + "size": 91180 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/models", + "status": "success", + "path": "en/api/php/beta/models.md", + "sha256": "ff03e133d90b88979227cd3d93111c8cb9373a4260710c01b1fc520e5af599a7", + "size": 91205 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/models/list", + "status": "success", + "path": "en/api/php/beta/models/list.md", + "sha256": "26a1af2409d0b698b0eb752f2e97519c04d7bfd56e5e29ecadca8248fb85bc7b", + "size": 91224 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/models/retrieve", + "status": "success", + "path": "en/api/php/beta/models/retrieve.md", + "sha256": "bfdff34adeeb662f44ea6c4716015b834d25937205b6165d9edab5eb738b50b3", + "size": 91236 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/messages", + "status": "success", + "path": "en/api/php/beta/messages.md", + "sha256": "000a0c07eff8f5750709404cd4b423e1aed067f1bea37803de3717c9bf00a71c", + "size": 91211 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/messages/create", + "status": "success", + "path": "en/api/php/beta/messages/create.md", + "sha256": "c3e1e2f5d416eee63c6b9a8dbca3501aa483fe98b9537bbbfd675535fa34fe4b", + "size": 91236 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/messages/count_tokens", + "status": "success", + "path": "en/api/php/beta/messages/count_tokens.md", + "sha256": "1000cc1da5e42daa2d55593aa988e64fec649bd4aa9058633b16c211f85a3831", + "size": 91254 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/messages/batches", + "status": "success", + "path": "en/api/php/beta/messages/batches.md", + "sha256": "9b8312aa68730db6bf121c40a7d31d69ffa97c94a72830cc0e858bb48b491c97", + "size": 91239 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/messages/batches/create", + "status": "success", + "path": "en/api/php/beta/messages/batches/create.md", + "sha256": "dc48a7083ab6ad98fcc70128c855eb237281a1ebcb30dc5d57b29646506451ca", + "size": 91264 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/messages/batches/retrieve", + "status": "success", + "path": "en/api/php/beta/messages/batches/retrieve.md", + "sha256": "81f08e3af85118ea03cf997bde20138fdf632f4705dcff0e11cac8eabc898e9d", + "size": 91270 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/messages/batches/list", + "status": "success", + "path": "en/api/php/beta/messages/batches/list.md", + "sha256": "41aeba1e96e5238404296bc4778f83599d5fdc8ecb077b68b8df743e2e4d542e", + "size": 91258 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/messages/batches/cancel", + "status": "success", + "path": "en/api/php/beta/messages/batches/cancel.md", + "sha256": "c58cbf28176bcbdeef3cece26db47e060b3ed32bcef14928191e63424ace26c2", + "size": 91264 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/messages/batches/delete", + "status": "success", + "path": "en/api/php/beta/messages/batches/delete.md", + "sha256": "c508015946940a7b40fa5df71fbe1671504297459f5779829bd8c286df059f37", + "size": 91264 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/messages/batches/results", + "status": "success", + "path": "en/api/php/beta/messages/batches/results.md", + "sha256": "ad319493c84e9e2e8191767f2c61ef7639e9a5b8cf168d06a78d520057d692b5", + "size": 91267 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/agents", + "status": "success", + "path": "en/api/php/beta/agents.md", + "sha256": "224201be3789365a36430da51fce09c933654bf160090696a2c8a1eb285fdef8", + "size": 91205 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/agents/create", + "status": "success", + "path": "en/api/php/beta/agents/create.md", + "sha256": "8d29bd1d7a871e2241d15a571c9c9502156eec2eea4a209868f00f21ac2539ab", + "size": 91230 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/agents/list", + "status": "success", + "path": "en/api/php/beta/agents/list.md", + "sha256": "05b4322e61b6f631eb763645799feebb3e95fa05bd328c1738cdfc7141ace3a6", + "size": 91224 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/agents/retrieve", + "status": "success", + "path": "en/api/php/beta/agents/retrieve.md", + "sha256": "acb050a2245106e657dfdc64b75be7be294678b717683c8fdc7de4781da97554", + "size": 91236 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/agents/update", + "status": "success", + "path": "en/api/php/beta/agents/update.md", + "sha256": "ae4ed5947957ed040af8d30f8728a8c906feaa0dfa331474ff62661626518b37", + "size": 91230 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/agents/archive", + "status": "success", + "path": "en/api/php/beta/agents/archive.md", + "sha256": "784ba92a412edfca877c23d4dd891a761e7698ebf6bf6931a31c6bb15e88c047", + "size": 91233 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/agents/versions", + "status": "success", + "path": "en/api/php/beta/agents/versions.md", + "sha256": "f7ec6990995cb4c4fb1cb1ec75644fc1a7673a25491e15374c9fb88c27abe99e", + "size": 91236 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/agents/versions/list", + "status": "success", + "path": "en/api/php/beta/agents/versions/list.md", + "sha256": "1ff62f7f1fc0c1bd28a208fac8275b7cd1dc53620a5c0c39821fe9a215c2fdc7", + "size": 91255 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/environments", + "status": "success", + "path": "en/api/php/beta/environments.md", + "sha256": "d8f8c2606256841777c3549dd75fa30acfbd5e41b3db64d80a348713a19bfa97", + "size": 91223 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/environments/create", + "status": "success", + "path": "en/api/php/beta/environments/create.md", + "sha256": "68b65aeb38dd52116024040b65b5cd97969359b85a4c77f33b1640dbbe69fae2", + "size": 91248 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/environments/list", + "status": "success", + "path": "en/api/php/beta/environments/list.md", + "sha256": "fc2a956b136e7d66977abbd6b882dfc8dc479545c3d6e7304dda73d06c0c2d07", + "size": 91242 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/environments/retrieve", + "status": "success", + "path": "en/api/php/beta/environments/retrieve.md", + "sha256": "c2f30b4c0afe75528f0ac02bb156ceef9e00cccaabfda44a543ac6a6dbfc43b5", + "size": 91254 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/environments/update", + "status": "success", + "path": "en/api/php/beta/environments/update.md", + "sha256": "9d9ce59f67b25ea0061cea308c19319e816d0d21e3c9d6934767a8dbeb82ac16", + "size": 91248 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/environments/delete", + "status": "success", + "path": "en/api/php/beta/environments/delete.md", + "sha256": "f0c5fbe8268dc56d0f5d7cac11d9f1aba4f65c8d299e6bf4ff8c844586e73aa4", + "size": 91248 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/environments/archive", + "status": "success", + "path": "en/api/php/beta/environments/archive.md", + "sha256": "d3691c6b989561aecc503e7e49afe66014ffe16be0cb32ef66cf671ddbf16392", + "size": 91251 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/sessions", + "status": "success", + "path": "en/api/php/beta/sessions.md", + "sha256": "28b40b84f90b06f53e0021a4db8bd42d6b04ec8a59357aae904c4ed977716ede", + "size": 91211 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/sessions/create", + "status": "success", + "path": "en/api/php/beta/sessions/create.md", + "sha256": "e63bb64c549d8d764a8c8dad5fea3ff4c8190b8c25d57c4e277d041431bee96c", + "size": 91236 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/sessions/list", + "status": "success", + "path": "en/api/php/beta/sessions/list.md", + "sha256": "6ed2f67bbc08128e95d79a3f1586fda5cbb9ddff38f4fef852f0f4bd49dc2524", + "size": 91230 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/sessions/retrieve", + "status": "success", + "path": "en/api/php/beta/sessions/retrieve.md", + "sha256": "0685751da51fa2f5e8db2f10c7f547b4ecc2ca5ff13092bdd1f83cce2b4f26c1", + "size": 91242 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/sessions/update", + "status": "success", + "path": "en/api/php/beta/sessions/update.md", + "sha256": "086c5f288258504943b931dbe970da5f1fcf491b632efb1810f54d3d3591de66", + "size": 91236 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/sessions/delete", + "status": "success", + "path": "en/api/php/beta/sessions/delete.md", + "sha256": "7a0dfdfe52139b249db21a49e98763b1a4f45cd17a098488223533837dd6322d", + "size": 91236 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/sessions/archive", + "status": "success", + "path": "en/api/php/beta/sessions/archive.md", + "sha256": "93b0e763627ab7d56272cc576b621ba596d760f96597fd711946bd1faaee9fb4", + "size": 91239 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/sessions/events", + "status": "success", + "path": "en/api/php/beta/sessions/events.md", + "sha256": "6060ab7dcc84c23e11cd7a267fd92173e3d800f6bdf1413fb1814297171174b3", + "size": 91236 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/sessions/events/list", + "status": "success", + "path": "en/api/php/beta/sessions/events/list.md", + "sha256": "9d9a1a7a94455aaddb9a00c09f6c3152295c42df744f8133cad9d3452a12eaa9", + "size": 91255 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/sessions/events/send", + "status": "success", + "path": "en/api/php/beta/sessions/events/send.md", + "sha256": "35421f4012d12a968c7296eea162a19fa20bf74931411aff351f17fbae2e2c45", + "size": 91255 + }, + { + "url": "https://platform.claude.com/docs/en/api/php/beta/sessions/events/stream", "status": "success", - "path": "en/api/php/messages/batches/list.md", - "sha256": "fad691848824f2a091b9201b06adbb45fc08c0fb2efb936f767903604189b7e5", - "size": 91199 + "path": "en/api/php/beta/sessions/events/stream.md", + "sha256": "0d0934a952c3c45b66c868867d471d38170dd5feacdd9239dc27db62822b04b9", + "size": 91261 }, { - "url": "https://platform.claude.com/docs/en/api/php/messages/batches/cancel", + "url": "https://platform.claude.com/docs/en/api/php/beta/sessions/resources", "status": "success", - "path": "en/api/php/messages/batches/cancel.md", - "sha256": "8e5c4f8830c94a8d392d252ecc5d17f8d405449f2e57b34556a1d80ad809af67", - "size": 91205 + "path": "en/api/php/beta/sessions/resources.md", + "sha256": "4755c462a60ec0964e12d3badb8193cc4f1a1ffd09f08c4eb3108c365e83aa61", + "size": 91245 }, { - "url": "https://platform.claude.com/docs/en/api/php/messages/batches/delete", + "url": "https://platform.claude.com/docs/en/api/php/beta/sessions/resources/add", "status": "success", - "path": "en/api/php/messages/batches/delete.md", - "sha256": "ac47313df81a3e2ac586c0ca3d99445a18cfc8221fb708d6f77ad312440814f7", - "size": 91205 + "path": "en/api/php/beta/sessions/resources/add.md", + "sha256": "6b6b45e0ea973377a737e07cb9d24489ad2f6a898713d1b0151853c654841592", + "size": 91261 }, { - "url": "https://platform.claude.com/docs/en/api/php/messages/batches/results", + "url": "https://platform.claude.com/docs/en/api/php/beta/sessions/resources/list", "status": "success", - "path": "en/api/php/messages/batches/results.md", - "sha256": "2a9676eb11a92ce6920890bdb98616a5511deafbdc04036fa75e7319cd682fd9", - "size": 91208 + "path": "en/api/php/beta/sessions/resources/list.md", + "sha256": "643e5fc9dc0fa4559c68a57628e2ba943a70cea7d760286e20ef8063548bbd8b", + "size": 91264 }, { - "url": "https://platform.claude.com/docs/en/api/php/models", + "url": "https://platform.claude.com/docs/en/api/php/beta/sessions/resources/retrieve", "status": "success", - "path": "en/api/php/models.md", - "sha256": "2faf0b400126f056ca8c22e46da09819585097e56b7a90161d7b26e10f6db547", - "size": 91146 + "path": "en/api/php/beta/sessions/resources/retrieve.md", + "sha256": "8e179dd3f54aef9113018bae6b3a6fee0e49f51c1749f9b34352e9cd0bc0fe6b", + "size": 91276 }, { - "url": "https://platform.claude.com/docs/en/api/php/models/list", + "url": "https://platform.claude.com/docs/en/api/php/beta/sessions/resources/update", "status": "success", - "path": "en/api/php/models/list.md", - "sha256": "15db9b6be2cb984256d3217fa18be3e3e9c8d4f80fd6fad68b27caba66d0b133", - "size": 91165 + "path": "en/api/php/beta/sessions/resources/update.md", + "sha256": "bee4640b092db6e72f31d8559d2aec4caccc271c892c84fbbb370fb328482552", + "size": 91270 }, { - "url": "https://platform.claude.com/docs/en/api/php/models/retrieve", + "url": "https://platform.claude.com/docs/en/api/php/beta/sessions/resources/delete", "status": "success", - "path": "en/api/php/models/retrieve.md", - "sha256": "c2c0b2a3ea57389869dcac7b4960e818d7454894896ef242569e8d3ec7f3e286", - "size": 91177 + "path": "en/api/php/beta/sessions/resources/delete.md", + "sha256": "9cf2bad2d9b3c525acd72829327721bd0a96cfb5079267604020b8eb2b2f5572", + "size": 91270 }, { - "url": "https://platform.claude.com/docs/en/api/php/beta", + "url": "https://platform.claude.com/docs/en/api/php/beta/vaults", "status": "success", - "path": "en/api/php/beta.md", - "sha256": "2a7a9177d71f806a889544a44d5620b2096a54f91c11f31f3a3e5dbf1f2c5f31", - "size": 91140 + "path": "en/api/php/beta/vaults.md", + "sha256": "268d7854a37ec710139a8780789fb1942f37a48625748354b64748cf81b7a2f9", + "size": 91205 }, { - "url": "https://platform.claude.com/docs/en/api/php/beta/models", + "url": "https://platform.claude.com/docs/en/api/php/beta/vaults/create", "status": "success", - "path": "en/api/php/beta/models.md", - "sha256": "ee2fed605dac6693decdc5cb7d9fa5dfdf369dea043cb970c756c7eed6cea9a8", - "size": 91165 + "path": "en/api/php/beta/vaults/create.md", + "sha256": "7042dd9021a7795cc5523bf9de68c5292deba2a40a5cc76d8b959d8f97949447", + "size": 91230 }, { - "url": "https://platform.claude.com/docs/en/api/php/beta/models/list", + "url": "https://platform.claude.com/docs/en/api/php/beta/vaults/list", "status": "success", - "path": "en/api/php/beta/models/list.md", - "sha256": "4940bb1b3fabe6840cab0ff0ee0c3baa3abea06992dc1a0f15af1bc933c468ec", - "size": 91184 + "path": "en/api/php/beta/vaults/list.md", + "sha256": "935c9841f99c4a85b15a766c001a17ae7386a209b69cd307defea10816dd5fdb", + "size": 91224 }, { - "url": "https://platform.claude.com/docs/en/api/php/beta/models/retrieve", + "url": "https://platform.claude.com/docs/en/api/php/beta/vaults/retrieve", "status": "success", - "path": "en/api/php/beta/models/retrieve.md", - "sha256": "f4b46ad21b939ea0a390b32ce888087effb968467fbee03fabc69fb3635bfc88", - "size": 91196 + "path": "en/api/php/beta/vaults/retrieve.md", + "sha256": "89d2eade24255e983d6729e96b91f6abc6f2667d0f7c6016b290531681ad6051", + "size": 91236 }, { - "url": "https://platform.claude.com/docs/en/api/php/beta/messages", + "url": "https://platform.claude.com/docs/en/api/php/beta/vaults/update", "status": "success", - "path": "en/api/php/beta/messages.md", - "sha256": "457003494209a066f57639cda69df910b9a1e8640c2b76886bcedeea7b9c7d18", - "size": 91171 + "path": "en/api/php/beta/vaults/update.md", + "sha256": "6976393965212e8b43dcad249ea1411d45a489e239d33548962a2ac3bb2fd465", + "size": 91230 }, { - "url": "https://platform.claude.com/docs/en/api/php/beta/messages/create", + "url": "https://platform.claude.com/docs/en/api/php/beta/vaults/delete", "status": "success", - "path": "en/api/php/beta/messages/create.md", - "sha256": "6983cdc9990f60b39ba6cc8e6973eb5ecbc513316481f8d7889f95b0f1cf5a78", - "size": 91196 + "path": "en/api/php/beta/vaults/delete.md", + "sha256": "be7c3e68088e33b2cc2fe155aaeff46837a9232ebd59d03bd4f8cf00aa335791", + "size": 91230 }, { - "url": "https://platform.claude.com/docs/en/api/php/beta/messages/count_tokens", + "url": "https://platform.claude.com/docs/en/api/php/beta/vaults/archive", "status": "success", - "path": "en/api/php/beta/messages/count_tokens.md", - "sha256": "612089effb4667c37438eeb3170e9da405579b863e5983e9f10a2e85cb329942", - "size": 91214 + "path": "en/api/php/beta/vaults/archive.md", + "sha256": "37bce98c78797d48da9b89d5e6686583ac4e7cb6a1181a3be341a85b3b20ba15", + "size": 91233 }, { - "url": "https://platform.claude.com/docs/en/api/php/beta/messages/batches", + "url": "https://platform.claude.com/docs/en/api/php/beta/vaults/credentials", "status": "success", - "path": "en/api/php/beta/messages/batches.md", - "sha256": "a2a06b70cd7cb2817d1d50db4db44bc8c88086a801e1bfef8995225e4d1a15ac", - "size": 91199 + "path": "en/api/php/beta/vaults/credentials.md", + "sha256": "ff1d3ba8255695d89dec69b65144e6cd62fe1a69ea482f4c5f2b73df0a3c0c8d", + "size": 91245 }, { - "url": "https://platform.claude.com/docs/en/api/php/beta/messages/batches/create", + "url": "https://platform.claude.com/docs/en/api/php/beta/vaults/credentials/create", "status": "success", - "path": "en/api/php/beta/messages/batches/create.md", - "sha256": "84dbd30da69e2266d93b996124728a3ab6750d4203a2a644b9ea4e34137ae777", - "size": 91224 + "path": "en/api/php/beta/vaults/credentials/create.md", + "sha256": "34782de519b4001f0dc31f88ca39ebcede74a512d80bd674406df208731633f7", + "size": 91270 }, { - "url": "https://platform.claude.com/docs/en/api/php/beta/messages/batches/retrieve", + "url": "https://platform.claude.com/docs/en/api/php/beta/vaults/credentials/list", "status": "success", - "path": "en/api/php/beta/messages/batches/retrieve.md", - "sha256": "66fef54b33f32a0fb450e775103f267680e114cd838e48eddaf37835405c6357", - "size": 91230 + "path": "en/api/php/beta/vaults/credentials/list.md", + "sha256": "239f946c9b7aa7320a442e9613ad4b30c7f9f13cd15791b3e514ac2943d22755", + "size": 91264 }, { - "url": "https://platform.claude.com/docs/en/api/php/beta/messages/batches/list", + "url": "https://platform.claude.com/docs/en/api/php/beta/vaults/credentials/retrieve", "status": "success", - "path": "en/api/php/beta/messages/batches/list.md", - "sha256": "a881a45bc87fb4b6813b704388940bb6e60066a28d49840360f21f06b1355eba", - "size": 91218 + "path": "en/api/php/beta/vaults/credentials/retrieve.md", + "sha256": "df72e49d5861c5e428facc7bfdce02e4e04940eec221758ffcc2832e0343dbef", + "size": 91276 }, { - "url": "https://platform.claude.com/docs/en/api/php/beta/messages/batches/cancel", + "url": "https://platform.claude.com/docs/en/api/php/beta/vaults/credentials/update", "status": "success", - "path": "en/api/php/beta/messages/batches/cancel.md", - "sha256": "03ec7283668f6a5ac936266cb2fe01bf05b7939941335c967531441d67a10777", - "size": 91224 + "path": "en/api/php/beta/vaults/credentials/update.md", + "sha256": "0eea8eae6c2ab53f108350e521d733f20659867eab935d45fa8d73c538fd7997", + "size": 91270 }, { - "url": "https://platform.claude.com/docs/en/api/php/beta/messages/batches/delete", + "url": "https://platform.claude.com/docs/en/api/php/beta/vaults/credentials/delete", "status": "success", - "path": "en/api/php/beta/messages/batches/delete.md", - "sha256": "fc78f7826b6c43f1c76d1d37fabe091543a7d4d06c7773fa3b53728d861e2eb8", - "size": 91224 + "path": "en/api/php/beta/vaults/credentials/delete.md", + "sha256": "0754d25559c3f6c1658e421da576b610e4be11621a9d51bd5eea5781510d10bd", + "size": 91270 }, { - "url": "https://platform.claude.com/docs/en/api/php/beta/messages/batches/results", + "url": "https://platform.claude.com/docs/en/api/php/beta/vaults/credentials/archive", "status": "success", - "path": "en/api/php/beta/messages/batches/results.md", - "sha256": "e17bf53a3ca21b87aa8021966bdf993e1a671178366e90830d8db7dfe3bb30c3", - "size": 91227 + "path": "en/api/php/beta/vaults/credentials/archive.md", + "sha256": "da3cb4c8d8f55c46ffc97572a2b95115072dcc37e139d7fc95fd3d345e2f647f", + "size": 91273 }, { "url": "https://platform.claude.com/docs/en/api/php/beta/files", "status": "success", "path": "en/api/php/beta/files.md", - "sha256": "a28a8e47532cb1b5751fcfd36881b59580f115507dcaf3284636f1494b07c177", - "size": 91162 + "sha256": "60a3760402679110f849e7c63b20227f03dbed25b2d81c2c34c13c408375125d", + "size": 91202 }, { "url": "https://platform.claude.com/docs/en/api/php/beta/files/upload", "status": "success", "path": "en/api/php/beta/files/upload.md", - "sha256": "99dff7aa59b2827872515f4fcedb133af53e01bf30f690d174f29f0a9219efbb", - "size": 91187 + "sha256": "c1cde69c7d4b7d3cc79ad34f1b123fe8bee6983c552ed6e1a3e9dedba9c14df7", + "size": 91227 }, { "url": "https://platform.claude.com/docs/en/api/php/beta/files/list", "status": "success", "path": "en/api/php/beta/files/list.md", - "sha256": "cbd9d30b4c434c297c6f6ea09da02c0c77abd286b3de8e79c357b81951066a6b", - "size": 91181 + "sha256": "93515331afe631d88b627a650a38226ffdb0e5be7b3f26219635a6dc658a8843", + "size": 91221 }, { "url": "https://platform.claude.com/docs/en/api/php/beta/files/download", "status": "success", "path": "en/api/php/beta/files/download.md", - "sha256": "4fba87f4dbed49202b43f193027e6275f5a4219a2ef5189e3c741f7906714cec", - "size": 91193 + "sha256": "306032a73763a2a50a4d52d430368cfafb31ba7243bed0f6594a5830a9e0af90", + "size": 91233 }, { "url": "https://platform.claude.com/docs/en/api/php/beta/files/retrieve_metadata", "status": "success", "path": "en/api/php/beta/files/retrieve_metadata.md", - "sha256": "7e25761039e5e9777d28309de843f1eb044356aee20bb32b0c94b07e9968d150", - "size": 91220 + "sha256": "6a0ecc443c7126cee6af3cb01ceca3b7370d89f94c4c85254e951dcbdb6ad672", + "size": 91260 }, { "url": "https://platform.claude.com/docs/en/api/php/beta/files/delete", "status": "success", "path": "en/api/php/beta/files/delete.md", - "sha256": "8aff1a5d6e0656a15e9b0b6addfc9a39240c0197fbb7d6dc165e5bc6f01cae83", - "size": 91187 + "sha256": "3cd3f44ae67f805231b9084cbdfbf3b19ab9da3902172005b55e8f639037166a", + "size": 91227 }, { "url": "https://platform.claude.com/docs/en/api/php/beta/skills", "status": "success", "path": "en/api/php/beta/skills.md", - "sha256": "4e547af445f489f6f980bf934ac025d88d066b1e7131efb47b0f14751a1684a6", - "size": 91165 + "sha256": "c01a648da1a3325b649fa48afa25f793b4a9a2a7926caf2c098bed839e41c4ee", + "size": 91205 }, { "url": "https://platform.claude.com/docs/en/api/php/beta/skills/create", "status": "success", "path": "en/api/php/beta/skills/create.md", - "sha256": "905792a68e8ea49789b13735fa28f03971a9eb501b55752a18206bc1471abb21", - "size": 91190 + "sha256": "fcfd9298a14e2d48a04f1e412760ff73ae6da90a556a7de31ae443f2f16787fd", + "size": 91230 }, { "url": "https://platform.claude.com/docs/en/api/php/beta/skills/list", "status": "success", "path": "en/api/php/beta/skills/list.md", - "sha256": "5d4441dc80d30778f8873ecf209404e71910d5c3af41b1bee2c21a5f7ae34268", - "size": 91184 + "sha256": "b7f08a68ee74644cbea3a31700668caa369c4916222abce73d14fb6c2c54faa2", + "size": 91224 }, { "url": "https://platform.claude.com/docs/en/api/php/beta/skills/retrieve", "status": "success", "path": "en/api/php/beta/skills/retrieve.md", - "sha256": "03bd7e36e16776090acea4fdb865c5b7224cc57f7a3c324fe7825b2e8936fa64", - "size": 91196 + "sha256": "754515030e5f5b9aaf31175acf508626542f0c4cf74a9582ee7f543fca75ddd7", + "size": 91236 }, { "url": "https://platform.claude.com/docs/en/api/php/beta/skills/delete", "status": "success", "path": "en/api/php/beta/skills/delete.md", - "sha256": "bbe5f2b103a8abee4e5c20535d90ee7e784337a4d7b29d82fbb4807145fb24c6", - "size": 91190 + "sha256": "19e22b03d8c36a7118c44de2d56bfc62c0aad25003ca1dc527c8e47aff52a6d8", + "size": 91230 }, { "url": "https://platform.claude.com/docs/en/api/php/beta/skills/versions", "status": "success", "path": "en/api/php/beta/skills/versions.md", - "sha256": "93e209997870345e2aa7eee40b46c27bdb27ae19d90d5718f53e29a3cefaa152", - "size": 91196 + "sha256": "39ef08a27d2058f852daeddb1155aaf00803fc6c03857eaea5451338a3112f0c", + "size": 91236 }, { "url": "https://platform.claude.com/docs/en/api/php/beta/skills/versions/create", "status": "success", "path": "en/api/php/beta/skills/versions/create.md", - "sha256": "a1218fdf8cbf43ce40016f12d2d7537ce0f1b3a2584bb4298a0c664cdd7ab9a5", - "size": 91221 + "sha256": "c541f7f414bfde70b52802595c622855b7baae647b61548ccf3586c5521b6cf3", + "size": 91261 }, { "url": "https://platform.claude.com/docs/en/api/php/beta/skills/versions/list", "status": "success", "path": "en/api/php/beta/skills/versions/list.md", - "sha256": "3ae450f08f6c9b63f207b9f673ad600d9f2145e0ffb74bc01c5ec7b347db487b", - "size": 91215 + "sha256": "a7a398c61ba7541c00ad212220a3c39f7f2438f1b4cf111878a350b9eec93cb1", + "size": 91255 }, { "url": "https://platform.claude.com/docs/en/api/php/beta/skills/versions/retrieve", "status": "success", "path": "en/api/php/beta/skills/versions/retrieve.md", - "sha256": "aaec3c2ea39e410a8dd5e43ddd9137ec3d907d3d719454a50b06a602ce980670", - "size": 91227 + "sha256": "dbc15196f28f6d33f3aba861275b3f8cc162503c81b8567e49bd1a97a5a75c5e", + "size": 91267 }, { "url": "https://platform.claude.com/docs/en/api/php/beta/skills/versions/delete", "status": "success", "path": "en/api/php/beta/skills/versions/delete.md", - "sha256": "d9e982919a294a37c065f305ffa3d6c0b7ae48ba42fe348e0539e74c8ff2c42a", - "size": 91221 - }, - { - "url": "https://platform.claude.com/docs/en/api/php/beta/user_profiles", - "status": "success", - "path": "en/api/php/beta/user_profiles.md", - "sha256": "564686b9d82f3116fffb6d007478a76a68eae6494994a57cc063329bcedf0a73", - "size": 91186 - }, - { - "url": "https://platform.claude.com/docs/en/api/php/beta/user_profiles/create", - "status": "success", - "path": "en/api/php/beta/user_profiles/create.md", - "sha256": "521536d848fceca52e4f91290e05a9256b9fc6333f44c0fef8a48ff27b69b3a1", - "size": 91211 - }, - { - "url": "https://platform.claude.com/docs/en/api/php/beta/user_profiles/list", - "status": "success", - "path": "en/api/php/beta/user_profiles/list.md", - "sha256": "7311558074872dd6e241bab998cc012dd47b1f64d971daaffd2f6bd817b28ac5", - "size": 91205 - }, - { - "url": "https://platform.claude.com/docs/en/api/php/beta/user_profiles/retrieve", - "status": "success", - "path": "en/api/php/beta/user_profiles/retrieve.md", - "sha256": "254f694162a7f7605c9ea9a7e3590afbeb0e20c02f2cb141d0fee3f63fa1abc9", - "size": 91217 - }, - { - "url": "https://platform.claude.com/docs/en/api/php/beta/user_profiles/update", - "status": "success", - "path": "en/api/php/beta/user_profiles/update.md", - "sha256": "95834e8d6d153702e86e1b88316885c6a8b78f7f51f3e92874f2dc0a7148e540", - "size": 91211 - }, - { - "url": "https://platform.claude.com/docs/en/api/php/beta/user_profiles/create_enrollment_url", - "status": "success", - "path": "en/api/php/beta/user_profiles/create_enrollment_url.md", - "sha256": "2efb1bba72f9747a8aa158d94e18d8184c8537118079227090537439f5e73301", - "size": 91256 + "sha256": "e9317fb4f282e60066168c0c7b6fb0b2d17f46d52eb65b0dbf4da8631cab1055", + "size": 91261 }, { "url": "https://platform.claude.com/docs/en/api/csharp/completions", @@ -4194,36 +6763,36 @@ "url": "https://platform.claude.com/docs/en/api/csharp/messages", "status": "success", "path": "en/api/csharp/messages.md", - "sha256": "474cb961c0b20f9623842001640399f7d4449e0cde1a72e8becaa1e38c9ddbd9", - "size": 815102 + "sha256": "3eda67f4fbd65528cab2496246ee26621a545095d13d0636ecb220d5d3faa835", + "size": 816307 }, { "url": "https://platform.claude.com/docs/en/api/csharp/messages/create", "status": "success", "path": "en/api/csharp/messages/create.md", - "sha256": "7cd054dc7608f748a94aa1079cc3d712f2d4ebfb5833ee361ed29aed7a554ec8", - "size": 108575 + "sha256": "a0bb7598cbb69c399bfaf9621fa0411ea565ab7f3616c6993b784f620d3ad47d", + "size": 108702 }, { "url": "https://platform.claude.com/docs/en/api/csharp/messages/count_tokens", "status": "success", "path": "en/api/csharp/messages/count_tokens.md", - "sha256": "56d13c5beaa50bd7f37e5149410f1a69b715672217d0c7bc3873cdebf2c40310", - "size": 85351 + "sha256": "f735ced704b27a354349a1cdaab436b4a24aecf63ef65d3b1572dc63a9dcacac", + "size": 85357 }, { "url": "https://platform.claude.com/docs/en/api/csharp/messages/batches", "status": "success", "path": "en/api/csharp/messages/batches.md", - "sha256": "d858129969cf0e93c6b4274fa652005b2351872b7e0441eb0ace1586ae1c9f2f", - "size": 224687 + "sha256": "a64debd7a740c1d1069ac6067e9f9a47bccd201259fccb7b715b6033fa114776", + "size": 225366 }, { "url": "https://platform.claude.com/docs/en/api/csharp/messages/batches/create", "status": "success", "path": "en/api/csharp/messages/batches/create.md", - "sha256": "3205ba87b32def4d05c65e413c2345d22405fa616f93b07a2b8a023a514189d9", - "size": 107613 + "sha256": "5707af633c1e75908891b0fc130f0f0554af947e158c6ef1d0ec33bb35bf6d16", + "size": 107748 }, { "url": "https://platform.claude.com/docs/en/api/csharp/messages/batches/retrieve", @@ -4257,281 +6826,561 @@ "url": "https://platform.claude.com/docs/en/api/csharp/messages/batches/results", "status": "success", "path": "en/api/csharp/messages/batches/results.md", - "sha256": "8bea0c495de570d8ea7c84881c5b73192958c471d96c7c28becf4429140c39e6", - "size": 26586 + "sha256": "b8d775128011b91c6588c8e4d7cc0f8a8ccd3e567d37696b7c5f5287c4da6466", + "size": 26725 }, { "url": "https://platform.claude.com/docs/en/api/csharp/models", "status": "success", "path": "en/api/csharp/models.md", - "sha256": "8aa979c54b70f3f42d9e28d7cd952c22ea5930f6e0265672a59365cca8abd3a3", - "size": 25688 + "sha256": "ddbee4d7744df184243b7b3d7bd42c7c06262fd716804da1345bcacaadc1a4ed", + "size": 25572 }, { "url": "https://platform.claude.com/docs/en/api/csharp/models/list", "status": "success", "path": "en/api/csharp/models/list.md", - "sha256": "9f65afaf49bb102609a125b667c16d8d2527b721695e8b66632c412b2170f0e7", - "size": 7591 + "sha256": "8ef50f30a282c287f643d837158efb3cc584c9624e657d402375022f1b915000", + "size": 7533 }, { "url": "https://platform.claude.com/docs/en/api/csharp/models/retrieve", "status": "success", "path": "en/api/csharp/models/retrieve.md", - "sha256": "96f8b613464e22c24acf1faac852cce1da5859c9f1332cce71cc343be390b6ae", - "size": 6594 + "sha256": "d66b6e9eb6fa3c7f35eef431ff3a7c567b0c72639470c6a1a5d8aee117b81917", + "size": 6536 }, { "url": "https://platform.claude.com/docs/en/api/csharp/beta", "status": "success", "path": "en/api/csharp/beta.md", - "sha256": "43b12a9d30a6c26db2af11902d85049516fb44e2ae347846edc1840f6c2d8888", - "size": 1087810 + "sha256": "35d9e1c417c10c9f5805404bcb3f1a2b5b1f8ef1d57c7648e94ec8d2cce347fe", + "size": 1617783 }, { "url": "https://platform.claude.com/docs/en/api/csharp/beta/models", "status": "success", "path": "en/api/csharp/beta/models.md", - "sha256": "a368432005773f88d37046a62762c380af551f49c3d287b81a8621d9d744d44b", - "size": 26155 + "sha256": "7ae78995f6d0475e59fd6080b2429348f708b46fce608e3c835361e45cfe292f", + "size": 26039 }, { "url": "https://platform.claude.com/docs/en/api/csharp/beta/models/list", "status": "success", "path": "en/api/csharp/beta/models/list.md", - "sha256": "09adf26a995207dd6899bf6f15e5b8f2817277a8351bb0f7fec436daf222ee70", - "size": 7685 + "sha256": "94abf704b8d0e06410611ba860ccea23dedcc8e203b6b6fc93762bfbe3983e83", + "size": 7627 }, { "url": "https://platform.claude.com/docs/en/api/csharp/beta/models/retrieve", "status": "success", "path": "en/api/csharp/beta/models/retrieve.md", - "sha256": "9761e33b9ea22a7a951531e750e541646dc22594d1acb975ea5950969e1e8d1c", - "size": 6700 + "sha256": "4180b260df9e0e19ddece9bf1cdf2bcac971688636d5b4c9616193ab5d608a55", + "size": 6642 }, { "url": "https://platform.claude.com/docs/en/api/csharp/beta/messages", "status": "success", "path": "en/api/csharp/beta/messages.md", - "sha256": "84d9ec776cd0d4354fa9e042fa09f85960ddc5551da5c8e22c48a0b69c6690e8", - "size": 1006414 + "sha256": "6003b9c2b0f969c31728ca99cb7608ef1e6c5a14bbb97422e24091bcc433d312", + "size": 1006782 }, { "url": "https://platform.claude.com/docs/en/api/csharp/beta/messages/create", "status": "success", "path": "en/api/csharp/beta/messages/create.md", - "sha256": "16a13400f4a02ac3547f0e33e4a5ed5f27f35f11d21b99e23da4ab96243ec722", - "size": 135400 + "sha256": "8d3f85f84ab9038aa35f4f87867e6ed7708ef9f65f8370c8095c916234d56bad", + "size": 135306 }, { "url": "https://platform.claude.com/docs/en/api/csharp/beta/messages/count_tokens", "status": "success", "path": "en/api/csharp/beta/messages/count_tokens.md", - "sha256": "17873469efc1b5e51993d47aafe07b4167b809701f6f1d23b7f64bd99b6aef4e", - "size": 103893 + "sha256": "9f37f843cbcacd38ea6c3c5f4f71116abce0feef34f0317120b2b28b051aef35", + "size": 103841 }, { "url": "https://platform.claude.com/docs/en/api/csharp/beta/messages/batches", "status": "success", "path": "en/api/csharp/beta/messages/batches.md", - "sha256": "a87b4110e203a3258454d688be3d9b2a2c740fa9be4e24f672aec75eac6974cc", - "size": 290485 + "sha256": "781b49d6c1e8b4bf3f5e3f5eca319017fb3c564af0d191899fe7fba12b2de379", + "size": 290606 }, { "url": "https://platform.claude.com/docs/en/api/csharp/beta/messages/batches/create", "status": "success", "path": "en/api/csharp/beta/messages/batches/create.md", - "sha256": "820f03bfb2c8cf0f7413c1350918a5fc031826a61616d2ad7c48939304f4149f", - "size": 132695 + "sha256": "d53de96b19dba573be1a223064696088e771051b71efbf025600e8672d5ce9bb", + "size": 132562 }, { "url": "https://platform.claude.com/docs/en/api/csharp/beta/messages/batches/retrieve", "status": "success", "path": "en/api/csharp/beta/messages/batches/retrieve.md", - "sha256": "85ecd99515bd6b8dbed589d97b968c3e7b630f4859e49c666864c4050b5fca9f", - "size": 5161 + "sha256": "3e341f805e7fd59d7c0bcd5c911ea3509c39f69a44c36004309b98192adada4a", + "size": 5103 }, { "url": "https://platform.claude.com/docs/en/api/csharp/beta/messages/batches/list", "status": "success", "path": "en/api/csharp/beta/messages/batches/list.md", - "sha256": "046ab85f7d76b416a7d8695fa7c4bafdb474a800186d5f5d7bac306ada10f405", - "size": 5906 + "sha256": "6d0d7a7f0772dc72f0a1cda128733b4e4d1ba757978960fe7afa04c1449412a8", + "size": 5848 }, { "url": "https://platform.claude.com/docs/en/api/csharp/beta/messages/batches/cancel", "status": "success", "path": "en/api/csharp/beta/messages/batches/cancel.md", - "sha256": "4bca1f8a36ed5948078524d9bd86ae0a6028d3b380ce51718c2821ba8d7b436a", - "size": 5467 + "sha256": "7732c21fbd74f058ffb6c4feabb94c708b4248fcdb1eb943d8ae8804d97e5c67", + "size": 5409 }, { "url": "https://platform.claude.com/docs/en/api/csharp/beta/messages/batches/delete", "status": "success", "path": "en/api/csharp/beta/messages/batches/delete.md", - "sha256": "c0dc7724f62d1845aa08660dca15383bcbc0cfbdcf730c0dafd70fa57d81dfa9", - "size": 2509 + "sha256": "44490ac987b539a779d35f4b438b4bc0425daab6d2e6be1ccdfd2f26236c30da", + "size": 2451 }, { "url": "https://platform.claude.com/docs/en/api/csharp/beta/messages/batches/results", "status": "success", "path": "en/api/csharp/beta/messages/batches/results.md", - "sha256": "0f4074b8d782af5be1b5c2a653fabe38fdbd00e01469d1f14a6561430a5d3a20", - "size": 36593 + "sha256": "d815e86f2c19a7d401fffdf4559d18a9d950c1e35b20d9822195e17e94885461", + "size": 36674 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/agents", + "status": "success", + "path": "en/api/csharp/beta/agents.md", + "sha256": "a70cb62e9949e7ec41a0c84d3a61074bf29a856c5a349e947dcaa4d01a4c4787", + "size": 102196 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/agents/create", + "status": "success", + "path": "en/api/csharp/beta/agents/create.md", + "sha256": "74ebd5cd49e1976c8e992cc797e9b10c0bf2b057eef3689e9e92b17d6d1e6c24", + "size": 18530 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/agents/list", + "status": "success", + "path": "en/api/csharp/beta/agents/list.md", + "sha256": "aae243c18ea78d864de5f6d5b39105ccef7fa7f52b724fa5fcc7de144b309102", + "size": 9519 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/agents/retrieve", + "status": "success", + "path": "en/api/csharp/beta/agents/retrieve.md", + "sha256": "84abd8d8aa413087b35c7ac3a152b0b86a1555c4688223c6f95a614c80b40ece", + "size": 8837 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/agents/update", + "status": "success", + "path": "en/api/csharp/beta/agents/update.md", + "sha256": "fb17263624686afe71bc6a07db855be8e74b2ff1ed249defb861dc7f4d02158b", + "size": 19203 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/agents/archive", + "status": "success", + "path": "en/api/csharp/beta/agents/archive.md", + "sha256": "2009dc8cdf7fc455af0af1aab47b6046e4493fcde132e4572a0dcf4cf976fec0", + "size": 8699 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/agents/versions", + "status": "success", + "path": "en/api/csharp/beta/agents/versions.md", + "sha256": "37bfbb21ddeb61591fa2268744dd02a26401a3e5b191dba65f25a82637abaa33", + "size": 9367 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/agents/versions/list", + "status": "success", + "path": "en/api/csharp/beta/agents/versions/list.md", + "sha256": "901d41cd3c28d6aa3608b51d566143d58a2d54644e9edc8716d9b48c7a0281e9", + "size": 9355 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/environments", + "status": "success", + "path": "en/api/csharp/beta/environments.md", + "sha256": "484b348d3cde7fadccc9b8b3dc4ea7770bcc70f4b21b087e16ccb485556cf3fb", + "size": 35480 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/environments/create", + "status": "success", + "path": "en/api/csharp/beta/environments/create.md", + "sha256": "093c99b9a7bc97ac38a7992d39c065a7d30e1857fc86f6d482e3a8eb53c7cbba", + "size": 4832 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/environments/list", + "status": "success", + "path": "en/api/csharp/beta/environments/list.md", + "sha256": "6d5d29748f8c9b7c9fededb812c4b9af6cdfa0d67b701cb29410436acbe8b5dc", + "size": 5163 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/environments/retrieve", + "status": "success", + "path": "en/api/csharp/beta/environments/retrieve.md", + "sha256": "11d39bb148ae1f4f50791fd689d9905bf2816c343622b111f5348b6c0712a30c", + "size": 4411 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/environments/update", + "status": "success", + "path": "en/api/csharp/beta/environments/update.md", + "sha256": "2b37e9bd4cefbb606d7807a02e4a01a8ff5852144252b258c3636427715be284", + "size": 4952 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/environments/delete", + "status": "success", + "path": "en/api/csharp/beta/environments/delete.md", + "sha256": "f1b5c3adfa7b90e18b8474b13a1ff261782a05c35f72d2014480ead5ce2a8205", + "size": 2206 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/environments/archive", + "status": "success", + "path": "en/api/csharp/beta/environments/archive.md", + "sha256": "c7c991fa0362f70b53352de7d1f5bf295187e5a678fb5d4319cf72f026291232", + "size": 4466 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/sessions", + "status": "success", + "path": "en/api/csharp/beta/sessions.md", + "sha256": "3b41084193d92bd208e49b098e5eeb4b46419fc45ab243f606e06da25ee67b11", + "size": 341141 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/sessions/create", + "status": "success", + "path": "en/api/csharp/beta/sessions/create.md", + "sha256": "7da8988b2758d3ead4c8b9f024f60e900a45935cc2ec57178abe7004287247bf", + "size": 14365 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/sessions/list", + "status": "success", + "path": "en/api/csharp/beta/sessions/list.md", + "sha256": "2f577873955f8e1a11c38f1aae17c1879a8be4aac3b035dc1cec5cf64ca36135", + "size": 13342 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/sessions/retrieve", + "status": "success", + "path": "en/api/csharp/beta/sessions/retrieve.md", + "sha256": "923ef9e1ac91caf78b409c96e431ef2b1060fb3f59f627a6346b1688d8032448", + "size": 11808 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/sessions/update", + "status": "success", + "path": "en/api/csharp/beta/sessions/update.md", + "sha256": "4c270c11d305175b055da01d8041cb4e5eae41fc0a148c3f1c24f206256b34db", + "size": 12256 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/sessions/delete", + "status": "success", + "path": "en/api/csharp/beta/sessions/delete.md", + "sha256": "86bf63d092e825b80b6250bac1623a01110a11d3f2b962042bbb19520d90145e", + "size": 2135 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/sessions/archive", + "status": "success", + "path": "en/api/csharp/beta/sessions/archive.md", + "sha256": "e4e821d91cfa6819a341a1ddc8b0c69b8f097d5070b07922c654271825a75714", + "size": 11815 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/sessions/events", + "status": "success", + "path": "en/api/csharp/beta/sessions/events.md", + "sha256": "bf3c1e17695f46819ce16a253b7097d28a7c8af6f7ed016318344e8d4278b165", + "size": 236789 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/sessions/events/list", + "status": "success", + "path": "en/api/csharp/beta/sessions/events/list.md", + "sha256": "e40304c178a4d29695773c129deacf7137044c3675a8b91a4a1177d90f6962c8", + "size": 37682 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/sessions/events/send", + "status": "success", + "path": "en/api/csharp/beta/sessions/events/send.md", + "sha256": "907cd8e51ca9a90e4939fb6ea09ed3b98f93a96e097c98dbd1995f7c9669d89c", + "size": 20290 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/sessions/events/stream", + "status": "success", + "path": "en/api/csharp/beta/sessions/events/stream.md", + "sha256": "1674ef6fff9c59557641e9971052842b6872b4953b1909efdfc468f9815645e8", + "size": 35920 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/sessions/resources", + "status": "success", + "path": "en/api/csharp/beta/sessions/resources.md", + "sha256": "5a384619fbe07edc9dd7c034ab2d1040d43151a6008409cd384e216f2e14e8a9", + "size": 18331 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/sessions/resources/add", + "status": "success", + "path": "en/api/csharp/beta/sessions/resources/add.md", + "sha256": "aafea55154b328273610e63768f00595e0fd985c304a79426d1c8068ddbf389a", + "size": 2634 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/sessions/resources/list", + "status": "success", + "path": "en/api/csharp/beta/sessions/resources/list.md", + "sha256": "4e96c1ab521871c3327fefc20a7f12bb02b26338ea53167e172ac6780386cc65", + "size": 3702 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/sessions/resources/retrieve", + "status": "success", + "path": "en/api/csharp/beta/sessions/resources/retrieve.md", + "sha256": "200f57b30bb7e2b45474c94c3154f6370d4de7e25d64635255e82477f9ac8c62", + "size": 3356 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/sessions/resources/update", + "status": "success", + "path": "en/api/csharp/beta/sessions/resources/update.md", + "sha256": "23a2b249288c360cefd680f0c59007a52682414d6649ad05212a67222a31efb6", + "size": 3557 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/sessions/resources/delete", + "status": "success", + "path": "en/api/csharp/beta/sessions/resources/delete.md", + "sha256": "15be1918ded1ed9001fe07fa6a4c017e7e575ca6c162de7163b3030719ae6734", + "size": 2368 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/vaults", + "status": "success", + "path": "en/api/csharp/beta/vaults.md", + "sha256": "23cb1d3ec0c262a13c50e4129182ffaa115dda7e2143c9171d7cdef1ee7f05b6", + "size": 63450 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/vaults/create", + "status": "success", + "path": "en/api/csharp/beta/vaults/create.md", + "sha256": "8674c65ea504ab2bae94375b27b5ac263dba6ac9f90ca33f5b3a1b4379ae8bcc", + "size": 2681 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/vaults/list", + "status": "success", + "path": "en/api/csharp/beta/vaults/list.md", + "sha256": "81bc4a87a480c82f8cedb88abad20d66ec6cc54d0bbb1de1a443575ea6c944fa", + "size": 2903 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/vaults/retrieve", + "status": "success", + "path": "en/api/csharp/beta/vaults/retrieve.md", + "sha256": "d2a6e3193cc741e4dbb02777d8c2a5b8b894c19e0b807dbbc78c2dad13370938", + "size": 2534 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/vaults/update", + "status": "success", + "path": "en/api/csharp/beta/vaults/update.md", + "sha256": "4aad29ff944cb8ddce08d540a6db872cdb03f235f7ff0dc2ada7d7e59c612429", + "size": 2832 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/vaults/delete", + "status": "success", + "path": "en/api/csharp/beta/vaults/delete.md", + "sha256": "b6a6cd5957a161213173a7bca942b32655d633505ccb5f36d8fff54c696f4211", + "size": 2118 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/vaults/archive", + "status": "success", + "path": "en/api/csharp/beta/vaults/archive.md", + "sha256": "b3d24905af7a6772683ec793745f7394cdcb58f2c7c2462af5d27427955b0e69", + "size": 2541 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/vaults/credentials", + "status": "success", + "path": "en/api/csharp/beta/vaults/credentials.md", + "sha256": "eba994b0ec5166901ff85e4031a0ab9220c19459a0c8c94af9ff7e7ba250ff30", + "size": 46883 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/vaults/credentials/create", + "status": "success", + "path": "en/api/csharp/beta/vaults/credentials/create.md", + "sha256": "a45225a0f9f67e66068f9fd36eeb4ef918ee8df9ef3e54cc3b8634b33a840ae7", + "size": 7602 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/vaults/credentials/list", + "status": "success", + "path": "en/api/csharp/beta/vaults/credentials/list.md", + "sha256": "b6fe3e87714a7cd1bf6e3b67b58becab9491a9b0c60ffdc9dc4372fa7f8cdf48", + "size": 5323 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/vaults/credentials/retrieve", + "status": "success", + "path": "en/api/csharp/beta/vaults/credentials/retrieve.md", + "sha256": "3783f8b85f16d8dc7cb83d81e221756bae35f31e96e686a6e100095a3db9b18d", + "size": 4911 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/vaults/credentials/update", + "status": "success", + "path": "en/api/csharp/beta/vaults/credentials/update.md", + "sha256": "a0f8d24e8096c3118269eb56804725608d310140c0318dbd86793225ce808794", + "size": 6999 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/vaults/credentials/delete", + "status": "success", + "path": "en/api/csharp/beta/vaults/credentials/delete.md", + "sha256": "207c03f4fb490f668bee0b7dbdb22bc72b46d31d74828276ce4c8e8aadae8be6", + "size": 2402 + }, + { + "url": "https://platform.claude.com/docs/en/api/csharp/beta/vaults/credentials/archive", + "status": "success", + "path": "en/api/csharp/beta/vaults/credentials/archive.md", + "sha256": "dd7947fea067b74dec29421ccd354af7f6bc46edff969faa91fa04acdaa759c7", + "size": 4918 }, { "url": "https://platform.claude.com/docs/en/api/csharp/beta/files", "status": "success", "path": "en/api/csharp/beta/files.md", - "sha256": "05aafb6177333279ce32d8d84b7d224f05a53ee08fa48cc0fcf93076e42b989b", - "size": 13169 + "sha256": "e70a0f1769283f975012fb03866eec70b2f1c9987405033dca67be661fc88cc4", + "size": 14459 }, { "url": "https://platform.claude.com/docs/en/api/csharp/beta/files/upload", "status": "success", "path": "en/api/csharp/beta/files/upload.md", - "sha256": "3d54d6fa3e86565ed338c5619bbfad31c0d017fd6075baf397a4c762edd9a77d", - "size": 2532 + "sha256": "3035c57924bd8689f299ea8da74a39e00369d0022177fb86612aa017cc2d78ac", + "size": 2777 }, { "url": "https://platform.claude.com/docs/en/api/csharp/beta/files/list", "status": "success", "path": "en/api/csharp/beta/files/list.md", - "sha256": "689751458ecc43515da14f80a29ebaeb4755bf54b7e02e6c1f91975a850adef0", - "size": 3241 + "sha256": "fa8b3cff6a0d35b630a4b550a6bd16ff1b3f64adc0bc1052e65d1bf1d20c7d39", + "size": 3635 }, { "url": "https://platform.claude.com/docs/en/api/csharp/beta/files/download", "status": "success", "path": "en/api/csharp/beta/files/download.md", - "sha256": "bfbe6336a3835b971dc0d91fa3bcf65eca9c46df9e4a586847f6c5ccdfa8e6af", - "size": 1868 + "sha256": "bd6bc796c7656bb0c3cafc00c9cb615469043c9bc8c501c13d7c00fc0da20a7e", + "size": 1810 }, { "url": "https://platform.claude.com/docs/en/api/csharp/beta/files/retrieve_metadata", "status": "success", "path": "en/api/csharp/beta/files/retrieve_metadata.md", - "sha256": "20ba7ae753a68d3e63a9491326894293a88093d21534fa5b6e0b006c7aa52640", - "size": 2550 + "sha256": "90965758841e69edf5d383fc37dc51db35d3203039e17674ca9cda4a7bef0a95", + "size": 2795 }, { "url": "https://platform.claude.com/docs/en/api/csharp/beta/files/delete", "status": "success", "path": "en/api/csharp/beta/files/delete.md", - "sha256": "cb85cf7451f1b21b7dfaa6ec661a733118a033de2e38c014e6aead45ec7fec55", - "size": 2081 + "sha256": "21430b2118ca3651ea249205a6af4030d37ed23f6543f117ad54248f24805514", + "size": 2023 }, { "url": "https://platform.claude.com/docs/en/api/csharp/beta/skills", "status": "success", "path": "en/api/csharp/beta/skills.md", - "sha256": "32613d07137229cf038d1760256eb1683796f351e56c2b759cca6ff0becdbbe4", - "size": 24951 + "sha256": "8c7f2d9a799551c87ccf927baeb3fc7150f3314c943edfb381273703c8b57367", + "size": 24487 }, { "url": "https://platform.claude.com/docs/en/api/csharp/beta/skills/create", "status": "success", "path": "en/api/csharp/beta/skills/create.md", - "sha256": "8572536b9983748d12dd0102f7964e6001f7b2815b6066b90a443f72dc292b00", - "size": 3127 + "sha256": "5da3519b9a13ac11858c8aa27273467ea913a3ba0ada02a81de50f65268cb59b", + "size": 3069 }, { "url": "https://platform.claude.com/docs/en/api/csharp/beta/skills/list", "status": "success", "path": "en/api/csharp/beta/skills/list.md", - "sha256": "a329a4245fba162aaee2f390a1de6c8592d30d34b03d97e0f17ea3fd4a33eaad", - "size": 3872 + "sha256": "8a85f5bb82f36f6110c14a7280db9224b55a9707e14314dc03f9feea0019700e", + "size": 3814 }, { "url": "https://platform.claude.com/docs/en/api/csharp/beta/skills/retrieve", "status": "success", "path": "en/api/csharp/beta/skills/retrieve.md", - "sha256": "71a4361189bcc8504b414505aabd8c579ac08ee25acf0a9224b0eaabf74ed028", - "size": 2918 + "sha256": "39d67d39531438085c2196c0a649db32e5c0cf09498a1b06e0b31bb2d1d68170", + "size": 2860 }, { "url": "https://platform.claude.com/docs/en/api/csharp/beta/skills/delete", "status": "success", "path": "en/api/csharp/beta/skills/delete.md", - "sha256": "efc4412139778e69fde63929953cfc3f0694d290074541c242fac94cf4c8e8af", - "size": 2204 + "sha256": "f52f2651ddd90c95cba488036e46d4a03c8038bd57c8f2de59034a0856678f1f", + "size": 2146 }, { "url": "https://platform.claude.com/docs/en/api/csharp/beta/skills/versions", "status": "success", "path": "en/api/csharp/beta/skills/versions.md", - "sha256": "c26f396ae8b12082ec1c4f0410b7d115f5d8d45c5cbbe5884422485f484781b8", - "size": 12816 + "sha256": "a334e86ccd2a937b5819fcdea787453cb3b7bea91390a5b78679b748e3892bac", + "size": 12584 }, { "url": "https://platform.claude.com/docs/en/api/csharp/beta/skills/versions/create", "status": "success", "path": "en/api/csharp/beta/skills/versions/create.md", - "sha256": "9b618f96a3b4c3eb6b0e8b89e6507b2b254c4cbb20c9129ae27669c748b6d57d", - "size": 3275 + "sha256": "7d5eef0c6e884bfb9f0e03b118d7b1ea790e65721a684a7dff06023d2068658d", + "size": 3217 }, { "url": "https://platform.claude.com/docs/en/api/csharp/beta/skills/versions/list", "status": "success", "path": "en/api/csharp/beta/skills/versions/list.md", - "sha256": "b4280740d1810b8fed0b56ac0519e423c7e9af20dbca41111b47478caf5eed5b", - "size": 3700 + "sha256": "44c0af4c8fb7a6ef8550f84b98bfb749462b73dc18d3db1cd62acd98a251fdfd", + "size": 3642 }, { "url": "https://platform.claude.com/docs/en/api/csharp/beta/skills/versions/retrieve", "status": "success", "path": "en/api/csharp/beta/skills/versions/retrieve.md", - "sha256": "c05655ef2d7c1effbfccc354cc6ba9e50867663318d947d19962ca2e15dc5b47", - "size": 3292 + "sha256": "03380734193c4b21a065ec19c4e47cc4740a513a246a4ddac76b8fcc023b6f6c", + "size": 3234 }, { "url": "https://platform.claude.com/docs/en/api/csharp/beta/skills/versions/delete", "status": "success", "path": "en/api/csharp/beta/skills/versions/delete.md", - "sha256": "71c52bbc8a11e7577cec64d95823a4a7052038662e541aaad8da038ed59a73fd", - "size": 2534 - }, - { - "url": "https://platform.claude.com/docs/en/api/csharp/beta/user_profiles", - "status": "success", - "path": "en/api/csharp/beta/user_profiles.md", - "sha256": "72dacb634f3e0044ea3a93d66a3a1e2ab9904823d165be3d18d44b6025cdd3c7", - "size": 13375 - }, - { - "url": "https://platform.claude.com/docs/en/api/csharp/beta/user_profiles/create", - "status": "success", - "path": "en/api/csharp/beta/user_profiles/create.md", - "sha256": "c6dbeff57b6d7548e3ba88b8593ed6093afc7066dca2dabff1aed1e1df22d3ec", - "size": 2579 - }, - { - "url": "https://platform.claude.com/docs/en/api/csharp/beta/user_profiles/list", - "status": "success", - "path": "en/api/csharp/beta/user_profiles/list.md", - "sha256": "2ddef90904f6cacc8f3ea146e85502fc1c9b34f3c7da639038978480db70d515", - "size": 2656 - }, - { - "url": "https://platform.claude.com/docs/en/api/csharp/beta/user_profiles/retrieve", - "status": "success", - "path": "en/api/csharp/beta/user_profiles/retrieve.md", - "sha256": "5d8c226a262846f84e136bb13b2ec90128e05dc5ba1abe13b15891617e2d7b8b", - "size": 2358 - }, - { - "url": "https://platform.claude.com/docs/en/api/csharp/beta/user_profiles/update", - "status": "success", - "path": "en/api/csharp/beta/user_profiles/update.md", - "sha256": "ed78d701de73b5f7559d2e2ca8d3392d294b38cb535fd9c1b507f055d25f0a06", - "size": 2748 - }, - { - "url": "https://platform.claude.com/docs/en/api/csharp/beta/user_profiles/create_enrollment_url", - "status": "success", - "path": "en/api/csharp/beta/user_profiles/create_enrollment_url.md", - "sha256": "8f8c3a95cadf263ae4af32e882455bf9dc0fa176ce48d5930a90575fad7a7286", - "size": 2221 + "sha256": "4e2a18efdf06be7e53847ce82f7a62f7cf8f2c7a53723e1b0b32428deaade94b", + "size": 2476 }, { "url": "https://platform.claude.com/docs/en/api/admin", @@ -4796,8 +7645,8 @@ "url": "https://code.claude.com/docs/en/authentication", "status": "success", "path": "en/docs/claude-code/authentication.md", - "sha256": "0ba8fe2b803c153a0b50f4ea2d77a57347072b4197bfd40b37486c6a4ef89de3", - "size": 8665 + "sha256": "7ae4c818ae2ea6a2c84c7be4bb92b2e96de31fe780ba6ccd19187dcf06f5c12f", + "size": 8820 }, { "url": "https://code.claude.com/docs/en/best-practices", @@ -4810,8 +7659,8 @@ "url": "https://code.claude.com/docs/en/changelog", "status": "success", "path": "en/docs/claude-code/changelog.md", - "sha256": "934d2c7d2867699dd232bb0f2a846743d5ca32474c2ef5fcd8bfa306d0ab28df", - "size": 219591 + "sha256": "581a9af1ad06f1bdcd584fafa2d24e68f45c8aedcbe9c2cd6e7a74a93fcf9d50", + "size": 219830 }, { "url": "https://code.claude.com/docs/en/channels", @@ -4957,8 +7806,8 @@ "url": "https://code.claude.com/docs/en/fast-mode", "status": "success", "path": "en/docs/claude-code/fast-mode.md", - "sha256": "f1d458ae23db0f577a786718cc387190f4efbc020d4d7a6818b23b8064c94810", - "size": 8275 + "sha256": "6741462f186f5a68e9a9700f6dfe2b0d6aac30e7cb8c916881c78ab9f28d1bb3", + "size": 8267 }, { "url": "https://code.claude.com/docs/en/features-overview", @@ -5027,8 +7876,8 @@ "url": "https://code.claude.com/docs/en/how-claude-code-works", "status": "success", "path": "en/docs/claude-code/how-claude-code-works.md", - "sha256": "2014a550fffb07f12680e50d0201c05a3fb8f469638f0a1dc572a627cbdfdc62", - "size": 18956 + "sha256": "98fc5e9e2f016d61a3521eaf4d371545b0d04a35047c4ac5884693c6befd0df0", + "size": 19285 }, { "url": "https://code.claude.com/docs/en/interactive-mode", @@ -5216,8 +8065,8 @@ "url": "https://code.claude.com/docs/en/setup", "status": "success", "path": "en/docs/claude-code/setup.md", - "sha256": "de8cc3649f3d49ee1f8e6d04d381757f81d1095c9796ecaa35fe411fb2112337", - "size": 16138 + "sha256": "daf138bc358b5279118890698877b40546759fd1292d1590fca27ff1951d1d23", + "size": 16677 }, { "url": "https://code.claude.com/docs/en/skills", @@ -5237,8 +8086,8 @@ "url": "https://code.claude.com/docs/en/statusline", "status": "success", "path": "en/docs/claude-code/statusline.md", - "sha256": "41cc3cd8da43d13414ee4e140b39af3e3b89cc696f8674de171a4e91f265f1de", - "size": 49026 + "sha256": "36c624483473c41544a19f7bbb0675160e66a5c9225ce621d16b7f331c36ae49", + "size": 49358 }, { "url": "https://code.claude.com/docs/en/sub-agents", @@ -5272,8 +8121,8 @@ "url": "https://code.claude.com/docs/en/troubleshooting", "status": "success", "path": "en/docs/claude-code/troubleshooting.md", - "sha256": "f7ef007ec48e33218701c1300a7cf54b732fd9b77872ff7a60d6066adde99fce", - "size": 39022 + "sha256": "14c398c424c4734a9c8580aed166d9b66eb848155ade4c93ffd522e08d869734", + "size": 39785 }, { "url": "https://code.claude.com/docs/en/ultraplan", @@ -5342,14 +8191,14 @@ "url": "https://www.anthropic.com/engineering/claude-code-best-practices", "status": "success", "path": "blog/engineering/claude-code-best-practices.md", - "sha256": "876799d698588cb1a619231d985430633e66823e6bb77dd6f55d6e48fe28a4b3", + "sha256": "9ed31a28299be1c3482556495b82f5c2b44a8aee571465ccc30da2be0258167d", "size": 43860 }, { "url": "https://www.anthropic.com/engineering/claude-code-sandboxing", "status": "success", "path": "blog/engineering/claude-code-sandboxing.md", - "sha256": "ec74dc9ac2caa00489c33665c1ab3ea238127a79361e371fb0a294a81d8f088f", + "sha256": "2247936081b84944053453299b757401beda09e04be9bfdda397149084f0fd7f", "size": 8687 }, { @@ -5363,8 +8212,8 @@ "url": "https://www.anthropic.com/news/claude-code-on-team-and-enterprise", "status": "success", "path": "blog/news/claude-code-on-team-and-enterprise.md", - "sha256": "f35bfd2a8ae6df10cc4a2eda41cfb64bf5e4b53dbc138793e4f93b36e5d485d9", - "size": 5454 + "sha256": "ee7a39206599b2b9533791b3e3716b2d84e4d93010b8907cca679820b49607bf", + "size": 11047 }, { "url": "https://www.anthropic.com/news/claude-code-security", @@ -5389,8 +8238,8 @@ } ], "summary": { - "total": 769, - "downloaded": 769, + "total": 1176, + "downloaded": 1176, "skipped": 0, "failed": 0, "success_rate": 100.0 diff --git a/content/blog/engineering/claude-code-best-practices.md b/content/blog/engineering/claude-code-best-practices.md index 97d5308c6..31dd16afc 100644 --- a/content/blog/engineering/claude-code-best-practices.md +++ b/content/blog/engineering/claude-code-best-practices.md @@ -125,7 +125,7 @@ Claude performs dramatically better when it can verify its own work, like run te | Strategy | Before | After | | --- | --- | --- | -| **Provide verification criteria** | _”implement a function that validates email addresses"_ | _"write a validateEmail function. example test cases: [[email protected]](https://www.anthropic.com/cdn-cgi/l/email-protection#7005031502301508111d001c155e131f1d) is true, invalid is false, [[email protected]](https://www.anthropic.com/cdn-cgi/l/email-protection#b8cdcbddcaf896dbd7d5) is false. run the tests after implementing”_ | +| **Provide verification criteria** | _”implement a function that validates email addresses"_ | _"write a validateEmail function. example test cases: [[email protected]](https://www.anthropic.com/cdn-cgi/l/email-protection#f386809681b3968b929e839f96dd909c9e) is true, invalid is false, [[email protected]](https://www.anthropic.com/cdn-cgi/l/email-protection#becbcddbccfe90ddd1d3) is false. run the tests after implementing”_ | | **Verify UI changes visually** | _”make the dashboard look better"_ | _"[paste screenshot] implement this design. take a screenshot of the result and compare it to the original. list differences and fix them”_ | | **Address root causes, not symptoms** | _”the build is failing"_ | _"the build fails with this error: [paste error]. fix it and verify the build succeeds. address the root cause, don’t suppress the error”_ | diff --git a/content/blog/engineering/claude-code-sandboxing.md b/content/blog/engineering/claude-code-sandboxing.md index 9543db71a..88a62029e 100644 --- a/content/blog/engineering/claude-code-sandboxing.md +++ b/content/blog/engineering/claude-code-sandboxing.md @@ -68,7 +68,7 @@ Our new sandboxed bash tool and Claude Code on the web offer substantial improve To get started with these tools: 1. Run `/sandbox` in Claude and check out [our docs](https://docs.claude.com/en/docs/claude-code/sandboxing) on how to configure this sandbox. -2. Go to [claude.com/code](http://claude.ai/redirect/website.v1.91b9b576-38af-40d7-8b65-118a3bfcad75/code) to try out Claude Code on the web. +2. Go to [claude.com/code](http://claude.ai/redirect/website.v1.2c75e6bb-6a63-4eff-b77e-916242daf86e/code) to try out Claude Code on the web. Or, if you're building your own agents, check out our [open-sourced sandboxing code](https://github.com/anthropic-experimental/sandbox-runtime), and consider integrating it into your work. We look forward to seeing what you build. diff --git a/content/blog/news/claude-code-on-team-and-enterprise.md b/content/blog/news/claude-code-on-team-and-enterprise.md index 2961be15d..df71ebb2a 100644 --- a/content/blog/news/claude-code-on-team-and-enterprise.md +++ b/content/blog/news/claude-code-on-team-and-enterprise.md @@ -3,6 +3,26 @@ Title: Claude Code and new admin controls for business plans URL Source: https://www.anthropic.com/news/claude-code-on-team-and-enterprise Markdown Content: +# Claude Code and new admin controls for business plans \ Anthropic + +[Skip to main content](https://www.anthropic.com/news/claude-code-on-team-and-enterprise#main-content)[Skip to footer](https://www.anthropic.com/news/claude-code-on-team-and-enterprise#footer) + +[](https://www.anthropic.com/) + +* [Research](https://www.anthropic.com/research) +* [Economic Futures](https://www.anthropic.com/economic-futures) +* Commitments +* Learn +* [News](https://www.anthropic.com/news) + +[Try Claude](https://claude.ai/) + +Product + +# Claude Code and new admin controls for business plans + +Aug 20, 2025 + Enterprise and Team customers can now upgrade to premium seats that include more usage and Claude Code—bringing our app and powerful coding agent together under one subscription. Users can move seamlessly between ideation and implementation, while admins get the visibility and controls they need to scale Claude across their organization. We are also introducing a new Compliance API, giving organizations programmatic access to usage data and customer content for better observability, auditing, and governance. @@ -44,6 +64,8 @@ Team and Enterprise plan admins can now upgrade to premium seats with Claude Cod To explore how Claude for Enterprise can transform your organization's productivity and learn more about the Compliance API, [contact](https://www.anthropic.com/contact-sales) our sales team. +[](https://twitter.com/intent/tweet?text=https://www.anthropic.com/news/claude-code-on-team-and-enterprise)[](https://www.linkedin.com/shareArticle?mini=true&url=https://www.anthropic.com/news/claude-code-on-team-and-enterprise) + ## Related content ### Anthropic expands partnership with Google and Broadcom for multiple gigawatts of next-generation compute @@ -59,3 +81,108 @@ To explore how Claude for Enterprise can transform your organization's productiv We’re launching the Claude Partner Network, a program for partner organizations helping enterprises adopt Claude. [Read more](https://www.anthropic.com/news/claude-partner-network) + +[](https://www.anthropic.com/) + +### Products + +* [Claude](https://claude.com/product/overview) +* [Claude Code](https://claude.com/product/claude-code) +* [Claude Code Enterprise](https://claude.com/product/claude-code/enterprise) +* [Claude Code Security](https://claude.com/claude-code-security) +* [Claude Cowork](https://claude.com/product/cowork) +* [Claude for Chrome](https://claude.com/chrome) +* [Claude for Excel](https://claude.com/claude-for-excel) +* [Claude for PowerPoint](https://claude.com/claude-for-powerpoint) +* [Claude for Slack](https://claude.com/claude-for-slack) +* [Skills](https://www.claude.com/skills) +* [Max plan](https://claude.com/pricing/max) +* [Team plan](https://claude.com/pricing/team) +* [Enterprise plan](https://claude.com/pricing/enterprise) +* [Download app](https://claude.ai/download) +* [Pricing](https://claude.com/pricing) +* [Log in to Claude](https://claude.ai/) + +### Models + +* [Mythos preview](https://www.anthropic.com/glasswing) +* [Opus](https://www.anthropic.com/claude/opus) +* [Sonnet](https://www.anthropic.com/claude/sonnet) +* [Haiku](https://www.anthropic.com/claude/haiku) + +### Solutions + +* [AI agents](https://claude.com/solutions/agents) +* [Code modernization](https://claude.com/solutions/code-modernization) +* [Coding](https://claude.com/solutions/coding) +* [Customer support](https://claude.com/solutions/customer-support) +* [Education](https://claude.com/solutions/education) +* [Financial services](https://claude.com/solutions/financial-services) +* [Government](https://claude.com/solutions/government) +* [Healthcare](https://claude.com/solutions/healthcare) +* [Life sciences](https://claude.com/solutions/life-sciences) +* [Nonprofits](https://claude.com/solutions/nonprofits) +* [Security](https://claude.com/solutions/security) + +### Claude Platform + +* [Overview](https://claude.com/platform/api) +* [Developer docs](https://platform.claude.com/docs) +* [Pricing](https://claude.com/pricing#api) +* [Marketplace](https://claude.com/platform/marketplace) +* [Regional compliance](https://claude.com/regional-compliance) +* [Amazon Bedrock](https://claude.com/partners/amazon-bedrock) +* [Google Cloud’s Vertex AI](https://claude.com/partners/google-cloud-vertex-ai) +* [Microsoft Foundry](https://claude.com/partners/microsoft-foundry) +* [Console login](https://platform.claude.com/) + +### Resources + +* [Blog](https://claude.com/blog) +* [Claude partner network](https://claude.com/partners) +* [Community](https://claude.com/community) +* [Connectors](https://claude.com/connectors) +* [Courses](https://www.anthropic.com/learn) +* [Customer stories](https://claude.com/customers) +* [Engineering at Anthropic](https://www.anthropic.com/engineering) +* [Events](https://www.anthropic.com/events) +* [Inside Claude Code](https://www.anthropic.com/product/claude-code) +* [Inside Claude Cowork](https://www.anthropic.com/product/claude-cowork) +* [Plugins](https://claude.com/plugins) +* [Powered by Claude](https://claude.com/partners/powered-by-claude) +* [Service partners](https://claude.com/partners/services) +* [Startups program](https://claude.com/programs/startups) +* [Tutorials](https://claude.com/resources/tutorials) +* [Use cases](https://claude.com/resources/use-cases) + +### Help and security + +* [Availability](https://www.anthropic.com/supported-countries) +* [Status](https://status.anthropic.com/) +* [Support center](https://support.claude.com/en/) + +### Company + +* [Anthropic](https://www.anthropic.com/company) +* [Careers](https://www.anthropic.com/careers) +* [Economic Futures](https://www.anthropic.com/economic-index) +* [Research](https://www.anthropic.com/research) +* [News](https://www.anthropic.com/news) +* [Claude’s Constitution](https://www.anthropic.com/constitution) +* [Responsible Scaling Policy](https://www.anthropic.com/news/announcing-our-updated-responsible-scaling-policy) +* [Security and compliance](https://trust.anthropic.com/) +* [Transparency](https://www.anthropic.com/transparency) + +### Terms and policies + +* [Privacy policy](https://www.anthropic.com/legal/privacy) +* [Consumer health data privacy policy](https://www.anthropic.com/legal/consumer-health-data-privacy-policy) +* [Responsible disclosure policy](https://www.anthropic.com/responsible-disclosure-policy) +* [Terms of service: Commercial](https://www.anthropic.com/legal/commercial-terms) +* [Terms of service: Consumer](https://www.anthropic.com/legal/consumer-terms) +* [Usage policy](https://www.anthropic.com/legal/aup) + +© 2026 Anthropic PBC +* [](https://www.linkedin.com/company/anthropicresearch) +* [](https://x.com/AnthropicAI) +* [](https://www.youtube.com/@anthropic-ai) diff --git a/content/en/about-claude/models/migration-guide.md b/content/en/about-claude/models/migration-guide.md index 39f22c068..126c31341 100644 --- a/content/en/about-claude/models/migration-guide.md +++ b/content/en/about-claude/models/migration-guide.md @@ -4,6 +4,10 @@ Guide for migrating to Claude 4.6 models from previous Claude versions --- + +This guide covers migrating [Messages API](/docs/en/build-with-claude/working-with-messages) code. If you use [Claude Managed Agents](/docs/en/managed-agents/overview), see [Migrating between model versions](/docs/en/managed-agents/migration#migrating-between-model-versions). The Managed Agents runtime handles most of the request-shape changes described here. + + ## Migrating to Claude 4.6 Claude Opus 4.6 is a near drop-in replacement for Claude 4.5, with a few breaking changes to be aware of. For a full list of new features, see [What's new in Claude 4.6](/docs/en/about-claude/models/whats-new-claude-4-6). @@ -50,6 +54,20 @@ These are not required but will improve your experience: ) ``` + ```bash CLI + ant messages create <<'YAML' + model: claude-opus-4-6 + max_tokens: 16000 + thinking: + type: adaptive + output_config: + effort: high + messages: + - role: user + content: Your prompt here + YAML + ``` + ```typescript TypeScript hidelines={1..2} import Anthropic from "@anthropic-ai/sdk"; @@ -222,7 +240,7 @@ model = "claude-opus-4-6" # After Use only `temperature` OR `top_p`, not both: - ```python nocheck + ```python Python nocheck # Before - This will error in Claude 4+ models response = client.messages.create( model="claude-3-7-sonnet-20250219", @@ -263,7 +281,7 @@ model = "claude-opus-4-6" # After Update your application to [handle `refusal` stop reasons](/docs/en/test-and-evaluate/strengthen-guardrails/handle-streaming-refusals): - ```python nocheck + ```python Python nocheck response = client.messages.create(...) if response.stop_reason == "refusal": @@ -276,7 +294,7 @@ model = "claude-opus-4-6" # After Claude 4.5+ models return a `model_context_window_exceeded` stop reason when generation stops due to hitting the context window limit, rather than the requested `max_tokens` limit. Update your application to handle this new stop reason: - ```python nocheck + ```python Python nocheck response = client.messages.create(...) if response.stop_reason == "model_context_window_exceeded": @@ -436,6 +454,18 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant messages create <<'YAML' +model: claude-sonnet-4-6 +max_tokens: 8192 +output_config: + effort: low +messages: + - role: user + content: Your prompt here +YAML +``` + ```python Python response = client.messages.create( model="claude-sonnet-4-6", @@ -615,6 +645,20 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI nocheck +ant messages create <<'YAML' +model: claude-sonnet-4-6 +max_tokens: 64000 +thinking: + type: adaptive +output_config: + effort: medium +messages: + - role: user + content: Your prompt here +YAML +``` + ```python Python nocheck response = client.messages.create( model="claude-sonnet-4-6", @@ -803,6 +847,21 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant beta:messages create --beta interleaved-thinking-2025-05-14 <<'YAML' +model: claude-sonnet-4-6 +max_tokens: 16384 +thinking: + type: enabled + budget_tokens: 16384 +output_config: + effort: medium +messages: + - role: user + content: Your prompt here +YAML +``` + ```python Python response = client.beta.messages.create( model="claude-sonnet-4-6", @@ -995,6 +1054,21 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant beta:messages create --beta interleaved-thinking-2025-05-14 <<'YAML' +model: claude-sonnet-4-6 +max_tokens: 8192 +thinking: + type: enabled + budget_tokens: 16384 +output_config: + effort: low +messages: + - role: user + content: Your prompt here +YAML +``` + ```python Python response = client.beta.messages.create( model="claude-sonnet-4-6", diff --git a/content/en/about-claude/models/whats-new-claude-4-6.md b/content/en/about-claude/models/whats-new-claude-4-6.md index 58be69ac7..39ec2ffb0 100644 --- a/content/en/about-claude/models/whats-new-claude-4-6.md +++ b/content/en/about-claude/models/whats-new-claude-4-6.md @@ -25,7 +25,7 @@ For complete pricing and specs, see the [models overview](/docs/en/about-claude/ `thinking: {type: "enabled"}` and `budget_tokens` are **deprecated** on Opus 4.6 and Sonnet 4.6. They remain functional but will be removed in a future model release. Use adaptive thinking and the [effort parameter](/docs/en/build-with-claude/effort) to control thinking depth instead. Adaptive thinking also automatically enables interleaved thinking. -```python +```python Python response = client.messages.create( model="claude-opus-4-6", max_tokens=16000, @@ -66,7 +66,7 @@ The following tools are now generally available: [Fast mode](/docs/en/build-with-claude/fast-mode) (`speed: "fast"`) delivers significantly faster output token generation for Opus models. Fast mode is up to 2.5x as fast at premium pricing ($30/$150 per MTok). This is the same model running with faster inference (no change to intelligence or capabilities). -```python +```python Python response = client.beta.messages.create( model="claude-opus-4-6", max_tokens=4096, @@ -106,7 +106,7 @@ On **Sonnet 4.6**, the `interleaved-thinking-2025-05-14` beta header is still fu The `output_format` parameter for [structured outputs](/docs/en/build-with-claude/structured-outputs) has been moved to `output_config.format`. The old parameter remains functional but is deprecated and will be removed in a future model release. -```python nocheck +```python Python nocheck # Before response = client.messages.create( output_format={"type": "json_schema", "schema": {...}}, diff --git a/content/en/about-claude/pricing.md b/content/en/about-claude/pricing.md index 97345912c..85bdfb7d8 100644 --- a/content/en/about-claude/pricing.md +++ b/content/en/about-claude/pricing.md @@ -281,41 +281,67 @@ Computer use follows the standard [tool use pricing](/docs/en/agents-and-tools/t If you're also using bash or text editor tools alongside computer use, those tools have their own token costs as documented in their respective pages. -## Agent use case pricing examples +## Claude Managed Agents pricing -Understanding pricing for agent applications is crucial when building with Claude. These real-world examples can help you estimate costs for different agent patterns. +[Claude Managed Agents](/docs/en/managed-agents/overview) is billed on two dimensions: tokens and session runtime. -### Customer support agent example +### Tokens -When building a customer support agent, here's how costs might break down: +All tokens consumed by a Claude Managed Agents session are billed at the rates shown in [Model pricing](#model-pricing) above. [Prompt caching](#prompt-caching) multipliers apply identically. Web search triggered inside a session incurs the standard $10 per 1,000 searches. + +The following Messages API modifiers do **not** apply to Claude Managed Agents sessions: + +| Modifier | Why it doesn't apply | +| --- | --- | +| [Batch API discount](#batch-processing) | Sessions are stateful and interactive. There is no batch mode. | +| [Fast mode premium](#fast-mode-pricing) | Inference speed is managed by the runtime. | +| [Data residency multiplier](#data-residency-pricing) | `inference_geo` is a Messages API request field. | +| [Long context premium](#long-context-pricing) | Context window is managed by the runtime. | +| [Third-party platform pricing](#third-party-platform-pricing) | Claude Managed Agents is available only through the Claude API directly. | + +### Session runtime + +| SKU | Rate | Metering | +| --- | --- | --- | +| Session runtime | $0.08 per session-hour | `running` status duration | + +Runtime is measured to the millisecond and accrues only while the session's status is `running`. Time spent `idle` (waiting for your next message or a tool confirmation), `rescheduling`, or `terminated` does not count toward runtime. - Example calculation for processing 10,000 support tickets: - - Average ~3,700 tokens per conversation - - Using Claude Opus 4.6 at $5/MTok input, $25/MTok output - - Total cost: ~$37.00 per 10,000 tickets +Session runtime replaces the [Code Execution](#code-execution-tool) container-hour billing model when using Claude Managed Agents. You are not separately billed for container hours on top of session runtime. -For a detailed walkthrough of this calculation, see the [customer support agent guide](/docs/en/about-claude/use-case-guides/customer-support-chat). +### Worked example -### General agent workflow pricing +A one-hour coding session using Claude Opus 4.6 that consumes 50,000 input tokens and 15,000 output tokens: -For more complex agent architectures with multiple steps: +| Line item | Calculation | Cost | +| --- | --- | --- | +| Input tokens | 50,000 × $5 / 1,000,000 | $0.25 | +| Output tokens | 15,000 × $25 / 1,000,000 | $0.375 | +| Session runtime | 1.0 hour × $0.08 | $0.08 | +| **Total** | | **$0.705** | -1. **Initial request processing** - - Typical input: 500-1,000 tokens - - Processing cost: ~$0.003 per request +If prompt caching is active and 40,000 of the input tokens are cache reads: -2. **Memory and context retrieval** - - Retrieved context: 2,000-5,000 tokens - - Cost per retrieval: ~$0.015 per operation +| Line item | Calculation | Cost | +| --- | --- | --- | +| Uncached input tokens | 10,000 × $5 / 1,000,000 | $0.05 | +| Cache read tokens | 40,000 × $5 × 0.1 / 1,000,000 | $0.02 | +| Output tokens | 15,000 × $25 / 1,000,000 | $0.375 | +| Session runtime | 1.0 hour × $0.08 | $0.08 | +| **Total** | | **$0.525** | -3. **Action planning and execution** - - Planning tokens: 1,000-2,000 - - Execution feedback: 500-1,000 - - Combined cost: ~$0.045 per action + + Example calculation for processing 10,000 support tickets: + - Average ~3,700 tokens per conversation + - Using Claude Opus 4.6 at $5/MTok input, $25/MTok output + - Total cost: ~$37.00 per 10,000 tickets + -For a comprehensive guide on agent pricing patterns, see the [agent use cases guide](/docs/en/about-claude/use-case-guides). +For a detailed walkthrough of this calculation, see the [customer support agent guide](/docs/en/about-claude/use-case-guides/customer-support-chat). + +## Additional pricing considerations ### Cost optimization strategies @@ -330,8 +356,6 @@ When building agents with Claude: For high-volume agent applications, contact the [enterprise sales team](https://claude.com/contact-sales) for custom pricing arrangements. -## Additional pricing considerations - ### Rate limits Rate limits vary by usage tier and affect how many requests you can make: diff --git a/content/en/about-claude/use-case-guides/content-moderation.md b/content/en/about-claude/use-case-guides/content-moderation.md index 22b37fa36..fb67b95ef 100644 --- a/content/en/about-claude/use-case-guides/content-moderation.md +++ b/content/en/about-claude/use-case-guides/content-moderation.md @@ -113,7 +113,7 @@ When selecting a model, it’s important to consider the size of your data. If c In order to use Claude for content moderation, Claude must understand the moderation requirements of your application. Let’s start by writing a prompt that allows you to define your moderation needs: -```python nocheck hidelines={1} +```python Python nocheck hidelines={1} import anthropic import json @@ -190,7 +190,7 @@ Content moderation is a classification problem. Thus, you can use the same techn One additional consideration is that instead of treating content moderation as a binary classification problem, you may instead create multiple categories to represent various risk levels. Creating multiple risk levels allows you to adjust the aggressiveness of your moderation. For example, you might want to automatically block user queries that are deemed high risk, while users with many medium risk queries are flagged for human review. -```python nocheck hidelines={1} +```python Python nocheck hidelines={1} import anthropic import json @@ -289,7 +289,7 @@ In complex scenarios, it may be helpful to consider additional strategies to imp In addition to listing the unsafe categories in the prompt, further improvements can be made by providing definitions and phrases related to each category. -```python nocheck hidelines={1} +```python Python nocheck hidelines={1} import anthropic import json @@ -387,7 +387,7 @@ Notably, the definition for the `Specialized Advice` category now specifies the To reduce costs in situations where real-time moderation isn't necessary, consider moderating messages in batches. Include multiple messages within the prompt's context, and ask Claude to assess which messages should be moderated. -```python nocheck hidelines={1} +```python Python nocheck hidelines={1} import anthropic import json @@ -456,6 +456,7 @@ Violated Categories: {", ".join(violation["categories"])} Explanation: {violation["explanation"]} """) ``` + In this example, the `batch_moderate_messages` function handles the moderation of an entire batch of messages with a single Claude API call. Inside the function, a prompt is created that includes the list of messages to evaluate, the defined unsafe content categories, and their descriptions. The prompt directs Claude to return a JSON object listing all messages that contain violations. Each message in the response is identified by its id, which corresponds to the message's position in the input list. Keep in mind that finding the optimal batch size for your specific needs may require some experimentation. While larger batch sizes can lower costs, they might also lead to a slight decrease in quality. Additionally, you may need to increase the `max_tokens` parameter in the Claude API call to accommodate longer responses. For details on the maximum number of tokens your chosen model can output, refer to the [model comparison page](/docs/en/about-claude/models#model-comparison-table). diff --git a/content/en/about-claude/use-case-guides/legal-summarization.md b/content/en/about-claude/use-case-guides/legal-summarization.md index ac8ec5001..7d02228f4 100644 --- a/content/en/about-claude/use-case-guides/legal-summarization.md +++ b/content/en/about-claude/use-case-guides/legal-summarization.md @@ -152,7 +152,7 @@ Claude can adapt to various summarization styles. You can change the details of Here’s an example of how to create a prompt that ensures the generated summaries follow a consistent structure when analyzing sublease agreements: -```python nocheck hidelines={1..2} +```python Python nocheck hidelines={1..2} import anthropic # Initialize the Anthropic client @@ -252,7 +252,7 @@ Legal summarization often involves handling long documents or many related docum Here's an example of how to perform meta-summarization: -```python nocheck hidelines={1..2} +```python Python nocheck hidelines={1..2} import anthropic # Initialize the Anthropic client diff --git a/content/en/about-claude/use-case-guides/ticket-routing.md b/content/en/about-claude/use-case-guides/ticket-routing.md index 27da05445..cb1cd7c09 100644 --- a/content/en/about-claude/use-case-guides/ticket-routing.md +++ b/content/en/about-claude/use-case-guides/ticket-routing.md @@ -344,7 +344,7 @@ It’s hard to know how well your prompt works without deploying it in a test pr Let’s build the deployment structure. Start by defining the method signature for wrapping our call to Claude. We'll take the method we’ve already begun to write, which has `ticket_contents` as input, and now return a tuple of `reasoning` and `intent` as output. If you have an existing automation using traditional ML, you'll want to follow that method signature instead. -```python nocheck hidelines={1} +```python Python nocheck hidelines={1} import anthropic import re @@ -410,7 +410,7 @@ You may need to assess Claude on other axes depending on what factors that are i To assess this, we first have to modify the script we wrote and add a function to compare the predicted intent with the actual intent and calculate the percentage of correct predictions. We also have to add in cost calculation and time measurement functionality. -```python nocheck hidelines={1} +```python Python nocheck hidelines={1} import anthropic import re diff --git a/content/en/agent-sdk/cost-tracking.md b/content/en/agent-sdk/cost-tracking.md index e72c73d66..587bac8ca 100644 --- a/content/en/agent-sdk/cost-tracking.md +++ b/content/en/agent-sdk/cost-tracking.md @@ -29,7 +29,7 @@ The following diagram shows the message stream from a single `query()` call, wit - When Claude responds, it sends one or more assistant messages. In TypeScript, each assistant message contains a nested `BetaMessage` (accessed via `message.message`) with an `id` and a [`usage`](/docs/en/api/messages) object with token counts (`input_tokens`, `output_tokens`). In Python, the `AssistantMessage` dataclass exposes the same data directly via `message.usage` and `message.message_id`. When Claude uses multiple tools in one turn, all messages in that turn share the same ID, so deduplicate by ID to avoid double-counting. + When Claude responds, it sends one or more assistant messages. In TypeScript, each assistant message contains a nested `BetaMessage` (accessed via `message.message`) with an `id` and a [`usage`](/docs/en/api/messages/create) object with token counts (`input_tokens`, `output_tokens`). In Python, the `AssistantMessage` dataclass exposes the same data directly via `message.usage` and `message.message_id`. When Claude uses multiple tools in one turn, all messages in that turn share the same ID, so deduplicate by ID to avoid double-counting. When the `query()` call completes, the SDK emits a result message with `total_cost_usd` and cumulative `usage`. This is available in both TypeScript ([`SDKResultMessage`](/docs/en/agent-sdk/typescript#sdk-result-message)) and Python ([`ResultMessage`](/docs/en/agent-sdk/python#result-message)). If you make multiple `query()` calls (for example, in a multi-turn session), each result only reflects the cost of that individual call. If you only need the total cost, you can ignore the per-step usage and read this single value. diff --git a/content/en/agent-sdk/slash-commands.md b/content/en/agent-sdk/slash-commands.md index 104d9833a..8b19d0f7f 100644 --- a/content/en/agent-sdk/slash-commands.md +++ b/content/en/agent-sdk/slash-commands.md @@ -32,7 +32,9 @@ from claude_agent_sdk import query, ClaudeAgentOptions, SystemMessage async def main(): - async for message in query(prompt="Hello Claude", options=ClaudeAgentOptions(max_turns=1)): + async for message in query( + prompt="Hello Claude", options=ClaudeAgentOptions(max_turns=1) + ): if isinstance(message, SystemMessage) and message.subtype == "init": print("Available slash commands:", message.data["slash_commands"]) # Example output: ["/compact", "/clear", "/help"] @@ -70,7 +72,9 @@ from claude_agent_sdk import query, ClaudeAgentOptions, ResultMessage async def main(): # Send a slash command - async for message in query(prompt="/compact", options=ClaudeAgentOptions(max_turns=1)): + async for message in query( + prompt="/compact", options=ClaudeAgentOptions(max_turns=1) + ): if isinstance(message, ResultMessage): print("Command executed:", message.result) @@ -109,10 +113,14 @@ from claude_agent_sdk import query, ClaudeAgentOptions, SystemMessage async def main(): - async for message in query(prompt="/compact", options=ClaudeAgentOptions(max_turns=1)): + async for message in query( + prompt="/compact", options=ClaudeAgentOptions(max_turns=1) + ): if isinstance(message, SystemMessage) and message.subtype == "compact_boundary": print("Compaction completed") - print("Pre-compaction tokens:", message.data["compact_metadata"]["pre_tokens"]) + print( + "Pre-compaction tokens:", message.data["compact_metadata"]["pre_tokens"] + ) print("Trigger:", message.data["compact_metadata"]["trigger"]) @@ -149,7 +157,9 @@ from claude_agent_sdk import query, ClaudeAgentOptions, SystemMessage async def main(): # Clear conversation and start fresh - async for message in query(prompt="/clear", options=ClaudeAgentOptions(max_turns=1)): + async for message in query( + prompt="/clear", options=ClaudeAgentOptions(max_turns=1) + ): if isinstance(message, SystemMessage) and message.subtype == "init": print("Conversation cleared, new session started") print("Session ID:", message.data["session_id"]) @@ -315,7 +325,9 @@ from claude_agent_sdk import query, ClaudeAgentOptions, ResultMessage async def main(): # Pass arguments to custom command - async for message in query(prompt="/fix-issue 123 high", options=ClaudeAgentOptions(max_turns=5)): + async for message in query( + prompt="/fix-issue 123 high", options=ClaudeAgentOptions(max_turns=5) + ): # Command will process with $1="123" and $2="high" if isinstance(message, ResultMessage): print("Issue fixed:", message.result) @@ -464,12 +476,16 @@ from claude_agent_sdk import query, ClaudeAgentOptions async def main(): # Run code review - async for message in query(prompt="/code-review", options=ClaudeAgentOptions(max_turns=3)): + async for message in query( + prompt="/code-review", options=ClaudeAgentOptions(max_turns=3) + ): # Process review feedback pass # Run specific tests - async for message in query(prompt="/test auth", options=ClaudeAgentOptions(max_turns=5)): + async for message in query( + prompt="/test auth", options=ClaudeAgentOptions(max_turns=5) + ): # Handle test results pass diff --git a/content/en/agent-sdk/typescript.md b/content/en/agent-sdk/typescript.md index 18c873494..6a6884369 100644 --- a/content/en/agent-sdk/typescript.md +++ b/content/en/agent-sdk/typescript.md @@ -740,7 +740,7 @@ type SDKAssistantMessage = { }; ``` -The `message` field is a [`BetaMessage`](/docs/en/api/messages) from the Anthropic SDK. It includes fields like `id`, `content`, `model`, `stop_reason`, and `usage`. +The `message` field is a [`BetaMessage`](/docs/en/api/messages/create) from the Anthropic SDK. It includes fields like `id`, `content`, `model`, `stop_reason`, and `usage`. `SDKAssistantMessageError` is one of: `'authentication_failed'`, `'billing_error'`, `'rate_limit'`, `'invalid_request'`, `'server_error'`, `'max_output_tokens'`, or `'unknown'`. diff --git a/content/en/agents-and-tools/agent-skills/best-practices.md b/content/en/agents-and-tools/agent-skills/best-practices.md index 70b6bffc7..25bb1d4f6 100644 --- a/content/en/agents-and-tools/agent-skills/best-practices.md +++ b/content/en/agents-and-tools/agent-skills/best-practices.md @@ -1127,13 +1127,6 @@ Before sharing a Skill, verify: > Create and manage Skills in Claude Code - - Use Skills programmatically in TypeScript and Python - Upload and manage Skills programmatically - - Security patterns for agent deployment - \ No newline at end of file diff --git a/content/en/agents-and-tools/agent-skills/overview.md b/content/en/agents-and-tools/agent-skills/overview.md index 66a0fc601..dad4aaa53 100644 --- a/content/en/agents-and-tools/agent-skills/overview.md +++ b/content/en/agents-and-tools/agent-skills/overview.md @@ -177,16 +177,6 @@ Custom Skills in Claude Code are filesystem-based and don't require API uploads. To learn more, see [Use Skills in Claude Code](https://code.claude.com/docs/en/skills). -### Claude Agent SDK - -The [Claude Agent SDK](/docs/en/agent-sdk/overview) supports custom Skills through filesystem-based configuration. - -**Custom Skills**: Create Skills as directories with SKILL.md files in `.claude/skills/`. Enable Skills by including `"Skill"` in your `allowed_tools` configuration. - -Skills in the Agent SDK are then automatically discovered when the SDK runs. - -To learn more, see [Agent Skills in the SDK](/docs/en/agent-sdk/skills). - ### Claude.ai [Claude.ai](https://claude.ai) supports both pre-built Agent Skills and custom Skills. @@ -344,13 +334,6 @@ Plan your Skills to work within these constraints. > Create and manage custom Skills in Claude Code - - Use Skills programmatically in TypeScript and Python - + +```bash Shell +curl "https://api.anthropic.com/v1/skills?source=anthropic" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: skills-2025-10-02" +``` + +```bash CLI +ant beta:skills list --source anthropic +``` + ```python Python import anthropic @@ -57,13 +68,6 @@ for (const skill of skills.data) { console.log(`${skill.id}: ${skill.display_title}`); } ``` - -```bash Shell -curl "https://api.anthropic.com/v1/skills?source=anthropic" \ - -H "x-api-key: $ANTHROPIC_API_KEY" \ - -H "anthropic-version: 2023-06-01" \ - -H "anthropic-beta: skills-2025-10-02" -``` You see the following Skills: `pptx`, `xlsx`, `docx`, and `pdf`. @@ -75,6 +79,56 @@ This API returns each Skill's metadata: its name and description. Claude loads t Now use the PowerPoint Skill to create a presentation about renewable energy. Specify Skills using the `container` parameter in the Messages API: +```bash Shell +curl https://api.anthropic.com/v1/messages \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: code-execution-2025-08-25,skills-2025-10-02" \ + -H "content-type: application/json" \ + -d '{ + "model": "claude-opus-4-6", + "max_tokens": 4096, + "container": { + "skills": [ + { + "type": "anthropic", + "skill_id": "pptx", + "version": "latest" + } + ] + }, + "messages": [{ + "role": "user", + "content": "Create a presentation about renewable energy with 5 slides" + }], + "tools": [{ + "type": "code_execution_20250825", + "name": "code_execution" + }] + }' +``` + +```bash CLI +ant beta:messages create \ + --beta code-execution-2025-08-25 \ + --beta skills-2025-10-02 \ + --transform content <<'YAML' +model: claude-opus-4-6 +max_tokens: 4096 +container: + skills: + - type: anthropic + skill_id: pptx + version: latest +messages: + - role: user + content: Create a presentation about renewable energy with 5 slides +tools: + - type: code_execution_20250825 + name: code_execution +YAML +``` + ```python Python import anthropic @@ -135,35 +189,6 @@ const response = await client.beta.messages.create({ console.log(response.content); ``` - -```bash Shell -curl https://api.anthropic.com/v1/messages \ - -H "x-api-key: $ANTHROPIC_API_KEY" \ - -H "anthropic-version: 2023-06-01" \ - -H "anthropic-beta: code-execution-2025-08-25,skills-2025-10-02" \ - -H "content-type: application/json" \ - -d '{ - "model": "claude-opus-4-6", - "max_tokens": 4096, - "container": { - "skills": [ - { - "type": "anthropic", - "skill_id": "pptx", - "version": "latest" - } - ] - }, - "messages": [{ - "role": "user", - "content": "Create a presentation about renewable energy with 5 slides" - }], - "tools": [{ - "type": "code_execution_20250825", - "name": "code_execution" - }] - }' -``` Let's break down what each part does: @@ -183,6 +208,50 @@ The presentation was created in the code execution container and saved as a file +```bash Shell nocheck +# Extract file_id from response (using jq) +FILE_ID=$(echo "$RESPONSE" | jq -r '.content[] | select(.type=="tool_use" and .name=="code_execution") | .content[] | select(.file_id) | .file_id') + +# Download the file +curl "https://api.anthropic.com/v1/files/$FILE_ID/content" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: files-api-2025-04-14" \ + --output renewable_energy.pptx + +echo "Presentation saved to renewable_energy.pptx" +``` + +```bash CLI +# Extract file_id with --transform on the messages create call +FILE_ID=$(ant beta:messages create \ + --beta code-execution-2025-08-25 --beta skills-2025-10-02 \ + --transform 'content.#.content.content.#.file_id|@flatten|0' \ + --format yaml <<'YAML' +model: claude-opus-4-6 +max_tokens: 4096 +container: + skills: + - type: anthropic + skill_id: pptx + version: latest +messages: + - role: user + content: Create a presentation about renewable energy with 5 slides +tools: + - type: code_execution_20250825 + name: code_execution +YAML +) + +# Download the file +ant beta:files download \ + --file-id "$FILE_ID" \ + --output renewable_energy.pptx + +printf 'Presentation saved to renewable_energy.pptx\n' +``` + ```python Python nocheck from typing import Any @@ -238,20 +307,6 @@ if (fileId) { console.log("Presentation saved to renewable_energy.pptx"); } ``` - -```bash Shell nocheck -# Extract file_id from response (using jq) -FILE_ID=$(echo "$RESPONSE" | jq -r '.content[] | select(.type=="tool_use" and .name=="code_execution") | .content[] | select(.file_id) | .file_id') - -# Download the file -curl "https://api.anthropic.com/v1/files/$FILE_ID/content" \ - -H "x-api-key: $ANTHROPIC_API_KEY" \ - -H "anthropic-version: 2023-06-01" \ - -H "anthropic-beta: files-api-2025-04-14" \ - --output renewable_energy.pptx - -echo "Presentation saved to renewable_energy.pptx" -``` @@ -265,6 +320,55 @@ Now that you've created your first document with Skills, try these variations: ### Create a spreadsheet +```bash Shell +curl https://api.anthropic.com/v1/messages \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: code-execution-2025-08-25,skills-2025-10-02" \ + -H "content-type: application/json" \ + -d '{ + "model": "claude-opus-4-6", + "max_tokens": 4096, + "container": { + "skills": [ + { + "type": "anthropic", + "skill_id": "xlsx", + "version": "latest" + } + ] + }, + "messages": [{ + "role": "user", + "content": "Create a quarterly sales tracking spreadsheet with sample data" + }], + "tools": [{ + "type": "code_execution_20250825", + "name": "code_execution" + }] + }' +``` + +```bash CLI +ant beta:messages create \ + --beta code-execution-2025-08-25 \ + --beta skills-2025-10-02 <<'YAML' +model: claude-opus-4-6 +max_tokens: 4096 +container: + skills: + - type: anthropic + skill_id: xlsx + version: latest +messages: + - role: user + content: Create a quarterly sales tracking spreadsheet with sample data +tools: + - type: code_execution_20250825 + name: code_execution +YAML +``` + ```python Python response = client.beta.messages.create( model="claude-opus-4-6", @@ -311,7 +415,11 @@ const response = await client.beta.messages.create({ ] }); ``` + +### Create a Word document + + ```bash Shell curl https://api.anthropic.com/v1/messages \ -H "x-api-key: $ANTHROPIC_API_KEY" \ @@ -325,14 +433,14 @@ curl https://api.anthropic.com/v1/messages \ "skills": [ { "type": "anthropic", - "skill_id": "xlsx", + "skill_id": "docx", "version": "latest" } ] }, "messages": [{ "role": "user", - "content": "Create a quarterly sales tracking spreadsheet with sample data" + "content": "Write a 2-page report on the benefits of renewable energy" }], "tools": [{ "type": "code_execution_20250825", @@ -340,11 +448,27 @@ curl https://api.anthropic.com/v1/messages \ }] }' ``` - -### Create a Word document +```bash CLI +ant beta:messages create \ + --beta code-execution-2025-08-25 \ + --beta skills-2025-10-02 <<'YAML' +model: claude-opus-4-6 +max_tokens: 4096 +container: + skills: + - type: anthropic + skill_id: docx + version: latest +messages: + - role: user + content: Write a 2-page report on the benefits of renewable energy +tools: + - type: code_execution_20250825 + name: code_execution +YAML +``` - ```python Python response = client.beta.messages.create( model="claude-opus-4-6", @@ -391,7 +515,11 @@ const response = await client.beta.messages.create({ ] }); ``` + +### Generate a PDF + + ```bash Shell curl https://api.anthropic.com/v1/messages \ -H "x-api-key: $ANTHROPIC_API_KEY" \ @@ -405,14 +533,14 @@ curl https://api.anthropic.com/v1/messages \ "skills": [ { "type": "anthropic", - "skill_id": "docx", + "skill_id": "pdf", "version": "latest" } ] }, "messages": [{ "role": "user", - "content": "Write a 2-page report on the benefits of renewable energy" + "content": "Generate a PDF invoice template" }], "tools": [{ "type": "code_execution_20250825", @@ -420,11 +548,27 @@ curl https://api.anthropic.com/v1/messages \ }] }' ``` - -### Generate a PDF +```bash CLI +ant beta:messages create \ + --beta code-execution-2025-08-25 \ + --beta skills-2025-10-02 <<'YAML' +model: claude-opus-4-6 +max_tokens: 4096 +container: + skills: + - type: anthropic + skill_id: pdf + version: latest +messages: + - role: user + content: Generate a PDF invoice template +tools: + - type: code_execution_20250825 + name: code_execution +YAML +``` - ```python Python response = client.beta.messages.create( model="claude-opus-4-6", @@ -466,35 +610,6 @@ const response = await client.beta.messages.create({ ] }); ``` - -```bash Shell -curl https://api.anthropic.com/v1/messages \ - -H "x-api-key: $ANTHROPIC_API_KEY" \ - -H "anthropic-version: 2023-06-01" \ - -H "anthropic-beta: code-execution-2025-08-25,skills-2025-10-02" \ - -H "content-type: application/json" \ - -d '{ - "model": "claude-opus-4-6", - "max_tokens": 4096, - "container": { - "skills": [ - { - "type": "anthropic", - "skill_id": "pdf", - "version": "latest" - } - ] - }, - "messages": [{ - "role": "user", - "content": "Generate a PDF invoice template" - }], - "tools": [{ - "type": "code_execution_20250825", - "name": "code_execution" - }] - }' -``` ## Next steps @@ -530,13 +645,6 @@ Now that you've used pre-built Agent Skills, you can: > Learn about Skills in Claude Code - - Use Skills programmatically in TypeScript and Python - - Use the [`mcp_servers` API parameter](#using-the-mcp-connector-in-the-messages-api) when you have remote servers accessible via URL and only need tool support. If you're using the [Agent SDK](/docs/en/agent-sdk/mcp), MCP connections are managed automatically. Use the client-side helpers when you need local servers, prompts, resources, or more control over the connection with the base SDK. + Use the [`mcp_servers` API parameter](#using-the-mcp-connector-in-the-messages-api) when you have remote servers accessible via URL and only need tool support. Use the client-side helpers when you need local servers, prompts, resources, or more control over the connection with the base SDK. ### Installation diff --git a/content/en/agents-and-tools/tool-use/bash-tool.md b/content/en/agents-and-tools/tool-use/bash-tool.md index 0e33e90dc..79b95beee 100644 --- a/content/en/agents-and-tools/tool-use/bash-tool.md +++ b/content/en/agents-and-tools/tool-use/bash-tool.md @@ -28,23 +28,6 @@ For model support, see the [Tool reference](/docs/en/agents-and-tools/tool-use/t ## Quick start -```python Python -import anthropic - -client = anthropic.Anthropic() - -response = client.messages.create( - model="claude-opus-4-6", - max_tokens=1024, - tools=[{"type": "bash_20250124", "name": "bash"}], - messages=[ - {"role": "user", "content": "List all Python files in the current directory."} - ], -) - -print(response) -``` - ```bash Shell curl https://api.anthropic.com/v1/messages \ -H "content-type: application/json" \ @@ -67,6 +50,31 @@ curl https://api.anthropic.com/v1/messages \ ] }' ``` + +```bash CLI +ant messages create \ + --model claude-opus-4-6 \ + --max-tokens 1024 \ + --tool '{type: bash_20250124, name: bash}' \ + --message '{role: user, content: List all Python files in the current directory.}' +``` + +```python Python +import anthropic + +client = anthropic.Anthropic() + +response = client.messages.create( + model="claude-opus-4-6", + max_tokens=1024, + tools=[{"type": "bash_20250124", "name": "bash"}], + messages=[ + {"role": "user", "content": "List all Python files in the current directory."} + ], +) + +print(response) +``` ## How it works diff --git a/content/en/agents-and-tools/tool-use/code-execution-tool.md b/content/en/agents-and-tools/tool-use/code-execution-tool.md index 7e3120685..062a18484 100644 --- a/content/en/agents-and-tools/tool-use/code-execution-tool.md +++ b/content/en/agents-and-tools/tool-use/code-execution-tool.md @@ -68,6 +68,14 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant messages create \ + --model claude-opus-4-6 \ + --max-tokens 4096 \ + --message '{role: user, content: "Calculate the mean and standard deviation of [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"}' \ + --tool '{type: code_execution_20250825, name: code_execution}' +``` + ```python Python hidelines={1..2} import anthropic @@ -345,6 +353,31 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI hidelines={1} +printf 'name,value\nfoo,1\nbar,2\n' > data.csv +# Upload a file +FILE_ID=$(ant beta:files upload \ + --file ./data.csv \ + --transform id --format yaml) + +# Use the file_id with code execution +ant beta:messages create \ + --beta files-api-2025-04-14 < +```bash CLI nocheck +# Request code execution that creates files; extract file_ids from tool results +TOOL_RESULT='content.#(type=="bash_code_execution_tool_result")#' +FILE_IDS=$(ant beta:messages create \ + --beta files-api-2025-04-14 \ + --transform "${TOOL_RESULT}.content.content|@flatten|#.file_id" \ + --format yaml \ + --model claude-opus-4-6 \ + --max-tokens 4096 \ + --message '{role: user, content: Create a matplotlib visualization and save it as output.png}' \ + --tool '{type: code_execution_20250825, name: code_execution}' +) + +# Download each created file +while IFS= read -r LINE; do + [[ "$LINE" != "- "* ]] && continue + FILE_ID="${LINE#- }" + FILENAME=$(ant beta:files retrieve-metadata \ + --file-id "$FILE_ID" \ + --transform filename --format yaml) + ant beta:files download \ + --file-id "$FILE_ID" \ + --output "$FILENAME" > /dev/null + printf 'Downloaded: %s\n' "$FILENAME" +done <<< "$FILE_IDS" +``` + ```python Python nocheck hidelines={1..2} from anthropic import Anthropic @@ -1063,7 +1123,7 @@ The code execution tool can return two types of results depending on the operati ### Bash command response -```json hidelines={1,-1} +```json Output hidelines={1,-1} [ { "type": "server_tool_use", @@ -1089,7 +1149,7 @@ The code execution tool can return two types of results depending on the operati ### File operation responses **View file:** -```json hidelines={1,-1} +```json Output hidelines={1,-1} [ { "type": "server_tool_use", @@ -1116,7 +1176,7 @@ The code execution tool can return two types of results depending on the operati ``` **Create file:** -```json hidelines={1,-1} +```json Output hidelines={1,-1} [ { "type": "server_tool_use", @@ -1140,7 +1200,7 @@ The code execution tool can return two types of results depending on the operati ``` **Edit file (str_replace):** -```json hidelines={1,-1} +```json Output hidelines={1,-1} [ { "type": "server_tool_use", @@ -1185,7 +1245,7 @@ Additional fields for file operations: Each tool type can return specific errors: **Common errors (all tools):** -```json +```json Output { "type": "bash_code_execution_tool_result", "tool_use_id": "srvtoolu_01VfmxgZ46TiHbmXgy928hQR", @@ -1296,6 +1356,24 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +# First request: Create a file with a random number +CONTAINER_ID=$(ant messages create \ + --transform container.id --format yaml \ + --model claude-opus-4-6 \ + --max-tokens 4096 \ + --message '{role: user, content: Write a file with a random number and save it to "/tmp/number.txt"}' \ + --tool '{type: code_execution_20250825, name: code_execution}' +) + +# Second request: Reuse the container to read the file +ant messages create --container "$CONTAINER_ID" \ + --model claude-opus-4-6 \ + --max-tokens 4096 \ + --message '{role: user, content: Read the number from "/tmp/number.txt" and calculate its square}' \ + --tool '{type: code_execution_20250825, name: code_execution}' +``` + ```python Python hidelines={1..6} import os from anthropic import Anthropic diff --git a/content/en/agents-and-tools/tool-use/computer-use-tool.md b/content/en/agents-and-tools/tool-use/computer-use-tool.md index 67000cb10..5fe985fe5 100644 --- a/content/en/agents-and-tools/tool-use/computer-use-tool.md +++ b/content/en/agents-and-tools/tool-use/computer-use-tool.md @@ -102,6 +102,26 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant beta:messages create --beta computer-use-2025-11-24 <<'YAML' +model: claude-opus-4-6 +max_tokens: 1024 +tools: + - type: computer_20251124 + name: computer + display_width_px: 1024 + display_height_px: 768 + display_number: 1 + - type: text_editor_20250728 + name: str_replace_based_edit_tool + - type: bash_20250124 + name: bash +messages: + - role: user + content: Save a picture of a cat to my desktop. +YAML +``` + ```python Python hidelines={1..2} import anthropic diff --git a/content/en/agents-and-tools/tool-use/fine-grained-tool-streaming.md b/content/en/agents-and-tools/tool-use/fine-grained-tool-streaming.md index a5e88ebaf..7bf188071 100644 --- a/content/en/agents-and-tools/tool-use/fine-grained-tool-streaming.md +++ b/content/en/agents-and-tools/tool-use/fine-grained-tool-streaming.md @@ -60,6 +60,33 @@ Here's an example of how to use fine-grained tool streaming with the API: }' ``` + ```bash CLI + ant messages create --stream \ + --transform usage <<'YAML' + model: claude-opus-4-6 + max_tokens: 65536 + tools: + - name: make_file + description: Write text to a file + eager_input_streaming: true + input_schema: + type: object + properties: + filename: + type: string + description: The filename to write text to + lines_of_text: + type: array + description: An array of lines of text to write to the file + required: + - filename + - lines_of_text + messages: + - role: user + content: Can you write a long poem and make a file called poem.txt? + YAML + ``` + ```python Python hidelines={1..2} import anthropic diff --git a/content/en/agents-and-tools/tool-use/memory-tool.md b/content/en/agents-and-tools/tool-use/memory-tool.md index e7b53e50b..0dbc6bdfb 100644 --- a/content/en/agents-and-tools/tool-use/memory-tool.md +++ b/content/en/agents-and-tools/tool-use/memory-tool.md @@ -134,6 +134,35 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +````bash CLI +ant messages create <<'YAML' +model: claude-opus-4-6 +max_tokens: 2048 +tools: + - type: memory_20250818 + name: memory +messages: + - role: user + content: | + I'm working on a Python web scraper that keeps crashing with a + timeout error. Here's the problematic function: + + ```python + def fetch_page(url, retries=3): + for i in range(retries): + try: + response = requests.get(url, timeout=5) + return response.text + except requests.exceptions.Timeout: + if i == retries - 1: + raise + time.sleep(1) + ``` + + Please help me debug this. +YAML +```` + ```python Python hidelines={1..2} import anthropic diff --git a/content/en/agents-and-tools/tool-use/overview.md b/content/en/agents-and-tools/tool-use/overview.md index e2ea42493..f0085d4c7 100644 --- a/content/en/agents-and-tools/tool-use/overview.md +++ b/content/en/agents-and-tools/tool-use/overview.md @@ -9,6 +9,27 @@ Tool use lets Claude call functions you define or that Anthropic provides. Claud Here's the simplest example using a server tool, where Anthropic handles execution: +```bash Shell +curl https://api.anthropic.com/v1/messages \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "content-type: application/json" \ + -d '{ + "model": "claude-opus-4-6", + "max_tokens": 1024, + "tools": [{"type": "web_search_20260209", "name": "web_search"}], + "messages": [{"role": "user", "content": "What'\''s the latest on the Mars rover?"}] + }' +``` + +```bash CLI +ant messages create --transform content --format yaml \ + --model claude-opus-4-6 \ + --max-tokens 1024 \ + --tool '{type: web_search_20260209, name: web_search}' \ + --message '{role: user, content: "What is the latest on the Mars rover?"}' +``` + ```python Python import anthropic @@ -34,19 +55,6 @@ const response = await client.messages.create({ }); console.log(response.content); ``` - -```bash Shell -curl https://api.anthropic.com/v1/messages \ - -H "x-api-key: $ANTHROPIC_API_KEY" \ - -H "anthropic-version: 2023-06-01" \ - -H "content-type: application/json" \ - -d '{ - "model": "claude-opus-4-6", - "max_tokens": 1024, - "tools": [{"type": "web_search_20260209", "name": "web_search"}], - "messages": [{"role": "user", "content": "What'\''s the latest on the Mars rover?"}] - }' -``` --- diff --git a/content/en/agents-and-tools/tool-use/programmatic-tool-calling.md b/content/en/agents-and-tools/tool-use/programmatic-tool-calling.md index 78ba43f0c..9792864e9 100644 --- a/content/en/agents-and-tools/tool-use/programmatic-tool-calling.md +++ b/content/en/agents-and-tools/tool-use/programmatic-tool-calling.md @@ -65,6 +65,35 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant messages create <<'YAML' +model: claude-opus-4-6 +max_tokens: 4096 +messages: + - role: user + content: >- + Query sales data for the West, East, and Central regions, then + tell me which region had the highest revenue +tools: + - type: code_execution_20260120 + name: code_execution + - name: query_database + description: >- + Execute a SQL query against the sales database. Returns a list + of rows as JSON objects. + input_schema: + type: object + properties: + sql: + type: string + description: SQL query to execute + required: + - sql + allowed_callers: + - code_execution_20260120 +YAML +``` + ```python Python import anthropic @@ -471,7 +500,7 @@ The request shape is identical to the [Quick start](#quick-start) example: inclu Claude writes code that calls your tool. The API pauses and returns: -```json +```json Output { "role": "assistant", "content": [ @@ -512,6 +541,44 @@ Include the full conversation history plus your tool result: +```bash CLI nocheck +ant messages create <<'YAML' +model: claude-opus-4-6 +max_tokens: 4096 +container: container_xyz789 +messages: + - role: user + content: >- + Query customer purchase history from the last quarter and identify our + top 5 customers by revenue + - role: assistant + content: + - type: text + text: I'll query the purchase history and analyze the results. + - type: server_tool_use + id: srvtoolu_abc123 + name: code_execution + input: + code: "..." + - type: tool_use + id: toolu_def456 + name: query_database + input: + sql: "" + caller: + type: code_execution_20260120 + tool_id: srvtoolu_abc123 + - role: user + content: + - type: tool_result + tool_use_id: toolu_def456 + content: >- + [{"customer_id": "C1", "revenue": 45000}, {"customer_id": "C2", + "revenue": 38000}, ...] +tools: [...] +YAML +``` + ```python Python nocheck response = client.messages.create( model="claude-opus-4-6", @@ -940,7 +1007,7 @@ The code execution continues and processes the results. If additional tool calls Once the code execution completes, Claude provides the final response: -```json +```json Output { "content": [ { diff --git a/content/en/agents-and-tools/tool-use/text-editor-tool.md b/content/en/agents-and-tools/tool-use/text-editor-tool.md index 82dc286fa..6b8764039 100644 --- a/content/en/agents-and-tools/tool-use/text-editor-tool.md +++ b/content/en/agents-and-tools/tool-use/text-editor-tool.md @@ -54,6 +54,14 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant messages create \ + --model claude-opus-4-6 \ + --max-tokens 1024 \ + --tool '{type: text_editor_20250728, name: str_replace_based_edit_tool, max_characters: 10000}' \ + --message '{role: user, content: There is a syntax error in my primes.py file. Can you help me fix it?}' +``` + ```python Python hidelines={1..2} import anthropic @@ -323,6 +331,14 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant messages create \ + --model claude-opus-4-6 \ + --max-tokens 1024 \ + --tool '{type: text_editor_20250728, name: str_replace_based_edit_tool}' \ + --message '{role: user, content: There is a syntax error in my primes.py file. Can you help me fix it?}' +``` + ```python Python hidelines={1..2} import anthropic @@ -397,7 +413,7 @@ void main() { Claude uses the text editor tool first to view the file: -```json +```json Output { "id": "msg_01XAbCDeFgHiJkLmNoPQrStU", "model": "claude-opus-4-6", @@ -475,6 +491,69 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant messages create <<'YAML' +model: claude-opus-4-6 +max_tokens: 1024 +tools: + - type: text_editor_20250728 + name: str_replace_based_edit_tool +messages: + - role: user + content: There's a syntax error in my primes.py file. Can you help me fix it? + - role: assistant + content: + - type: text + text: >- + I'll help you fix the syntax error in your primes.py file. First, + let me take a look at the file to identify the issue. + - type: tool_use + id: toolu_01AbCdEfGhIjKlMnOpQrStU + name: str_replace_based_edit_tool + input: + command: view + path: primes.py + - role: user + content: + - type: tool_result + tool_use_id: toolu_01AbCdEfGhIjKlMnOpQrStU + content: |- + 1: def is_prime(n): + 2: """Check if a number is prime.""" + 3: if n <= 1: + 4: return False + 5: if n <= 3: + 6: return True + 7: if n % 2 == 0 or n % 3 == 0: + 8: return False + 9: i = 5 + 10: while i * i <= n: + 11: if n % i == 0 or n % (i + 2) == 0: + 12: return False + 13: i += 6 + 14: return True + 15: + 16: def get_primes(limit): + 17: """Generate a list of prime numbers up to the given limit.""" + 18: primes = [] + 19: for num in range(2, limit + 1) + 20: if is_prime(num): + 21: primes.append(num) + 22: return primes + 23: + 24: def main(): + 25: """Main function to demonstrate prime number generation.""" + 26: limit = 100 + 27: prime_list = get_primes(limit) + 28: print(f"Prime numbers up to {limit}:") + 29: print(prime_list) + 30: print(f"Found {len(prime_list)} prime numbers.") + 31: + 32: if __name__ == "__main__": + 33: main() +YAML +``` + ```python Python response = client.messages.create( model="claude-opus-4-6", @@ -642,7 +721,7 @@ In the example above, the `view` tool result includes file contents with line nu Claude identifies the syntax error and uses the `str_replace` command to fix it: -```json +```json Output { "id": "msg_01VwXyZAbCdEfGhIjKlMnO", "model": "claude-opus-4-6", @@ -671,6 +750,38 @@ Claude identifies the syntax error and uses the `str_replace` command to fix it: Your application should then make the edit and return the result: +```bash CLI +ant messages create <<'YAML' +model: claude-opus-4-6 +max_tokens: 1024 +tools: + - type: text_editor_20250728 + name: str_replace_based_edit_tool +messages: + # Previous messages... + - role: assistant + content: + - type: text + text: >- + I found the syntax error in your primes.py file. In the `get_primes` + function, there is a missing colon (:) at the end of the for loop + line. Let me fix that for you. + - type: tool_use + id: toolu_01PqRsTuVwXyZAbCdEfGh + name: str_replace_based_edit_tool + input: + command: str_replace + path: primes.py + old_str: " for num in range(2, limit + 1)" + new_str: " for num in range(2, limit + 1):" + - role: user + content: + - type: tool_result + tool_use_id: toolu_01PqRsTuVwXyZAbCdEfGh + content: Successfully replaced text at exactly one location. +YAML +``` + ```python Python response = client.messages.create( model="claude-opus-4-6", @@ -838,7 +949,7 @@ public class TextEditorConversationExample { Finally, Claude provides a complete explanation of the fix: -```json +```json Output { "id": "msg_01IjKlMnOpQrStUvWxYzAb", "model": "claude-opus-4-6", diff --git a/content/en/agents-and-tools/tool-use/tool-search-tool.md b/content/en/agents-and-tools/tool-use/tool-search-tool.md index 6c1c3aa7d..e8c166eb4 100644 --- a/content/en/agents-and-tools/tool-use/tool-search-tool.md +++ b/content/en/agents-and-tools/tool-use/tool-search-tool.md @@ -110,6 +110,44 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant messages create <<'YAML' +model: claude-opus-4-6 +max_tokens: 2048 +messages: + - role: user + content: What is the weather in San Francisco? +tools: + - type: tool_search_tool_regex_20251119 + name: tool_search_tool_regex + - name: get_weather + description: Get the weather at a specific location + input_schema: + type: object + properties: + location: + type: string + unit: + type: string + enum: [celsius, fahrenheit] + required: [location] + defer_loading: true + - name: search_files + description: Search through files in the workspace + input_schema: + type: object + properties: + query: + type: string + file_types: + type: array + items: + type: string + required: [query] + defer_loading: true +YAML +``` + ```python Python hidelines={1..2} import anthropic diff --git a/content/en/agents-and-tools/tool-use/web-fetch-tool.md b/content/en/agents-and-tools/tool-use/web-fetch-tool.md index 1f90db152..e4b47543a 100644 --- a/content/en/agents-and-tools/tool-use/web-fetch-tool.md +++ b/content/en/agents-and-tools/tool-use/web-fetch-tool.md @@ -82,6 +82,21 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant messages create <<'YAML' +model: claude-opus-4-6 +max_tokens: 4096 +messages: + - role: user + content: >- + Fetch the content at https://example.com/research-paper + and extract the key findings. +tools: + - type: web_fetch_20260209 + name: web_fetch +YAML +``` + ```python Python hidelines={1..2} import anthropic @@ -279,6 +294,14 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant messages create \ + --model claude-opus-4-6 \ + --max-tokens 1024 \ + --message '{role: user, content: "Please analyze the content at https://example.com/article"}' \ + --tool '{type: web_fetch_20250910, name: web_fetch, max_uses: 5}' +``` + ```python Python hidelines={1..2} import anthropic @@ -516,7 +539,7 @@ When displaying API outputs directly to end users, citations must be included to Here's an example response structure: -```json +```json Output { "role": "assistant", "content": [ @@ -600,7 +623,7 @@ The web fetch tool caches results to improve performance and reduce redundant re For PDF documents, content is returned as base64-encoded data: -```json +```json Output { "type": "web_fetch_tool_result", "tool_use_id": "srvtoolu_02", @@ -625,7 +648,7 @@ For PDF documents, content is returned as base64-encoded data: When the web fetch tool encounters an error, the Claude API returns a 200 (success) response with the error represented in the response body: -```json +```json Output { "type": "web_fetch_tool_result", "tool_use_id": "srvtoolu_a93jad", @@ -661,7 +684,7 @@ The tool cannot fetch arbitrary URLs that Claude generates or URLs from containe Web fetch works seamlessly with web search for comprehensive information gathering: -```python hidelines={1..2} +```python Python hidelines={1..2} import anthropic client = anthropic.Anthropic() @@ -701,7 +724,7 @@ For caching tool definitions across turns, see [Tool use with prompt caching](/d With streaming enabled, fetch events are part of the stream with a pause during content retrieval: -```sse +```sse Output event: message_start data: {"type": "message_start", "message": {"id": "msg_abc123", "type": "message"}} diff --git a/content/en/agents-and-tools/tool-use/web-search-tool.md b/content/en/agents-and-tools/tool-use/web-search-tool.md index a70737131..91319102f 100644 --- a/content/en/agents-and-tools/tool-use/web-search-tool.md +++ b/content/en/agents-and-tools/tool-use/web-search-tool.md @@ -62,6 +62,21 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant messages create <<'YAML' +model: claude-opus-4-6 +max_tokens: 4096 +messages: + - role: user + content: >- + Search for the current prices of AAPL and GOOGL, then calculate + which has a better P/E ratio. +tools: + - type: web_search_20260209 + name: web_search +YAML +``` + ```python Python hidelines={1..2} import anthropic @@ -263,6 +278,14 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant messages create \ + --model claude-opus-4-6 \ + --max-tokens 1024 \ + --message '{role: user, content: What is the weather in NYC?}' \ + --tool '{type: web_search_20250305, name: web_search, max_uses: 5}' +``` + ```python Python hidelines={1..2} import anthropic @@ -490,7 +513,7 @@ The `user_location` parameter allows you to localize search results based on a u Here's an example response structure: -```json +```json Output { "role": "assistant", "content": [ @@ -581,7 +604,7 @@ The web search citation fields `cited_text`, `title`, and `url` do not count tow When the web search tool encounters an error (such as hitting rate limits), the Claude API still returns a 200 (success) response. The error is represented within the response body using the following structure: -```json +```json Output { "type": "web_search_tool_result", "tool_use_id": "servertoolu_a93jad", @@ -612,7 +635,7 @@ For caching tool definitions across turns, see [Tool use with prompt caching](/d With streaming enabled, you'll receive search events as part of the stream. There will be a pause while the search executes: -```sse +```sse Output event: message_start data: {"type": "message_start", "message": {"id": "msg_abc123", "type": "message"}} diff --git a/content/en/api/beta-headers.md b/content/en/api/beta-headers.md index 1af561735..60927d33e 100644 --- a/content/en/api/beta-headers.md +++ b/content/en/api/beta-headers.md @@ -27,6 +27,29 @@ When using the SDK, you can specify beta headers in the request options: +```bash Shell +curl https://api.anthropic.com/v1/messages \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: files-api-2025-04-14" \ + -H "content-type: application/json" \ + -d '{ + "model": "claude-opus-4-6", + "max_tokens": 1024, + "messages": [ + {"role": "user", "content": "Hello, Claude"} + ] + }' +``` + +```bash CLI +ant beta:messages create \ + --beta files-api-2025-04-14 \ + --model claude-opus-4-6 \ + --max-tokens 1024 \ + --message '{role: user, content: "Hello, Claude"}' +``` + ```python Python hidelines={1..2} from anthropic import Anthropic @@ -53,21 +76,6 @@ const msg = await anthropic.beta.messages.create({ }); ``` -```bash Shell -curl https://api.anthropic.com/v1/messages \ - -H "x-api-key: $ANTHROPIC_API_KEY" \ - -H "anthropic-version: 2023-06-01" \ - -H "anthropic-beta: files-api-2025-04-14" \ - -H "content-type: application/json" \ - -d '{ - "model": "claude-opus-4-6", - "max_tokens": 1024, - "messages": [ - {"role": "user", "content": "Hello, Claude"} - ] - }' -``` - @@ -86,6 +94,16 @@ To use multiple beta features in a single request, include all feature names in anthropic-beta: feature1,feature2,feature3 ``` +### Endpoint-specific headers + +Some beta features are scoped to specific endpoints rather than individual request parameters. [Claude Managed Agents](/docs/en/managed-agents/overview) uses a single beta header for all endpoints: + +| Endpoints | Beta header | +| --- | --- | +| `/v1/agents`, `/v1/sessions`, `/v1/environments` | `managed-agents-2026-04-01` | + +See the [Managed Agents overview](/docs/en/managed-agents/overview) for details. + ### Version naming conventions Beta feature names typically follow the pattern: `feature-name-YYYY-MM-DD`, where the date indicates when the beta version was released. Always use the exact beta feature name as documented. @@ -94,7 +112,7 @@ Beta feature names typically follow the pattern: `feature-name-YYYY-MM-DD`, wher If you use an invalid or unavailable beta header, you'll receive an error response: -```json +```json Output { "type": "error", "error": { diff --git a/content/en/api/beta.md b/content/en/api/beta.md index 10d283c01..bb43e6799 100644 --- a/content/en/api/beta.md +++ b/content/en/api/beta.md @@ -4,11 +4,11 @@ ### Anthropic Beta -- `AnthropicBeta = string or "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` +- `AnthropicBeta = string or "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -52,8 +52,6 @@ - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Beta API Error - `BetaAPIError = object { message, type }` @@ -338,7 +336,7 @@ The Models API response can be used to determine which models are available for - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -382,8 +380,6 @@ The Models API response can be used to determine which models are available for - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `data: array of BetaModelInfo` @@ -610,7 +606,7 @@ The Models API response can be used to determine information about a specific mo - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -654,8 +650,6 @@ The Models API response can be used to determine information about a specific mo - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaModelInfo = object { id, capabilities, created_at, 4 more }` @@ -1346,7 +1340,7 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -1390,8 +1384,6 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Body Parameters - `max_tokens: number` @@ -3979,15 +3971,19 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -6056,10 +6052,6 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en Recommended for advanced use cases only. You usually only need to use `temperature`. -- `user_profile_id: optional string` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - ### Returns - `BetaMessage = object { id, container, content, 8 more }` @@ -6983,15 +6975,19 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -7326,7 +7322,7 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -7370,8 +7366,6 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Body Parameters - `messages: array of BetaMessageParam` @@ -9951,15 +9945,19 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -11962,7 +11960,7 @@ curl https://api.anthropic.com/v1/messages/count_tokens \ "role": "user" } ], - "model": "claude-opus-4-6" + "model": "claude-mythos-preview" }' ``` @@ -19151,15 +19149,19 @@ curl https://api.anthropic.com/v1/messages/count_tokens \ See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -24495,15 +24497,19 @@ curl https://api.anthropic.com/v1/messages/count_tokens \ See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -25739,15 +25745,19 @@ curl https://api.anthropic.com/v1/messages/count_tokens \ See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -34282,7 +34292,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -34326,8 +34336,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Body Parameters - `requests: array of object { custom_id, params }` @@ -34340,7 +34348,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Must be unique for each request within the Message Batch. - - `params: object { max_tokens, messages, model, 20 more }` + - `params: object { max_tokens, messages, model, 19 more }` Messages API creation parameters for the individual request. @@ -36931,15 +36939,19 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -39008,10 +39020,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Recommended for advanced use cases only. You usually only need to use `temperature`. - - `user_profile_id: optional string` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - ### Returns - `BetaMessageBatch = object { id, archived_at, cancel_initiated_at, 7 more }` @@ -39151,7 +39159,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -39195,365 +39203,359 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - -### Returns - -- `BetaMessageBatch = object { id, archived_at, cancel_initiated_at, 7 more }` - - - `id: string` - - Unique object identifier. - - The format and length of IDs may change over time. - - - `archived_at: string` - - RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. - - - `cancel_initiated_at: string` - - RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. - - - `created_at: string` - - RFC 3339 datetime string representing the time at which the Message Batch was created. - - - `ended_at: string` - - RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. - - Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. - - - `expires_at: string` - - RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. - - - `processing_status: "in_progress" or "canceling" or "ended"` - - Processing status of the Message Batch. - - - `"in_progress"` - - - `"canceling"` - - - `"ended"` - - - `request_counts: BetaMessageBatchRequestCounts` - - Tallies requests within the Message Batch, categorized by their status. - - Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. - - - `canceled: number` - - Number of requests in the Message Batch that have been canceled. - - This is zero until processing of the entire Message Batch has ended. - - - `errored: number` - - Number of requests in the Message Batch that encountered an error. - - This is zero until processing of the entire Message Batch has ended. - - - `expired: number` - - Number of requests in the Message Batch that have expired. - - This is zero until processing of the entire Message Batch has ended. - - - `processing: number` - - Number of requests in the Message Batch that are processing. - - - `succeeded: number` - - Number of requests in the Message Batch that have completed successfully. - - This is zero until processing of the entire Message Batch has ended. - - - `results_url: string` - - URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. - - Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. - - - `type: "message_batch"` - - Object type. - - For Message Batches, this is always `"message_batch"`. - - - `"message_batch"` - -### Example - -```http -curl https://api.anthropic.com/v1/messages/batches/$MESSAGE_BATCH_ID \ - -H 'anthropic-version: 2023-06-01' \ - -H 'anthropic-beta: message-batches-2024-09-24' \ - -H "X-Api-Key: $ANTHROPIC_API_KEY" -``` - -## List - -**get** `/v1/messages/batches` - -List all Message Batches within a Workspace. Most recently created batches are returned first. - -Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) - -### Query Parameters - -- `after_id: optional string` - - ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object. - -- `before_id: optional string` - - ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object. - -- `limit: optional number` - - Number of items to return per page. - - Defaults to `20`. Ranges from `1` to `1000`. - -### Header Parameters - -- `"anthropic-beta": optional array of AnthropicBeta` - - Optional header to specify the beta version(s) you want to use. - - - `UnionMember0 = string` - - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` - - - `"message-batches-2024-09-24"` - - - `"prompt-caching-2024-07-31"` - - - `"computer-use-2024-10-22"` - - - `"computer-use-2025-01-24"` - - - `"pdfs-2024-09-25"` - - - `"token-counting-2024-11-01"` - - - `"token-efficient-tools-2025-02-19"` - - - `"output-128k-2025-02-19"` - - - `"files-api-2025-04-14"` - - - `"mcp-client-2025-04-04"` - - - `"mcp-client-2025-11-20"` - - - `"dev-full-thinking-2025-05-14"` - - - `"interleaved-thinking-2025-05-14"` - - - `"code-execution-2025-05-22"` - - - `"extended-cache-ttl-2025-04-11"` - - - `"context-1m-2025-08-07"` - - - `"context-management-2025-06-27"` - - - `"model-context-window-exceeded-2025-08-26"` - - - `"skills-2025-10-02"` - - - `"fast-mode-2026-02-01"` - - - `"output-300k-2026-03-24"` - - - `"user-profiles-2026-03-24"` - -### Returns - -- `data: array of BetaMessageBatch` - - - `id: string` - - Unique object identifier. - - The format and length of IDs may change over time. - - - `archived_at: string` - - RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. - - - `cancel_initiated_at: string` - - RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. - - - `created_at: string` - - RFC 3339 datetime string representing the time at which the Message Batch was created. - - - `ended_at: string` - - RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. - - Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. - - - `expires_at: string` - - RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. - - - `processing_status: "in_progress" or "canceling" or "ended"` - - Processing status of the Message Batch. - - - `"in_progress"` - - - `"canceling"` - - - `"ended"` - - - `request_counts: BetaMessageBatchRequestCounts` - - Tallies requests within the Message Batch, categorized by their status. - - Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. - - - `canceled: number` - - Number of requests in the Message Batch that have been canceled. - - This is zero until processing of the entire Message Batch has ended. - - - `errored: number` - - Number of requests in the Message Batch that encountered an error. - - This is zero until processing of the entire Message Batch has ended. - - - `expired: number` - - Number of requests in the Message Batch that have expired. - - This is zero until processing of the entire Message Batch has ended. - - - `processing: number` - - Number of requests in the Message Batch that are processing. - - - `succeeded: number` - - Number of requests in the Message Batch that have completed successfully. - - This is zero until processing of the entire Message Batch has ended. - - - `results_url: string` - - URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. - - Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. - - - `type: "message_batch"` - - Object type. - - For Message Batches, this is always `"message_batch"`. - - - `"message_batch"` - -- `first_id: string` - - First ID in the `data` list. Can be used as the `before_id` for the previous page. - -- `has_more: boolean` - - Indicates if there are more results in the requested page direction. - -- `last_id: string` - - Last ID in the `data` list. Can be used as the `after_id` for the next page. - -### Example - -```http -curl https://api.anthropic.com/v1/messages/batches \ - -H 'anthropic-version: 2023-06-01' \ - -H 'anthropic-beta: message-batches-2024-09-24' \ - -H "X-Api-Key: $ANTHROPIC_API_KEY" -``` - -## Cancel - -**post** `/v1/messages/batches/{message_batch_id}/cancel` - -Batches may be canceled any time before processing ends. Once cancellation is initiated, the batch enters a `canceling` state, at which time the system may complete any in-progress, non-interruptible requests before finalizing cancellation. - -The number of canceled requests is specified in `request_counts`. To determine which requests were canceled, check the individual results within the batch. Note that cancellation may not result in any canceled requests if they were non-interruptible. - -Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) - -### Path Parameters - -- `message_batch_id: string` - - ID of the Message Batch. - -### Header Parameters - -- `"anthropic-beta": optional array of AnthropicBeta` - - Optional header to specify the beta version(s) you want to use. - - - `UnionMember0 = string` - - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` - - - `"message-batches-2024-09-24"` - - - `"prompt-caching-2024-07-31"` - - - `"computer-use-2024-10-22"` - - - `"computer-use-2025-01-24"` - - - `"pdfs-2024-09-25"` - - - `"token-counting-2024-11-01"` - - - `"token-efficient-tools-2025-02-19"` - - - `"output-128k-2025-02-19"` - - - `"files-api-2025-04-14"` - - - `"mcp-client-2025-04-04"` - - - `"mcp-client-2025-11-20"` - - - `"dev-full-thinking-2025-05-14"` - - - `"interleaved-thinking-2025-05-14"` - - - `"code-execution-2025-05-22"` - - - `"extended-cache-ttl-2025-04-11"` - - - `"context-1m-2025-08-07"` - - - `"context-management-2025-06-27"` - - - `"model-context-window-exceeded-2025-08-26"` - - - `"skills-2025-10-02"` - - - `"fast-mode-2026-02-01"` - - - `"output-300k-2026-03-24"` - - - `"user-profiles-2026-03-24"` +### Returns + +- `BetaMessageBatch = object { id, archived_at, cancel_initiated_at, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: BetaMessageBatchRequestCounts` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + + - `"message_batch"` + +### Example + +```http +curl https://api.anthropic.com/v1/messages/batches/$MESSAGE_BATCH_ID \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: message-batches-2024-09-24' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## List + +**get** `/v1/messages/batches` + +List all Message Batches within a Workspace. Most recently created batches are returned first. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Query Parameters + +- `after_id: optional string` + + ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object. + +- `before_id: optional string` + + ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object. + +- `limit: optional number` + + Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `data: array of BetaMessageBatch` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: BetaMessageBatchRequestCounts` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + + - `"message_batch"` + +- `first_id: string` + + First ID in the `data` list. Can be used as the `before_id` for the previous page. + +- `has_more: boolean` + + Indicates if there are more results in the requested page direction. + +- `last_id: string` + + Last ID in the `data` list. Can be used as the `after_id` for the next page. + +### Example + +```http +curl https://api.anthropic.com/v1/messages/batches \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: message-batches-2024-09-24' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Cancel + +**post** `/v1/messages/batches/{message_batch_id}/cancel` + +Batches may be canceled any time before processing ends. Once cancellation is initiated, the batch enters a `canceling` state, at which time the system may complete any in-progress, non-interruptible requests before finalizing cancellation. + +The number of canceled requests is specified in `request_counts`. To determine which requests were canceled, check the individual results within the batch. Note that cancellation may not result in any canceled requests if they were non-interruptible. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Path Parameters + +- `message_batch_id: string` + + ID of the Message Batch. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` ### Returns @@ -39679,7 +39681,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -39723,8 +39725,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaDeletedMessageBatch = object { id, type }` @@ -39775,7 +39775,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -39819,8 +39819,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaMessageBatchIndividualResponse = object { custom_id, result }` @@ -40762,15 +40760,19 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -42335,15 +42337,19 @@ curl https://api.anthropic.com/v1/messages/batches/$MESSAGE_BATCH_ID/results \ See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -43707,15 +43713,19 @@ curl https://api.anthropic.com/v1/messages/batches/$MESSAGE_BATCH_ID/results \ See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -45041,12 +45051,447 @@ curl https://api.anthropic.com/v1/messages/batches/$MESSAGE_BATCH_ID/results \ See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `UnionMember1 = string` + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `"assistant"` + + - `stop_details: BetaRefusalStopDetails` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `"refusal"` + + - `stop_reason: BetaStopReason` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"compaction"` + + - `"refusal"` + + - `"model_context_window_exceeded"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `"message"` + + - `usage: BetaUsage` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: BetaCacheCreation` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `iterations: BetaIterationsUsage` + + Per-iteration token usage breakdown. + + Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + + - Determine which iterations exceeded long context thresholds (>=200k tokens) + - Calculate the true context window size from the last iteration + - Understand token accumulation across server-side tool use loops + + - `BetaMessageIterationUsage = object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: BetaCacheCreation` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + + - `"message"` + + - `BetaCompactionIterationUsage = object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: BetaCacheCreation` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + + - `"compaction"` + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: BetaServerToolUsage` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `speed: "standard" or "fast"` + + The inference speed mode used for this request. + + - `"standard"` + + - `"fast"` + + - `type: "succeeded"` + + - `"succeeded"` + +# Agents + +## Create + +**post** `/v1/agents` + +Create Agent + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `model: BetaManagedAgentsModel or BetaManagedAgentsModelConfigParams` + + Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control + + - `BetaManagedAgentsModel = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `BetaManagedAgentsModelConfigParams = object { id, speed }` + + An object that defines additional configuration control over model use + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-opus-4-6"` Most intelligent model for building agents and coding @@ -45079,276 +45524,22720 @@ curl https://api.anthropic.com/v1/messages/batches/$MESSAGE_BATCH_ID/results \ High-performance model for agents and coding - - `"claude-opus-4-1"` + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +- `name: string` + + Human-readable name for the agent. 1-256 characters. + +- `description: optional string` + + Description of what the agent does. Up to 2048 characters. + +- `mcp_servers: optional array of BetaManagedAgentsURLMCPServerParams` + + MCP servers this agent connects to. Maximum 20. Names must be unique within the array. + + - `name: string` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `type: "url"` + + - `"url"` + + - `url: string` + + Endpoint URL for the MCP server. + +- `metadata: optional map[string]` + + Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars. + +- `skills: optional array of BetaManagedAgentsSkillParams` + + Skills available to the agent. Maximum 20. + + - `BetaManagedAgentsAnthropicSkillParams = object { skill_id, type, version }` + + An Anthropic-managed skill. + + - `skill_id: string` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: optional string` + + Version to pin. Defaults to latest if omitted. + + - `BetaManagedAgentsCustomSkillParams = object { skill_id, type, version }` + + A user-created custom skill. + + - `skill_id: string` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: "custom"` + + - `"custom"` + + - `version: optional string` + + Version to pin. Defaults to latest if omitted. + +- `system: optional string` + + System prompt for the agent. Up to 100,000 characters. + +- `tools: optional array of BetaManagedAgentsAgentToolset20260401Params or BetaManagedAgentsMCPToolsetParams or BetaManagedAgentsCustomToolParams` + + Tool configurations available to the agent. Maximum of 128 tools across all toolsets allowed. + + - `BetaManagedAgentsAgentToolset20260401Params = object { type, configs, default_config }` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `configs: optional array of BetaManagedAgentsAgentToolConfigParams` + + Per-tool configuration overrides. + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled: optional boolean` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: optional BetaManagedAgentsAgentToolsetDefaultConfigParams` + + Default configuration for all tools in a toolset. + + - `enabled: optional boolean` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `BetaManagedAgentsMCPToolsetParams = object { mcp_server_name, type, configs, default_config }` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `mcp_server_name: string` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `configs: optional array of BetaManagedAgentsMCPToolConfigParams` + + Per-tool configuration overrides. + + - `name: string` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled: optional boolean` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: optional BetaManagedAgentsMCPToolsetDefaultConfigParams` + + Default configuration for all tools from an MCP server. + + - `enabled: optional boolean` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `BetaManagedAgentsCustomToolParams = object { description, input_schema, name, type }` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: string` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: "custom"` + + - `"custom"` + +### Returns + +- `BetaManagedAgentsAgent = object { id, archived_at, created_at, 11 more }` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```http +curl https://api.anthropic.com/v1/agents \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "model": "claude-sonnet-4-6", + "name": "My First Agent" + }' +``` + +## List + +**get** `/v1/agents` + +List Agents + +### Query Parameters + +- `"created_at[gte]": optional string` + + Return agents created at or after this time (inclusive). + +- `"created_at[lte]": optional string` + + Return agents created at or before this time (inclusive). + +- `include_archived: optional boolean` + + Include archived agents in results. Defaults to false. + +- `limit: optional number` + + Maximum results per page. Default 20, maximum 100. + +- `page: optional string` + + Opaque pagination cursor from a previous response. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `data: optional array of BetaManagedAgentsAgent` + + List of agents. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +- `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```http +curl https://api.anthropic.com/v1/agents \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Retrieve + +**get** `/v1/agents/{agent_id}` + +Get Agent + +### Path Parameters + +- `agent_id: string` + +### Query Parameters + +- `version: optional number` + + Agent version. Omit for the most recent version. Must be at least 1 if specified. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsAgent = object { id, archived_at, created_at, 11 more }` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```http +curl https://api.anthropic.com/v1/agents/$AGENT_ID \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Update + +**post** `/v1/agents/{agent_id}` + +Update Agent + +### Path Parameters + +- `agent_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `version: number` + + The agent's current version, used to prevent concurrent overwrites. Obtain this value from a create or retrieve response. The request fails if this does not match the server's current version. + +- `description: optional string` + + Description. Up to 2048 characters. Omit to preserve; send empty string or null to clear. + +- `mcp_servers: optional array of BetaManagedAgentsURLMCPServerParams` + + MCP servers. Full replacement. Omit to preserve; send empty array or null to clear. Names must be unique. Maximum 20. + + - `name: string` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `type: "url"` + + - `"url"` + + - `url: string` + + Endpoint URL for the MCP server. + +- `metadata: optional map[string]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. The stored bag is limited to 16 keys (up to 64 chars each) with values up to 512 chars. + +- `model: optional BetaManagedAgentsModel or BetaManagedAgentsModelConfigParams` + + Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control. Omit to preserve. Cannot be cleared. + + - `BetaManagedAgentsModel = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `BetaManagedAgentsModelConfigParams = object { id, speed }` + + An object that defines additional configuration control over model use + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +- `name: optional string` + + Human-readable name. 1-256 characters. Omit to preserve. Cannot be cleared. + +- `skills: optional array of BetaManagedAgentsSkillParams` + + Skills. Full replacement. Omit to preserve; send empty array or null to clear. Maximum 20. + + - `BetaManagedAgentsAnthropicSkillParams = object { skill_id, type, version }` + + An Anthropic-managed skill. + + - `skill_id: string` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: optional string` + + Version to pin. Defaults to latest if omitted. + + - `BetaManagedAgentsCustomSkillParams = object { skill_id, type, version }` + + A user-created custom skill. + + - `skill_id: string` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: "custom"` + + - `"custom"` + + - `version: optional string` + + Version to pin. Defaults to latest if omitted. + +- `system: optional string` + + System prompt. Up to 100,000 characters. Omit to preserve; send empty string or null to clear. + +- `tools: optional array of BetaManagedAgentsAgentToolset20260401Params or BetaManagedAgentsMCPToolsetParams or BetaManagedAgentsCustomToolParams` + + Tool configurations available to the agent. Full replacement. Omit to preserve; send empty array or null to clear. Maximum of 128 tools across all toolsets allowed. + + - `BetaManagedAgentsAgentToolset20260401Params = object { type, configs, default_config }` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `configs: optional array of BetaManagedAgentsAgentToolConfigParams` + + Per-tool configuration overrides. + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled: optional boolean` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: optional BetaManagedAgentsAgentToolsetDefaultConfigParams` + + Default configuration for all tools in a toolset. + + - `enabled: optional boolean` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `BetaManagedAgentsMCPToolsetParams = object { mcp_server_name, type, configs, default_config }` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `mcp_server_name: string` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `configs: optional array of BetaManagedAgentsMCPToolConfigParams` + + Per-tool configuration overrides. + + - `name: string` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled: optional boolean` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: optional BetaManagedAgentsMCPToolsetDefaultConfigParams` + + Default configuration for all tools from an MCP server. + + - `enabled: optional boolean` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `BetaManagedAgentsCustomToolParams = object { description, input_schema, name, type }` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: string` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: "custom"` + + - `"custom"` + +### Returns + +- `BetaManagedAgentsAgent = object { id, archived_at, created_at, 11 more }` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```http +curl https://api.anthropic.com/v1/agents/$AGENT_ID \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "version": 1 + }' +``` + +## Archive + +**post** `/v1/agents/{agent_id}/archive` + +Archive Agent + +### Path Parameters + +- `agent_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsAgent = object { id, archived_at, created_at, 11 more }` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```http +curl https://api.anthropic.com/v1/agents/$AGENT_ID/archive \ + -X POST \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Domain Types + +### Beta Managed Agents Agent + +- `BetaManagedAgentsAgent = object { id, archived_at, created_at, 11 more }` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Beta Managed Agents Agent Tool Config + +- `BetaManagedAgentsAgentToolConfig = object { enabled, name, permission_policy }` + + Configuration for a specific agent tool. + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Agent Tool Config Params + +- `BetaManagedAgentsAgentToolConfigParams = object { name, enabled, permission_policy }` + + Configuration override for a specific tool within a toolset. + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled: optional boolean` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Agent Toolset Default Config + +- `BetaManagedAgentsAgentToolsetDefaultConfig = object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Agent Toolset Default Config Params + +- `BetaManagedAgentsAgentToolsetDefaultConfigParams = object { enabled, permission_policy }` + + Default configuration for all tools in a toolset. + + - `enabled: optional boolean` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Agent Toolset20260401 + +- `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + +### Beta Managed Agents Agent Toolset20260401 Params + +- `BetaManagedAgentsAgentToolset20260401Params = object { type, configs, default_config }` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `configs: optional array of BetaManagedAgentsAgentToolConfigParams` + + Per-tool configuration overrides. + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled: optional boolean` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: optional BetaManagedAgentsAgentToolsetDefaultConfigParams` + + Default configuration for all tools in a toolset. + + - `enabled: optional boolean` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Always Allow Policy + +- `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + +### Beta Managed Agents Always Ask Policy + +- `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Anthropic Skill + +- `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + +### Beta Managed Agents Anthropic Skill Params + +- `BetaManagedAgentsAnthropicSkillParams = object { skill_id, type, version }` + + An Anthropic-managed skill. + + - `skill_id: string` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: optional string` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents Custom Skill + +- `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + +### Beta Managed Agents Custom Skill Params + +- `BetaManagedAgentsCustomSkillParams = object { skill_id, type, version }` + + A user-created custom skill. + + - `skill_id: string` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: "custom"` + + - `"custom"` + + - `version: optional string` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents Custom Tool + +- `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + +### Beta Managed Agents Custom Tool Input Schema + +- `BetaManagedAgentsCustomToolInputSchema = object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + +### Beta Managed Agents Custom Tool Params + +- `BetaManagedAgentsCustomToolParams = object { description, input_schema, name, type }` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: string` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: "custom"` + + - `"custom"` + +### Beta Managed Agents MCP Server URL Definition + +- `BetaManagedAgentsMCPServerURLDefinition = object { name, type, url }` + + URL-based MCP server connection as returned in API responses. + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + +### Beta Managed Agents MCP Tool Config + +- `BetaManagedAgentsMCPToolConfig = object { enabled, name, permission_policy }` + + Resolved configuration for a specific MCP tool. + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents MCP Tool Config Params + +- `BetaManagedAgentsMCPToolConfigParams = object { name, enabled, permission_policy }` + + Configuration override for a specific MCP tool. + + - `name: string` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled: optional boolean` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents MCP Toolset + +- `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + +### Beta Managed Agents MCP Toolset Default Config + +- `BetaManagedAgentsMCPToolsetDefaultConfig = object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents MCP Toolset Default Config Params + +- `BetaManagedAgentsMCPToolsetDefaultConfigParams = object { enabled, permission_policy }` + + Default configuration for all tools from an MCP server. + + - `enabled: optional boolean` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents MCP Toolset Params + +- `BetaManagedAgentsMCPToolsetParams = object { mcp_server_name, type, configs, default_config }` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `mcp_server_name: string` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `configs: optional array of BetaManagedAgentsMCPToolConfigParams` + + Per-tool configuration overrides. + + - `name: string` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled: optional boolean` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: optional BetaManagedAgentsMCPToolsetDefaultConfigParams` + + Default configuration for all tools from an MCP server. + + - `enabled: optional boolean` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Model + +- `BetaManagedAgentsModel = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + +### Beta Managed Agents Model Config + +- `BetaManagedAgentsModelConfig = object { id, speed }` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +### Beta Managed Agents Model Config Params + +- `BetaManagedAgentsModelConfigParams = object { id, speed }` + + An object that defines additional configuration control over model use + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +### Beta Managed Agents Skill Params + +- `BetaManagedAgentsSkillParams = BetaManagedAgentsAnthropicSkillParams or BetaManagedAgentsCustomSkillParams` + + Skill to load in the session container. + + - `BetaManagedAgentsAnthropicSkillParams = object { skill_id, type, version }` + + An Anthropic-managed skill. + + - `skill_id: string` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: optional string` + + Version to pin. Defaults to latest if omitted. + + - `BetaManagedAgentsCustomSkillParams = object { skill_id, type, version }` + + A user-created custom skill. + + - `skill_id: string` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: "custom"` + + - `"custom"` + + - `version: optional string` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents URL MCP Server Params + +- `BetaManagedAgentsURLMCPServerParams = object { name, type, url }` + + URL-based MCP server connection. + + - `name: string` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `type: "url"` + + - `"url"` + + - `url: string` + + Endpoint URL for the MCP server. + +# Versions + +## List + +**get** `/v1/agents/{agent_id}/versions` + +List Agent Versions + +### Path Parameters + +- `agent_id: string` + +### Query Parameters + +- `limit: optional number` + + Maximum results per page. Default 20, maximum 100. + +- `page: optional string` + + Opaque pagination cursor. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `data: optional array of BetaManagedAgentsAgent` + + Agent versions. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +- `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```http +curl https://api.anthropic.com/v1/agents/$AGENT_ID/versions \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +# Environments + +## Create + +**post** `/v1/environments` + +Create a new environment with the specified configuration. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Cookie Parameters + +- `sessionKey: optional string` + +### Body Parameters + +- `name: string` + + Human-readable name for the environment + +- `config: optional BetaCloudConfigParams` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `networking: optional BetaUnrestrictedNetwork or BetaLimitedNetworkParams` + + Network configuration policy. Omit on update to preserve the existing value. + + - `BetaUnrestrictedNetwork = object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetworkParams = object { type, allow_mcp_servers, allow_package_managers, allowed_hosts }` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `allow_mcp_servers: optional boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: optional boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: optional array of string` + + Specifies domains the container can reach. + + - `packages: optional BetaPackagesParams` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: optional array of string` + + Ubuntu/Debian packages to install + + - `cargo: optional array of string` + + Rust packages to install + + - `gem: optional array of string` + + Ruby packages to install + + - `go: optional array of string` + + Go packages to install + + - `npm: optional array of string` + + Node.js packages to install + + - `pip: optional array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + +- `description: optional string` + + Optional description of the environment + +- `metadata: optional map[string]` + + User-provided metadata key-value pairs + +### Returns + +- `BetaEnvironment = object { id, archived_at, config, 6 more }` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork = object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork = object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```http +curl https://api.anthropic.com/v1/environments \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "name": "python-data-analysis", + "config": { + "type": "cloud", + "networking": { + "type": "limited", + "allow_package_managers": true, + "allowed_hosts": [ + "api.example.com" + ] + }, + "packages": { + "pip": [ + "pandas", + "numpy" + ] + } + } + }' +``` + +## List + +**get** `/v1/environments` + +List environments with pagination support. + +### Query Parameters + +- `include_archived: optional boolean` + + Include archived environments in the response + +- `limit: optional number` + + Maximum number of environments to return + +- `page: optional string` + + Opaque cursor from previous response for pagination. Pass the `next_page` value from the previous response. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Cookie Parameters + +- `sessionKey: optional string` + +### Returns + +- `data: array of BetaEnvironment` + + List of environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork = object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork = object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +- `next_page: string` + + Token for fetching the next page of results. If `null`, there are no more results available. Pass this value to the `page` parameter in the next request. + +### Example + +```http +curl https://api.anthropic.com/v1/environments \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Retrieve + +**get** `/v1/environments/{environment_id}` + +Retrieve a specific environment by ID. + +### Path Parameters + +- `environment_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Cookie Parameters + +- `sessionKey: optional string` + +### Returns + +- `BetaEnvironment = object { id, archived_at, config, 6 more }` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork = object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork = object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```http +curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Update + +**post** `/v1/environments/{environment_id}` + +Update an existing environment's configuration. + +### Path Parameters + +- `environment_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Cookie Parameters + +- `sessionKey: optional string` + +### Body Parameters + +- `config: optional BetaCloudConfigParams` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `networking: optional BetaUnrestrictedNetwork or BetaLimitedNetworkParams` + + Network configuration policy. Omit on update to preserve the existing value. + + - `BetaUnrestrictedNetwork = object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetworkParams = object { type, allow_mcp_servers, allow_package_managers, allowed_hosts }` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `allow_mcp_servers: optional boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: optional boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: optional array of string` + + Specifies domains the container can reach. + + - `packages: optional BetaPackagesParams` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: optional array of string` + + Ubuntu/Debian packages to install + + - `cargo: optional array of string` + + Rust packages to install + + - `gem: optional array of string` + + Ruby packages to install + + - `go: optional array of string` + + Go packages to install + + - `npm: optional array of string` + + Node.js packages to install + + - `pip: optional array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + +- `description: optional string` + + Updated description of the environment + +- `metadata: optional map[string]` + + User-provided metadata key-value pairs. Set a value to null or empty string to delete the key. + +- `name: optional string` + + Updated name for the environment + +### Returns + +- `BetaEnvironment = object { id, archived_at, config, 6 more }` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork = object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork = object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```http +curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "config": { + "type": "cloud", + "networking": { + "type": "limited", + "allow_package_managers": true, + "allowed_hosts": [ + "api.example.com" + ] + }, + "packages": { + "pip": [ + "pandas", + "numpy" + ] + } + } + }' +``` + +## Delete + +**delete** `/v1/environments/{environment_id}` + +Delete an environment by ID. Returns a confirmation of the deletion. + +### Path Parameters + +- `environment_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Cookie Parameters + +- `sessionKey: optional string` + +### Returns + +- `BetaEnvironmentDeleteResponse = object { id, type }` + + Response after deleting an environment. + + - `id: string` + + Environment identifier + + - `type: "environment_deleted"` + + The type of response + + - `"environment_deleted"` + +### Example + +```http +curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID \ + -X DELETE \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Archive + +**post** `/v1/environments/{environment_id}/archive` + +Archive an environment by ID. Archived environments cannot be used to create new sessions. + +### Path Parameters + +- `environment_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Cookie Parameters + +- `sessionKey: optional string` + +### Returns + +- `BetaEnvironment = object { id, archived_at, config, 6 more }` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork = object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork = object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```http +curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID/archive \ + -X POST \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Domain Types + +### Beta Cloud Config + +- `BetaCloudConfig = object { networking, packages, type }` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork = object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork = object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + +### Beta Cloud Config Params + +- `BetaCloudConfigParams = object { type, networking, packages }` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `networking: optional BetaUnrestrictedNetwork or BetaLimitedNetworkParams` + + Network configuration policy. Omit on update to preserve the existing value. + + - `BetaUnrestrictedNetwork = object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetworkParams = object { type, allow_mcp_servers, allow_package_managers, allowed_hosts }` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `allow_mcp_servers: optional boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: optional boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: optional array of string` + + Specifies domains the container can reach. + + - `packages: optional BetaPackagesParams` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: optional array of string` + + Ubuntu/Debian packages to install + + - `cargo: optional array of string` + + Rust packages to install + + - `gem: optional array of string` + + Ruby packages to install + + - `go: optional array of string` + + Go packages to install + + - `npm: optional array of string` + + Node.js packages to install + + - `pip: optional array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + +### Beta Environment + +- `BetaEnvironment = object { id, archived_at, config, 6 more }` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork = object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork = object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Beta Environment Delete Response + +- `BetaEnvironmentDeleteResponse = object { id, type }` + + Response after deleting an environment. + + - `id: string` + + Environment identifier + + - `type: "environment_deleted"` + + The type of response + + - `"environment_deleted"` + +### Beta Limited Network + +- `BetaLimitedNetwork = object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + +### Beta Limited Network Params + +- `BetaLimitedNetworkParams = object { type, allow_mcp_servers, allow_package_managers, allowed_hosts }` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `allow_mcp_servers: optional boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: optional boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: optional array of string` + + Specifies domains the container can reach. + +### Beta Packages + +- `BetaPackages = object { apt, cargo, gem, 4 more }` + + Packages (and their versions) available in this environment. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + +### Beta Packages Params + +- `BetaPackagesParams = object { apt, cargo, gem, 4 more }` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: optional array of string` + + Ubuntu/Debian packages to install + + - `cargo: optional array of string` + + Rust packages to install + + - `gem: optional array of string` + + Ruby packages to install + + - `go: optional array of string` + + Go packages to install + + - `npm: optional array of string` + + Node.js packages to install + + - `pip: optional array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + +### Beta Unrestricted Network + +- `BetaUnrestrictedNetwork = object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + +# Sessions + +## Create + +**post** `/v1/sessions` + +Create Session + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `agent: string or BetaManagedAgentsAgentParams` + + Agent identifier. Accepts the `agent` ID string, which pins the latest version for the session, or an `agent` object with both id and version specified. + + - `UnionMember0 = string` + + - `BetaManagedAgentsAgentParams = object { id, type, version }` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `id: string` + + The `agent` ID. + + - `type: "agent"` + + - `"agent"` + + - `version: optional number` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + +- `environment_id: string` + + ID of the `environment` defining the container configuration for this session. + +- `metadata: optional map[string]` + + Arbitrary key-value metadata attached to the session. + +- `resources: optional array of BetaManagedAgentsGitHubRepositoryResourceParams or BetaManagedAgentsFileResourceParams` + + Resources (e.g. repositories, files) to mount into the session's container. + + - `BetaManagedAgentsGitHubRepositoryResourceParams = object { authorization_token, type, url, 2 more }` + + Mount a GitHub repository into the session's container. + + - `authorization_token: string` + + GitHub authorization token used to clone the repository. + + - `type: "github_repository"` + + - `"github_repository"` + + - `url: string` + + Github URL of the repository + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `mount_path: optional string` + + Mount path in the container. Defaults to `/workspace/`. + + - `BetaManagedAgentsFileResourceParams = object { file_id, type, mount_path }` + + Mount a file uploaded via the Files API into the session. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `mount_path: optional string` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +- `title: optional string` + + Human-readable session title. + +- `vault_ids: optional array of string` + + Vault IDs for stored credentials the agent can use during the session. + +### Returns + +- `BetaManagedAgentsSession = object { id, agent, archived_at, 11 more }` + + A Managed Agents `session`. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```http +curl https://api.anthropic.com/v1/sessions \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "agent": "agent_011CZkYpogX7uDKUyvBTophP", + "environment_id": "env_011CZkZ9X2dpNyB7HsEFoRfW" + }' +``` + +## List + +**get** `/v1/sessions` + +List Sessions + +### Query Parameters + +- `agent_id: optional string` + + Filter sessions created with this agent ID. + +- `agent_version: optional number` + + Filter by agent version. Only applies when agent_id is also set. + +- `"created_at[gt]": optional string` + + Return sessions created after this time (exclusive). + +- `"created_at[gte]": optional string` + + Return sessions created at or after this time (inclusive). + +- `"created_at[lt]": optional string` + + Return sessions created before this time (exclusive). + +- `"created_at[lte]": optional string` + + Return sessions created at or before this time (inclusive). + +- `include_archived: optional boolean` + + When true, includes archived sessions. Default: false (exclude archived). + +- `limit: optional number` + + Maximum number of results to return. + +- `order: optional "asc" or "desc"` + + Sort direction for results, ordered by created_at. Defaults to desc (newest first). + + - `"asc"` + + - `"desc"` + +- `page: optional string` + + Opaque pagination cursor from a previous response's next_page. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `data: optional array of BetaManagedAgentsSession` + + List of sessions. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +- `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```http +curl https://api.anthropic.com/v1/sessions \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Retrieve + +**get** `/v1/sessions/{session_id}` + +Get Session + +### Path Parameters + +- `session_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSession = object { id, agent, archived_at, 11 more }` + + A Managed Agents `session`. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Update + +**post** `/v1/sessions/{session_id}` + +Update Session + +### Path Parameters + +- `session_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `metadata: optional map[string]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. + +- `title: optional string` + + Human-readable session title. + +- `vault_ids: optional array of string` + + Vault IDs (`vlt_*`) to attach to the session. Not yet supported; requests setting this field are rejected. Reserved for future use. + +### Returns + +- `BetaManagedAgentsSession = object { id, agent, archived_at, 11 more }` + + A Managed Agents `session`. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{}' +``` + +## Delete + +**delete** `/v1/sessions/{session_id}` + +Delete Session + +### Path Parameters + +- `session_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsDeletedSession = object { id, type }` + + Confirmation that a `session` has been permanently deleted. + + - `id: string` + + - `type: "session_deleted"` + + - `"session_deleted"` + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID \ + -X DELETE \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Archive + +**post** `/v1/sessions/{session_id}/archive` + +Archive Session + +### Path Parameters + +- `session_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSession = object { id, agent, archived_at, 11 more }` + + A Managed Agents `session`. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/archive \ + -X POST \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Domain Types + +### Beta Managed Agents Agent Params + +- `BetaManagedAgentsAgentParams = object { id, type, version }` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `id: string` + + The `agent` ID. + + - `type: "agent"` + + - `"agent"` + + - `version: optional number` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + +### Beta Managed Agents Branch Checkout + +- `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + +### Beta Managed Agents Cache Creation Usage + +- `BetaManagedAgentsCacheCreationUsage = object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + +### Beta Managed Agents Commit Checkout + +- `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + +### Beta Managed Agents Deleted Session + +- `BetaManagedAgentsDeletedSession = object { id, type }` + + Confirmation that a `session` has been permanently deleted. + + - `id: string` + + - `type: "session_deleted"` + + - `"session_deleted"` + +### Beta Managed Agents File Resource Params + +- `BetaManagedAgentsFileResourceParams = object { file_id, type, mount_path }` + + Mount a file uploaded via the Files API into the session. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `mount_path: optional string` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +### Beta Managed Agents GitHub Repository Resource Params + +- `BetaManagedAgentsGitHubRepositoryResourceParams = object { authorization_token, type, url, 2 more }` + + Mount a GitHub repository into the session's container. + + - `authorization_token: string` + + GitHub authorization token used to clone the repository. + + - `type: "github_repository"` + + - `"github_repository"` + + - `url: string` + + Github URL of the repository + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `mount_path: optional string` + + Mount path in the container. Defaults to `/workspace/`. + +### Beta Managed Agents Session + +- `BetaManagedAgentsSession = object { id, agent, archived_at, 11 more }` + + A Managed Agents `session`. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Beta Managed Agents Session Agent + +- `BetaManagedAgentsSessionAgent = object { id, description, mcp_servers, 7 more }` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + +### Beta Managed Agents Session Stats + +- `BetaManagedAgentsSessionStats = object { active_seconds, duration_seconds }` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + +### Beta Managed Agents Session Usage + +- `BetaManagedAgentsSessionUsage = object { cache_creation, cache_read_input_tokens, input_tokens, output_tokens }` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + +# Events + +## List + +**get** `/v1/sessions/{session_id}/events` + +List Events + +### Path Parameters + +- `session_id: string` + +### Query Parameters + +- `limit: optional number` + + Query parameter for limit + +- `order: optional "asc" or "desc"` + + Sort direction for results, ordered by created_at. Defaults to asc (chronological). + + - `"asc"` + + - `"desc"` + +- `page: optional string` + + Opaque pagination cursor from a previous response's next_page. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `data: optional array of BetaManagedAgentsSessionEvent` + + Events for the session, ordered by `created_at`. + + - `BetaManagedAgentsUserMessageEvent = object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent = object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent = object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent = object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsAgentCustomToolUseEvent = object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `BetaManagedAgentsAgentMessageEvent = object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `BetaManagedAgentsAgentThinkingEvent = object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `BetaManagedAgentsAgentMCPToolUseEvent = object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentMCPToolResultEvent = object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentToolUseEvent = object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentToolResultEvent = object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentThreadContextCompactedEvent = object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `BetaManagedAgentsSessionErrorEvent = object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError = object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError = object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError = object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError = object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError = object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError = object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError = object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `BetaManagedAgentsSessionStatusRescheduledEvent = object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `BetaManagedAgentsSessionStatusRunningEvent = object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `BetaManagedAgentsSessionStatusIdleEvent = object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn = object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction = object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted = object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `BetaManagedAgentsSessionStatusTerminatedEvent = object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `BetaManagedAgentsSpanModelRequestStartEvent = object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `BetaManagedAgentsSpanModelRequestEndEvent = object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `BetaManagedAgentsSessionDeletedEvent = object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +- `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/events \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Send + +**post** `/v1/sessions/{session_id}/events` + +Send Events + +### Path Parameters + +- `session_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `events: array of BetaManagedAgentsEventParams` + + Events to send to the `session`. + + - `BetaManagedAgentsUserMessageEventParams = object { content, type }` + + Parameters for sending a user message to the session. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks for the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `BetaManagedAgentsUserInterruptEventParams = object { type }` + + Parameters for sending an interrupt to pause the agent. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `BetaManagedAgentsUserToolConfirmationEventParams = object { result, tool_use_id, type, deny_message }` + + Parameters for confirming or denying a tool execution request. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `BetaManagedAgentsUserCustomToolResultEventParams = object { custom_tool_use_id, type, content, is_error }` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + +### Returns + +- `BetaManagedAgentsSendSessionEvents = object { data }` + + Events that were successfully sent to the session. + + - `data: optional array of BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or BetaManagedAgentsUserCustomToolResultEvent` + + Sent events + + - `BetaManagedAgentsUserMessageEvent = object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent = object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent = object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent = object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/events \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "events": [ + { + "content": [ + { + "text": "Where is my order #1234?", + "type": "text" + } + ], + "type": "user.message" + } + ] + }' +``` + +## Stream + +**get** `/v1/sessions/{session_id}/events/stream` + +Stream Events + +### Path Parameters + +- `session_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsStreamSessionEvents = BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or 17 more` + + Server-sent event in the session stream. + + - `BetaManagedAgentsUserMessageEvent = object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent = object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent = object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent = object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsAgentCustomToolUseEvent = object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `BetaManagedAgentsAgentMessageEvent = object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `BetaManagedAgentsAgentThinkingEvent = object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `BetaManagedAgentsAgentMCPToolUseEvent = object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentMCPToolResultEvent = object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentToolUseEvent = object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentToolResultEvent = object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentThreadContextCompactedEvent = object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `BetaManagedAgentsSessionErrorEvent = object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError = object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError = object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError = object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError = object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError = object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError = object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError = object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `BetaManagedAgentsSessionStatusRescheduledEvent = object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `BetaManagedAgentsSessionStatusRunningEvent = object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `BetaManagedAgentsSessionStatusIdleEvent = object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn = object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction = object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted = object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `BetaManagedAgentsSessionStatusTerminatedEvent = object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `BetaManagedAgentsSpanModelRequestStartEvent = object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `BetaManagedAgentsSpanModelRequestEndEvent = object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `BetaManagedAgentsSessionDeletedEvent = object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/events/stream \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Domain Types + +### Beta Managed Agents Agent Custom Tool Use Event + +- `BetaManagedAgentsAgentCustomToolUseEvent = object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + +### Beta Managed Agents Agent MCP Tool Result Event + +- `BetaManagedAgentsAgentMCPToolResultEvent = object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent MCP Tool Use Event + +- `BetaManagedAgentsAgentMCPToolUseEvent = object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + +### Beta Managed Agents Agent Message Event + +- `BetaManagedAgentsAgentMessageEvent = object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + +### Beta Managed Agents Agent Thinking Event + +- `BetaManagedAgentsAgentThinkingEvent = object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + +### Beta Managed Agents Agent Thread Context Compacted Event + +- `BetaManagedAgentsAgentThreadContextCompactedEvent = object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + +### Beta Managed Agents Agent Tool Result Event + +- `BetaManagedAgentsAgentToolResultEvent = object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent Tool Use Event + +- `BetaManagedAgentsAgentToolUseEvent = object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + +### Beta Managed Agents Base64 Document Source + +- `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + +### Beta Managed Agents Base64 Image Source + +- `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + +### Beta Managed Agents Billing Error + +- `BetaManagedAgentsBillingError = object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + +### Beta Managed Agents Document Block + +- `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + +### Beta Managed Agents Event Params + +- `BetaManagedAgentsEventParams = BetaManagedAgentsUserMessageEventParams or BetaManagedAgentsUserInterruptEventParams or BetaManagedAgentsUserToolConfirmationEventParams or BetaManagedAgentsUserCustomToolResultEventParams` + + Union type for event parameters that can be sent to a session. + + - `BetaManagedAgentsUserMessageEventParams = object { content, type }` + + Parameters for sending a user message to the session. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks for the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `BetaManagedAgentsUserInterruptEventParams = object { type }` + + Parameters for sending an interrupt to pause the agent. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `BetaManagedAgentsUserToolConfirmationEventParams = object { result, tool_use_id, type, deny_message }` + + Parameters for confirming or denying a tool execution request. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `BetaManagedAgentsUserCustomToolResultEventParams = object { custom_tool_use_id, type, content, is_error }` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents File Document Source + +- `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + +### Beta Managed Agents File Image Source + +- `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + +### Beta Managed Agents Image Block + +- `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + +### Beta Managed Agents MCP Authentication Failed Error + +- `BetaManagedAgentsMCPAuthenticationFailedError = object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + +### Beta Managed Agents MCP Connection Failed Error + +- `BetaManagedAgentsMCPConnectionFailedError = object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + +### Beta Managed Agents Model Overloaded Error + +- `BetaManagedAgentsModelOverloadedError = object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + +### Beta Managed Agents Model Rate Limited Error + +- `BetaManagedAgentsModelRateLimitedError = object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + +### Beta Managed Agents Model Request Failed Error + +- `BetaManagedAgentsModelRequestFailedError = object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + +### Beta Managed Agents Plain Text Document Source + +- `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + +### Beta Managed Agents Retry Status Exhausted + +- `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + +### Beta Managed Agents Retry Status Retrying + +- `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + +### Beta Managed Agents Retry Status Terminal + +- `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + +### Beta Managed Agents Send Session Events + +- `BetaManagedAgentsSendSessionEvents = object { data }` + + Events that were successfully sent to the session. + + - `data: optional array of BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or BetaManagedAgentsUserCustomToolResultEvent` + + Sent events + + - `BetaManagedAgentsUserMessageEvent = object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent = object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent = object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent = object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents Session Deleted Event + +- `BetaManagedAgentsSessionDeletedEvent = object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Beta Managed Agents Session End Turn + +- `BetaManagedAgentsSessionEndTurn = object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + +### Beta Managed Agents Session Error Event + +- `BetaManagedAgentsSessionErrorEvent = object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError = object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError = object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError = object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError = object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError = object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError = object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError = object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + +### Beta Managed Agents Session Event + +- `BetaManagedAgentsSessionEvent = BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or 17 more` + + Union type for all event types in a session. + + - `BetaManagedAgentsUserMessageEvent = object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent = object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent = object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent = object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsAgentCustomToolUseEvent = object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `BetaManagedAgentsAgentMessageEvent = object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `BetaManagedAgentsAgentThinkingEvent = object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `BetaManagedAgentsAgentMCPToolUseEvent = object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentMCPToolResultEvent = object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentToolUseEvent = object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentToolResultEvent = object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentThreadContextCompactedEvent = object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `BetaManagedAgentsSessionErrorEvent = object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError = object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError = object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError = object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError = object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError = object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError = object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError = object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `BetaManagedAgentsSessionStatusRescheduledEvent = object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `BetaManagedAgentsSessionStatusRunningEvent = object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `BetaManagedAgentsSessionStatusIdleEvent = object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn = object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction = object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted = object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `BetaManagedAgentsSessionStatusTerminatedEvent = object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `BetaManagedAgentsSpanModelRequestStartEvent = object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `BetaManagedAgentsSpanModelRequestEndEvent = object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `BetaManagedAgentsSessionDeletedEvent = object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Beta Managed Agents Session Requires Action + +- `BetaManagedAgentsSessionRequiresAction = object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + +### Beta Managed Agents Session Retries Exhausted + +- `BetaManagedAgentsSessionRetriesExhausted = object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + +### Beta Managed Agents Session Status Idle Event + +- `BetaManagedAgentsSessionStatusIdleEvent = object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn = object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction = object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted = object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + +### Beta Managed Agents Session Status Rescheduled Event + +- `BetaManagedAgentsSessionStatusRescheduledEvent = object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + +### Beta Managed Agents Session Status Running Event + +- `BetaManagedAgentsSessionStatusRunningEvent = object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + +### Beta Managed Agents Session Status Terminated Event + +- `BetaManagedAgentsSessionStatusTerminatedEvent = object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + +### Beta Managed Agents Span Model Request End Event + +- `BetaManagedAgentsSpanModelRequestEndEvent = object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + +### Beta Managed Agents Span Model Request Start Event + +- `BetaManagedAgentsSpanModelRequestStartEvent = object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + +### Beta Managed Agents Span Model Usage + +- `BetaManagedAgentsSpanModelUsage = object { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 2 more }` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +### Beta Managed Agents Stream Session Events + +- `BetaManagedAgentsStreamSessionEvents = BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or 17 more` + + Server-sent event in the session stream. + + - `BetaManagedAgentsUserMessageEvent = object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent = object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent = object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent = object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsAgentCustomToolUseEvent = object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `BetaManagedAgentsAgentMessageEvent = object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `BetaManagedAgentsAgentThinkingEvent = object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `BetaManagedAgentsAgentMCPToolUseEvent = object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentMCPToolResultEvent = object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentToolUseEvent = object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentToolResultEvent = object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentThreadContextCompactedEvent = object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `BetaManagedAgentsSessionErrorEvent = object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError = object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError = object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError = object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError = object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError = object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError = object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError = object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `BetaManagedAgentsSessionStatusRescheduledEvent = object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `BetaManagedAgentsSessionStatusRunningEvent = object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `BetaManagedAgentsSessionStatusIdleEvent = object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn = object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction = object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted = object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `BetaManagedAgentsSessionStatusTerminatedEvent = object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `BetaManagedAgentsSpanModelRequestStartEvent = object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `BetaManagedAgentsSpanModelRequestEndEvent = object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `BetaManagedAgentsSessionDeletedEvent = object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Beta Managed Agents Text Block + +- `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + +### Beta Managed Agents Unknown Error + +- `BetaManagedAgentsUnknownError = object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + +### Beta Managed Agents URL Document Source + +- `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + +### Beta Managed Agents URL Image Source + +- `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + +### Beta Managed Agents User Custom Tool Result Event + +- `BetaManagedAgentsUserCustomToolResultEvent = object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Custom Tool Result Event Params + +- `BetaManagedAgentsUserCustomToolResultEventParams = object { custom_tool_use_id, type, content, is_error }` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents User Interrupt Event + +- `BetaManagedAgentsUserInterruptEvent = object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Interrupt Event Params + +- `BetaManagedAgentsUserInterruptEventParams = object { type }` + + Parameters for sending an interrupt to pause the agent. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + +### Beta Managed Agents User Message Event + +- `BetaManagedAgentsUserMessageEvent = object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Message Event Params + +- `BetaManagedAgentsUserMessageEventParams = object { content, type }` + + Parameters for sending a user message to the session. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks for the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + +### Beta Managed Agents User Tool Confirmation Event + +- `BetaManagedAgentsUserToolConfirmationEvent = object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Tool Confirmation Event Params + +- `BetaManagedAgentsUserToolConfirmationEventParams = object { result, tool_use_id, type, deny_message }` + + Parameters for confirming or denying a tool execution request. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + +# Resources + +## Add + +**post** `/v1/sessions/{session_id}/resources` + +Add Session Resource + +### Path Parameters + +- `session_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `file_id: string` + + ID of a previously uploaded file. + +- `type: "file"` + + - `"file"` + +- `mount_path: optional string` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +### Returns + +- `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/resources \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "file_id": "file_011CNha8iCJcU1wXNR6q4V8w", + "type": "file" + }' +``` + +## List + +**get** `/v1/sessions/{session_id}/resources` + +List Session Resources + +### Path Parameters + +- `session_id: string` + +### Query Parameters + +- `limit: optional number` + + Maximum number of resources to return per page (max 1000). If omitted, returns all resources. + +- `page: optional string` + + Opaque cursor from a previous response's next_page field. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `data: array of BetaManagedAgentsSessionResource` + + Resources for the session, ordered by `created_at`. + + - `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +- `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/resources \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Retrieve + +**get** `/v1/sessions/{session_id}/resources/{resource_id}` + +Get Session Resource + +### Path Parameters + +- `session_id: string` + +- `resource_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + +- `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/resources/$RESOURCE_ID \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Update + +**post** `/v1/sessions/{session_id}/resources/{resource_id}` + +Update Session Resource + +### Path Parameters + +- `session_id: string` + +- `resource_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `authorization_token: string` + + New authorization token for the resource. Currently only `github_repository` resources support token rotation. + +### Returns + +- `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + +- `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/resources/$RESOURCE_ID \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "authorization_token": "ghp_exampletoken" + }' +``` + +## Delete + +**delete** `/v1/sessions/{session_id}/resources/{resource_id}` + +Delete Session Resource + +### Path Parameters + +- `session_id: string` + +- `resource_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsDeleteSessionResource = object { id, type }` + + Confirmation of resource deletion. + + - `id: string` + + - `type: "session_resource_deleted"` + + - `"session_resource_deleted"` + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/resources/$RESOURCE_ID \ + -X DELETE \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Domain Types + +### Beta Managed Agents Delete Session Resource + +- `BetaManagedAgentsDeleteSessionResource = object { id, type }` + + Confirmation of resource deletion. + + - `id: string` + + - `type: "session_resource_deleted"` + + - `"session_resource_deleted"` + +### Beta Managed Agents File Resource + +- `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents GitHub Repository Resource + +- `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + +### Beta Managed Agents Session Resource + +- `BetaManagedAgentsSessionResource = BetaManagedAgentsGitHubRepositoryResource or BetaManagedAgentsFileResource` + + - `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Resource Retrieve Response + +- `ResourceRetrieveResponse = BetaManagedAgentsGitHubRepositoryResource or BetaManagedAgentsFileResource` + + The requested session resource. + + - `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Resource Update Response + +- `ResourceUpdateResponse = BetaManagedAgentsGitHubRepositoryResource or BetaManagedAgentsFileResource` + + The updated session resource. + + - `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +# Vaults + +## Create + +**post** `/v1/vaults` + +Create Vault + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `display_name: string` + + Human-readable name for the vault. 1-255 characters. + +- `metadata: optional map[string]` + + Arbitrary key-value metadata to attach to the vault. + +### Returns + +- `BetaManagedAgentsVault = object { id, archived_at, created_at, 4 more }` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```http +curl https://api.anthropic.com/v1/vaults \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "display_name": "Example vault" + }' +``` + +## List + +**get** `/v1/vaults` + +List Vaults + +### Query Parameters + +- `include_archived: optional boolean` + + Whether to include archived vaults in the results. + +- `limit: optional number` + + Maximum number of vaults to return per page. Defaults to 20, maximum 100. + +- `page: optional string` + + Opaque pagination token from a previous `list_vaults` response. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `data: optional array of BetaManagedAgentsVault` + + List of vaults. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +- `next_page: optional string` + + Pagination token for the next page, or null if no more results. + +### Example + +```http +curl https://api.anthropic.com/v1/vaults \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Retrieve + +**get** `/v1/vaults/{vault_id}` + +Get Vault + +### Path Parameters + +- `vault_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsVault = object { id, archived_at, created_at, 4 more }` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Update + +**post** `/v1/vaults/{vault_id}` + +Update Vault + +### Path Parameters + +- `vault_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `display_name: optional string` + + Updated human-readable name for the vault. 1-255 characters. + +- `metadata: optional map[string]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + +### Returns + +- `BetaManagedAgentsVault = object { id, archived_at, created_at, 4 more }` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{}' +``` + +## Delete + +**delete** `/v1/vaults/{vault_id}` + +Delete Vault + +### Path Parameters + +- `vault_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsDeletedVault = object { id, type }` + + Confirmation of a deleted vault. + + - `id: string` + + Unique identifier of the deleted vault. + + - `type: "vault_deleted"` + + - `"vault_deleted"` + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID \ + -X DELETE \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Archive + +**post** `/v1/vaults/{vault_id}/archive` + +Archive Vault + +### Path Parameters + +- `vault_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsVault = object { id, archived_at, created_at, 4 more }` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID/archive \ + -X POST \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Domain Types + +### Beta Managed Agents Deleted Vault + +- `BetaManagedAgentsDeletedVault = object { id, type }` + + Confirmation of a deleted vault. + + - `id: string` + + Unique identifier of the deleted vault. + + - `type: "vault_deleted"` + + - `"vault_deleted"` + +### Beta Managed Agents Vault + +- `BetaManagedAgentsVault = object { id, archived_at, created_at, 4 more }` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +# Credentials + +## Create + +**post** `/v1/vaults/{vault_id}/credentials` + +Create Credential + +### Path Parameters + +- `vault_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `auth: BetaManagedAgentsMCPOAuthCreateParams or BetaManagedAgentsStaticBearerCreateParams` + + Authentication details for creating a credential. + + - `BetaManagedAgentsMCPOAuthCreateParams = object { access_token, mcp_server_url, type, 2 more }` + + Parameters for creating an MCP OAuth credential. + + - `access_token: string` + + OAuth access token. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshParams` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: string` + + OAuth client ID. + + - `refresh_token: string` + + OAuth refresh token. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam or BetaManagedAgentsTokenEndpointAuthBasicParam or BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneParam = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicParam = object { client_secret, type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostParam = object { client_secret, type }` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerCreateParams = object { token, mcp_server_url, type }` + + Parameters for creating a static bearer token credential. + + - `token: string` + + Static bearer token value. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + +- `display_name: optional string` + + Human-readable name for the credential. Up to 255 characters. + +- `metadata: optional map[string]` + + Arbitrary key-value metadata to attach to the credential. + +### Returns + +- `BetaManagedAgentsCredential = object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse = object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse = object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse = object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse = object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID/credentials \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "auth": { + "token": "bearer_exampletoken", + "mcp_server_url": "https://example-server.modelcontextprotocol.io/sse", + "type": "static_bearer" + } + }' +``` + +## List + +**get** `/v1/vaults/{vault_id}/credentials` + +List Credentials + +### Path Parameters + +- `vault_id: string` + +### Query Parameters + +- `include_archived: optional boolean` + + Whether to include archived credentials in the results. + +- `limit: optional number` + + Maximum number of credentials to return per page. Defaults to 20, maximum 100. + +- `page: optional string` + + Opaque pagination token from a previous `list_credentials` response. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `data: optional array of BetaManagedAgentsCredential` + + List of credentials. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse = object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse = object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse = object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse = object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +- `next_page: optional string` + + Pagination token for the next page, or null if no more results. + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID/credentials \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Retrieve + +**get** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Get Credential + +### Path Parameters + +- `vault_id: string` + +- `credential_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsCredential = object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse = object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse = object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse = object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse = object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID/credentials/$CREDENTIAL_ID \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Update + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Update Credential + +### Path Parameters + +- `vault_id: string` + +- `credential_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `auth: optional BetaManagedAgentsMCPOAuthUpdateParams or BetaManagedAgentsStaticBearerUpdateParams` + + Updated authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthUpdateParams = object { type, access_token, expires_at, refresh }` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `access_token: optional string` + + Updated OAuth access token. + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshUpdateParams` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: optional string` + + Updated OAuth refresh token. + + - `scope: optional string` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: optional BetaManagedAgentsTokenEndpointAuthBasicUpdateParam or BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `BetaManagedAgentsTokenEndpointAuthBasicUpdateParam = object { type, client_secret }` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret: optional string` + + Updated OAuth client secret. + + - `BetaManagedAgentsTokenEndpointAuthPostUpdateParam = object { type, client_secret }` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret: optional string` + + Updated OAuth client secret. + + - `BetaManagedAgentsStaticBearerUpdateParams = object { type, token }` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `token: optional string` + + Updated static bearer token value. + +- `display_name: optional string` + + Updated human-readable name for the credential. 1-255 characters. + +- `metadata: optional map[string]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + +### Returns + +- `BetaManagedAgentsCredential = object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse = object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse = object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse = object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse = object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID/credentials/$CREDENTIAL_ID \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{}' +``` + +## Delete + +**delete** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Delete Credential + +### Path Parameters + +- `vault_id: string` + +- `credential_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsDeletedCredential = object { id, type }` + + Confirmation of a deleted credential. + + - `id: string` + + Unique identifier of the deleted credential. + + - `type: "vault_credential_deleted"` + + - `"vault_credential_deleted"` + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID/credentials/$CREDENTIAL_ID \ + -X DELETE \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Archive + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}/archive` + +Archive Credential + +### Path Parameters + +- `vault_id: string` + +- `credential_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` - Exceptional model for specialized complex tasks + - `"prompt-caching-2024-07-31"` - - `"claude-opus-4-1-20250805"` + - `"computer-use-2024-10-22"` - Exceptional model for specialized complex tasks + - `"computer-use-2025-01-24"` - - `"claude-opus-4-0"` + - `"pdfs-2024-09-25"` - Powerful model for complex tasks + - `"token-counting-2024-11-01"` - - `"claude-opus-4-20250514"` + - `"token-efficient-tools-2025-02-19"` - Powerful model for complex tasks + - `"output-128k-2025-02-19"` - - `"claude-sonnet-4-0"` + - `"files-api-2025-04-14"` - High-performance model with extended thinking + - `"mcp-client-2025-04-04"` - - `"claude-sonnet-4-20250514"` + - `"mcp-client-2025-11-20"` - High-performance model with extended thinking + - `"dev-full-thinking-2025-05-14"` - - `"claude-3-haiku-20240307"` + - `"interleaved-thinking-2025-05-14"` - Fast and cost-effective model + - `"code-execution-2025-05-22"` - - `UnionMember1 = string` + - `"extended-cache-ttl-2025-04-11"` - - `role: "assistant"` + - `"context-1m-2025-08-07"` - Conversational role of the generated message. + - `"context-management-2025-06-27"` - This will always be `"assistant"`. + - `"model-context-window-exceeded-2025-08-26"` - - `"assistant"` + - `"skills-2025-10-02"` - - `stop_details: BetaRefusalStopDetails` + - `"fast-mode-2026-02-01"` - Structured information about a refusal. + - `"output-300k-2026-03-24"` - - `category: "cyber" or "bio"` +### Returns - The policy category that triggered the refusal. +- `BetaManagedAgentsCredential = object { id, archived_at, auth, 6 more }` - `null` when the refusal doesn't map to a named category. + A credential stored in a vault. Sensitive fields are never returned in responses. - - `"cyber"` + - `id: string` - - `"bio"` + Unique identifier for the credential. - - `explanation: string` + - `archived_at: string` - Human-readable explanation of the refusal. + A timestamp in RFC 3339 format - This text is not guaranteed to be stable. `null` when no explanation is available for the category. + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` - - `type: "refusal"` + Authentication details for a credential. - - `"refusal"` + - `BetaManagedAgentsMCPOAuthAuthResponse = object { mcp_server_url, type, expires_at, refresh }` - - `stop_reason: BetaStopReason` + OAuth credential details for an MCP server. - The reason that we stopped. + - `mcp_server_url: string` - This may be one the following values: + URL of the MCP server this credential authenticates against. - * `"end_turn"`: the model reached a natural stopping point - * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum - * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated - * `"tool_use"`: the model invoked one or more tools - * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. - * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + - `type: "mcp_oauth"` - In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + - `"mcp_oauth"` - - `"end_turn"` + - `expires_at: optional string` - - `"max_tokens"` + A timestamp in RFC 3339 format - - `"stop_sequence"` + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshResponse` - - `"tool_use"` + OAuth refresh token configuration returned in credential responses. - - `"pause_turn"` + - `client_id: string` - - `"compaction"` + OAuth client ID. - - `"refusal"` + - `token_endpoint: string` - - `"model_context_window_exceeded"` + Token endpoint URL used to refresh the access token. - - `stop_sequence: string` + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` - Which custom stop sequence was generated, if any. + Token endpoint requires no client authentication. - This value will be a non-null string if one of your custom stop sequences was generated. + - `BetaManagedAgentsTokenEndpointAuthNoneResponse = object { type }` - - `type: "message"` + Token endpoint requires no client authentication. - Object type. + - `type: "none"` - For Messages, this is always `"message"`. + - `"none"` - - `"message"` + - `BetaManagedAgentsTokenEndpointAuthBasicResponse = object { type }` - - `usage: BetaUsage` + Token endpoint uses HTTP Basic authentication with client credentials. - Billing and rate-limit usage. + - `type: "client_secret_basic"` - Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + - `"client_secret_basic"` - Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + - `BetaManagedAgentsTokenEndpointAuthPostResponse = object { type }` - For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + Token endpoint uses POST body authentication with client credentials. - Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + - `type: "client_secret_post"` - - `cache_creation: BetaCacheCreation` + - `"client_secret_post"` - Breakdown of cached tokens by TTL + - `resource: optional string` - - `ephemeral_1h_input_tokens: number` + OAuth resource indicator. - The number of input tokens used to create the 1 hour cache entry. + - `scope: optional string` - - `ephemeral_5m_input_tokens: number` + OAuth scope for the refresh request. - The number of input tokens used to create the 5 minute cache entry. + - `BetaManagedAgentsStaticBearerAuthResponse = object { mcp_server_url, type }` - - `cache_creation_input_tokens: number` + Static bearer token credential details for an MCP server. - The number of input tokens used to create the cache entry. + - `mcp_server_url: string` - - `cache_read_input_tokens: number` + URL of the MCP server this credential authenticates against. - The number of input tokens read from the cache. + - `type: "static_bearer"` - - `inference_geo: string` + - `"static_bearer"` - The geographic region where inference was performed for this request. + - `created_at: string` - - `input_tokens: number` + A timestamp in RFC 3339 format - The number of input tokens which were used. + - `metadata: map[string]` - - `iterations: BetaIterationsUsage` + Arbitrary key-value metadata attached to the credential. - Per-iteration token usage breakdown. + - `type: "vault_credential"` - Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + - `"vault_credential"` - - Determine which iterations exceeded long context thresholds (>=200k tokens) - - Calculate the true context window size from the last iteration - - Understand token accumulation across server-side tool use loops + - `updated_at: string` - - `BetaMessageIterationUsage = object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + A timestamp in RFC 3339 format - Token usage for a sampling iteration. + - `vault_id: string` - - `cache_creation: BetaCacheCreation` + Identifier of the vault this credential belongs to. - Breakdown of cached tokens by TTL + - `display_name: optional string` - - `ephemeral_1h_input_tokens: number` + Human-readable name for the credential. - The number of input tokens used to create the 1 hour cache entry. +### Example - - `ephemeral_5m_input_tokens: number` +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID/credentials/$CREDENTIAL_ID/archive \ + -X POST \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` - The number of input tokens used to create the 5 minute cache entry. +## Domain Types - - `cache_creation_input_tokens: number` +### Beta Managed Agents Credential - The number of input tokens used to create the cache entry. +- `BetaManagedAgentsCredential = object { id, archived_at, auth, 6 more }` - - `cache_read_input_tokens: number` + A credential stored in a vault. Sensitive fields are never returned in responses. - The number of input tokens read from the cache. + - `id: string` - - `input_tokens: number` + Unique identifier for the credential. - The number of input tokens which were used. + - `archived_at: string` - - `output_tokens: number` + A timestamp in RFC 3339 format - The number of output tokens which were used. + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` - - `type: "message"` + Authentication details for a credential. - Usage for a sampling iteration + - `BetaManagedAgentsMCPOAuthAuthResponse = object { mcp_server_url, type, expires_at, refresh }` - - `"message"` + OAuth credential details for an MCP server. - - `BetaCompactionIterationUsage = object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + - `mcp_server_url: string` - Token usage for a compaction iteration. + URL of the MCP server this credential authenticates against. - - `cache_creation: BetaCacheCreation` + - `type: "mcp_oauth"` - Breakdown of cached tokens by TTL + - `"mcp_oauth"` - - `ephemeral_1h_input_tokens: number` + - `expires_at: optional string` - The number of input tokens used to create the 1 hour cache entry. + A timestamp in RFC 3339 format - - `ephemeral_5m_input_tokens: number` + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshResponse` - The number of input tokens used to create the 5 minute cache entry. + OAuth refresh token configuration returned in credential responses. - - `cache_creation_input_tokens: number` + - `client_id: string` - The number of input tokens used to create the cache entry. + OAuth client ID. - - `cache_read_input_tokens: number` + - `token_endpoint: string` - The number of input tokens read from the cache. + Token endpoint URL used to refresh the access token. - - `input_tokens: number` + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` - The number of input tokens which were used. + Token endpoint requires no client authentication. - - `output_tokens: number` + - `BetaManagedAgentsTokenEndpointAuthNoneResponse = object { type }` - The number of output tokens which were used. + Token endpoint requires no client authentication. - - `type: "compaction"` + - `type: "none"` - Usage for a compaction iteration + - `"none"` - - `"compaction"` + - `BetaManagedAgentsTokenEndpointAuthBasicResponse = object { type }` - - `output_tokens: number` + Token endpoint uses HTTP Basic authentication with client credentials. - The number of output tokens which were used. + - `type: "client_secret_basic"` - - `server_tool_use: BetaServerToolUsage` + - `"client_secret_basic"` - The number of server tool requests. + - `BetaManagedAgentsTokenEndpointAuthPostResponse = object { type }` - - `web_fetch_requests: number` + Token endpoint uses POST body authentication with client credentials. - The number of web fetch tool requests. + - `type: "client_secret_post"` - - `web_search_requests: number` + - `"client_secret_post"` - The number of web search tool requests. + - `resource: optional string` - - `service_tier: "standard" or "priority" or "batch"` + OAuth resource indicator. - If the request used the priority, standard, or batch tier. + - `scope: optional string` - - `"standard"` + OAuth scope for the refresh request. - - `"priority"` + - `BetaManagedAgentsStaticBearerAuthResponse = object { mcp_server_url, type }` - - `"batch"` + Static bearer token credential details for an MCP server. - - `speed: "standard" or "fast"` + - `mcp_server_url: string` - The inference speed mode used for this request. + URL of the MCP server this credential authenticates against. - - `"standard"` + - `type: "static_bearer"` - - `"fast"` + - `"static_bearer"` - - `type: "succeeded"` + - `created_at: string` - - `"succeeded"` + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Beta Managed Agents Deleted Credential + +- `BetaManagedAgentsDeletedCredential = object { id, type }` + + Confirmation of a deleted credential. + + - `id: string` + + Unique identifier of the deleted credential. + + - `type: "vault_credential_deleted"` + + - `"vault_credential_deleted"` + +### Beta Managed Agents MCP OAuth Auth Response + +- `BetaManagedAgentsMCPOAuthAuthResponse = object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse = object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse = object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Create Params + +- `BetaManagedAgentsMCPOAuthCreateParams = object { access_token, mcp_server_url, type, 2 more }` + + Parameters for creating an MCP OAuth credential. + + - `access_token: string` + + OAuth access token. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshParams` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: string` + + OAuth client ID. + + - `refresh_token: string` + + OAuth refresh token. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam or BetaManagedAgentsTokenEndpointAuthBasicParam or BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneParam = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicParam = object { client_secret, type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostParam = object { client_secret, type }` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Params + +- `BetaManagedAgentsMCPOAuthRefreshParams = object { client_id, refresh_token, token_endpoint, 3 more }` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: string` + + OAuth client ID. + + - `refresh_token: string` + + OAuth refresh token. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam or BetaManagedAgentsTokenEndpointAuthBasicParam or BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneParam = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicParam = object { client_secret, type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostParam = object { client_secret, type }` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Response + +- `BetaManagedAgentsMCPOAuthRefreshResponse = object { client_id, token_endpoint, token_endpoint_auth, 2 more }` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse = object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse = object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Update Params + +- `BetaManagedAgentsMCPOAuthRefreshUpdateParams = object { refresh_token, scope, token_endpoint_auth }` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: optional string` + + Updated OAuth refresh token. + + - `scope: optional string` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: optional BetaManagedAgentsTokenEndpointAuthBasicUpdateParam or BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `BetaManagedAgentsTokenEndpointAuthBasicUpdateParam = object { type, client_secret }` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret: optional string` + + Updated OAuth client secret. + + - `BetaManagedAgentsTokenEndpointAuthPostUpdateParam = object { type, client_secret }` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret: optional string` + + Updated OAuth client secret. + +### Beta Managed Agents MCP OAuth Update Params + +- `BetaManagedAgentsMCPOAuthUpdateParams = object { type, access_token, expires_at, refresh }` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `access_token: optional string` + + Updated OAuth access token. + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshUpdateParams` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: optional string` + + Updated OAuth refresh token. + + - `scope: optional string` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: optional BetaManagedAgentsTokenEndpointAuthBasicUpdateParam or BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `BetaManagedAgentsTokenEndpointAuthBasicUpdateParam = object { type, client_secret }` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret: optional string` + + Updated OAuth client secret. + + - `BetaManagedAgentsTokenEndpointAuthPostUpdateParam = object { type, client_secret }` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret: optional string` + + Updated OAuth client secret. + +### Beta Managed Agents Static Bearer Auth Response + +- `BetaManagedAgentsStaticBearerAuthResponse = object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + +### Beta Managed Agents Static Bearer Create Params + +- `BetaManagedAgentsStaticBearerCreateParams = object { token, mcp_server_url, type }` + + Parameters for creating a static bearer token credential. + + - `token: string` + + Static bearer token value. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + +### Beta Managed Agents Static Bearer Update Params + +- `BetaManagedAgentsStaticBearerUpdateParams = object { type, token }` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `token: optional string` + + Updated static bearer token value. + +### Beta Managed Agents Token Endpoint Auth Basic Param + +- `BetaManagedAgentsTokenEndpointAuthBasicParam = object { client_secret, type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + +### Beta Managed Agents Token Endpoint Auth Basic Response + +- `BetaManagedAgentsTokenEndpointAuthBasicResponse = object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + +### Beta Managed Agents Token Endpoint Auth Basic Update Param + +- `BetaManagedAgentsTokenEndpointAuthBasicUpdateParam = object { type, client_secret }` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret: optional string` + + Updated OAuth client secret. + +### Beta Managed Agents Token Endpoint Auth None Param + +- `BetaManagedAgentsTokenEndpointAuthNoneParam = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + +### Beta Managed Agents Token Endpoint Auth None Response + +- `BetaManagedAgentsTokenEndpointAuthNoneResponse = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + +### Beta Managed Agents Token Endpoint Auth Post Param + +- `BetaManagedAgentsTokenEndpointAuthPostParam = object { client_secret, type }` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + +### Beta Managed Agents Token Endpoint Auth Post Response + +- `BetaManagedAgentsTokenEndpointAuthPostResponse = object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + +### Beta Managed Agents Token Endpoint Auth Post Update Param + +- `BetaManagedAgentsTokenEndpointAuthPostUpdateParam = object { type, client_secret }` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret: optional string` + + Updated OAuth client secret. # Files @@ -45366,7 +68255,7 @@ Upload File - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -45410,11 +68299,9 @@ Upload File - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns -- `FileMetadata = object { id, created_at, filename, 4 more }` +- `FileMetadata = object { id, created_at, filename, 5 more }` - `id: string` @@ -45450,6 +68337,20 @@ Upload File Whether the file can be downloaded. + - `scope: optional BetaFileScope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + + - `"session"` + ### Example ```http @@ -45483,6 +68384,10 @@ List Files Defaults to `20`. Ranges from `1` to `1000`. +- `scope_id: optional string` + + Filter by scope ID. Only returns files associated with the specified scope (e.g., a session ID). + ### Header Parameters - `"anthropic-beta": optional array of AnthropicBeta` @@ -45491,7 +68396,7 @@ List Files - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -45535,8 +68440,6 @@ List Files - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `data: array of FileMetadata` @@ -45577,6 +68480,20 @@ List Files Whether the file can be downloaded. + - `scope: optional BetaFileScope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + + - `"session"` + - `first_id: optional string` ID of the first file in this page of results. @@ -45618,7 +68535,7 @@ Download File - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -45662,8 +68579,6 @@ Download File - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Example ```http @@ -45693,7 +68608,7 @@ Get File Metadata - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -45737,11 +68652,9 @@ Get File Metadata - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns -- `FileMetadata = object { id, created_at, filename, 4 more }` +- `FileMetadata = object { id, created_at, filename, 5 more }` - `id: string` @@ -45777,6 +68690,20 @@ Get File Metadata Whether the file can be downloaded. + - `scope: optional BetaFileScope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + + - `"session"` + ### Example ```http @@ -45806,7 +68733,7 @@ Delete File - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -45850,8 +68777,6 @@ Delete File - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `DeletedFile = object { id, type }` @@ -45880,6 +68805,20 @@ curl https://api.anthropic.com/v1/files/$FILE_ID \ ## Domain Types +### Beta File Scope + +- `BetaFileScope = object { id, type }` + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + + - `"session"` + ### Deleted File - `DeletedFile = object { id, type }` @@ -45898,7 +68837,7 @@ curl https://api.anthropic.com/v1/files/$FILE_ID \ ### File Metadata -- `FileMetadata = object { id, created_at, filename, 4 more }` +- `FileMetadata = object { id, created_at, filename, 5 more }` - `id: string` @@ -45934,6 +68873,20 @@ curl https://api.anthropic.com/v1/files/$FILE_ID \ Whether the file can be downloaded. + - `scope: optional BetaFileScope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + + - `"session"` + # Skills ## Create @@ -45950,7 +68903,7 @@ Create Skill - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -45994,8 +68947,6 @@ Create Skill - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `id: string` @@ -46086,7 +69037,7 @@ List Skills - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -46130,8 +69081,6 @@ List Skills - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `data: array of object { id, created_at, display_title, 4 more }` @@ -46222,7 +69171,7 @@ Get Skill - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -46266,8 +69215,6 @@ Get Skill - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `id: string` @@ -46342,7 +69289,7 @@ Delete Skill - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -46386,8 +69333,6 @@ Delete Skill - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `id: string` @@ -46589,7 +69534,7 @@ Create Skill Version - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -46633,8 +69578,6 @@ Create Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `id: string` @@ -46725,7 +69668,7 @@ List Skill Versions - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -46769,8 +69712,6 @@ List Skill Versions - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `data: array of object { id, created_at, description, 5 more }` @@ -46866,7 +69807,7 @@ Get Skill Version - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -46910,8 +69851,6 @@ Get Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `id: string` @@ -46995,7 +69934,7 @@ Delete Skill Version - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -47039,8 +69978,6 @@ Delete Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `id: string` @@ -47226,555 +70163,3 @@ curl https://api.anthropic.com/v1/skills/$SKILL_ID/versions/$VERSION \ Deleted object type. For Skill Versions, this is always `"skill_version_deleted"`. - -# User Profiles - -## Create - -**post** `/v1/user_profiles` - -Create User Profile - -### Header Parameters - -- `"anthropic-beta": optional array of AnthropicBeta` - - Optional header to specify the beta version(s) you want to use. - - - `UnionMember0 = string` - - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` - - - `"message-batches-2024-09-24"` - - - `"prompt-caching-2024-07-31"` - - - `"computer-use-2024-10-22"` - - - `"computer-use-2025-01-24"` - - - `"pdfs-2024-09-25"` - - - `"token-counting-2024-11-01"` - - - `"token-efficient-tools-2025-02-19"` - - - `"output-128k-2025-02-19"` - - - `"files-api-2025-04-14"` - - - `"mcp-client-2025-04-04"` - - - `"mcp-client-2025-11-20"` - - - `"dev-full-thinking-2025-05-14"` - - - `"interleaved-thinking-2025-05-14"` - - - `"code-execution-2025-05-22"` - - - `"extended-cache-ttl-2025-04-11"` - - - `"context-1m-2025-08-07"` - - - `"context-management-2025-06-27"` - - - `"model-context-window-exceeded-2025-08-26"` - - - `"skills-2025-10-02"` - - - `"fast-mode-2026-02-01"` - - - `"output-300k-2026-03-24"` - - - `"user-profiles-2026-03-24"` - -### Body Parameters - -- `external_id: optional string` - -- `metadata: optional map[string]` - - Free-form key-value data to attach to this user profile. Maximum 16 keys, with keys up to 64 characters and values up to 512 characters. Values must be non-empty strings. - -### Returns - -- `BetaUserProfile = object { id, created_at, metadata, 4 more }` - - - `id: string` - - - `created_at: string` - - A timestamp in RFC 3339 format - - - `metadata: map[string]` - - - `trust_grants: map[BetaUserProfileTrustGrant]` - - - `status: string` - - - `type: string` - - - `updated_at: string` - - A timestamp in RFC 3339 format - - - `external_id: optional string` - -### Example - -```http -curl https://api.anthropic.com/v1/user_profiles \ - -H 'Content-Type: application/json' \ - -H 'anthropic-version: 2023-06-01' \ - -H 'anthropic-beta: user-profiles-2026-03-24' \ - -H "X-Api-Key: $ANTHROPIC_API_KEY" \ - -d '{}' -``` - -## List - -**get** `/v1/user_profiles` - -List User Profiles - -### Query Parameters - -- `limit: optional number` - - Query parameter for limit - -- `order: optional "asc" or "desc"` - - Query parameter for order - - - `"asc"` - - - `"desc"` - -- `page: optional string` - - Query parameter for page - -### Header Parameters - -- `"anthropic-beta": optional array of AnthropicBeta` - - Optional header to specify the beta version(s) you want to use. - - - `UnionMember0 = string` - - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` - - - `"message-batches-2024-09-24"` - - - `"prompt-caching-2024-07-31"` - - - `"computer-use-2024-10-22"` - - - `"computer-use-2025-01-24"` - - - `"pdfs-2024-09-25"` - - - `"token-counting-2024-11-01"` - - - `"token-efficient-tools-2025-02-19"` - - - `"output-128k-2025-02-19"` - - - `"files-api-2025-04-14"` - - - `"mcp-client-2025-04-04"` - - - `"mcp-client-2025-11-20"` - - - `"dev-full-thinking-2025-05-14"` - - - `"interleaved-thinking-2025-05-14"` - - - `"code-execution-2025-05-22"` - - - `"extended-cache-ttl-2025-04-11"` - - - `"context-1m-2025-08-07"` - - - `"context-management-2025-06-27"` - - - `"model-context-window-exceeded-2025-08-26"` - - - `"skills-2025-10-02"` - - - `"fast-mode-2026-02-01"` - - - `"output-300k-2026-03-24"` - - - `"user-profiles-2026-03-24"` - -### Returns - -- `data: array of BetaUserProfile` - - - `id: string` - - - `created_at: string` - - A timestamp in RFC 3339 format - - - `metadata: map[string]` - - - `trust_grants: map[BetaUserProfileTrustGrant]` - - - `status: string` - - - `type: string` - - - `updated_at: string` - - A timestamp in RFC 3339 format - - - `external_id: optional string` - -- `next_page: optional string` - -### Example - -```http -curl https://api.anthropic.com/v1/user_profiles \ - -H 'anthropic-version: 2023-06-01' \ - -H 'anthropic-beta: user-profiles-2026-03-24' \ - -H "X-Api-Key: $ANTHROPIC_API_KEY" -``` - -## Retrieve - -**get** `/v1/user_profiles/{id}` - -Get User Profile - -### Path Parameters - -- `id: string` - -### Header Parameters - -- `"anthropic-beta": optional array of AnthropicBeta` - - Optional header to specify the beta version(s) you want to use. - - - `UnionMember0 = string` - - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` - - - `"message-batches-2024-09-24"` - - - `"prompt-caching-2024-07-31"` - - - `"computer-use-2024-10-22"` - - - `"computer-use-2025-01-24"` - - - `"pdfs-2024-09-25"` - - - `"token-counting-2024-11-01"` - - - `"token-efficient-tools-2025-02-19"` - - - `"output-128k-2025-02-19"` - - - `"files-api-2025-04-14"` - - - `"mcp-client-2025-04-04"` - - - `"mcp-client-2025-11-20"` - - - `"dev-full-thinking-2025-05-14"` - - - `"interleaved-thinking-2025-05-14"` - - - `"code-execution-2025-05-22"` - - - `"extended-cache-ttl-2025-04-11"` - - - `"context-1m-2025-08-07"` - - - `"context-management-2025-06-27"` - - - `"model-context-window-exceeded-2025-08-26"` - - - `"skills-2025-10-02"` - - - `"fast-mode-2026-02-01"` - - - `"output-300k-2026-03-24"` - - - `"user-profiles-2026-03-24"` - -### Returns - -- `BetaUserProfile = object { id, created_at, metadata, 4 more }` - - - `id: string` - - - `created_at: string` - - A timestamp in RFC 3339 format - - - `metadata: map[string]` - - - `trust_grants: map[BetaUserProfileTrustGrant]` - - - `status: string` - - - `type: string` - - - `updated_at: string` - - A timestamp in RFC 3339 format - - - `external_id: optional string` - -### Example - -```http -curl https://api.anthropic.com/v1/user_profiles/$ID \ - -H 'anthropic-version: 2023-06-01' \ - -H 'anthropic-beta: user-profiles-2026-03-24' \ - -H "X-Api-Key: $ANTHROPIC_API_KEY" -``` - -## Update - -**post** `/v1/user_profiles/{id}` - -Update User Profile - -### Path Parameters - -- `id: string` - -### Header Parameters - -- `"anthropic-beta": optional array of AnthropicBeta` - - Optional header to specify the beta version(s) you want to use. - - - `UnionMember0 = string` - - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` - - - `"message-batches-2024-09-24"` - - - `"prompt-caching-2024-07-31"` - - - `"computer-use-2024-10-22"` - - - `"computer-use-2025-01-24"` - - - `"pdfs-2024-09-25"` - - - `"token-counting-2024-11-01"` - - - `"token-efficient-tools-2025-02-19"` - - - `"output-128k-2025-02-19"` - - - `"files-api-2025-04-14"` - - - `"mcp-client-2025-04-04"` - - - `"mcp-client-2025-11-20"` - - - `"dev-full-thinking-2025-05-14"` - - - `"interleaved-thinking-2025-05-14"` - - - `"code-execution-2025-05-22"` - - - `"extended-cache-ttl-2025-04-11"` - - - `"context-1m-2025-08-07"` - - - `"context-management-2025-06-27"` - - - `"model-context-window-exceeded-2025-08-26"` - - - `"skills-2025-10-02"` - - - `"fast-mode-2026-02-01"` - - - `"output-300k-2026-03-24"` - - - `"user-profiles-2026-03-24"` - -### Body Parameters - -- `external_id: optional string` - -- `metadata: optional map[string]` - - Key-value pairs to merge into the stored metadata. Keys provided overwrite existing values. To remove a key, set its value to an empty string. Keys not provided are left unchanged. Maximum 16 keys, with keys up to 64 characters and values up to 512 characters. - -### Returns - -- `BetaUserProfile = object { id, created_at, metadata, 4 more }` - - - `id: string` - - - `created_at: string` - - A timestamp in RFC 3339 format - - - `metadata: map[string]` - - - `trust_grants: map[BetaUserProfileTrustGrant]` - - - `status: string` - - - `type: string` - - - `updated_at: string` - - A timestamp in RFC 3339 format - - - `external_id: optional string` - -### Example - -```http -curl https://api.anthropic.com/v1/user_profiles/$ID \ - -H 'Content-Type: application/json' \ - -H 'anthropic-version: 2023-06-01' \ - -H 'anthropic-beta: user-profiles-2026-03-24' \ - -H "X-Api-Key: $ANTHROPIC_API_KEY" \ - -d '{}' -``` - -## Create Enrollment URL - -**post** `/v1/user_profiles/{id}/enrollment_url` - -Create Enrollment URL - -### Path Parameters - -- `id: string` - -### Header Parameters - -- `"anthropic-beta": optional array of AnthropicBeta` - - Optional header to specify the beta version(s) you want to use. - - - `UnionMember0 = string` - - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` - - - `"message-batches-2024-09-24"` - - - `"prompt-caching-2024-07-31"` - - - `"computer-use-2024-10-22"` - - - `"computer-use-2025-01-24"` - - - `"pdfs-2024-09-25"` - - - `"token-counting-2024-11-01"` - - - `"token-efficient-tools-2025-02-19"` - - - `"output-128k-2025-02-19"` - - - `"files-api-2025-04-14"` - - - `"mcp-client-2025-04-04"` - - - `"mcp-client-2025-11-20"` - - - `"dev-full-thinking-2025-05-14"` - - - `"interleaved-thinking-2025-05-14"` - - - `"code-execution-2025-05-22"` - - - `"extended-cache-ttl-2025-04-11"` - - - `"context-1m-2025-08-07"` - - - `"context-management-2025-06-27"` - - - `"model-context-window-exceeded-2025-08-26"` - - - `"skills-2025-10-02"` - - - `"fast-mode-2026-02-01"` - - - `"output-300k-2026-03-24"` - - - `"user-profiles-2026-03-24"` - -### Returns - -- `BetaUserProfileEnrollmentURL = object { expires_at, type, url }` - - - `expires_at: string` - - A timestamp in RFC 3339 format - - - `type: string` - - - `url: string` - -### Example - -```http -curl https://api.anthropic.com/v1/user_profiles/$ID/enrollment_url \ - -X POST \ - -H 'anthropic-version: 2023-06-01' \ - -H 'anthropic-beta: user-profiles-2026-03-24' \ - -H "X-Api-Key: $ANTHROPIC_API_KEY" -``` - -## Domain Types - -### Beta User Profile - -- `BetaUserProfile = object { id, created_at, metadata, 4 more }` - - - `id: string` - - - `created_at: string` - - A timestamp in RFC 3339 format - - - `metadata: map[string]` - - - `trust_grants: map[BetaUserProfileTrustGrant]` - - - `status: string` - - - `type: string` - - - `updated_at: string` - - A timestamp in RFC 3339 format - - - `external_id: optional string` - -### Beta User Profile Enrollment URL - -- `BetaUserProfileEnrollmentURL = object { expires_at, type, url }` - - - `expires_at: string` - - A timestamp in RFC 3339 format - - - `type: string` - - - `url: string` - -### Beta User Profile Trust Grant - -- `BetaUserProfileTrustGrant = object { status }` - - - `status: string` diff --git a/content/en/api/beta/agents.md b/content/en/api/beta/agents.md new file mode 100644 index 000000000..38e438d41 --- /dev/null +++ b/content/en/api/beta/agents.md @@ -0,0 +1,4301 @@ +# Agents + +## Create + +**post** `/v1/agents` + +Create Agent + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `model: BetaManagedAgentsModel or BetaManagedAgentsModelConfigParams` + + Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control + + - `BetaManagedAgentsModel = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `BetaManagedAgentsModelConfigParams = object { id, speed }` + + An object that defines additional configuration control over model use + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +- `name: string` + + Human-readable name for the agent. 1-256 characters. + +- `description: optional string` + + Description of what the agent does. Up to 2048 characters. + +- `mcp_servers: optional array of BetaManagedAgentsURLMCPServerParams` + + MCP servers this agent connects to. Maximum 20. Names must be unique within the array. + + - `name: string` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `type: "url"` + + - `"url"` + + - `url: string` + + Endpoint URL for the MCP server. + +- `metadata: optional map[string]` + + Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars. + +- `skills: optional array of BetaManagedAgentsSkillParams` + + Skills available to the agent. Maximum 20. + + - `BetaManagedAgentsAnthropicSkillParams = object { skill_id, type, version }` + + An Anthropic-managed skill. + + - `skill_id: string` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: optional string` + + Version to pin. Defaults to latest if omitted. + + - `BetaManagedAgentsCustomSkillParams = object { skill_id, type, version }` + + A user-created custom skill. + + - `skill_id: string` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: "custom"` + + - `"custom"` + + - `version: optional string` + + Version to pin. Defaults to latest if omitted. + +- `system: optional string` + + System prompt for the agent. Up to 100,000 characters. + +- `tools: optional array of BetaManagedAgentsAgentToolset20260401Params or BetaManagedAgentsMCPToolsetParams or BetaManagedAgentsCustomToolParams` + + Tool configurations available to the agent. Maximum of 128 tools across all toolsets allowed. + + - `BetaManagedAgentsAgentToolset20260401Params = object { type, configs, default_config }` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `configs: optional array of BetaManagedAgentsAgentToolConfigParams` + + Per-tool configuration overrides. + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled: optional boolean` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: optional BetaManagedAgentsAgentToolsetDefaultConfigParams` + + Default configuration for all tools in a toolset. + + - `enabled: optional boolean` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `BetaManagedAgentsMCPToolsetParams = object { mcp_server_name, type, configs, default_config }` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `mcp_server_name: string` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `configs: optional array of BetaManagedAgentsMCPToolConfigParams` + + Per-tool configuration overrides. + + - `name: string` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled: optional boolean` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: optional BetaManagedAgentsMCPToolsetDefaultConfigParams` + + Default configuration for all tools from an MCP server. + + - `enabled: optional boolean` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `BetaManagedAgentsCustomToolParams = object { description, input_schema, name, type }` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: string` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: "custom"` + + - `"custom"` + +### Returns + +- `BetaManagedAgentsAgent = object { id, archived_at, created_at, 11 more }` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```http +curl https://api.anthropic.com/v1/agents \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "model": "claude-sonnet-4-6", + "name": "My First Agent" + }' +``` + +## List + +**get** `/v1/agents` + +List Agents + +### Query Parameters + +- `"created_at[gte]": optional string` + + Return agents created at or after this time (inclusive). + +- `"created_at[lte]": optional string` + + Return agents created at or before this time (inclusive). + +- `include_archived: optional boolean` + + Include archived agents in results. Defaults to false. + +- `limit: optional number` + + Maximum results per page. Default 20, maximum 100. + +- `page: optional string` + + Opaque pagination cursor from a previous response. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `data: optional array of BetaManagedAgentsAgent` + + List of agents. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +- `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```http +curl https://api.anthropic.com/v1/agents \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Retrieve + +**get** `/v1/agents/{agent_id}` + +Get Agent + +### Path Parameters + +- `agent_id: string` + +### Query Parameters + +- `version: optional number` + + Agent version. Omit for the most recent version. Must be at least 1 if specified. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsAgent = object { id, archived_at, created_at, 11 more }` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```http +curl https://api.anthropic.com/v1/agents/$AGENT_ID \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Update + +**post** `/v1/agents/{agent_id}` + +Update Agent + +### Path Parameters + +- `agent_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `version: number` + + The agent's current version, used to prevent concurrent overwrites. Obtain this value from a create or retrieve response. The request fails if this does not match the server's current version. + +- `description: optional string` + + Description. Up to 2048 characters. Omit to preserve; send empty string or null to clear. + +- `mcp_servers: optional array of BetaManagedAgentsURLMCPServerParams` + + MCP servers. Full replacement. Omit to preserve; send empty array or null to clear. Names must be unique. Maximum 20. + + - `name: string` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `type: "url"` + + - `"url"` + + - `url: string` + + Endpoint URL for the MCP server. + +- `metadata: optional map[string]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. The stored bag is limited to 16 keys (up to 64 chars each) with values up to 512 chars. + +- `model: optional BetaManagedAgentsModel or BetaManagedAgentsModelConfigParams` + + Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control. Omit to preserve. Cannot be cleared. + + - `BetaManagedAgentsModel = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `BetaManagedAgentsModelConfigParams = object { id, speed }` + + An object that defines additional configuration control over model use + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +- `name: optional string` + + Human-readable name. 1-256 characters. Omit to preserve. Cannot be cleared. + +- `skills: optional array of BetaManagedAgentsSkillParams` + + Skills. Full replacement. Omit to preserve; send empty array or null to clear. Maximum 20. + + - `BetaManagedAgentsAnthropicSkillParams = object { skill_id, type, version }` + + An Anthropic-managed skill. + + - `skill_id: string` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: optional string` + + Version to pin. Defaults to latest if omitted. + + - `BetaManagedAgentsCustomSkillParams = object { skill_id, type, version }` + + A user-created custom skill. + + - `skill_id: string` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: "custom"` + + - `"custom"` + + - `version: optional string` + + Version to pin. Defaults to latest if omitted. + +- `system: optional string` + + System prompt. Up to 100,000 characters. Omit to preserve; send empty string or null to clear. + +- `tools: optional array of BetaManagedAgentsAgentToolset20260401Params or BetaManagedAgentsMCPToolsetParams or BetaManagedAgentsCustomToolParams` + + Tool configurations available to the agent. Full replacement. Omit to preserve; send empty array or null to clear. Maximum of 128 tools across all toolsets allowed. + + - `BetaManagedAgentsAgentToolset20260401Params = object { type, configs, default_config }` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `configs: optional array of BetaManagedAgentsAgentToolConfigParams` + + Per-tool configuration overrides. + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled: optional boolean` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: optional BetaManagedAgentsAgentToolsetDefaultConfigParams` + + Default configuration for all tools in a toolset. + + - `enabled: optional boolean` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `BetaManagedAgentsMCPToolsetParams = object { mcp_server_name, type, configs, default_config }` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `mcp_server_name: string` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `configs: optional array of BetaManagedAgentsMCPToolConfigParams` + + Per-tool configuration overrides. + + - `name: string` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled: optional boolean` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: optional BetaManagedAgentsMCPToolsetDefaultConfigParams` + + Default configuration for all tools from an MCP server. + + - `enabled: optional boolean` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `BetaManagedAgentsCustomToolParams = object { description, input_schema, name, type }` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: string` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: "custom"` + + - `"custom"` + +### Returns + +- `BetaManagedAgentsAgent = object { id, archived_at, created_at, 11 more }` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```http +curl https://api.anthropic.com/v1/agents/$AGENT_ID \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "version": 1 + }' +``` + +## Archive + +**post** `/v1/agents/{agent_id}/archive` + +Archive Agent + +### Path Parameters + +- `agent_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsAgent = object { id, archived_at, created_at, 11 more }` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```http +curl https://api.anthropic.com/v1/agents/$AGENT_ID/archive \ + -X POST \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Domain Types + +### Beta Managed Agents Agent + +- `BetaManagedAgentsAgent = object { id, archived_at, created_at, 11 more }` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Beta Managed Agents Agent Tool Config + +- `BetaManagedAgentsAgentToolConfig = object { enabled, name, permission_policy }` + + Configuration for a specific agent tool. + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Agent Tool Config Params + +- `BetaManagedAgentsAgentToolConfigParams = object { name, enabled, permission_policy }` + + Configuration override for a specific tool within a toolset. + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled: optional boolean` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Agent Toolset Default Config + +- `BetaManagedAgentsAgentToolsetDefaultConfig = object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Agent Toolset Default Config Params + +- `BetaManagedAgentsAgentToolsetDefaultConfigParams = object { enabled, permission_policy }` + + Default configuration for all tools in a toolset. + + - `enabled: optional boolean` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Agent Toolset20260401 + +- `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + +### Beta Managed Agents Agent Toolset20260401 Params + +- `BetaManagedAgentsAgentToolset20260401Params = object { type, configs, default_config }` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `configs: optional array of BetaManagedAgentsAgentToolConfigParams` + + Per-tool configuration overrides. + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled: optional boolean` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: optional BetaManagedAgentsAgentToolsetDefaultConfigParams` + + Default configuration for all tools in a toolset. + + - `enabled: optional boolean` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Always Allow Policy + +- `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + +### Beta Managed Agents Always Ask Policy + +- `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Anthropic Skill + +- `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + +### Beta Managed Agents Anthropic Skill Params + +- `BetaManagedAgentsAnthropicSkillParams = object { skill_id, type, version }` + + An Anthropic-managed skill. + + - `skill_id: string` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: optional string` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents Custom Skill + +- `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + +### Beta Managed Agents Custom Skill Params + +- `BetaManagedAgentsCustomSkillParams = object { skill_id, type, version }` + + A user-created custom skill. + + - `skill_id: string` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: "custom"` + + - `"custom"` + + - `version: optional string` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents Custom Tool + +- `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + +### Beta Managed Agents Custom Tool Input Schema + +- `BetaManagedAgentsCustomToolInputSchema = object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + +### Beta Managed Agents Custom Tool Params + +- `BetaManagedAgentsCustomToolParams = object { description, input_schema, name, type }` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: string` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: "custom"` + + - `"custom"` + +### Beta Managed Agents MCP Server URL Definition + +- `BetaManagedAgentsMCPServerURLDefinition = object { name, type, url }` + + URL-based MCP server connection as returned in API responses. + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + +### Beta Managed Agents MCP Tool Config + +- `BetaManagedAgentsMCPToolConfig = object { enabled, name, permission_policy }` + + Resolved configuration for a specific MCP tool. + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents MCP Tool Config Params + +- `BetaManagedAgentsMCPToolConfigParams = object { name, enabled, permission_policy }` + + Configuration override for a specific MCP tool. + + - `name: string` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled: optional boolean` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents MCP Toolset + +- `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + +### Beta Managed Agents MCP Toolset Default Config + +- `BetaManagedAgentsMCPToolsetDefaultConfig = object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents MCP Toolset Default Config Params + +- `BetaManagedAgentsMCPToolsetDefaultConfigParams = object { enabled, permission_policy }` + + Default configuration for all tools from an MCP server. + + - `enabled: optional boolean` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents MCP Toolset Params + +- `BetaManagedAgentsMCPToolsetParams = object { mcp_server_name, type, configs, default_config }` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `mcp_server_name: string` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `configs: optional array of BetaManagedAgentsMCPToolConfigParams` + + Per-tool configuration overrides. + + - `name: string` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled: optional boolean` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: optional BetaManagedAgentsMCPToolsetDefaultConfigParams` + + Default configuration for all tools from an MCP server. + + - `enabled: optional boolean` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Model + +- `BetaManagedAgentsModel = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + +### Beta Managed Agents Model Config + +- `BetaManagedAgentsModelConfig = object { id, speed }` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +### Beta Managed Agents Model Config Params + +- `BetaManagedAgentsModelConfigParams = object { id, speed }` + + An object that defines additional configuration control over model use + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +### Beta Managed Agents Skill Params + +- `BetaManagedAgentsSkillParams = BetaManagedAgentsAnthropicSkillParams or BetaManagedAgentsCustomSkillParams` + + Skill to load in the session container. + + - `BetaManagedAgentsAnthropicSkillParams = object { skill_id, type, version }` + + An Anthropic-managed skill. + + - `skill_id: string` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: optional string` + + Version to pin. Defaults to latest if omitted. + + - `BetaManagedAgentsCustomSkillParams = object { skill_id, type, version }` + + A user-created custom skill. + + - `skill_id: string` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: "custom"` + + - `"custom"` + + - `version: optional string` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents URL MCP Server Params + +- `BetaManagedAgentsURLMCPServerParams = object { name, type, url }` + + URL-based MCP server connection. + + - `name: string` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `type: "url"` + + - `"url"` + + - `url: string` + + Endpoint URL for the MCP server. + +# Versions + +## List + +**get** `/v1/agents/{agent_id}/versions` + +List Agent Versions + +### Path Parameters + +- `agent_id: string` + +### Query Parameters + +- `limit: optional number` + + Maximum results per page. Default 20, maximum 100. + +- `page: optional string` + + Opaque pagination cursor. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `data: optional array of BetaManagedAgentsAgent` + + Agent versions. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +- `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```http +curl https://api.anthropic.com/v1/agents/$AGENT_ID/versions \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` diff --git a/content/en/api/beta/agents/archive.md b/content/en/api/beta/agents/archive.md new file mode 100644 index 000000000..6ec30b465 --- /dev/null +++ b/content/en/api/beta/agents/archive.md @@ -0,0 +1,369 @@ +## Archive + +**post** `/v1/agents/{agent_id}/archive` + +Archive Agent + +### Path Parameters + +- `agent_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsAgent = object { id, archived_at, created_at, 11 more }` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```http +curl https://api.anthropic.com/v1/agents/$AGENT_ID/archive \ + -X POST \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` diff --git a/content/en/api/beta/agents/create.md b/content/en/api/beta/agents/create.md new file mode 100644 index 000000000..99baefc92 --- /dev/null +++ b/content/en/api/beta/agents/create.md @@ -0,0 +1,741 @@ +## Create + +**post** `/v1/agents` + +Create Agent + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `model: BetaManagedAgentsModel or BetaManagedAgentsModelConfigParams` + + Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control + + - `BetaManagedAgentsModel = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `BetaManagedAgentsModelConfigParams = object { id, speed }` + + An object that defines additional configuration control over model use + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +- `name: string` + + Human-readable name for the agent. 1-256 characters. + +- `description: optional string` + + Description of what the agent does. Up to 2048 characters. + +- `mcp_servers: optional array of BetaManagedAgentsURLMCPServerParams` + + MCP servers this agent connects to. Maximum 20. Names must be unique within the array. + + - `name: string` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `type: "url"` + + - `"url"` + + - `url: string` + + Endpoint URL for the MCP server. + +- `metadata: optional map[string]` + + Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars. + +- `skills: optional array of BetaManagedAgentsSkillParams` + + Skills available to the agent. Maximum 20. + + - `BetaManagedAgentsAnthropicSkillParams = object { skill_id, type, version }` + + An Anthropic-managed skill. + + - `skill_id: string` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: optional string` + + Version to pin. Defaults to latest if omitted. + + - `BetaManagedAgentsCustomSkillParams = object { skill_id, type, version }` + + A user-created custom skill. + + - `skill_id: string` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: "custom"` + + - `"custom"` + + - `version: optional string` + + Version to pin. Defaults to latest if omitted. + +- `system: optional string` + + System prompt for the agent. Up to 100,000 characters. + +- `tools: optional array of BetaManagedAgentsAgentToolset20260401Params or BetaManagedAgentsMCPToolsetParams or BetaManagedAgentsCustomToolParams` + + Tool configurations available to the agent. Maximum of 128 tools across all toolsets allowed. + + - `BetaManagedAgentsAgentToolset20260401Params = object { type, configs, default_config }` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `configs: optional array of BetaManagedAgentsAgentToolConfigParams` + + Per-tool configuration overrides. + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled: optional boolean` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: optional BetaManagedAgentsAgentToolsetDefaultConfigParams` + + Default configuration for all tools in a toolset. + + - `enabled: optional boolean` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `BetaManagedAgentsMCPToolsetParams = object { mcp_server_name, type, configs, default_config }` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `mcp_server_name: string` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `configs: optional array of BetaManagedAgentsMCPToolConfigParams` + + Per-tool configuration overrides. + + - `name: string` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled: optional boolean` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: optional BetaManagedAgentsMCPToolsetDefaultConfigParams` + + Default configuration for all tools from an MCP server. + + - `enabled: optional boolean` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `BetaManagedAgentsCustomToolParams = object { description, input_schema, name, type }` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: string` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: "custom"` + + - `"custom"` + +### Returns + +- `BetaManagedAgentsAgent = object { id, archived_at, created_at, 11 more }` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```http +curl https://api.anthropic.com/v1/agents \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "model": "claude-sonnet-4-6", + "name": "My First Agent" + }' +``` diff --git a/content/en/api/beta/agents/list.md b/content/en/api/beta/agents/list.md new file mode 100644 index 000000000..fa653c48b --- /dev/null +++ b/content/en/api/beta/agents/list.md @@ -0,0 +1,390 @@ +## List + +**get** `/v1/agents` + +List Agents + +### Query Parameters + +- `"created_at[gte]": optional string` + + Return agents created at or after this time (inclusive). + +- `"created_at[lte]": optional string` + + Return agents created at or before this time (inclusive). + +- `include_archived: optional boolean` + + Include archived agents in results. Defaults to false. + +- `limit: optional number` + + Maximum results per page. Default 20, maximum 100. + +- `page: optional string` + + Opaque pagination cursor from a previous response. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `data: optional array of BetaManagedAgentsAgent` + + List of agents. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +- `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```http +curl https://api.anthropic.com/v1/agents \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` diff --git a/content/en/api/beta/agents/retrieve.md b/content/en/api/beta/agents/retrieve.md new file mode 100644 index 000000000..e256d4ff9 --- /dev/null +++ b/content/en/api/beta/agents/retrieve.md @@ -0,0 +1,374 @@ +## Retrieve + +**get** `/v1/agents/{agent_id}` + +Get Agent + +### Path Parameters + +- `agent_id: string` + +### Query Parameters + +- `version: optional number` + + Agent version. Omit for the most recent version. Must be at least 1 if specified. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsAgent = object { id, archived_at, created_at, 11 more }` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```http +curl https://api.anthropic.com/v1/agents/$AGENT_ID \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` diff --git a/content/en/api/beta/agents/update.md b/content/en/api/beta/agents/update.md new file mode 100644 index 000000000..7b46129a5 --- /dev/null +++ b/content/en/api/beta/agents/update.md @@ -0,0 +1,748 @@ +## Update + +**post** `/v1/agents/{agent_id}` + +Update Agent + +### Path Parameters + +- `agent_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `version: number` + + The agent's current version, used to prevent concurrent overwrites. Obtain this value from a create or retrieve response. The request fails if this does not match the server's current version. + +- `description: optional string` + + Description. Up to 2048 characters. Omit to preserve; send empty string or null to clear. + +- `mcp_servers: optional array of BetaManagedAgentsURLMCPServerParams` + + MCP servers. Full replacement. Omit to preserve; send empty array or null to clear. Names must be unique. Maximum 20. + + - `name: string` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `type: "url"` + + - `"url"` + + - `url: string` + + Endpoint URL for the MCP server. + +- `metadata: optional map[string]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. The stored bag is limited to 16 keys (up to 64 chars each) with values up to 512 chars. + +- `model: optional BetaManagedAgentsModel or BetaManagedAgentsModelConfigParams` + + Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control. Omit to preserve. Cannot be cleared. + + - `BetaManagedAgentsModel = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `BetaManagedAgentsModelConfigParams = object { id, speed }` + + An object that defines additional configuration control over model use + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +- `name: optional string` + + Human-readable name. 1-256 characters. Omit to preserve. Cannot be cleared. + +- `skills: optional array of BetaManagedAgentsSkillParams` + + Skills. Full replacement. Omit to preserve; send empty array or null to clear. Maximum 20. + + - `BetaManagedAgentsAnthropicSkillParams = object { skill_id, type, version }` + + An Anthropic-managed skill. + + - `skill_id: string` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: optional string` + + Version to pin. Defaults to latest if omitted. + + - `BetaManagedAgentsCustomSkillParams = object { skill_id, type, version }` + + A user-created custom skill. + + - `skill_id: string` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: "custom"` + + - `"custom"` + + - `version: optional string` + + Version to pin. Defaults to latest if omitted. + +- `system: optional string` + + System prompt. Up to 100,000 characters. Omit to preserve; send empty string or null to clear. + +- `tools: optional array of BetaManagedAgentsAgentToolset20260401Params or BetaManagedAgentsMCPToolsetParams or BetaManagedAgentsCustomToolParams` + + Tool configurations available to the agent. Full replacement. Omit to preserve; send empty array or null to clear. Maximum of 128 tools across all toolsets allowed. + + - `BetaManagedAgentsAgentToolset20260401Params = object { type, configs, default_config }` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `configs: optional array of BetaManagedAgentsAgentToolConfigParams` + + Per-tool configuration overrides. + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled: optional boolean` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: optional BetaManagedAgentsAgentToolsetDefaultConfigParams` + + Default configuration for all tools in a toolset. + + - `enabled: optional boolean` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `BetaManagedAgentsMCPToolsetParams = object { mcp_server_name, type, configs, default_config }` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `mcp_server_name: string` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `configs: optional array of BetaManagedAgentsMCPToolConfigParams` + + Per-tool configuration overrides. + + - `name: string` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled: optional boolean` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: optional BetaManagedAgentsMCPToolsetDefaultConfigParams` + + Default configuration for all tools from an MCP server. + + - `enabled: optional boolean` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `BetaManagedAgentsCustomToolParams = object { description, input_schema, name, type }` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: string` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: "custom"` + + - `"custom"` + +### Returns + +- `BetaManagedAgentsAgent = object { id, archived_at, created_at, 11 more }` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```http +curl https://api.anthropic.com/v1/agents/$AGENT_ID \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "version": 1 + }' +``` diff --git a/content/en/api/beta/agents/versions.md b/content/en/api/beta/agents/versions.md new file mode 100644 index 000000000..5415ec41c --- /dev/null +++ b/content/en/api/beta/agents/versions.md @@ -0,0 +1,384 @@ +# Versions + +## List + +**get** `/v1/agents/{agent_id}/versions` + +List Agent Versions + +### Path Parameters + +- `agent_id: string` + +### Query Parameters + +- `limit: optional number` + + Maximum results per page. Default 20, maximum 100. + +- `page: optional string` + + Opaque pagination cursor. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `data: optional array of BetaManagedAgentsAgent` + + Agent versions. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +- `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```http +curl https://api.anthropic.com/v1/agents/$AGENT_ID/versions \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` diff --git a/content/en/api/beta/agents/versions/list.md b/content/en/api/beta/agents/versions/list.md new file mode 100644 index 000000000..0a5bfa87e --- /dev/null +++ b/content/en/api/beta/agents/versions/list.md @@ -0,0 +1,382 @@ +## List + +**get** `/v1/agents/{agent_id}/versions` + +List Agent Versions + +### Path Parameters + +- `agent_id: string` + +### Query Parameters + +- `limit: optional number` + + Maximum results per page. Default 20, maximum 100. + +- `page: optional string` + + Opaque pagination cursor. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `data: optional array of BetaManagedAgentsAgent` + + Agent versions. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +- `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```http +curl https://api.anthropic.com/v1/agents/$AGENT_ID/versions \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` diff --git a/content/en/api/beta/environments.md b/content/en/api/beta/environments.md new file mode 100644 index 000000000..0925f4650 --- /dev/null +++ b/content/en/api/beta/environments.md @@ -0,0 +1,1769 @@ +# Environments + +## Create + +**post** `/v1/environments` + +Create a new environment with the specified configuration. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Cookie Parameters + +- `sessionKey: optional string` + +### Body Parameters + +- `name: string` + + Human-readable name for the environment + +- `config: optional BetaCloudConfigParams` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `networking: optional BetaUnrestrictedNetwork or BetaLimitedNetworkParams` + + Network configuration policy. Omit on update to preserve the existing value. + + - `BetaUnrestrictedNetwork = object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetworkParams = object { type, allow_mcp_servers, allow_package_managers, allowed_hosts }` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `allow_mcp_servers: optional boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: optional boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: optional array of string` + + Specifies domains the container can reach. + + - `packages: optional BetaPackagesParams` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: optional array of string` + + Ubuntu/Debian packages to install + + - `cargo: optional array of string` + + Rust packages to install + + - `gem: optional array of string` + + Ruby packages to install + + - `go: optional array of string` + + Go packages to install + + - `npm: optional array of string` + + Node.js packages to install + + - `pip: optional array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + +- `description: optional string` + + Optional description of the environment + +- `metadata: optional map[string]` + + User-provided metadata key-value pairs + +### Returns + +- `BetaEnvironment = object { id, archived_at, config, 6 more }` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork = object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork = object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```http +curl https://api.anthropic.com/v1/environments \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "name": "python-data-analysis", + "config": { + "type": "cloud", + "networking": { + "type": "limited", + "allow_package_managers": true, + "allowed_hosts": [ + "api.example.com" + ] + }, + "packages": { + "pip": [ + "pandas", + "numpy" + ] + } + } + }' +``` + +## List + +**get** `/v1/environments` + +List environments with pagination support. + +### Query Parameters + +- `include_archived: optional boolean` + + Include archived environments in the response + +- `limit: optional number` + + Maximum number of environments to return + +- `page: optional string` + + Opaque cursor from previous response for pagination. Pass the `next_page` value from the previous response. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Cookie Parameters + +- `sessionKey: optional string` + +### Returns + +- `data: array of BetaEnvironment` + + List of environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork = object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork = object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +- `next_page: string` + + Token for fetching the next page of results. If `null`, there are no more results available. Pass this value to the `page` parameter in the next request. + +### Example + +```http +curl https://api.anthropic.com/v1/environments \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Retrieve + +**get** `/v1/environments/{environment_id}` + +Retrieve a specific environment by ID. + +### Path Parameters + +- `environment_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Cookie Parameters + +- `sessionKey: optional string` + +### Returns + +- `BetaEnvironment = object { id, archived_at, config, 6 more }` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork = object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork = object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```http +curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Update + +**post** `/v1/environments/{environment_id}` + +Update an existing environment's configuration. + +### Path Parameters + +- `environment_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Cookie Parameters + +- `sessionKey: optional string` + +### Body Parameters + +- `config: optional BetaCloudConfigParams` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `networking: optional BetaUnrestrictedNetwork or BetaLimitedNetworkParams` + + Network configuration policy. Omit on update to preserve the existing value. + + - `BetaUnrestrictedNetwork = object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetworkParams = object { type, allow_mcp_servers, allow_package_managers, allowed_hosts }` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `allow_mcp_servers: optional boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: optional boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: optional array of string` + + Specifies domains the container can reach. + + - `packages: optional BetaPackagesParams` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: optional array of string` + + Ubuntu/Debian packages to install + + - `cargo: optional array of string` + + Rust packages to install + + - `gem: optional array of string` + + Ruby packages to install + + - `go: optional array of string` + + Go packages to install + + - `npm: optional array of string` + + Node.js packages to install + + - `pip: optional array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + +- `description: optional string` + + Updated description of the environment + +- `metadata: optional map[string]` + + User-provided metadata key-value pairs. Set a value to null or empty string to delete the key. + +- `name: optional string` + + Updated name for the environment + +### Returns + +- `BetaEnvironment = object { id, archived_at, config, 6 more }` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork = object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork = object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```http +curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "config": { + "type": "cloud", + "networking": { + "type": "limited", + "allow_package_managers": true, + "allowed_hosts": [ + "api.example.com" + ] + }, + "packages": { + "pip": [ + "pandas", + "numpy" + ] + } + } + }' +``` + +## Delete + +**delete** `/v1/environments/{environment_id}` + +Delete an environment by ID. Returns a confirmation of the deletion. + +### Path Parameters + +- `environment_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Cookie Parameters + +- `sessionKey: optional string` + +### Returns + +- `BetaEnvironmentDeleteResponse = object { id, type }` + + Response after deleting an environment. + + - `id: string` + + Environment identifier + + - `type: "environment_deleted"` + + The type of response + + - `"environment_deleted"` + +### Example + +```http +curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID \ + -X DELETE \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Archive + +**post** `/v1/environments/{environment_id}/archive` + +Archive an environment by ID. Archived environments cannot be used to create new sessions. + +### Path Parameters + +- `environment_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Cookie Parameters + +- `sessionKey: optional string` + +### Returns + +- `BetaEnvironment = object { id, archived_at, config, 6 more }` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork = object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork = object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```http +curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID/archive \ + -X POST \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Domain Types + +### Beta Cloud Config + +- `BetaCloudConfig = object { networking, packages, type }` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork = object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork = object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + +### Beta Cloud Config Params + +- `BetaCloudConfigParams = object { type, networking, packages }` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `networking: optional BetaUnrestrictedNetwork or BetaLimitedNetworkParams` + + Network configuration policy. Omit on update to preserve the existing value. + + - `BetaUnrestrictedNetwork = object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetworkParams = object { type, allow_mcp_servers, allow_package_managers, allowed_hosts }` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `allow_mcp_servers: optional boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: optional boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: optional array of string` + + Specifies domains the container can reach. + + - `packages: optional BetaPackagesParams` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: optional array of string` + + Ubuntu/Debian packages to install + + - `cargo: optional array of string` + + Rust packages to install + + - `gem: optional array of string` + + Ruby packages to install + + - `go: optional array of string` + + Go packages to install + + - `npm: optional array of string` + + Node.js packages to install + + - `pip: optional array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + +### Beta Environment + +- `BetaEnvironment = object { id, archived_at, config, 6 more }` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork = object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork = object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Beta Environment Delete Response + +- `BetaEnvironmentDeleteResponse = object { id, type }` + + Response after deleting an environment. + + - `id: string` + + Environment identifier + + - `type: "environment_deleted"` + + The type of response + + - `"environment_deleted"` + +### Beta Limited Network + +- `BetaLimitedNetwork = object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + +### Beta Limited Network Params + +- `BetaLimitedNetworkParams = object { type, allow_mcp_servers, allow_package_managers, allowed_hosts }` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `allow_mcp_servers: optional boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: optional boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: optional array of string` + + Specifies domains the container can reach. + +### Beta Packages + +- `BetaPackages = object { apt, cargo, gem, 4 more }` + + Packages (and their versions) available in this environment. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + +### Beta Packages Params + +- `BetaPackagesParams = object { apt, cargo, gem, 4 more }` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: optional array of string` + + Ubuntu/Debian packages to install + + - `cargo: optional array of string` + + Rust packages to install + + - `gem: optional array of string` + + Ruby packages to install + + - `go: optional array of string` + + Go packages to install + + - `npm: optional array of string` + + Node.js packages to install + + - `pip: optional array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + +### Beta Unrestricted Network + +- `BetaUnrestrictedNetwork = object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` diff --git a/content/en/api/beta/environments/archive.md b/content/en/api/beta/environments/archive.md new file mode 100644 index 000000000..82258aca5 --- /dev/null +++ b/content/en/api/beta/environments/archive.md @@ -0,0 +1,195 @@ +## Archive + +**post** `/v1/environments/{environment_id}/archive` + +Archive an environment by ID. Archived environments cannot be used to create new sessions. + +### Path Parameters + +- `environment_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Cookie Parameters + +- `sessionKey: optional string` + +### Returns + +- `BetaEnvironment = object { id, archived_at, config, 6 more }` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork = object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork = object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```http +curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID/archive \ + -X POST \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` diff --git a/content/en/api/beta/environments/create.md b/content/en/api/beta/environments/create.md new file mode 100644 index 000000000..2d3b50530 --- /dev/null +++ b/content/en/api/beta/environments/create.md @@ -0,0 +1,312 @@ +## Create + +**post** `/v1/environments` + +Create a new environment with the specified configuration. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Cookie Parameters + +- `sessionKey: optional string` + +### Body Parameters + +- `name: string` + + Human-readable name for the environment + +- `config: optional BetaCloudConfigParams` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `networking: optional BetaUnrestrictedNetwork or BetaLimitedNetworkParams` + + Network configuration policy. Omit on update to preserve the existing value. + + - `BetaUnrestrictedNetwork = object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetworkParams = object { type, allow_mcp_servers, allow_package_managers, allowed_hosts }` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `allow_mcp_servers: optional boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: optional boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: optional array of string` + + Specifies domains the container can reach. + + - `packages: optional BetaPackagesParams` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: optional array of string` + + Ubuntu/Debian packages to install + + - `cargo: optional array of string` + + Rust packages to install + + - `gem: optional array of string` + + Ruby packages to install + + - `go: optional array of string` + + Go packages to install + + - `npm: optional array of string` + + Node.js packages to install + + - `pip: optional array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + +- `description: optional string` + + Optional description of the environment + +- `metadata: optional map[string]` + + User-provided metadata key-value pairs + +### Returns + +- `BetaEnvironment = object { id, archived_at, config, 6 more }` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork = object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork = object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```http +curl https://api.anthropic.com/v1/environments \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "name": "python-data-analysis", + "config": { + "type": "cloud", + "networking": { + "type": "limited", + "allow_package_managers": true, + "allowed_hosts": [ + "api.example.com" + ] + }, + "packages": { + "pip": [ + "pandas", + "numpy" + ] + } + } + }' +``` diff --git a/content/en/api/beta/environments/delete.md b/content/en/api/beta/environments/delete.md new file mode 100644 index 000000000..cf22d1f4b --- /dev/null +++ b/content/en/api/beta/environments/delete.md @@ -0,0 +1,91 @@ +## Delete + +**delete** `/v1/environments/{environment_id}` + +Delete an environment by ID. Returns a confirmation of the deletion. + +### Path Parameters + +- `environment_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Cookie Parameters + +- `sessionKey: optional string` + +### Returns + +- `BetaEnvironmentDeleteResponse = object { id, type }` + + Response after deleting an environment. + + - `id: string` + + Environment identifier + + - `type: "environment_deleted"` + + The type of response + + - `"environment_deleted"` + +### Example + +```http +curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID \ + -X DELETE \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` diff --git a/content/en/api/beta/environments/list.md b/content/en/api/beta/environments/list.md new file mode 100644 index 000000000..207f67384 --- /dev/null +++ b/content/en/api/beta/environments/list.md @@ -0,0 +1,208 @@ +## List + +**get** `/v1/environments` + +List environments with pagination support. + +### Query Parameters + +- `include_archived: optional boolean` + + Include archived environments in the response + +- `limit: optional number` + + Maximum number of environments to return + +- `page: optional string` + + Opaque cursor from previous response for pagination. Pass the `next_page` value from the previous response. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Cookie Parameters + +- `sessionKey: optional string` + +### Returns + +- `data: array of BetaEnvironment` + + List of environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork = object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork = object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +- `next_page: string` + + Token for fetching the next page of results. If `null`, there are no more results available. Pass this value to the `page` parameter in the next request. + +### Example + +```http +curl https://api.anthropic.com/v1/environments \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` diff --git a/content/en/api/beta/environments/retrieve.md b/content/en/api/beta/environments/retrieve.md new file mode 100644 index 000000000..90e871208 --- /dev/null +++ b/content/en/api/beta/environments/retrieve.md @@ -0,0 +1,194 @@ +## Retrieve + +**get** `/v1/environments/{environment_id}` + +Retrieve a specific environment by ID. + +### Path Parameters + +- `environment_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Cookie Parameters + +- `sessionKey: optional string` + +### Returns + +- `BetaEnvironment = object { id, archived_at, config, 6 more }` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork = object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork = object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```http +curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` diff --git a/content/en/api/beta/environments/update.md b/content/en/api/beta/environments/update.md new file mode 100644 index 000000000..0542ea35a --- /dev/null +++ b/content/en/api/beta/environments/update.md @@ -0,0 +1,315 @@ +## Update + +**post** `/v1/environments/{environment_id}` + +Update an existing environment's configuration. + +### Path Parameters + +- `environment_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Cookie Parameters + +- `sessionKey: optional string` + +### Body Parameters + +- `config: optional BetaCloudConfigParams` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `networking: optional BetaUnrestrictedNetwork or BetaLimitedNetworkParams` + + Network configuration policy. Omit on update to preserve the existing value. + + - `BetaUnrestrictedNetwork = object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetworkParams = object { type, allow_mcp_servers, allow_package_managers, allowed_hosts }` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `allow_mcp_servers: optional boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: optional boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: optional array of string` + + Specifies domains the container can reach. + + - `packages: optional BetaPackagesParams` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: optional array of string` + + Ubuntu/Debian packages to install + + - `cargo: optional array of string` + + Rust packages to install + + - `gem: optional array of string` + + Ruby packages to install + + - `go: optional array of string` + + Go packages to install + + - `npm: optional array of string` + + Node.js packages to install + + - `pip: optional array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + +- `description: optional string` + + Updated description of the environment + +- `metadata: optional map[string]` + + User-provided metadata key-value pairs. Set a value to null or empty string to delete the key. + +- `name: optional string` + + Updated name for the environment + +### Returns + +- `BetaEnvironment = object { id, archived_at, config, 6 more }` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork = object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork = object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```http +curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "config": { + "type": "cloud", + "networking": { + "type": "limited", + "allow_package_managers": true, + "allowed_hosts": [ + "api.example.com" + ] + }, + "packages": { + "pip": [ + "pandas", + "numpy" + ] + } + } + }' +``` diff --git a/content/en/api/beta/files.md b/content/en/api/beta/files.md index cd40bc85b..0c58eb9e4 100644 --- a/content/en/api/beta/files.md +++ b/content/en/api/beta/files.md @@ -14,7 +14,7 @@ Upload File - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -58,11 +58,9 @@ Upload File - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns -- `FileMetadata = object { id, created_at, filename, 4 more }` +- `FileMetadata = object { id, created_at, filename, 5 more }` - `id: string` @@ -98,6 +96,20 @@ Upload File Whether the file can be downloaded. + - `scope: optional BetaFileScope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + + - `"session"` + ### Example ```http @@ -131,6 +143,10 @@ List Files Defaults to `20`. Ranges from `1` to `1000`. +- `scope_id: optional string` + + Filter by scope ID. Only returns files associated with the specified scope (e.g., a session ID). + ### Header Parameters - `"anthropic-beta": optional array of AnthropicBeta` @@ -139,7 +155,7 @@ List Files - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -183,8 +199,6 @@ List Files - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `data: array of FileMetadata` @@ -225,6 +239,20 @@ List Files Whether the file can be downloaded. + - `scope: optional BetaFileScope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + + - `"session"` + - `first_id: optional string` ID of the first file in this page of results. @@ -266,7 +294,7 @@ Download File - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -310,8 +338,6 @@ Download File - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Example ```http @@ -341,7 +367,7 @@ Get File Metadata - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -385,11 +411,9 @@ Get File Metadata - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns -- `FileMetadata = object { id, created_at, filename, 4 more }` +- `FileMetadata = object { id, created_at, filename, 5 more }` - `id: string` @@ -425,6 +449,20 @@ Get File Metadata Whether the file can be downloaded. + - `scope: optional BetaFileScope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + + - `"session"` + ### Example ```http @@ -454,7 +492,7 @@ Delete File - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -498,8 +536,6 @@ Delete File - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `DeletedFile = object { id, type }` @@ -528,6 +564,20 @@ curl https://api.anthropic.com/v1/files/$FILE_ID \ ## Domain Types +### Beta File Scope + +- `BetaFileScope = object { id, type }` + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + + - `"session"` + ### Deleted File - `DeletedFile = object { id, type }` @@ -546,7 +596,7 @@ curl https://api.anthropic.com/v1/files/$FILE_ID \ ### File Metadata -- `FileMetadata = object { id, created_at, filename, 4 more }` +- `FileMetadata = object { id, created_at, filename, 5 more }` - `id: string` @@ -581,3 +631,17 @@ curl https://api.anthropic.com/v1/files/$FILE_ID \ - `downloadable: optional boolean` Whether the file can be downloaded. + + - `scope: optional BetaFileScope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + + - `"session"` diff --git a/content/en/api/beta/files/delete.md b/content/en/api/beta/files/delete.md index 7009deee2..90d03544b 100644 --- a/content/en/api/beta/files/delete.md +++ b/content/en/api/beta/files/delete.md @@ -18,7 +18,7 @@ Delete File - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -62,8 +62,6 @@ Delete File - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `DeletedFile = object { id, type }` diff --git a/content/en/api/beta/files/download.md b/content/en/api/beta/files/download.md index 8d1164776..0e7a01d9e 100644 --- a/content/en/api/beta/files/download.md +++ b/content/en/api/beta/files/download.md @@ -18,7 +18,7 @@ Download File - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -62,8 +62,6 @@ Download File - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Example ```http diff --git a/content/en/api/beta/files/list.md b/content/en/api/beta/files/list.md index 8668a0ba0..089a26859 100644 --- a/content/en/api/beta/files/list.md +++ b/content/en/api/beta/files/list.md @@ -20,6 +20,10 @@ List Files Defaults to `20`. Ranges from `1` to `1000`. +- `scope_id: optional string` + + Filter by scope ID. Only returns files associated with the specified scope (e.g., a session ID). + ### Header Parameters - `"anthropic-beta": optional array of AnthropicBeta` @@ -28,7 +32,7 @@ List Files - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -72,8 +76,6 @@ List Files - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `data: array of FileMetadata` @@ -114,6 +116,20 @@ List Files Whether the file can be downloaded. + - `scope: optional BetaFileScope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + + - `"session"` + - `first_id: optional string` ID of the first file in this page of results. diff --git a/content/en/api/beta/files/retrieve_metadata.md b/content/en/api/beta/files/retrieve_metadata.md index 2172981e2..eecc8ac55 100644 --- a/content/en/api/beta/files/retrieve_metadata.md +++ b/content/en/api/beta/files/retrieve_metadata.md @@ -18,7 +18,7 @@ Get File Metadata - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -62,11 +62,9 @@ Get File Metadata - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns -- `FileMetadata = object { id, created_at, filename, 4 more }` +- `FileMetadata = object { id, created_at, filename, 5 more }` - `id: string` @@ -102,6 +100,20 @@ Get File Metadata Whether the file can be downloaded. + - `scope: optional BetaFileScope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + + - `"session"` + ### Example ```http diff --git a/content/en/api/beta/files/upload.md b/content/en/api/beta/files/upload.md index 47b2d0fc5..fe485bb97 100644 --- a/content/en/api/beta/files/upload.md +++ b/content/en/api/beta/files/upload.md @@ -12,7 +12,7 @@ Upload File - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -56,11 +56,9 @@ Upload File - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns -- `FileMetadata = object { id, created_at, filename, 4 more }` +- `FileMetadata = object { id, created_at, filename, 5 more }` - `id: string` @@ -96,6 +94,20 @@ Upload File Whether the file can be downloaded. + - `scope: optional BetaFileScope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + + - `"session"` + ### Example ```http diff --git a/content/en/api/beta/messages.md b/content/en/api/beta/messages.md index b01a5b1ef..26133cd09 100644 --- a/content/en/api/beta/messages.md +++ b/content/en/api/beta/messages.md @@ -18,7 +18,7 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -62,8 +62,6 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Body Parameters - `max_tokens: number` @@ -2651,15 +2649,19 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -4728,10 +4730,6 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en Recommended for advanced use cases only. You usually only need to use `temperature`. -- `user_profile_id: optional string` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - ### Returns - `BetaMessage = object { id, container, content, 8 more }` @@ -5655,15 +5653,19 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -5998,7 +6000,7 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -6042,8 +6044,6 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Body Parameters - `messages: array of BetaMessageParam` @@ -8623,15 +8623,19 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -10634,7 +10638,7 @@ curl https://api.anthropic.com/v1/messages/count_tokens \ "role": "user" } ], - "model": "claude-opus-4-6" + "model": "claude-mythos-preview" }' ``` @@ -17823,15 +17827,19 @@ curl https://api.anthropic.com/v1/messages/count_tokens \ See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -23167,15 +23175,19 @@ curl https://api.anthropic.com/v1/messages/count_tokens \ See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -24411,15 +24423,19 @@ curl https://api.anthropic.com/v1/messages/count_tokens \ See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -32954,7 +32970,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -32998,8 +33014,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Body Parameters - `requests: array of object { custom_id, params }` @@ -33012,7 +33026,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Must be unique for each request within the Message Batch. - - `params: object { max_tokens, messages, model, 20 more }` + - `params: object { max_tokens, messages, model, 19 more }` Messages API creation parameters for the individual request. @@ -35603,15 +35617,19 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -37680,10 +37698,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Recommended for advanced use cases only. You usually only need to use `temperature`. - - `user_profile_id: optional string` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - ### Returns - `BetaMessageBatch = object { id, archived_at, cancel_initiated_at, 7 more }` @@ -37823,7 +37837,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -37867,8 +37881,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaMessageBatch = object { id, archived_at, cancel_initiated_at, 7 more }` @@ -38000,7 +38012,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -38044,8 +38056,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `data: array of BetaMessageBatch` @@ -38181,7 +38191,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -38225,8 +38235,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaMessageBatch = object { id, archived_at, cancel_initiated_at, 7 more }` @@ -38351,7 +38359,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -38395,8 +38403,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaDeletedMessageBatch = object { id, type }` @@ -38447,7 +38453,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -38491,8 +38497,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaMessageBatchIndividualResponse = object { custom_id, result }` @@ -39434,15 +39438,19 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -41007,15 +41015,19 @@ curl https://api.anthropic.com/v1/messages/batches/$MESSAGE_BATCH_ID/results \ See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -42379,15 +42391,19 @@ curl https://api.anthropic.com/v1/messages/batches/$MESSAGE_BATCH_ID/results \ See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -43713,15 +43729,19 @@ curl https://api.anthropic.com/v1/messages/batches/$MESSAGE_BATCH_ID/results \ See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` diff --git a/content/en/api/beta/messages/batches.md b/content/en/api/beta/messages/batches.md index 1e6c99d13..8ed89d12d 100644 --- a/content/en/api/beta/messages/batches.md +++ b/content/en/api/beta/messages/batches.md @@ -18,7 +18,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -62,8 +62,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Body Parameters - `requests: array of object { custom_id, params }` @@ -76,7 +74,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Must be unique for each request within the Message Batch. - - `params: object { max_tokens, messages, model, 20 more }` + - `params: object { max_tokens, messages, model, 19 more }` Messages API creation parameters for the individual request. @@ -2667,15 +2665,19 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -4744,10 +4746,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Recommended for advanced use cases only. You usually only need to use `temperature`. - - `user_profile_id: optional string` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - ### Returns - `BetaMessageBatch = object { id, archived_at, cancel_initiated_at, 7 more }` @@ -4887,7 +4885,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -4931,8 +4929,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaMessageBatch = object { id, archived_at, cancel_initiated_at, 7 more }` @@ -5064,7 +5060,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -5108,8 +5104,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `data: array of BetaMessageBatch` @@ -5245,7 +5239,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -5289,8 +5283,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaMessageBatch = object { id, archived_at, cancel_initiated_at, 7 more }` @@ -5415,7 +5407,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -5459,8 +5451,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaDeletedMessageBatch = object { id, type }` @@ -5511,7 +5501,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -5555,8 +5545,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaMessageBatchIndividualResponse = object { custom_id, result }` @@ -6498,15 +6486,19 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -8071,15 +8063,19 @@ curl https://api.anthropic.com/v1/messages/batches/$MESSAGE_BATCH_ID/results \ See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -9443,15 +9439,19 @@ curl https://api.anthropic.com/v1/messages/batches/$MESSAGE_BATCH_ID/results \ See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -10777,15 +10777,19 @@ curl https://api.anthropic.com/v1/messages/batches/$MESSAGE_BATCH_ID/results \ See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` diff --git a/content/en/api/beta/messages/batches/cancel.md b/content/en/api/beta/messages/batches/cancel.md index b637d8c84..a554bb738 100644 --- a/content/en/api/beta/messages/batches/cancel.md +++ b/content/en/api/beta/messages/batches/cancel.md @@ -22,7 +22,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -66,8 +66,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaMessageBatch = object { id, archived_at, cancel_initiated_at, 7 more }` diff --git a/content/en/api/beta/messages/batches/create.md b/content/en/api/beta/messages/batches/create.md index 60945a961..87d0f4794 100644 --- a/content/en/api/beta/messages/batches/create.md +++ b/content/en/api/beta/messages/batches/create.md @@ -16,7 +16,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -60,8 +60,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Body Parameters - `requests: array of object { custom_id, params }` @@ -74,7 +72,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Must be unique for each request within the Message Batch. - - `params: object { max_tokens, messages, model, 20 more }` + - `params: object { max_tokens, messages, model, 19 more }` Messages API creation parameters for the individual request. @@ -2665,15 +2663,19 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -4742,10 +4744,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Recommended for advanced use cases only. You usually only need to use `temperature`. - - `user_profile_id: optional string` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - ### Returns - `BetaMessageBatch = object { id, archived_at, cancel_initiated_at, 7 more }` diff --git a/content/en/api/beta/messages/batches/delete.md b/content/en/api/beta/messages/batches/delete.md index b2a0e521a..121ee3398 100644 --- a/content/en/api/beta/messages/batches/delete.md +++ b/content/en/api/beta/messages/batches/delete.md @@ -22,7 +22,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -66,8 +66,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaDeletedMessageBatch = object { id, type }` diff --git a/content/en/api/beta/messages/batches/list.md b/content/en/api/beta/messages/batches/list.md index 602d870bd..227f1c2ca 100644 --- a/content/en/api/beta/messages/batches/list.md +++ b/content/en/api/beta/messages/batches/list.md @@ -30,7 +30,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -74,8 +74,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `data: array of BetaMessageBatch` diff --git a/content/en/api/beta/messages/batches/results.md b/content/en/api/beta/messages/batches/results.md index fff5b6b91..c46b3e8ac 100644 --- a/content/en/api/beta/messages/batches/results.md +++ b/content/en/api/beta/messages/batches/results.md @@ -22,7 +22,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -66,8 +66,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaMessageBatchIndividualResponse = object { custom_id, result }` @@ -1009,15 +1007,19 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` diff --git a/content/en/api/beta/messages/batches/retrieve.md b/content/en/api/beta/messages/batches/retrieve.md index e90385f83..02fb8b625 100644 --- a/content/en/api/beta/messages/batches/retrieve.md +++ b/content/en/api/beta/messages/batches/retrieve.md @@ -20,7 +20,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -64,8 +64,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaMessageBatch = object { id, archived_at, cancel_initiated_at, 7 more }` diff --git a/content/en/api/beta/messages/count_tokens.md b/content/en/api/beta/messages/count_tokens.md index b678e5997..070caad1d 100644 --- a/content/en/api/beta/messages/count_tokens.md +++ b/content/en/api/beta/messages/count_tokens.md @@ -16,7 +16,7 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -60,8 +60,6 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Body Parameters - `messages: array of BetaMessageParam` @@ -2641,15 +2639,19 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -4652,6 +4654,6 @@ curl https://api.anthropic.com/v1/messages/count_tokens \ "role": "user" } ], - "model": "claude-opus-4-6" + "model": "claude-mythos-preview" }' ``` diff --git a/content/en/api/beta/messages/create.md b/content/en/api/beta/messages/create.md index 412d127ef..6e3e737c1 100644 --- a/content/en/api/beta/messages/create.md +++ b/content/en/api/beta/messages/create.md @@ -16,7 +16,7 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -60,8 +60,6 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Body Parameters - `max_tokens: number` @@ -2649,15 +2647,19 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -4726,10 +4728,6 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en Recommended for advanced use cases only. You usually only need to use `temperature`. -- `user_profile_id: optional string` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - ### Returns - `BetaMessage = object { id, container, content, 8 more }` @@ -5653,15 +5651,19 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` diff --git a/content/en/api/beta/models.md b/content/en/api/beta/models.md index ddf8c392a..dffbab4af 100644 --- a/content/en/api/beta/models.md +++ b/content/en/api/beta/models.md @@ -32,7 +32,7 @@ The Models API response can be used to determine which models are available for - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -76,8 +76,6 @@ The Models API response can be used to determine which models are available for - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `data: array of BetaModelInfo` @@ -304,7 +302,7 @@ The Models API response can be used to determine information about a specific mo - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -348,8 +346,6 @@ The Models API response can be used to determine information about a specific mo - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaModelInfo = object { id, capabilities, created_at, 4 more }` diff --git a/content/en/api/beta/models/list.md b/content/en/api/beta/models/list.md index 261cff20d..6f5d6440e 100644 --- a/content/en/api/beta/models/list.md +++ b/content/en/api/beta/models/list.md @@ -30,7 +30,7 @@ The Models API response can be used to determine which models are available for - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -74,8 +74,6 @@ The Models API response can be used to determine which models are available for - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `data: array of BetaModelInfo` diff --git a/content/en/api/beta/models/retrieve.md b/content/en/api/beta/models/retrieve.md index b560585a2..89fc834e8 100644 --- a/content/en/api/beta/models/retrieve.md +++ b/content/en/api/beta/models/retrieve.md @@ -20,7 +20,7 @@ The Models API response can be used to determine information about a specific mo - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -64,8 +64,6 @@ The Models API response can be used to determine information about a specific mo - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaModelInfo = object { id, capabilities, created_at, 4 more }` diff --git a/content/en/api/beta/sessions.md b/content/en/api/beta/sessions.md new file mode 100644 index 000000000..729f33c01 --- /dev/null +++ b/content/en/api/beta/sessions.md @@ -0,0 +1,14204 @@ +# Sessions + +## Create + +**post** `/v1/sessions` + +Create Session + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `agent: string or BetaManagedAgentsAgentParams` + + Agent identifier. Accepts the `agent` ID string, which pins the latest version for the session, or an `agent` object with both id and version specified. + + - `UnionMember0 = string` + + - `BetaManagedAgentsAgentParams = object { id, type, version }` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `id: string` + + The `agent` ID. + + - `type: "agent"` + + - `"agent"` + + - `version: optional number` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + +- `environment_id: string` + + ID of the `environment` defining the container configuration for this session. + +- `metadata: optional map[string]` + + Arbitrary key-value metadata attached to the session. + +- `resources: optional array of BetaManagedAgentsGitHubRepositoryResourceParams or BetaManagedAgentsFileResourceParams` + + Resources (e.g. repositories, files) to mount into the session's container. + + - `BetaManagedAgentsGitHubRepositoryResourceParams = object { authorization_token, type, url, 2 more }` + + Mount a GitHub repository into the session's container. + + - `authorization_token: string` + + GitHub authorization token used to clone the repository. + + - `type: "github_repository"` + + - `"github_repository"` + + - `url: string` + + Github URL of the repository + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `mount_path: optional string` + + Mount path in the container. Defaults to `/workspace/`. + + - `BetaManagedAgentsFileResourceParams = object { file_id, type, mount_path }` + + Mount a file uploaded via the Files API into the session. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `mount_path: optional string` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +- `title: optional string` + + Human-readable session title. + +- `vault_ids: optional array of string` + + Vault IDs for stored credentials the agent can use during the session. + +### Returns + +- `BetaManagedAgentsSession = object { id, agent, archived_at, 11 more }` + + A Managed Agents `session`. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```http +curl https://api.anthropic.com/v1/sessions \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "agent": "agent_011CZkYpogX7uDKUyvBTophP", + "environment_id": "env_011CZkZ9X2dpNyB7HsEFoRfW" + }' +``` + +## List + +**get** `/v1/sessions` + +List Sessions + +### Query Parameters + +- `agent_id: optional string` + + Filter sessions created with this agent ID. + +- `agent_version: optional number` + + Filter by agent version. Only applies when agent_id is also set. + +- `"created_at[gt]": optional string` + + Return sessions created after this time (exclusive). + +- `"created_at[gte]": optional string` + + Return sessions created at or after this time (inclusive). + +- `"created_at[lt]": optional string` + + Return sessions created before this time (exclusive). + +- `"created_at[lte]": optional string` + + Return sessions created at or before this time (inclusive). + +- `include_archived: optional boolean` + + When true, includes archived sessions. Default: false (exclude archived). + +- `limit: optional number` + + Maximum number of results to return. + +- `order: optional "asc" or "desc"` + + Sort direction for results, ordered by created_at. Defaults to desc (newest first). + + - `"asc"` + + - `"desc"` + +- `page: optional string` + + Opaque pagination cursor from a previous response's next_page. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `data: optional array of BetaManagedAgentsSession` + + List of sessions. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +- `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```http +curl https://api.anthropic.com/v1/sessions \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Retrieve + +**get** `/v1/sessions/{session_id}` + +Get Session + +### Path Parameters + +- `session_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSession = object { id, agent, archived_at, 11 more }` + + A Managed Agents `session`. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Update + +**post** `/v1/sessions/{session_id}` + +Update Session + +### Path Parameters + +- `session_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `metadata: optional map[string]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. + +- `title: optional string` + + Human-readable session title. + +- `vault_ids: optional array of string` + + Vault IDs (`vlt_*`) to attach to the session. Not yet supported; requests setting this field are rejected. Reserved for future use. + +### Returns + +- `BetaManagedAgentsSession = object { id, agent, archived_at, 11 more }` + + A Managed Agents `session`. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{}' +``` + +## Delete + +**delete** `/v1/sessions/{session_id}` + +Delete Session + +### Path Parameters + +- `session_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsDeletedSession = object { id, type }` + + Confirmation that a `session` has been permanently deleted. + + - `id: string` + + - `type: "session_deleted"` + + - `"session_deleted"` + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID \ + -X DELETE \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Archive + +**post** `/v1/sessions/{session_id}/archive` + +Archive Session + +### Path Parameters + +- `session_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSession = object { id, agent, archived_at, 11 more }` + + A Managed Agents `session`. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/archive \ + -X POST \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Domain Types + +### Beta Managed Agents Agent Params + +- `BetaManagedAgentsAgentParams = object { id, type, version }` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `id: string` + + The `agent` ID. + + - `type: "agent"` + + - `"agent"` + + - `version: optional number` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + +### Beta Managed Agents Branch Checkout + +- `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + +### Beta Managed Agents Cache Creation Usage + +- `BetaManagedAgentsCacheCreationUsage = object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + +### Beta Managed Agents Commit Checkout + +- `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + +### Beta Managed Agents Deleted Session + +- `BetaManagedAgentsDeletedSession = object { id, type }` + + Confirmation that a `session` has been permanently deleted. + + - `id: string` + + - `type: "session_deleted"` + + - `"session_deleted"` + +### Beta Managed Agents File Resource Params + +- `BetaManagedAgentsFileResourceParams = object { file_id, type, mount_path }` + + Mount a file uploaded via the Files API into the session. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `mount_path: optional string` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +### Beta Managed Agents GitHub Repository Resource Params + +- `BetaManagedAgentsGitHubRepositoryResourceParams = object { authorization_token, type, url, 2 more }` + + Mount a GitHub repository into the session's container. + + - `authorization_token: string` + + GitHub authorization token used to clone the repository. + + - `type: "github_repository"` + + - `"github_repository"` + + - `url: string` + + Github URL of the repository + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `mount_path: optional string` + + Mount path in the container. Defaults to `/workspace/`. + +### Beta Managed Agents Session + +- `BetaManagedAgentsSession = object { id, agent, archived_at, 11 more }` + + A Managed Agents `session`. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Beta Managed Agents Session Agent + +- `BetaManagedAgentsSessionAgent = object { id, description, mcp_servers, 7 more }` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + +### Beta Managed Agents Session Stats + +- `BetaManagedAgentsSessionStats = object { active_seconds, duration_seconds }` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + +### Beta Managed Agents Session Usage + +- `BetaManagedAgentsSessionUsage = object { cache_creation, cache_read_input_tokens, input_tokens, output_tokens }` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + +# Events + +## List + +**get** `/v1/sessions/{session_id}/events` + +List Events + +### Path Parameters + +- `session_id: string` + +### Query Parameters + +- `limit: optional number` + + Query parameter for limit + +- `order: optional "asc" or "desc"` + + Sort direction for results, ordered by created_at. Defaults to asc (chronological). + + - `"asc"` + + - `"desc"` + +- `page: optional string` + + Opaque pagination cursor from a previous response's next_page. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `data: optional array of BetaManagedAgentsSessionEvent` + + Events for the session, ordered by `created_at`. + + - `BetaManagedAgentsUserMessageEvent = object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent = object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent = object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent = object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsAgentCustomToolUseEvent = object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `BetaManagedAgentsAgentMessageEvent = object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `BetaManagedAgentsAgentThinkingEvent = object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `BetaManagedAgentsAgentMCPToolUseEvent = object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentMCPToolResultEvent = object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentToolUseEvent = object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentToolResultEvent = object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentThreadContextCompactedEvent = object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `BetaManagedAgentsSessionErrorEvent = object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError = object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError = object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError = object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError = object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError = object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError = object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError = object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `BetaManagedAgentsSessionStatusRescheduledEvent = object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `BetaManagedAgentsSessionStatusRunningEvent = object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `BetaManagedAgentsSessionStatusIdleEvent = object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn = object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction = object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted = object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `BetaManagedAgentsSessionStatusTerminatedEvent = object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `BetaManagedAgentsSpanModelRequestStartEvent = object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `BetaManagedAgentsSpanModelRequestEndEvent = object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `BetaManagedAgentsSessionDeletedEvent = object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +- `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/events \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Send + +**post** `/v1/sessions/{session_id}/events` + +Send Events + +### Path Parameters + +- `session_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `events: array of BetaManagedAgentsEventParams` + + Events to send to the `session`. + + - `BetaManagedAgentsUserMessageEventParams = object { content, type }` + + Parameters for sending a user message to the session. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks for the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `BetaManagedAgentsUserInterruptEventParams = object { type }` + + Parameters for sending an interrupt to pause the agent. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `BetaManagedAgentsUserToolConfirmationEventParams = object { result, tool_use_id, type, deny_message }` + + Parameters for confirming or denying a tool execution request. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `BetaManagedAgentsUserCustomToolResultEventParams = object { custom_tool_use_id, type, content, is_error }` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + +### Returns + +- `BetaManagedAgentsSendSessionEvents = object { data }` + + Events that were successfully sent to the session. + + - `data: optional array of BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or BetaManagedAgentsUserCustomToolResultEvent` + + Sent events + + - `BetaManagedAgentsUserMessageEvent = object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent = object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent = object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent = object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/events \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "events": [ + { + "content": [ + { + "text": "Where is my order #1234?", + "type": "text" + } + ], + "type": "user.message" + } + ] + }' +``` + +## Stream + +**get** `/v1/sessions/{session_id}/events/stream` + +Stream Events + +### Path Parameters + +- `session_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsStreamSessionEvents = BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or 17 more` + + Server-sent event in the session stream. + + - `BetaManagedAgentsUserMessageEvent = object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent = object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent = object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent = object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsAgentCustomToolUseEvent = object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `BetaManagedAgentsAgentMessageEvent = object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `BetaManagedAgentsAgentThinkingEvent = object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `BetaManagedAgentsAgentMCPToolUseEvent = object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentMCPToolResultEvent = object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentToolUseEvent = object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentToolResultEvent = object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentThreadContextCompactedEvent = object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `BetaManagedAgentsSessionErrorEvent = object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError = object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError = object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError = object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError = object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError = object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError = object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError = object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `BetaManagedAgentsSessionStatusRescheduledEvent = object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `BetaManagedAgentsSessionStatusRunningEvent = object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `BetaManagedAgentsSessionStatusIdleEvent = object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn = object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction = object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted = object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `BetaManagedAgentsSessionStatusTerminatedEvent = object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `BetaManagedAgentsSpanModelRequestStartEvent = object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `BetaManagedAgentsSpanModelRequestEndEvent = object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `BetaManagedAgentsSessionDeletedEvent = object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/events/stream \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Domain Types + +### Beta Managed Agents Agent Custom Tool Use Event + +- `BetaManagedAgentsAgentCustomToolUseEvent = object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + +### Beta Managed Agents Agent MCP Tool Result Event + +- `BetaManagedAgentsAgentMCPToolResultEvent = object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent MCP Tool Use Event + +- `BetaManagedAgentsAgentMCPToolUseEvent = object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + +### Beta Managed Agents Agent Message Event + +- `BetaManagedAgentsAgentMessageEvent = object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + +### Beta Managed Agents Agent Thinking Event + +- `BetaManagedAgentsAgentThinkingEvent = object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + +### Beta Managed Agents Agent Thread Context Compacted Event + +- `BetaManagedAgentsAgentThreadContextCompactedEvent = object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + +### Beta Managed Agents Agent Tool Result Event + +- `BetaManagedAgentsAgentToolResultEvent = object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent Tool Use Event + +- `BetaManagedAgentsAgentToolUseEvent = object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + +### Beta Managed Agents Base64 Document Source + +- `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + +### Beta Managed Agents Base64 Image Source + +- `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + +### Beta Managed Agents Billing Error + +- `BetaManagedAgentsBillingError = object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + +### Beta Managed Agents Document Block + +- `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + +### Beta Managed Agents Event Params + +- `BetaManagedAgentsEventParams = BetaManagedAgentsUserMessageEventParams or BetaManagedAgentsUserInterruptEventParams or BetaManagedAgentsUserToolConfirmationEventParams or BetaManagedAgentsUserCustomToolResultEventParams` + + Union type for event parameters that can be sent to a session. + + - `BetaManagedAgentsUserMessageEventParams = object { content, type }` + + Parameters for sending a user message to the session. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks for the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `BetaManagedAgentsUserInterruptEventParams = object { type }` + + Parameters for sending an interrupt to pause the agent. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `BetaManagedAgentsUserToolConfirmationEventParams = object { result, tool_use_id, type, deny_message }` + + Parameters for confirming or denying a tool execution request. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `BetaManagedAgentsUserCustomToolResultEventParams = object { custom_tool_use_id, type, content, is_error }` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents File Document Source + +- `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + +### Beta Managed Agents File Image Source + +- `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + +### Beta Managed Agents Image Block + +- `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + +### Beta Managed Agents MCP Authentication Failed Error + +- `BetaManagedAgentsMCPAuthenticationFailedError = object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + +### Beta Managed Agents MCP Connection Failed Error + +- `BetaManagedAgentsMCPConnectionFailedError = object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + +### Beta Managed Agents Model Overloaded Error + +- `BetaManagedAgentsModelOverloadedError = object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + +### Beta Managed Agents Model Rate Limited Error + +- `BetaManagedAgentsModelRateLimitedError = object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + +### Beta Managed Agents Model Request Failed Error + +- `BetaManagedAgentsModelRequestFailedError = object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + +### Beta Managed Agents Plain Text Document Source + +- `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + +### Beta Managed Agents Retry Status Exhausted + +- `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + +### Beta Managed Agents Retry Status Retrying + +- `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + +### Beta Managed Agents Retry Status Terminal + +- `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + +### Beta Managed Agents Send Session Events + +- `BetaManagedAgentsSendSessionEvents = object { data }` + + Events that were successfully sent to the session. + + - `data: optional array of BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or BetaManagedAgentsUserCustomToolResultEvent` + + Sent events + + - `BetaManagedAgentsUserMessageEvent = object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent = object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent = object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent = object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents Session Deleted Event + +- `BetaManagedAgentsSessionDeletedEvent = object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Beta Managed Agents Session End Turn + +- `BetaManagedAgentsSessionEndTurn = object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + +### Beta Managed Agents Session Error Event + +- `BetaManagedAgentsSessionErrorEvent = object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError = object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError = object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError = object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError = object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError = object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError = object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError = object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + +### Beta Managed Agents Session Event + +- `BetaManagedAgentsSessionEvent = BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or 17 more` + + Union type for all event types in a session. + + - `BetaManagedAgentsUserMessageEvent = object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent = object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent = object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent = object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsAgentCustomToolUseEvent = object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `BetaManagedAgentsAgentMessageEvent = object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `BetaManagedAgentsAgentThinkingEvent = object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `BetaManagedAgentsAgentMCPToolUseEvent = object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentMCPToolResultEvent = object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentToolUseEvent = object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentToolResultEvent = object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentThreadContextCompactedEvent = object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `BetaManagedAgentsSessionErrorEvent = object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError = object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError = object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError = object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError = object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError = object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError = object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError = object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `BetaManagedAgentsSessionStatusRescheduledEvent = object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `BetaManagedAgentsSessionStatusRunningEvent = object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `BetaManagedAgentsSessionStatusIdleEvent = object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn = object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction = object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted = object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `BetaManagedAgentsSessionStatusTerminatedEvent = object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `BetaManagedAgentsSpanModelRequestStartEvent = object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `BetaManagedAgentsSpanModelRequestEndEvent = object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `BetaManagedAgentsSessionDeletedEvent = object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Beta Managed Agents Session Requires Action + +- `BetaManagedAgentsSessionRequiresAction = object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + +### Beta Managed Agents Session Retries Exhausted + +- `BetaManagedAgentsSessionRetriesExhausted = object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + +### Beta Managed Agents Session Status Idle Event + +- `BetaManagedAgentsSessionStatusIdleEvent = object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn = object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction = object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted = object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + +### Beta Managed Agents Session Status Rescheduled Event + +- `BetaManagedAgentsSessionStatusRescheduledEvent = object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + +### Beta Managed Agents Session Status Running Event + +- `BetaManagedAgentsSessionStatusRunningEvent = object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + +### Beta Managed Agents Session Status Terminated Event + +- `BetaManagedAgentsSessionStatusTerminatedEvent = object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + +### Beta Managed Agents Span Model Request End Event + +- `BetaManagedAgentsSpanModelRequestEndEvent = object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + +### Beta Managed Agents Span Model Request Start Event + +- `BetaManagedAgentsSpanModelRequestStartEvent = object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + +### Beta Managed Agents Span Model Usage + +- `BetaManagedAgentsSpanModelUsage = object { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 2 more }` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +### Beta Managed Agents Stream Session Events + +- `BetaManagedAgentsStreamSessionEvents = BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or 17 more` + + Server-sent event in the session stream. + + - `BetaManagedAgentsUserMessageEvent = object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent = object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent = object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent = object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsAgentCustomToolUseEvent = object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `BetaManagedAgentsAgentMessageEvent = object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `BetaManagedAgentsAgentThinkingEvent = object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `BetaManagedAgentsAgentMCPToolUseEvent = object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentMCPToolResultEvent = object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentToolUseEvent = object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentToolResultEvent = object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentThreadContextCompactedEvent = object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `BetaManagedAgentsSessionErrorEvent = object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError = object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError = object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError = object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError = object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError = object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError = object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError = object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `BetaManagedAgentsSessionStatusRescheduledEvent = object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `BetaManagedAgentsSessionStatusRunningEvent = object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `BetaManagedAgentsSessionStatusIdleEvent = object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn = object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction = object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted = object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `BetaManagedAgentsSessionStatusTerminatedEvent = object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `BetaManagedAgentsSpanModelRequestStartEvent = object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `BetaManagedAgentsSpanModelRequestEndEvent = object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `BetaManagedAgentsSessionDeletedEvent = object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Beta Managed Agents Text Block + +- `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + +### Beta Managed Agents Unknown Error + +- `BetaManagedAgentsUnknownError = object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + +### Beta Managed Agents URL Document Source + +- `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + +### Beta Managed Agents URL Image Source + +- `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + +### Beta Managed Agents User Custom Tool Result Event + +- `BetaManagedAgentsUserCustomToolResultEvent = object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Custom Tool Result Event Params + +- `BetaManagedAgentsUserCustomToolResultEventParams = object { custom_tool_use_id, type, content, is_error }` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents User Interrupt Event + +- `BetaManagedAgentsUserInterruptEvent = object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Interrupt Event Params + +- `BetaManagedAgentsUserInterruptEventParams = object { type }` + + Parameters for sending an interrupt to pause the agent. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + +### Beta Managed Agents User Message Event + +- `BetaManagedAgentsUserMessageEvent = object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Message Event Params + +- `BetaManagedAgentsUserMessageEventParams = object { content, type }` + + Parameters for sending a user message to the session. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks for the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + +### Beta Managed Agents User Tool Confirmation Event + +- `BetaManagedAgentsUserToolConfirmationEvent = object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Tool Confirmation Event Params + +- `BetaManagedAgentsUserToolConfirmationEventParams = object { result, tool_use_id, type, deny_message }` + + Parameters for confirming or denying a tool execution request. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + +# Resources + +## Add + +**post** `/v1/sessions/{session_id}/resources` + +Add Session Resource + +### Path Parameters + +- `session_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `file_id: string` + + ID of a previously uploaded file. + +- `type: "file"` + + - `"file"` + +- `mount_path: optional string` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +### Returns + +- `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/resources \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "file_id": "file_011CNha8iCJcU1wXNR6q4V8w", + "type": "file" + }' +``` + +## List + +**get** `/v1/sessions/{session_id}/resources` + +List Session Resources + +### Path Parameters + +- `session_id: string` + +### Query Parameters + +- `limit: optional number` + + Maximum number of resources to return per page (max 1000). If omitted, returns all resources. + +- `page: optional string` + + Opaque cursor from a previous response's next_page field. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `data: array of BetaManagedAgentsSessionResource` + + Resources for the session, ordered by `created_at`. + + - `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +- `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/resources \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Retrieve + +**get** `/v1/sessions/{session_id}/resources/{resource_id}` + +Get Session Resource + +### Path Parameters + +- `session_id: string` + +- `resource_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + +- `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/resources/$RESOURCE_ID \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Update + +**post** `/v1/sessions/{session_id}/resources/{resource_id}` + +Update Session Resource + +### Path Parameters + +- `session_id: string` + +- `resource_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `authorization_token: string` + + New authorization token for the resource. Currently only `github_repository` resources support token rotation. + +### Returns + +- `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + +- `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/resources/$RESOURCE_ID \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "authorization_token": "ghp_exampletoken" + }' +``` + +## Delete + +**delete** `/v1/sessions/{session_id}/resources/{resource_id}` + +Delete Session Resource + +### Path Parameters + +- `session_id: string` + +- `resource_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsDeleteSessionResource = object { id, type }` + + Confirmation of resource deletion. + + - `id: string` + + - `type: "session_resource_deleted"` + + - `"session_resource_deleted"` + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/resources/$RESOURCE_ID \ + -X DELETE \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Domain Types + +### Beta Managed Agents Delete Session Resource + +- `BetaManagedAgentsDeleteSessionResource = object { id, type }` + + Confirmation of resource deletion. + + - `id: string` + + - `type: "session_resource_deleted"` + + - `"session_resource_deleted"` + +### Beta Managed Agents File Resource + +- `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents GitHub Repository Resource + +- `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + +### Beta Managed Agents Session Resource + +- `BetaManagedAgentsSessionResource = BetaManagedAgentsGitHubRepositoryResource or BetaManagedAgentsFileResource` + + - `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Resource Retrieve Response + +- `ResourceRetrieveResponse = BetaManagedAgentsGitHubRepositoryResource or BetaManagedAgentsFileResource` + + The requested session resource. + + - `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Resource Update Response + +- `ResourceUpdateResponse = BetaManagedAgentsGitHubRepositoryResource or BetaManagedAgentsFileResource` + + The updated session resource. + + - `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format diff --git a/content/en/api/beta/sessions/archive.md b/content/en/api/beta/sessions/archive.md new file mode 100644 index 000000000..a5780fa29 --- /dev/null +++ b/content/en/api/beta/sessions/archive.md @@ -0,0 +1,501 @@ +## Archive + +**post** `/v1/sessions/{session_id}/archive` + +Archive Session + +### Path Parameters + +- `session_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSession = object { id, agent, archived_at, 11 more }` + + A Managed Agents `session`. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/archive \ + -X POST \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` diff --git a/content/en/api/beta/sessions/create.md b/content/en/api/beta/sessions/create.md new file mode 100644 index 000000000..8b899a9a5 --- /dev/null +++ b/content/en/api/beta/sessions/create.md @@ -0,0 +1,605 @@ +## Create + +**post** `/v1/sessions` + +Create Session + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `agent: string or BetaManagedAgentsAgentParams` + + Agent identifier. Accepts the `agent` ID string, which pins the latest version for the session, or an `agent` object with both id and version specified. + + - `UnionMember0 = string` + + - `BetaManagedAgentsAgentParams = object { id, type, version }` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `id: string` + + The `agent` ID. + + - `type: "agent"` + + - `"agent"` + + - `version: optional number` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + +- `environment_id: string` + + ID of the `environment` defining the container configuration for this session. + +- `metadata: optional map[string]` + + Arbitrary key-value metadata attached to the session. + +- `resources: optional array of BetaManagedAgentsGitHubRepositoryResourceParams or BetaManagedAgentsFileResourceParams` + + Resources (e.g. repositories, files) to mount into the session's container. + + - `BetaManagedAgentsGitHubRepositoryResourceParams = object { authorization_token, type, url, 2 more }` + + Mount a GitHub repository into the session's container. + + - `authorization_token: string` + + GitHub authorization token used to clone the repository. + + - `type: "github_repository"` + + - `"github_repository"` + + - `url: string` + + Github URL of the repository + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `mount_path: optional string` + + Mount path in the container. Defaults to `/workspace/`. + + - `BetaManagedAgentsFileResourceParams = object { file_id, type, mount_path }` + + Mount a file uploaded via the Files API into the session. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `mount_path: optional string` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +- `title: optional string` + + Human-readable session title. + +- `vault_ids: optional array of string` + + Vault IDs for stored credentials the agent can use during the session. + +### Returns + +- `BetaManagedAgentsSession = object { id, agent, archived_at, 11 more }` + + A Managed Agents `session`. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```http +curl https://api.anthropic.com/v1/sessions \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "agent": "agent_011CZkYpogX7uDKUyvBTophP", + "environment_id": "env_011CZkZ9X2dpNyB7HsEFoRfW" + }' +``` diff --git a/content/en/api/beta/sessions/delete.md b/content/en/api/beta/sessions/delete.md new file mode 100644 index 000000000..3c78010e1 --- /dev/null +++ b/content/en/api/beta/sessions/delete.md @@ -0,0 +1,83 @@ +## Delete + +**delete** `/v1/sessions/{session_id}` + +Delete Session + +### Path Parameters + +- `session_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsDeletedSession = object { id, type }` + + Confirmation that a `session` has been permanently deleted. + + - `id: string` + + - `type: "session_deleted"` + + - `"session_deleted"` + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID \ + -X DELETE \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` diff --git a/content/en/api/beta/sessions/events.md b/content/en/api/beta/sessions/events.md new file mode 100644 index 000000000..e56fe8478 --- /dev/null +++ b/content/en/api/beta/sessions/events.md @@ -0,0 +1,9636 @@ +# Events + +## List + +**get** `/v1/sessions/{session_id}/events` + +List Events + +### Path Parameters + +- `session_id: string` + +### Query Parameters + +- `limit: optional number` + + Query parameter for limit + +- `order: optional "asc" or "desc"` + + Sort direction for results, ordered by created_at. Defaults to asc (chronological). + + - `"asc"` + + - `"desc"` + +- `page: optional string` + + Opaque pagination cursor from a previous response's next_page. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `data: optional array of BetaManagedAgentsSessionEvent` + + Events for the session, ordered by `created_at`. + + - `BetaManagedAgentsUserMessageEvent = object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent = object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent = object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent = object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsAgentCustomToolUseEvent = object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `BetaManagedAgentsAgentMessageEvent = object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `BetaManagedAgentsAgentThinkingEvent = object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `BetaManagedAgentsAgentMCPToolUseEvent = object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentMCPToolResultEvent = object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentToolUseEvent = object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentToolResultEvent = object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentThreadContextCompactedEvent = object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `BetaManagedAgentsSessionErrorEvent = object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError = object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError = object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError = object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError = object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError = object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError = object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError = object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `BetaManagedAgentsSessionStatusRescheduledEvent = object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `BetaManagedAgentsSessionStatusRunningEvent = object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `BetaManagedAgentsSessionStatusIdleEvent = object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn = object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction = object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted = object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `BetaManagedAgentsSessionStatusTerminatedEvent = object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `BetaManagedAgentsSpanModelRequestStartEvent = object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `BetaManagedAgentsSpanModelRequestEndEvent = object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `BetaManagedAgentsSessionDeletedEvent = object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +- `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/events \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Send + +**post** `/v1/sessions/{session_id}/events` + +Send Events + +### Path Parameters + +- `session_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `events: array of BetaManagedAgentsEventParams` + + Events to send to the `session`. + + - `BetaManagedAgentsUserMessageEventParams = object { content, type }` + + Parameters for sending a user message to the session. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks for the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `BetaManagedAgentsUserInterruptEventParams = object { type }` + + Parameters for sending an interrupt to pause the agent. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `BetaManagedAgentsUserToolConfirmationEventParams = object { result, tool_use_id, type, deny_message }` + + Parameters for confirming or denying a tool execution request. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `BetaManagedAgentsUserCustomToolResultEventParams = object { custom_tool_use_id, type, content, is_error }` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + +### Returns + +- `BetaManagedAgentsSendSessionEvents = object { data }` + + Events that were successfully sent to the session. + + - `data: optional array of BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or BetaManagedAgentsUserCustomToolResultEvent` + + Sent events + + - `BetaManagedAgentsUserMessageEvent = object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent = object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent = object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent = object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/events \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "events": [ + { + "content": [ + { + "text": "Where is my order #1234?", + "type": "text" + } + ], + "type": "user.message" + } + ] + }' +``` + +## Stream + +**get** `/v1/sessions/{session_id}/events/stream` + +Stream Events + +### Path Parameters + +- `session_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsStreamSessionEvents = BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or 17 more` + + Server-sent event in the session stream. + + - `BetaManagedAgentsUserMessageEvent = object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent = object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent = object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent = object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsAgentCustomToolUseEvent = object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `BetaManagedAgentsAgentMessageEvent = object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `BetaManagedAgentsAgentThinkingEvent = object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `BetaManagedAgentsAgentMCPToolUseEvent = object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentMCPToolResultEvent = object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentToolUseEvent = object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentToolResultEvent = object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentThreadContextCompactedEvent = object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `BetaManagedAgentsSessionErrorEvent = object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError = object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError = object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError = object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError = object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError = object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError = object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError = object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `BetaManagedAgentsSessionStatusRescheduledEvent = object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `BetaManagedAgentsSessionStatusRunningEvent = object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `BetaManagedAgentsSessionStatusIdleEvent = object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn = object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction = object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted = object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `BetaManagedAgentsSessionStatusTerminatedEvent = object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `BetaManagedAgentsSpanModelRequestStartEvent = object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `BetaManagedAgentsSpanModelRequestEndEvent = object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `BetaManagedAgentsSessionDeletedEvent = object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/events/stream \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Domain Types + +### Beta Managed Agents Agent Custom Tool Use Event + +- `BetaManagedAgentsAgentCustomToolUseEvent = object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + +### Beta Managed Agents Agent MCP Tool Result Event + +- `BetaManagedAgentsAgentMCPToolResultEvent = object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent MCP Tool Use Event + +- `BetaManagedAgentsAgentMCPToolUseEvent = object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + +### Beta Managed Agents Agent Message Event + +- `BetaManagedAgentsAgentMessageEvent = object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + +### Beta Managed Agents Agent Thinking Event + +- `BetaManagedAgentsAgentThinkingEvent = object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + +### Beta Managed Agents Agent Thread Context Compacted Event + +- `BetaManagedAgentsAgentThreadContextCompactedEvent = object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + +### Beta Managed Agents Agent Tool Result Event + +- `BetaManagedAgentsAgentToolResultEvent = object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent Tool Use Event + +- `BetaManagedAgentsAgentToolUseEvent = object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + +### Beta Managed Agents Base64 Document Source + +- `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + +### Beta Managed Agents Base64 Image Source + +- `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + +### Beta Managed Agents Billing Error + +- `BetaManagedAgentsBillingError = object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + +### Beta Managed Agents Document Block + +- `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + +### Beta Managed Agents Event Params + +- `BetaManagedAgentsEventParams = BetaManagedAgentsUserMessageEventParams or BetaManagedAgentsUserInterruptEventParams or BetaManagedAgentsUserToolConfirmationEventParams or BetaManagedAgentsUserCustomToolResultEventParams` + + Union type for event parameters that can be sent to a session. + + - `BetaManagedAgentsUserMessageEventParams = object { content, type }` + + Parameters for sending a user message to the session. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks for the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `BetaManagedAgentsUserInterruptEventParams = object { type }` + + Parameters for sending an interrupt to pause the agent. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `BetaManagedAgentsUserToolConfirmationEventParams = object { result, tool_use_id, type, deny_message }` + + Parameters for confirming or denying a tool execution request. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `BetaManagedAgentsUserCustomToolResultEventParams = object { custom_tool_use_id, type, content, is_error }` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents File Document Source + +- `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + +### Beta Managed Agents File Image Source + +- `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + +### Beta Managed Agents Image Block + +- `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + +### Beta Managed Agents MCP Authentication Failed Error + +- `BetaManagedAgentsMCPAuthenticationFailedError = object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + +### Beta Managed Agents MCP Connection Failed Error + +- `BetaManagedAgentsMCPConnectionFailedError = object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + +### Beta Managed Agents Model Overloaded Error + +- `BetaManagedAgentsModelOverloadedError = object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + +### Beta Managed Agents Model Rate Limited Error + +- `BetaManagedAgentsModelRateLimitedError = object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + +### Beta Managed Agents Model Request Failed Error + +- `BetaManagedAgentsModelRequestFailedError = object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + +### Beta Managed Agents Plain Text Document Source + +- `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + +### Beta Managed Agents Retry Status Exhausted + +- `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + +### Beta Managed Agents Retry Status Retrying + +- `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + +### Beta Managed Agents Retry Status Terminal + +- `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + +### Beta Managed Agents Send Session Events + +- `BetaManagedAgentsSendSessionEvents = object { data }` + + Events that were successfully sent to the session. + + - `data: optional array of BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or BetaManagedAgentsUserCustomToolResultEvent` + + Sent events + + - `BetaManagedAgentsUserMessageEvent = object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent = object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent = object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent = object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents Session Deleted Event + +- `BetaManagedAgentsSessionDeletedEvent = object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Beta Managed Agents Session End Turn + +- `BetaManagedAgentsSessionEndTurn = object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + +### Beta Managed Agents Session Error Event + +- `BetaManagedAgentsSessionErrorEvent = object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError = object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError = object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError = object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError = object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError = object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError = object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError = object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + +### Beta Managed Agents Session Event + +- `BetaManagedAgentsSessionEvent = BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or 17 more` + + Union type for all event types in a session. + + - `BetaManagedAgentsUserMessageEvent = object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent = object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent = object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent = object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsAgentCustomToolUseEvent = object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `BetaManagedAgentsAgentMessageEvent = object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `BetaManagedAgentsAgentThinkingEvent = object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `BetaManagedAgentsAgentMCPToolUseEvent = object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentMCPToolResultEvent = object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentToolUseEvent = object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentToolResultEvent = object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentThreadContextCompactedEvent = object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `BetaManagedAgentsSessionErrorEvent = object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError = object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError = object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError = object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError = object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError = object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError = object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError = object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `BetaManagedAgentsSessionStatusRescheduledEvent = object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `BetaManagedAgentsSessionStatusRunningEvent = object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `BetaManagedAgentsSessionStatusIdleEvent = object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn = object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction = object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted = object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `BetaManagedAgentsSessionStatusTerminatedEvent = object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `BetaManagedAgentsSpanModelRequestStartEvent = object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `BetaManagedAgentsSpanModelRequestEndEvent = object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `BetaManagedAgentsSessionDeletedEvent = object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Beta Managed Agents Session Requires Action + +- `BetaManagedAgentsSessionRequiresAction = object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + +### Beta Managed Agents Session Retries Exhausted + +- `BetaManagedAgentsSessionRetriesExhausted = object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + +### Beta Managed Agents Session Status Idle Event + +- `BetaManagedAgentsSessionStatusIdleEvent = object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn = object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction = object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted = object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + +### Beta Managed Agents Session Status Rescheduled Event + +- `BetaManagedAgentsSessionStatusRescheduledEvent = object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + +### Beta Managed Agents Session Status Running Event + +- `BetaManagedAgentsSessionStatusRunningEvent = object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + +### Beta Managed Agents Session Status Terminated Event + +- `BetaManagedAgentsSessionStatusTerminatedEvent = object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + +### Beta Managed Agents Span Model Request End Event + +- `BetaManagedAgentsSpanModelRequestEndEvent = object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + +### Beta Managed Agents Span Model Request Start Event + +- `BetaManagedAgentsSpanModelRequestStartEvent = object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + +### Beta Managed Agents Span Model Usage + +- `BetaManagedAgentsSpanModelUsage = object { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 2 more }` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +### Beta Managed Agents Stream Session Events + +- `BetaManagedAgentsStreamSessionEvents = BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or 17 more` + + Server-sent event in the session stream. + + - `BetaManagedAgentsUserMessageEvent = object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent = object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent = object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent = object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsAgentCustomToolUseEvent = object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `BetaManagedAgentsAgentMessageEvent = object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `BetaManagedAgentsAgentThinkingEvent = object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `BetaManagedAgentsAgentMCPToolUseEvent = object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentMCPToolResultEvent = object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentToolUseEvent = object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentToolResultEvent = object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentThreadContextCompactedEvent = object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `BetaManagedAgentsSessionErrorEvent = object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError = object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError = object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError = object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError = object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError = object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError = object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError = object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `BetaManagedAgentsSessionStatusRescheduledEvent = object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `BetaManagedAgentsSessionStatusRunningEvent = object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `BetaManagedAgentsSessionStatusIdleEvent = object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn = object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction = object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted = object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `BetaManagedAgentsSessionStatusTerminatedEvent = object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `BetaManagedAgentsSpanModelRequestStartEvent = object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `BetaManagedAgentsSpanModelRequestEndEvent = object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `BetaManagedAgentsSessionDeletedEvent = object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Beta Managed Agents Text Block + +- `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + +### Beta Managed Agents Unknown Error + +- `BetaManagedAgentsUnknownError = object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + +### Beta Managed Agents URL Document Source + +- `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + +### Beta Managed Agents URL Image Source + +- `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + +### Beta Managed Agents User Custom Tool Result Event + +- `BetaManagedAgentsUserCustomToolResultEvent = object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Custom Tool Result Event Params + +- `BetaManagedAgentsUserCustomToolResultEventParams = object { custom_tool_use_id, type, content, is_error }` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents User Interrupt Event + +- `BetaManagedAgentsUserInterruptEvent = object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Interrupt Event Params + +- `BetaManagedAgentsUserInterruptEventParams = object { type }` + + Parameters for sending an interrupt to pause the agent. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + +### Beta Managed Agents User Message Event + +- `BetaManagedAgentsUserMessageEvent = object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Message Event Params + +- `BetaManagedAgentsUserMessageEventParams = object { content, type }` + + Parameters for sending a user message to the session. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks for the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + +### Beta Managed Agents User Tool Confirmation Event + +- `BetaManagedAgentsUserToolConfirmationEvent = object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Tool Confirmation Event Params + +- `BetaManagedAgentsUserToolConfirmationEventParams = object { result, tool_use_id, type, deny_message }` + + Parameters for confirming or denying a tool execution request. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. diff --git a/content/en/api/beta/sessions/events/list.md b/content/en/api/beta/sessions/events/list.md new file mode 100644 index 000000000..962f1b8cb --- /dev/null +++ b/content/en/api/beta/sessions/events/list.md @@ -0,0 +1,1462 @@ +## List + +**get** `/v1/sessions/{session_id}/events` + +List Events + +### Path Parameters + +- `session_id: string` + +### Query Parameters + +- `limit: optional number` + + Query parameter for limit + +- `order: optional "asc" or "desc"` + + Sort direction for results, ordered by created_at. Defaults to asc (chronological). + + - `"asc"` + + - `"desc"` + +- `page: optional string` + + Opaque pagination cursor from a previous response's next_page. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `data: optional array of BetaManagedAgentsSessionEvent` + + Events for the session, ordered by `created_at`. + + - `BetaManagedAgentsUserMessageEvent = object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent = object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent = object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent = object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsAgentCustomToolUseEvent = object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `BetaManagedAgentsAgentMessageEvent = object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `BetaManagedAgentsAgentThinkingEvent = object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `BetaManagedAgentsAgentMCPToolUseEvent = object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentMCPToolResultEvent = object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentToolUseEvent = object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentToolResultEvent = object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentThreadContextCompactedEvent = object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `BetaManagedAgentsSessionErrorEvent = object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError = object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError = object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError = object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError = object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError = object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError = object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError = object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `BetaManagedAgentsSessionStatusRescheduledEvent = object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `BetaManagedAgentsSessionStatusRunningEvent = object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `BetaManagedAgentsSessionStatusIdleEvent = object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn = object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction = object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted = object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `BetaManagedAgentsSessionStatusTerminatedEvent = object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `BetaManagedAgentsSpanModelRequestStartEvent = object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `BetaManagedAgentsSpanModelRequestEndEvent = object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `BetaManagedAgentsSessionDeletedEvent = object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +- `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/events \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` diff --git a/content/en/api/beta/sessions/events/send.md b/content/en/api/beta/sessions/events/send.md new file mode 100644 index 000000000..4dad96e46 --- /dev/null +++ b/content/en/api/beta/sessions/events/send.md @@ -0,0 +1,828 @@ +## Send + +**post** `/v1/sessions/{session_id}/events` + +Send Events + +### Path Parameters + +- `session_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `events: array of BetaManagedAgentsEventParams` + + Events to send to the `session`. + + - `BetaManagedAgentsUserMessageEventParams = object { content, type }` + + Parameters for sending a user message to the session. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks for the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `BetaManagedAgentsUserInterruptEventParams = object { type }` + + Parameters for sending an interrupt to pause the agent. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `BetaManagedAgentsUserToolConfirmationEventParams = object { result, tool_use_id, type, deny_message }` + + Parameters for confirming or denying a tool execution request. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `BetaManagedAgentsUserCustomToolResultEventParams = object { custom_tool_use_id, type, content, is_error }` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + +### Returns + +- `BetaManagedAgentsSendSessionEvents = object { data }` + + Events that were successfully sent to the session. + + - `data: optional array of BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or BetaManagedAgentsUserCustomToolResultEvent` + + Sent events + + - `BetaManagedAgentsUserMessageEvent = object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent = object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent = object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent = object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/events \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "events": [ + { + "content": [ + { + "text": "Where is my order #1234?", + "type": "text" + } + ], + "type": "user.message" + } + ] + }' +``` diff --git a/content/en/api/beta/sessions/events/stream.md b/content/en/api/beta/sessions/events/stream.md new file mode 100644 index 000000000..68d554a13 --- /dev/null +++ b/content/en/api/beta/sessions/events/stream.md @@ -0,0 +1,1440 @@ +## Stream + +**get** `/v1/sessions/{session_id}/events/stream` + +Stream Events + +### Path Parameters + +- `session_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsStreamSessionEvents = BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or 17 more` + + Server-sent event in the session stream. + + - `BetaManagedAgentsUserMessageEvent = object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent = object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent = object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent = object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsAgentCustomToolUseEvent = object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `BetaManagedAgentsAgentMessageEvent = object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `BetaManagedAgentsAgentThinkingEvent = object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `BetaManagedAgentsAgentMCPToolUseEvent = object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentMCPToolResultEvent = object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentToolUseEvent = object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentToolResultEvent = object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock = object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock = object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource = object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource = object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource = object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock = object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource = object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource = object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource = object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource = object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentThreadContextCompactedEvent = object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `BetaManagedAgentsSessionErrorEvent = object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError = object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError = object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError = object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError = object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError = object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError = object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError = object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying = object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted = object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal = object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `BetaManagedAgentsSessionStatusRescheduledEvent = object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `BetaManagedAgentsSessionStatusRunningEvent = object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `BetaManagedAgentsSessionStatusIdleEvent = object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn = object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction = object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted = object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `BetaManagedAgentsSessionStatusTerminatedEvent = object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `BetaManagedAgentsSpanModelRequestStartEvent = object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `BetaManagedAgentsSpanModelRequestEndEvent = object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `BetaManagedAgentsSessionDeletedEvent = object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/events/stream \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` diff --git a/content/en/api/beta/sessions/list.md b/content/en/api/beta/sessions/list.md new file mode 100644 index 000000000..4e79f2393 --- /dev/null +++ b/content/en/api/beta/sessions/list.md @@ -0,0 +1,546 @@ +## List + +**get** `/v1/sessions` + +List Sessions + +### Query Parameters + +- `agent_id: optional string` + + Filter sessions created with this agent ID. + +- `agent_version: optional number` + + Filter by agent version. Only applies when agent_id is also set. + +- `"created_at[gt]": optional string` + + Return sessions created after this time (exclusive). + +- `"created_at[gte]": optional string` + + Return sessions created at or after this time (inclusive). + +- `"created_at[lt]": optional string` + + Return sessions created before this time (exclusive). + +- `"created_at[lte]": optional string` + + Return sessions created at or before this time (inclusive). + +- `include_archived: optional boolean` + + When true, includes archived sessions. Default: false (exclude archived). + +- `limit: optional number` + + Maximum number of results to return. + +- `order: optional "asc" or "desc"` + + Sort direction for results, ordered by created_at. Defaults to desc (newest first). + + - `"asc"` + + - `"desc"` + +- `page: optional string` + + Opaque pagination cursor from a previous response's next_page. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `data: optional array of BetaManagedAgentsSession` + + List of sessions. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +- `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```http +curl https://api.anthropic.com/v1/sessions \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` diff --git a/content/en/api/beta/sessions/resources.md b/content/en/api/beta/sessions/resources.md new file mode 100644 index 000000000..4911c2b6b --- /dev/null +++ b/content/en/api/beta/sessions/resources.md @@ -0,0 +1,918 @@ +# Resources + +## Add + +**post** `/v1/sessions/{session_id}/resources` + +Add Session Resource + +### Path Parameters + +- `session_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `file_id: string` + + ID of a previously uploaded file. + +- `type: "file"` + + - `"file"` + +- `mount_path: optional string` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +### Returns + +- `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/resources \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "file_id": "file_011CNha8iCJcU1wXNR6q4V8w", + "type": "file" + }' +``` + +## List + +**get** `/v1/sessions/{session_id}/resources` + +List Session Resources + +### Path Parameters + +- `session_id: string` + +### Query Parameters + +- `limit: optional number` + + Maximum number of resources to return per page (max 1000). If omitted, returns all resources. + +- `page: optional string` + + Opaque cursor from a previous response's next_page field. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `data: array of BetaManagedAgentsSessionResource` + + Resources for the session, ordered by `created_at`. + + - `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +- `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/resources \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Retrieve + +**get** `/v1/sessions/{session_id}/resources/{resource_id}` + +Get Session Resource + +### Path Parameters + +- `session_id: string` + +- `resource_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + +- `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/resources/$RESOURCE_ID \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Update + +**post** `/v1/sessions/{session_id}/resources/{resource_id}` + +Update Session Resource + +### Path Parameters + +- `session_id: string` + +- `resource_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `authorization_token: string` + + New authorization token for the resource. Currently only `github_repository` resources support token rotation. + +### Returns + +- `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + +- `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/resources/$RESOURCE_ID \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "authorization_token": "ghp_exampletoken" + }' +``` + +## Delete + +**delete** `/v1/sessions/{session_id}/resources/{resource_id}` + +Delete Session Resource + +### Path Parameters + +- `session_id: string` + +- `resource_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsDeleteSessionResource = object { id, type }` + + Confirmation of resource deletion. + + - `id: string` + + - `type: "session_resource_deleted"` + + - `"session_resource_deleted"` + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/resources/$RESOURCE_ID \ + -X DELETE \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Domain Types + +### Beta Managed Agents Delete Session Resource + +- `BetaManagedAgentsDeleteSessionResource = object { id, type }` + + Confirmation of resource deletion. + + - `id: string` + + - `type: "session_resource_deleted"` + + - `"session_resource_deleted"` + +### Beta Managed Agents File Resource + +- `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents GitHub Repository Resource + +- `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + +### Beta Managed Agents Session Resource + +- `BetaManagedAgentsSessionResource = BetaManagedAgentsGitHubRepositoryResource or BetaManagedAgentsFileResource` + + - `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Resource Retrieve Response + +- `ResourceRetrieveResponse = BetaManagedAgentsGitHubRepositoryResource or BetaManagedAgentsFileResource` + + The requested session resource. + + - `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Resource Update Response + +- `ResourceUpdateResponse = BetaManagedAgentsGitHubRepositoryResource or BetaManagedAgentsFileResource` + + The updated session resource. + + - `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format diff --git a/content/en/api/beta/sessions/resources/add.md b/content/en/api/beta/sessions/resources/add.md new file mode 100644 index 000000000..adfab20dd --- /dev/null +++ b/content/en/api/beta/sessions/resources/add.md @@ -0,0 +1,111 @@ +## Add + +**post** `/v1/sessions/{session_id}/resources` + +Add Session Resource + +### Path Parameters + +- `session_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `file_id: string` + + ID of a previously uploaded file. + +- `type: "file"` + + - `"file"` + +- `mount_path: optional string` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +### Returns + +- `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/resources \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "file_id": "file_011CNha8iCJcU1wXNR6q4V8w", + "type": "file" + }' +``` diff --git a/content/en/api/beta/sessions/resources/delete.md b/content/en/api/beta/sessions/resources/delete.md new file mode 100644 index 000000000..d7c0c3758 --- /dev/null +++ b/content/en/api/beta/sessions/resources/delete.md @@ -0,0 +1,85 @@ +## Delete + +**delete** `/v1/sessions/{session_id}/resources/{resource_id}` + +Delete Session Resource + +### Path Parameters + +- `session_id: string` + +- `resource_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsDeleteSessionResource = object { id, type }` + + Confirmation of resource deletion. + + - `id: string` + + - `type: "session_resource_deleted"` + + - `"session_resource_deleted"` + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/resources/$RESOURCE_ID \ + -X DELETE \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` diff --git a/content/en/api/beta/sessions/resources/list.md b/content/en/api/beta/sessions/resources/list.md new file mode 100644 index 000000000..0a7e353d5 --- /dev/null +++ b/content/en/api/beta/sessions/resources/list.md @@ -0,0 +1,152 @@ +## List + +**get** `/v1/sessions/{session_id}/resources` + +List Session Resources + +### Path Parameters + +- `session_id: string` + +### Query Parameters + +- `limit: optional number` + + Maximum number of resources to return per page (max 1000). If omitted, returns all resources. + +- `page: optional string` + + Opaque cursor from a previous response's next_page field. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `data: array of BetaManagedAgentsSessionResource` + + Resources for the session, ordered by `created_at`. + + - `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +- `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/resources \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` diff --git a/content/en/api/beta/sessions/resources/retrieve.md b/content/en/api/beta/sessions/resources/retrieve.md new file mode 100644 index 000000000..21a3a3335 --- /dev/null +++ b/content/en/api/beta/sessions/resources/retrieve.md @@ -0,0 +1,136 @@ +## Retrieve + +**get** `/v1/sessions/{session_id}/resources/{resource_id}` + +Get Session Resource + +### Path Parameters + +- `session_id: string` + +- `resource_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + +- `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/resources/$RESOURCE_ID \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` diff --git a/content/en/api/beta/sessions/resources/update.md b/content/en/api/beta/sessions/resources/update.md new file mode 100644 index 000000000..c88941f2e --- /dev/null +++ b/content/en/api/beta/sessions/resources/update.md @@ -0,0 +1,146 @@ +## Update + +**post** `/v1/sessions/{session_id}/resources/{resource_id}` + +Update Session Resource + +### Path Parameters + +- `session_id: string` + +- `resource_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `authorization_token: string` + + New authorization token for the resource. Currently only `github_repository` resources support token rotation. + +### Returns + +- `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + +- `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID/resources/$RESOURCE_ID \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "authorization_token": "ghp_exampletoken" + }' +``` diff --git a/content/en/api/beta/sessions/retrieve.md b/content/en/api/beta/sessions/retrieve.md new file mode 100644 index 000000000..b0e453597 --- /dev/null +++ b/content/en/api/beta/sessions/retrieve.md @@ -0,0 +1,500 @@ +## Retrieve + +**get** `/v1/sessions/{session_id}` + +Get Session + +### Path Parameters + +- `session_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSession = object { id, agent, archived_at, 11 more }` + + A Managed Agents `session`. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` diff --git a/content/en/api/beta/sessions/update.md b/content/en/api/beta/sessions/update.md new file mode 100644 index 000000000..f84bec474 --- /dev/null +++ b/content/en/api/beta/sessions/update.md @@ -0,0 +1,516 @@ +## Update + +**post** `/v1/sessions/{session_id}` + +Update Session + +### Path Parameters + +- `session_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `metadata: optional map[string]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. + +- `title: optional string` + + Human-readable session title. + +- `vault_ids: optional array of string` + + Vault IDs (`vlt_*`) to attach to the session. Not yet supported; requests setting this field are rejected. Reserved for future use. + +### Returns + +- `BetaManagedAgentsSession = object { id, agent, archived_at, 11 more }` + + A Managed Agents `session`. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `UnionMember1 = string` + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `BetaManagedAgentsAnthropicSkill = object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill = object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `BetaManagedAgentsAgentToolset20260401 = object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset = object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy = object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy = object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool = object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `BetaManagedAgentsGitHubRepositoryResource = object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `BetaManagedAgentsBranchCheckout = object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout = object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource = object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```http +curl https://api.anthropic.com/v1/sessions/$SESSION_ID \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{}' +``` diff --git a/content/en/api/beta/skills.md b/content/en/api/beta/skills.md index 1f0df159b..ed7d5b024 100644 --- a/content/en/api/beta/skills.md +++ b/content/en/api/beta/skills.md @@ -14,7 +14,7 @@ Create Skill - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -58,8 +58,6 @@ Create Skill - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `id: string` @@ -150,7 +148,7 @@ List Skills - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -194,8 +192,6 @@ List Skills - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `data: array of object { id, created_at, display_title, 4 more }` @@ -286,7 +282,7 @@ Get Skill - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -330,8 +326,6 @@ Get Skill - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `id: string` @@ -406,7 +400,7 @@ Delete Skill - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -450,8 +444,6 @@ Delete Skill - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `id: string` @@ -653,7 +645,7 @@ Create Skill Version - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -697,8 +689,6 @@ Create Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `id: string` @@ -789,7 +779,7 @@ List Skill Versions - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -833,8 +823,6 @@ List Skill Versions - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `data: array of object { id, created_at, description, 5 more }` @@ -930,7 +918,7 @@ Get Skill Version - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -974,8 +962,6 @@ Get Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `id: string` @@ -1059,7 +1045,7 @@ Delete Skill Version - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -1103,8 +1089,6 @@ Delete Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `id: string` diff --git a/content/en/api/beta/skills/create.md b/content/en/api/beta/skills/create.md index e8f013249..f88f83b3a 100644 --- a/content/en/api/beta/skills/create.md +++ b/content/en/api/beta/skills/create.md @@ -12,7 +12,7 @@ Create Skill - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -56,8 +56,6 @@ Create Skill - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `id: string` diff --git a/content/en/api/beta/skills/delete.md b/content/en/api/beta/skills/delete.md index 084cbefc1..8b851bfd9 100644 --- a/content/en/api/beta/skills/delete.md +++ b/content/en/api/beta/skills/delete.md @@ -20,7 +20,7 @@ Delete Skill - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -64,8 +64,6 @@ Delete Skill - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `id: string` diff --git a/content/en/api/beta/skills/list.md b/content/en/api/beta/skills/list.md index 29bec9902..cd5d18ba1 100644 --- a/content/en/api/beta/skills/list.md +++ b/content/en/api/beta/skills/list.md @@ -35,7 +35,7 @@ List Skills - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -79,8 +79,6 @@ List Skills - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `data: array of object { id, created_at, display_title, 4 more }` diff --git a/content/en/api/beta/skills/retrieve.md b/content/en/api/beta/skills/retrieve.md index 814464b43..cb9e6b894 100644 --- a/content/en/api/beta/skills/retrieve.md +++ b/content/en/api/beta/skills/retrieve.md @@ -20,7 +20,7 @@ Get Skill - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -64,8 +64,6 @@ Get Skill - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `id: string` diff --git a/content/en/api/beta/skills/versions.md b/content/en/api/beta/skills/versions.md index 7ae4e5869..47a0a8d34 100644 --- a/content/en/api/beta/skills/versions.md +++ b/content/en/api/beta/skills/versions.md @@ -22,7 +22,7 @@ Create Skill Version - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -66,8 +66,6 @@ Create Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `id: string` @@ -158,7 +156,7 @@ List Skill Versions - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -202,8 +200,6 @@ List Skill Versions - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `data: array of object { id, created_at, description, 5 more }` @@ -299,7 +295,7 @@ Get Skill Version - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -343,8 +339,6 @@ Get Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `id: string` @@ -428,7 +422,7 @@ Delete Skill Version - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -472,8 +466,6 @@ Delete Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `id: string` diff --git a/content/en/api/beta/skills/versions/create.md b/content/en/api/beta/skills/versions/create.md index 1fb7211be..78ad908da 100644 --- a/content/en/api/beta/skills/versions/create.md +++ b/content/en/api/beta/skills/versions/create.md @@ -20,7 +20,7 @@ Create Skill Version - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -64,8 +64,6 @@ Create Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `id: string` diff --git a/content/en/api/beta/skills/versions/delete.md b/content/en/api/beta/skills/versions/delete.md index a60aee72e..dc079d54c 100644 --- a/content/en/api/beta/skills/versions/delete.md +++ b/content/en/api/beta/skills/versions/delete.md @@ -26,7 +26,7 @@ Delete Skill Version - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -70,8 +70,6 @@ Delete Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `id: string` diff --git a/content/en/api/beta/skills/versions/list.md b/content/en/api/beta/skills/versions/list.md index bb30a46ab..0d8b01677 100644 --- a/content/en/api/beta/skills/versions/list.md +++ b/content/en/api/beta/skills/versions/list.md @@ -32,7 +32,7 @@ List Skill Versions - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -76,8 +76,6 @@ List Skill Versions - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `data: array of object { id, created_at, description, 5 more }` diff --git a/content/en/api/beta/skills/versions/retrieve.md b/content/en/api/beta/skills/versions/retrieve.md index 8196ae049..09be09718 100644 --- a/content/en/api/beta/skills/versions/retrieve.md +++ b/content/en/api/beta/skills/versions/retrieve.md @@ -26,7 +26,7 @@ Get Skill Version - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -70,8 +70,6 @@ Get Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `id: string` diff --git a/content/en/api/beta/vaults.md b/content/en/api/beta/vaults.md new file mode 100644 index 000000000..96477b6f3 --- /dev/null +++ b/content/en/api/beta/vaults.md @@ -0,0 +1,2597 @@ +# Vaults + +## Create + +**post** `/v1/vaults` + +Create Vault + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `display_name: string` + + Human-readable name for the vault. 1-255 characters. + +- `metadata: optional map[string]` + + Arbitrary key-value metadata to attach to the vault. + +### Returns + +- `BetaManagedAgentsVault = object { id, archived_at, created_at, 4 more }` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```http +curl https://api.anthropic.com/v1/vaults \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "display_name": "Example vault" + }' +``` + +## List + +**get** `/v1/vaults` + +List Vaults + +### Query Parameters + +- `include_archived: optional boolean` + + Whether to include archived vaults in the results. + +- `limit: optional number` + + Maximum number of vaults to return per page. Defaults to 20, maximum 100. + +- `page: optional string` + + Opaque pagination token from a previous `list_vaults` response. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `data: optional array of BetaManagedAgentsVault` + + List of vaults. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +- `next_page: optional string` + + Pagination token for the next page, or null if no more results. + +### Example + +```http +curl https://api.anthropic.com/v1/vaults \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Retrieve + +**get** `/v1/vaults/{vault_id}` + +Get Vault + +### Path Parameters + +- `vault_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsVault = object { id, archived_at, created_at, 4 more }` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Update + +**post** `/v1/vaults/{vault_id}` + +Update Vault + +### Path Parameters + +- `vault_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `display_name: optional string` + + Updated human-readable name for the vault. 1-255 characters. + +- `metadata: optional map[string]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + +### Returns + +- `BetaManagedAgentsVault = object { id, archived_at, created_at, 4 more }` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{}' +``` + +## Delete + +**delete** `/v1/vaults/{vault_id}` + +Delete Vault + +### Path Parameters + +- `vault_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsDeletedVault = object { id, type }` + + Confirmation of a deleted vault. + + - `id: string` + + Unique identifier of the deleted vault. + + - `type: "vault_deleted"` + + - `"vault_deleted"` + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID \ + -X DELETE \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Archive + +**post** `/v1/vaults/{vault_id}/archive` + +Archive Vault + +### Path Parameters + +- `vault_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsVault = object { id, archived_at, created_at, 4 more }` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID/archive \ + -X POST \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Domain Types + +### Beta Managed Agents Deleted Vault + +- `BetaManagedAgentsDeletedVault = object { id, type }` + + Confirmation of a deleted vault. + + - `id: string` + + Unique identifier of the deleted vault. + + - `type: "vault_deleted"` + + - `"vault_deleted"` + +### Beta Managed Agents Vault + +- `BetaManagedAgentsVault = object { id, archived_at, created_at, 4 more }` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +# Credentials + +## Create + +**post** `/v1/vaults/{vault_id}/credentials` + +Create Credential + +### Path Parameters + +- `vault_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `auth: BetaManagedAgentsMCPOAuthCreateParams or BetaManagedAgentsStaticBearerCreateParams` + + Authentication details for creating a credential. + + - `BetaManagedAgentsMCPOAuthCreateParams = object { access_token, mcp_server_url, type, 2 more }` + + Parameters for creating an MCP OAuth credential. + + - `access_token: string` + + OAuth access token. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshParams` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: string` + + OAuth client ID. + + - `refresh_token: string` + + OAuth refresh token. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam or BetaManagedAgentsTokenEndpointAuthBasicParam or BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneParam = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicParam = object { client_secret, type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostParam = object { client_secret, type }` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerCreateParams = object { token, mcp_server_url, type }` + + Parameters for creating a static bearer token credential. + + - `token: string` + + Static bearer token value. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + +- `display_name: optional string` + + Human-readable name for the credential. Up to 255 characters. + +- `metadata: optional map[string]` + + Arbitrary key-value metadata to attach to the credential. + +### Returns + +- `BetaManagedAgentsCredential = object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse = object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse = object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse = object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse = object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID/credentials \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "auth": { + "token": "bearer_exampletoken", + "mcp_server_url": "https://example-server.modelcontextprotocol.io/sse", + "type": "static_bearer" + } + }' +``` + +## List + +**get** `/v1/vaults/{vault_id}/credentials` + +List Credentials + +### Path Parameters + +- `vault_id: string` + +### Query Parameters + +- `include_archived: optional boolean` + + Whether to include archived credentials in the results. + +- `limit: optional number` + + Maximum number of credentials to return per page. Defaults to 20, maximum 100. + +- `page: optional string` + + Opaque pagination token from a previous `list_credentials` response. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `data: optional array of BetaManagedAgentsCredential` + + List of credentials. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse = object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse = object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse = object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse = object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +- `next_page: optional string` + + Pagination token for the next page, or null if no more results. + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID/credentials \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Retrieve + +**get** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Get Credential + +### Path Parameters + +- `vault_id: string` + +- `credential_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsCredential = object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse = object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse = object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse = object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse = object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID/credentials/$CREDENTIAL_ID \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Update + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Update Credential + +### Path Parameters + +- `vault_id: string` + +- `credential_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `auth: optional BetaManagedAgentsMCPOAuthUpdateParams or BetaManagedAgentsStaticBearerUpdateParams` + + Updated authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthUpdateParams = object { type, access_token, expires_at, refresh }` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `access_token: optional string` + + Updated OAuth access token. + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshUpdateParams` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: optional string` + + Updated OAuth refresh token. + + - `scope: optional string` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: optional BetaManagedAgentsTokenEndpointAuthBasicUpdateParam or BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `BetaManagedAgentsTokenEndpointAuthBasicUpdateParam = object { type, client_secret }` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret: optional string` + + Updated OAuth client secret. + + - `BetaManagedAgentsTokenEndpointAuthPostUpdateParam = object { type, client_secret }` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret: optional string` + + Updated OAuth client secret. + + - `BetaManagedAgentsStaticBearerUpdateParams = object { type, token }` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `token: optional string` + + Updated static bearer token value. + +- `display_name: optional string` + + Updated human-readable name for the credential. 1-255 characters. + +- `metadata: optional map[string]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + +### Returns + +- `BetaManagedAgentsCredential = object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse = object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse = object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse = object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse = object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID/credentials/$CREDENTIAL_ID \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{}' +``` + +## Delete + +**delete** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Delete Credential + +### Path Parameters + +- `vault_id: string` + +- `credential_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsDeletedCredential = object { id, type }` + + Confirmation of a deleted credential. + + - `id: string` + + Unique identifier of the deleted credential. + + - `type: "vault_credential_deleted"` + + - `"vault_credential_deleted"` + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID/credentials/$CREDENTIAL_ID \ + -X DELETE \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Archive + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}/archive` + +Archive Credential + +### Path Parameters + +- `vault_id: string` + +- `credential_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsCredential = object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse = object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse = object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse = object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse = object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID/credentials/$CREDENTIAL_ID/archive \ + -X POST \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Domain Types + +### Beta Managed Agents Credential + +- `BetaManagedAgentsCredential = object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse = object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse = object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse = object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse = object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Beta Managed Agents Deleted Credential + +- `BetaManagedAgentsDeletedCredential = object { id, type }` + + Confirmation of a deleted credential. + + - `id: string` + + Unique identifier of the deleted credential. + + - `type: "vault_credential_deleted"` + + - `"vault_credential_deleted"` + +### Beta Managed Agents MCP OAuth Auth Response + +- `BetaManagedAgentsMCPOAuthAuthResponse = object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse = object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse = object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Create Params + +- `BetaManagedAgentsMCPOAuthCreateParams = object { access_token, mcp_server_url, type, 2 more }` + + Parameters for creating an MCP OAuth credential. + + - `access_token: string` + + OAuth access token. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshParams` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: string` + + OAuth client ID. + + - `refresh_token: string` + + OAuth refresh token. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam or BetaManagedAgentsTokenEndpointAuthBasicParam or BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneParam = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicParam = object { client_secret, type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostParam = object { client_secret, type }` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Params + +- `BetaManagedAgentsMCPOAuthRefreshParams = object { client_id, refresh_token, token_endpoint, 3 more }` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: string` + + OAuth client ID. + + - `refresh_token: string` + + OAuth refresh token. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam or BetaManagedAgentsTokenEndpointAuthBasicParam or BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneParam = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicParam = object { client_secret, type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostParam = object { client_secret, type }` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Response + +- `BetaManagedAgentsMCPOAuthRefreshResponse = object { client_id, token_endpoint, token_endpoint_auth, 2 more }` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse = object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse = object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Update Params + +- `BetaManagedAgentsMCPOAuthRefreshUpdateParams = object { refresh_token, scope, token_endpoint_auth }` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: optional string` + + Updated OAuth refresh token. + + - `scope: optional string` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: optional BetaManagedAgentsTokenEndpointAuthBasicUpdateParam or BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `BetaManagedAgentsTokenEndpointAuthBasicUpdateParam = object { type, client_secret }` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret: optional string` + + Updated OAuth client secret. + + - `BetaManagedAgentsTokenEndpointAuthPostUpdateParam = object { type, client_secret }` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret: optional string` + + Updated OAuth client secret. + +### Beta Managed Agents MCP OAuth Update Params + +- `BetaManagedAgentsMCPOAuthUpdateParams = object { type, access_token, expires_at, refresh }` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `access_token: optional string` + + Updated OAuth access token. + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshUpdateParams` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: optional string` + + Updated OAuth refresh token. + + - `scope: optional string` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: optional BetaManagedAgentsTokenEndpointAuthBasicUpdateParam or BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `BetaManagedAgentsTokenEndpointAuthBasicUpdateParam = object { type, client_secret }` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret: optional string` + + Updated OAuth client secret. + + - `BetaManagedAgentsTokenEndpointAuthPostUpdateParam = object { type, client_secret }` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret: optional string` + + Updated OAuth client secret. + +### Beta Managed Agents Static Bearer Auth Response + +- `BetaManagedAgentsStaticBearerAuthResponse = object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + +### Beta Managed Agents Static Bearer Create Params + +- `BetaManagedAgentsStaticBearerCreateParams = object { token, mcp_server_url, type }` + + Parameters for creating a static bearer token credential. + + - `token: string` + + Static bearer token value. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + +### Beta Managed Agents Static Bearer Update Params + +- `BetaManagedAgentsStaticBearerUpdateParams = object { type, token }` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `token: optional string` + + Updated static bearer token value. + +### Beta Managed Agents Token Endpoint Auth Basic Param + +- `BetaManagedAgentsTokenEndpointAuthBasicParam = object { client_secret, type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + +### Beta Managed Agents Token Endpoint Auth Basic Response + +- `BetaManagedAgentsTokenEndpointAuthBasicResponse = object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + +### Beta Managed Agents Token Endpoint Auth Basic Update Param + +- `BetaManagedAgentsTokenEndpointAuthBasicUpdateParam = object { type, client_secret }` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret: optional string` + + Updated OAuth client secret. + +### Beta Managed Agents Token Endpoint Auth None Param + +- `BetaManagedAgentsTokenEndpointAuthNoneParam = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + +### Beta Managed Agents Token Endpoint Auth None Response + +- `BetaManagedAgentsTokenEndpointAuthNoneResponse = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + +### Beta Managed Agents Token Endpoint Auth Post Param + +- `BetaManagedAgentsTokenEndpointAuthPostParam = object { client_secret, type }` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + +### Beta Managed Agents Token Endpoint Auth Post Response + +- `BetaManagedAgentsTokenEndpointAuthPostResponse = object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + +### Beta Managed Agents Token Endpoint Auth Post Update Param + +- `BetaManagedAgentsTokenEndpointAuthPostUpdateParam = object { type, client_secret }` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret: optional string` + + Updated OAuth client secret. diff --git a/content/en/api/beta/vaults/archive.md b/content/en/api/beta/vaults/archive.md new file mode 100644 index 000000000..22a562225 --- /dev/null +++ b/content/en/api/beta/vaults/archive.md @@ -0,0 +1,105 @@ +## Archive + +**post** `/v1/vaults/{vault_id}/archive` + +Archive Vault + +### Path Parameters + +- `vault_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsVault = object { id, archived_at, created_at, 4 more }` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID/archive \ + -X POST \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` diff --git a/content/en/api/beta/vaults/create.md b/content/en/api/beta/vaults/create.md new file mode 100644 index 000000000..a3334d625 --- /dev/null +++ b/content/en/api/beta/vaults/create.md @@ -0,0 +1,114 @@ +## Create + +**post** `/v1/vaults` + +Create Vault + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `display_name: string` + + Human-readable name for the vault. 1-255 characters. + +- `metadata: optional map[string]` + + Arbitrary key-value metadata to attach to the vault. + +### Returns + +- `BetaManagedAgentsVault = object { id, archived_at, created_at, 4 more }` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```http +curl https://api.anthropic.com/v1/vaults \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "display_name": "Example vault" + }' +``` diff --git a/content/en/api/beta/vaults/credentials.md b/content/en/api/beta/vaults/credentials.md new file mode 100644 index 000000000..48789a7ef --- /dev/null +++ b/content/en/api/beta/vaults/credentials.md @@ -0,0 +1,1897 @@ +# Credentials + +## Create + +**post** `/v1/vaults/{vault_id}/credentials` + +Create Credential + +### Path Parameters + +- `vault_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `auth: BetaManagedAgentsMCPOAuthCreateParams or BetaManagedAgentsStaticBearerCreateParams` + + Authentication details for creating a credential. + + - `BetaManagedAgentsMCPOAuthCreateParams = object { access_token, mcp_server_url, type, 2 more }` + + Parameters for creating an MCP OAuth credential. + + - `access_token: string` + + OAuth access token. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshParams` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: string` + + OAuth client ID. + + - `refresh_token: string` + + OAuth refresh token. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam or BetaManagedAgentsTokenEndpointAuthBasicParam or BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneParam = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicParam = object { client_secret, type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostParam = object { client_secret, type }` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerCreateParams = object { token, mcp_server_url, type }` + + Parameters for creating a static bearer token credential. + + - `token: string` + + Static bearer token value. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + +- `display_name: optional string` + + Human-readable name for the credential. Up to 255 characters. + +- `metadata: optional map[string]` + + Arbitrary key-value metadata to attach to the credential. + +### Returns + +- `BetaManagedAgentsCredential = object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse = object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse = object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse = object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse = object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID/credentials \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "auth": { + "token": "bearer_exampletoken", + "mcp_server_url": "https://example-server.modelcontextprotocol.io/sse", + "type": "static_bearer" + } + }' +``` + +## List + +**get** `/v1/vaults/{vault_id}/credentials` + +List Credentials + +### Path Parameters + +- `vault_id: string` + +### Query Parameters + +- `include_archived: optional boolean` + + Whether to include archived credentials in the results. + +- `limit: optional number` + + Maximum number of credentials to return per page. Defaults to 20, maximum 100. + +- `page: optional string` + + Opaque pagination token from a previous `list_credentials` response. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `data: optional array of BetaManagedAgentsCredential` + + List of credentials. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse = object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse = object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse = object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse = object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +- `next_page: optional string` + + Pagination token for the next page, or null if no more results. + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID/credentials \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Retrieve + +**get** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Get Credential + +### Path Parameters + +- `vault_id: string` + +- `credential_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsCredential = object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse = object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse = object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse = object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse = object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID/credentials/$CREDENTIAL_ID \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Update + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Update Credential + +### Path Parameters + +- `vault_id: string` + +- `credential_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `auth: optional BetaManagedAgentsMCPOAuthUpdateParams or BetaManagedAgentsStaticBearerUpdateParams` + + Updated authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthUpdateParams = object { type, access_token, expires_at, refresh }` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `access_token: optional string` + + Updated OAuth access token. + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshUpdateParams` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: optional string` + + Updated OAuth refresh token. + + - `scope: optional string` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: optional BetaManagedAgentsTokenEndpointAuthBasicUpdateParam or BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `BetaManagedAgentsTokenEndpointAuthBasicUpdateParam = object { type, client_secret }` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret: optional string` + + Updated OAuth client secret. + + - `BetaManagedAgentsTokenEndpointAuthPostUpdateParam = object { type, client_secret }` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret: optional string` + + Updated OAuth client secret. + + - `BetaManagedAgentsStaticBearerUpdateParams = object { type, token }` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `token: optional string` + + Updated static bearer token value. + +- `display_name: optional string` + + Updated human-readable name for the credential. 1-255 characters. + +- `metadata: optional map[string]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + +### Returns + +- `BetaManagedAgentsCredential = object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse = object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse = object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse = object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse = object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID/credentials/$CREDENTIAL_ID \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{}' +``` + +## Delete + +**delete** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Delete Credential + +### Path Parameters + +- `vault_id: string` + +- `credential_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsDeletedCredential = object { id, type }` + + Confirmation of a deleted credential. + + - `id: string` + + Unique identifier of the deleted credential. + + - `type: "vault_credential_deleted"` + + - `"vault_credential_deleted"` + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID/credentials/$CREDENTIAL_ID \ + -X DELETE \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Archive + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}/archive` + +Archive Credential + +### Path Parameters + +- `vault_id: string` + +- `credential_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsCredential = object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse = object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse = object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse = object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse = object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID/credentials/$CREDENTIAL_ID/archive \ + -X POST \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` + +## Domain Types + +### Beta Managed Agents Credential + +- `BetaManagedAgentsCredential = object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse = object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse = object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse = object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse = object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Beta Managed Agents Deleted Credential + +- `BetaManagedAgentsDeletedCredential = object { id, type }` + + Confirmation of a deleted credential. + + - `id: string` + + Unique identifier of the deleted credential. + + - `type: "vault_credential_deleted"` + + - `"vault_credential_deleted"` + +### Beta Managed Agents MCP OAuth Auth Response + +- `BetaManagedAgentsMCPOAuthAuthResponse = object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse = object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse = object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Create Params + +- `BetaManagedAgentsMCPOAuthCreateParams = object { access_token, mcp_server_url, type, 2 more }` + + Parameters for creating an MCP OAuth credential. + + - `access_token: string` + + OAuth access token. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshParams` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: string` + + OAuth client ID. + + - `refresh_token: string` + + OAuth refresh token. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam or BetaManagedAgentsTokenEndpointAuthBasicParam or BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneParam = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicParam = object { client_secret, type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostParam = object { client_secret, type }` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Params + +- `BetaManagedAgentsMCPOAuthRefreshParams = object { client_id, refresh_token, token_endpoint, 3 more }` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: string` + + OAuth client ID. + + - `refresh_token: string` + + OAuth refresh token. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam or BetaManagedAgentsTokenEndpointAuthBasicParam or BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneParam = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicParam = object { client_secret, type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostParam = object { client_secret, type }` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Response + +- `BetaManagedAgentsMCPOAuthRefreshResponse = object { client_id, token_endpoint, token_endpoint_auth, 2 more }` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse = object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse = object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Update Params + +- `BetaManagedAgentsMCPOAuthRefreshUpdateParams = object { refresh_token, scope, token_endpoint_auth }` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: optional string` + + Updated OAuth refresh token. + + - `scope: optional string` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: optional BetaManagedAgentsTokenEndpointAuthBasicUpdateParam or BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `BetaManagedAgentsTokenEndpointAuthBasicUpdateParam = object { type, client_secret }` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret: optional string` + + Updated OAuth client secret. + + - `BetaManagedAgentsTokenEndpointAuthPostUpdateParam = object { type, client_secret }` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret: optional string` + + Updated OAuth client secret. + +### Beta Managed Agents MCP OAuth Update Params + +- `BetaManagedAgentsMCPOAuthUpdateParams = object { type, access_token, expires_at, refresh }` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `access_token: optional string` + + Updated OAuth access token. + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshUpdateParams` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: optional string` + + Updated OAuth refresh token. + + - `scope: optional string` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: optional BetaManagedAgentsTokenEndpointAuthBasicUpdateParam or BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `BetaManagedAgentsTokenEndpointAuthBasicUpdateParam = object { type, client_secret }` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret: optional string` + + Updated OAuth client secret. + + - `BetaManagedAgentsTokenEndpointAuthPostUpdateParam = object { type, client_secret }` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret: optional string` + + Updated OAuth client secret. + +### Beta Managed Agents Static Bearer Auth Response + +- `BetaManagedAgentsStaticBearerAuthResponse = object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + +### Beta Managed Agents Static Bearer Create Params + +- `BetaManagedAgentsStaticBearerCreateParams = object { token, mcp_server_url, type }` + + Parameters for creating a static bearer token credential. + + - `token: string` + + Static bearer token value. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + +### Beta Managed Agents Static Bearer Update Params + +- `BetaManagedAgentsStaticBearerUpdateParams = object { type, token }` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `token: optional string` + + Updated static bearer token value. + +### Beta Managed Agents Token Endpoint Auth Basic Param + +- `BetaManagedAgentsTokenEndpointAuthBasicParam = object { client_secret, type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + +### Beta Managed Agents Token Endpoint Auth Basic Response + +- `BetaManagedAgentsTokenEndpointAuthBasicResponse = object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + +### Beta Managed Agents Token Endpoint Auth Basic Update Param + +- `BetaManagedAgentsTokenEndpointAuthBasicUpdateParam = object { type, client_secret }` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret: optional string` + + Updated OAuth client secret. + +### Beta Managed Agents Token Endpoint Auth None Param + +- `BetaManagedAgentsTokenEndpointAuthNoneParam = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + +### Beta Managed Agents Token Endpoint Auth None Response + +- `BetaManagedAgentsTokenEndpointAuthNoneResponse = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + +### Beta Managed Agents Token Endpoint Auth Post Param + +- `BetaManagedAgentsTokenEndpointAuthPostParam = object { client_secret, type }` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + +### Beta Managed Agents Token Endpoint Auth Post Response + +- `BetaManagedAgentsTokenEndpointAuthPostResponse = object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + +### Beta Managed Agents Token Endpoint Auth Post Update Param + +- `BetaManagedAgentsTokenEndpointAuthPostUpdateParam = object { type, client_secret }` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret: optional string` + + Updated OAuth client secret. diff --git a/content/en/api/beta/vaults/credentials/archive.md b/content/en/api/beta/vaults/credentials/archive.md new file mode 100644 index 000000000..976f84290 --- /dev/null +++ b/content/en/api/beta/vaults/credentials/archive.md @@ -0,0 +1,191 @@ +## Archive + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}/archive` + +Archive Credential + +### Path Parameters + +- `vault_id: string` + +- `credential_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsCredential = object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse = object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse = object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse = object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse = object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID/credentials/$CREDENTIAL_ID/archive \ + -X POST \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` diff --git a/content/en/api/beta/vaults/credentials/create.md b/content/en/api/beta/vaults/credentials/create.md new file mode 100644 index 000000000..8d0880a4a --- /dev/null +++ b/content/en/api/beta/vaults/credentials/create.md @@ -0,0 +1,306 @@ +## Create + +**post** `/v1/vaults/{vault_id}/credentials` + +Create Credential + +### Path Parameters + +- `vault_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `auth: BetaManagedAgentsMCPOAuthCreateParams or BetaManagedAgentsStaticBearerCreateParams` + + Authentication details for creating a credential. + + - `BetaManagedAgentsMCPOAuthCreateParams = object { access_token, mcp_server_url, type, 2 more }` + + Parameters for creating an MCP OAuth credential. + + - `access_token: string` + + OAuth access token. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshParams` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: string` + + OAuth client ID. + + - `refresh_token: string` + + OAuth refresh token. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam or BetaManagedAgentsTokenEndpointAuthBasicParam or BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneParam = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicParam = object { client_secret, type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostParam = object { client_secret, type }` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerCreateParams = object { token, mcp_server_url, type }` + + Parameters for creating a static bearer token credential. + + - `token: string` + + Static bearer token value. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + +- `display_name: optional string` + + Human-readable name for the credential. Up to 255 characters. + +- `metadata: optional map[string]` + + Arbitrary key-value metadata to attach to the credential. + +### Returns + +- `BetaManagedAgentsCredential = object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse = object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse = object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse = object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse = object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID/credentials \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{ + "auth": { + "token": "bearer_exampletoken", + "mcp_server_url": "https://example-server.modelcontextprotocol.io/sse", + "type": "static_bearer" + } + }' +``` diff --git a/content/en/api/beta/vaults/credentials/delete.md b/content/en/api/beta/vaults/credentials/delete.md new file mode 100644 index 000000000..dd3cfe65e --- /dev/null +++ b/content/en/api/beta/vaults/credentials/delete.md @@ -0,0 +1,87 @@ +## Delete + +**delete** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Delete Credential + +### Path Parameters + +- `vault_id: string` + +- `credential_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsDeletedCredential = object { id, type }` + + Confirmation of a deleted credential. + + - `id: string` + + Unique identifier of the deleted credential. + + - `type: "vault_credential_deleted"` + + - `"vault_credential_deleted"` + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID/credentials/$CREDENTIAL_ID \ + -X DELETE \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` diff --git a/content/en/api/beta/vaults/credentials/list.md b/content/en/api/beta/vaults/credentials/list.md new file mode 100644 index 000000000..9ded3b361 --- /dev/null +++ b/content/en/api/beta/vaults/credentials/list.md @@ -0,0 +1,206 @@ +## List + +**get** `/v1/vaults/{vault_id}/credentials` + +List Credentials + +### Path Parameters + +- `vault_id: string` + +### Query Parameters + +- `include_archived: optional boolean` + + Whether to include archived credentials in the results. + +- `limit: optional number` + + Maximum number of credentials to return per page. Defaults to 20, maximum 100. + +- `page: optional string` + + Opaque pagination token from a previous `list_credentials` response. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `data: optional array of BetaManagedAgentsCredential` + + List of credentials. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse = object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse = object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse = object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse = object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +- `next_page: optional string` + + Pagination token for the next page, or null if no more results. + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID/credentials \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` diff --git a/content/en/api/beta/vaults/credentials/retrieve.md b/content/en/api/beta/vaults/credentials/retrieve.md new file mode 100644 index 000000000..f7481b119 --- /dev/null +++ b/content/en/api/beta/vaults/credentials/retrieve.md @@ -0,0 +1,190 @@ +## Retrieve + +**get** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Get Credential + +### Path Parameters + +- `vault_id: string` + +- `credential_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsCredential = object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse = object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse = object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse = object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse = object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID/credentials/$CREDENTIAL_ID \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` diff --git a/content/en/api/beta/vaults/credentials/update.md b/content/en/api/beta/vaults/credentials/update.md new file mode 100644 index 000000000..5dff6f795 --- /dev/null +++ b/content/en/api/beta/vaults/credentials/update.md @@ -0,0 +1,274 @@ +## Update + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Update Credential + +### Path Parameters + +- `vault_id: string` + +- `credential_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `auth: optional BetaManagedAgentsMCPOAuthUpdateParams or BetaManagedAgentsStaticBearerUpdateParams` + + Updated authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthUpdateParams = object { type, access_token, expires_at, refresh }` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `access_token: optional string` + + Updated OAuth access token. + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshUpdateParams` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: optional string` + + Updated OAuth refresh token. + + - `scope: optional string` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: optional BetaManagedAgentsTokenEndpointAuthBasicUpdateParam or BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `BetaManagedAgentsTokenEndpointAuthBasicUpdateParam = object { type, client_secret }` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret: optional string` + + Updated OAuth client secret. + + - `BetaManagedAgentsTokenEndpointAuthPostUpdateParam = object { type, client_secret }` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret: optional string` + + Updated OAuth client secret. + + - `BetaManagedAgentsStaticBearerUpdateParams = object { type, token }` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `token: optional string` + + Updated static bearer token value. + +- `display_name: optional string` + + Updated human-readable name for the credential. 1-255 characters. + +- `metadata: optional map[string]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + +### Returns + +- `BetaManagedAgentsCredential = object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse = object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse = object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse = object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse = object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse = object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID/credentials/$CREDENTIAL_ID \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{}' +``` diff --git a/content/en/api/beta/vaults/delete.md b/content/en/api/beta/vaults/delete.md new file mode 100644 index 000000000..0ad52d27c --- /dev/null +++ b/content/en/api/beta/vaults/delete.md @@ -0,0 +1,85 @@ +## Delete + +**delete** `/v1/vaults/{vault_id}` + +Delete Vault + +### Path Parameters + +- `vault_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsDeletedVault = object { id, type }` + + Confirmation of a deleted vault. + + - `id: string` + + Unique identifier of the deleted vault. + + - `type: "vault_deleted"` + + - `"vault_deleted"` + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID \ + -X DELETE \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` diff --git a/content/en/api/beta/vaults/list.md b/content/en/api/beta/vaults/list.md new file mode 100644 index 000000000..8467026b6 --- /dev/null +++ b/content/en/api/beta/vaults/list.md @@ -0,0 +1,118 @@ +## List + +**get** `/v1/vaults` + +List Vaults + +### Query Parameters + +- `include_archived: optional boolean` + + Whether to include archived vaults in the results. + +- `limit: optional number` + + Maximum number of vaults to return per page. Defaults to 20, maximum 100. + +- `page: optional string` + + Opaque pagination token from a previous `list_vaults` response. + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `data: optional array of BetaManagedAgentsVault` + + List of vaults. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +- `next_page: optional string` + + Pagination token for the next page, or null if no more results. + +### Example + +```http +curl https://api.anthropic.com/v1/vaults \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` diff --git a/content/en/api/beta/vaults/retrieve.md b/content/en/api/beta/vaults/retrieve.md new file mode 100644 index 000000000..1ea0c7298 --- /dev/null +++ b/content/en/api/beta/vaults/retrieve.md @@ -0,0 +1,104 @@ +## Retrieve + +**get** `/v1/vaults/{vault_id}` + +Get Vault + +### Path Parameters + +- `vault_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsVault = object { id, archived_at, created_at, 4 more }` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" +``` diff --git a/content/en/api/beta/vaults/update.md b/content/en/api/beta/vaults/update.md new file mode 100644 index 000000000..1c81005c8 --- /dev/null +++ b/content/en/api/beta/vaults/update.md @@ -0,0 +1,116 @@ +## Update + +**post** `/v1/vaults/{vault_id}` + +Update Vault + +### Path Parameters + +- `vault_id: string` + +### Header Parameters + +- `"anthropic-beta": optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + + - `UnionMember0 = string` + + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Body Parameters + +- `display_name: optional string` + + Updated human-readable name for the vault. 1-255 characters. + +- `metadata: optional map[string]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + +### Returns + +- `BetaManagedAgentsVault = object { id, archived_at, created_at, 4 more }` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```http +curl https://api.anthropic.com/v1/vaults/$VAULT_ID \ + -H 'Content-Type: application/json' \ + -H 'anthropic-version: 2023-06-01' \ + -H 'anthropic-beta: managed-agents-2026-04-01' \ + -H "X-Api-Key: $ANTHROPIC_API_KEY" \ + -d '{}' +``` diff --git a/content/en/api/cli/beta.md b/content/en/api/cli/beta.md index 91ff456cc..49789ce5a 100644 --- a/content/en/api/cli/beta.md +++ b/content/en/api/cli/beta.md @@ -1 +1,47814 @@ -Not Found - Claude API Docs
    \ No newline at end of file +# Beta + +## Domain Types + +### Beta API Error + +- `beta_api_error: object { message, type }` + + - `message: string` + + - `type: "api_error"` + +### Beta Authentication Error + +- `beta_authentication_error: object { message, type }` + + - `message: string` + + - `type: "authentication_error"` + +### Beta Billing Error + +- `beta_billing_error: object { message, type }` + + - `message: string` + + - `type: "billing_error"` + +### Beta Error + +- `beta_error: BetaInvalidRequestError or BetaAuthenticationError or BetaBillingError or 6 more` + + - `beta_invalid_request_error: object { message, type }` + + - `message: string` + + - `type: "invalid_request_error"` + + - `beta_authentication_error: object { message, type }` + + - `message: string` + + - `type: "authentication_error"` + + - `beta_billing_error: object { message, type }` + + - `message: string` + + - `type: "billing_error"` + + - `beta_permission_error: object { message, type }` + + - `message: string` + + - `type: "permission_error"` + + - `beta_not_found_error: object { message, type }` + + - `message: string` + + - `type: "not_found_error"` + + - `beta_rate_limit_error: object { message, type }` + + - `message: string` + + - `type: "rate_limit_error"` + + - `beta_gateway_timeout_error: object { message, type }` + + - `message: string` + + - `type: "timeout_error"` + + - `beta_api_error: object { message, type }` + + - `message: string` + + - `type: "api_error"` + + - `beta_overloaded_error: object { message, type }` + + - `message: string` + + - `type: "overloaded_error"` + +### Beta Error Response + +- `beta_error_response: object { error, request_id, type }` + + - `error: BetaInvalidRequestError or BetaAuthenticationError or BetaBillingError or 6 more` + + - `beta_invalid_request_error: object { message, type }` + + - `message: string` + + - `type: "invalid_request_error"` + + - `beta_authentication_error: object { message, type }` + + - `message: string` + + - `type: "authentication_error"` + + - `beta_billing_error: object { message, type }` + + - `message: string` + + - `type: "billing_error"` + + - `beta_permission_error: object { message, type }` + + - `message: string` + + - `type: "permission_error"` + + - `beta_not_found_error: object { message, type }` + + - `message: string` + + - `type: "not_found_error"` + + - `beta_rate_limit_error: object { message, type }` + + - `message: string` + + - `type: "rate_limit_error"` + + - `beta_gateway_timeout_error: object { message, type }` + + - `message: string` + + - `type: "timeout_error"` + + - `beta_api_error: object { message, type }` + + - `message: string` + + - `type: "api_error"` + + - `beta_overloaded_error: object { message, type }` + + - `message: string` + + - `type: "overloaded_error"` + + - `request_id: string` + + - `type: "error"` + +### Beta Gateway Timeout Error + +- `beta_gateway_timeout_error: object { message, type }` + + - `message: string` + + - `type: "timeout_error"` + +### Beta Invalid Request Error + +- `beta_invalid_request_error: object { message, type }` + + - `message: string` + + - `type: "invalid_request_error"` + +### Beta Not Found Error + +- `beta_not_found_error: object { message, type }` + + - `message: string` + + - `type: "not_found_error"` + +### Beta Overloaded Error + +- `beta_overloaded_error: object { message, type }` + + - `message: string` + + - `type: "overloaded_error"` + +### Beta Permission Error + +- `beta_permission_error: object { message, type }` + + - `message: string` + + - `type: "permission_error"` + +### Beta Rate Limit Error + +- `beta_rate_limit_error: object { message, type }` + + - `message: string` + + - `type: "rate_limit_error"` + +# Models + +## List + +`$ ant beta:models list` + +**get** `/v1/models` + +List available models. + +The Models API response can be used to determine which models are available for use in the API. More recently released models are listed first. + +### Parameters + +- `--after-id: optional string` + + Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object. + +- `--before-id: optional string` + + Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object. + +- `--limit: optional number` + + Query param: Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaListResponse_ModelInfo_: object { data, first_id, has_more, last_id }` + + - `data: array of BetaModelInfo` + + - `id: string` + + Unique model identifier. + + - `capabilities: object { batch, citations, code_execution, 6 more }` + + Model capability information. + + - `batch: object { supported }` + + Whether the model supports the Batch API. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `citations: object { supported }` + + Whether the model supports citation generation. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `code_execution: object { supported }` + + Whether the model supports code execution tools. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `context_management: object { clear_thinking_20251015, clear_tool_uses_20250919, compact_20260112, supported }` + + Context management support and available strategies. + + - `clear_thinking_20251015: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `clear_tool_uses_20250919: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `compact_20260112: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `effort: object { high, low, max, 2 more }` + + Effort (reasoning_effort) support and available levels. + + - `high: object { supported }` + + Whether the model supports high effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `low: object { supported }` + + Whether the model supports low effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `max: object { supported }` + + Whether the model supports max effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `medium: object { supported }` + + Whether the model supports medium effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `image_input: object { supported }` + + Whether the model accepts image content blocks. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `pdf_input: object { supported }` + + Whether the model accepts PDF content blocks. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `structured_outputs: object { supported }` + + Whether the model supports structured output / JSON mode / strict tool schemas. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `thinking: object { supported, types }` + + Thinking capability and supported type configurations. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `types: object { adaptive, enabled }` + + Supported thinking type configurations. + + - `adaptive: object { supported }` + + Whether the model supports thinking with type 'adaptive' (auto). + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `enabled: object { supported }` + + Whether the model supports thinking with type 'enabled'. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown. + + - `display_name: string` + + A human-readable name for the model. + + - `max_input_tokens: number` + + Maximum input context window size in tokens for this model. + + - `max_tokens: number` + + Maximum value for the `max_tokens` parameter when using this model. + + - `type: "model"` + + Object type. + + For Models, this is always `"model"`. + + - `first_id: string` + + First ID in the `data` list. Can be used as the `before_id` for the previous page. + + - `has_more: boolean` + + Indicates if there are more results in the requested page direction. + + - `last_id: string` + + Last ID in the `data` list. Can be used as the `after_id` for the next page. + +### Example + +```cli +ant beta:models list \ + --api-key my-anthropic-api-key +``` + +## Retrieve + +`$ ant beta:models retrieve` + +**get** `/v1/models/{model_id}` + +Get a specific model. + +The Models API response can be used to determine information about a specific model or resolve a model alias to a model ID. + +### Parameters + +- `--model-id: string` + + Model identifier or alias. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_model_info: object { id, capabilities, created_at, 4 more }` + + - `id: string` + + Unique model identifier. + + - `capabilities: object { batch, citations, code_execution, 6 more }` + + Model capability information. + + - `batch: object { supported }` + + Whether the model supports the Batch API. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `citations: object { supported }` + + Whether the model supports citation generation. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `code_execution: object { supported }` + + Whether the model supports code execution tools. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `context_management: object { clear_thinking_20251015, clear_tool_uses_20250919, compact_20260112, supported }` + + Context management support and available strategies. + + - `clear_thinking_20251015: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `clear_tool_uses_20250919: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `compact_20260112: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `effort: object { high, low, max, 2 more }` + + Effort (reasoning_effort) support and available levels. + + - `high: object { supported }` + + Whether the model supports high effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `low: object { supported }` + + Whether the model supports low effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `max: object { supported }` + + Whether the model supports max effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `medium: object { supported }` + + Whether the model supports medium effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `image_input: object { supported }` + + Whether the model accepts image content blocks. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `pdf_input: object { supported }` + + Whether the model accepts PDF content blocks. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `structured_outputs: object { supported }` + + Whether the model supports structured output / JSON mode / strict tool schemas. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `thinking: object { supported, types }` + + Thinking capability and supported type configurations. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `types: object { adaptive, enabled }` + + Supported thinking type configurations. + + - `adaptive: object { supported }` + + Whether the model supports thinking with type 'adaptive' (auto). + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `enabled: object { supported }` + + Whether the model supports thinking with type 'enabled'. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown. + + - `display_name: string` + + A human-readable name for the model. + + - `max_input_tokens: number` + + Maximum input context window size in tokens for this model. + + - `max_tokens: number` + + Maximum value for the `max_tokens` parameter when using this model. + + - `type: "model"` + + Object type. + + For Models, this is always `"model"`. + +### Example + +```cli +ant beta:models retrieve \ + --api-key my-anthropic-api-key \ + --model-id model_id +``` + +## Domain Types + +### Beta Capability Support + +- `beta_capability_support: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + +### Beta Context Management Capability + +- `beta_context_management_capability: object { clear_thinking_20251015, clear_tool_uses_20250919, compact_20260112, supported }` + + Context management capability details. + + - `clear_thinking_20251015: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `clear_tool_uses_20250919: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `compact_20260112: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + +### Beta Effort Capability + +- `beta_effort_capability: object { high, low, max, 2 more }` + + Effort (reasoning_effort) capability details. + + - `high: object { supported }` + + Whether the model supports high effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `low: object { supported }` + + Whether the model supports low effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `max: object { supported }` + + Whether the model supports max effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `medium: object { supported }` + + Whether the model supports medium effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + +### Beta Model Capabilities + +- `beta_model_capabilities: object { batch, citations, code_execution, 6 more }` + + Model capability information. + + - `batch: object { supported }` + + Whether the model supports the Batch API. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `citations: object { supported }` + + Whether the model supports citation generation. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `code_execution: object { supported }` + + Whether the model supports code execution tools. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `context_management: object { clear_thinking_20251015, clear_tool_uses_20250919, compact_20260112, supported }` + + Context management support and available strategies. + + - `clear_thinking_20251015: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `clear_tool_uses_20250919: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `compact_20260112: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `effort: object { high, low, max, 2 more }` + + Effort (reasoning_effort) support and available levels. + + - `high: object { supported }` + + Whether the model supports high effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `low: object { supported }` + + Whether the model supports low effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `max: object { supported }` + + Whether the model supports max effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `medium: object { supported }` + + Whether the model supports medium effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `image_input: object { supported }` + + Whether the model accepts image content blocks. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `pdf_input: object { supported }` + + Whether the model accepts PDF content blocks. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `structured_outputs: object { supported }` + + Whether the model supports structured output / JSON mode / strict tool schemas. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `thinking: object { supported, types }` + + Thinking capability and supported type configurations. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `types: object { adaptive, enabled }` + + Supported thinking type configurations. + + - `adaptive: object { supported }` + + Whether the model supports thinking with type 'adaptive' (auto). + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `enabled: object { supported }` + + Whether the model supports thinking with type 'enabled'. + + - `supported: boolean` + + Whether this capability is supported by the model. + +### Beta Model Info + +- `beta_model_info: object { id, capabilities, created_at, 4 more }` + + - `id: string` + + Unique model identifier. + + - `capabilities: object { batch, citations, code_execution, 6 more }` + + Model capability information. + + - `batch: object { supported }` + + Whether the model supports the Batch API. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `citations: object { supported }` + + Whether the model supports citation generation. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `code_execution: object { supported }` + + Whether the model supports code execution tools. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `context_management: object { clear_thinking_20251015, clear_tool_uses_20250919, compact_20260112, supported }` + + Context management support and available strategies. + + - `clear_thinking_20251015: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `clear_tool_uses_20250919: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `compact_20260112: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `effort: object { high, low, max, 2 more }` + + Effort (reasoning_effort) support and available levels. + + - `high: object { supported }` + + Whether the model supports high effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `low: object { supported }` + + Whether the model supports low effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `max: object { supported }` + + Whether the model supports max effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `medium: object { supported }` + + Whether the model supports medium effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `image_input: object { supported }` + + Whether the model accepts image content blocks. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `pdf_input: object { supported }` + + Whether the model accepts PDF content blocks. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `structured_outputs: object { supported }` + + Whether the model supports structured output / JSON mode / strict tool schemas. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `thinking: object { supported, types }` + + Thinking capability and supported type configurations. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `types: object { adaptive, enabled }` + + Supported thinking type configurations. + + - `adaptive: object { supported }` + + Whether the model supports thinking with type 'adaptive' (auto). + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `enabled: object { supported }` + + Whether the model supports thinking with type 'enabled'. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown. + + - `display_name: string` + + A human-readable name for the model. + + - `max_input_tokens: number` + + Maximum input context window size in tokens for this model. + + - `max_tokens: number` + + Maximum value for the `max_tokens` parameter when using this model. + + - `type: "model"` + + Object type. + + For Models, this is always `"model"`. + +### Beta Thinking Capability + +- `beta_thinking_capability: object { supported, types }` + + Thinking capability details. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `types: object { adaptive, enabled }` + + Supported thinking type configurations. + + - `adaptive: object { supported }` + + Whether the model supports thinking with type 'adaptive' (auto). + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `enabled: object { supported }` + + Whether the model supports thinking with type 'enabled'. + + - `supported: boolean` + + Whether this capability is supported by the model. + +### Beta Thinking Types + +- `beta_thinking_types: object { adaptive, enabled }` + + Supported thinking type configurations. + + - `adaptive: object { supported }` + + Whether the model supports thinking with type 'adaptive' (auto). + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `enabled: object { supported }` + + Whether the model supports thinking with type 'enabled'. + + - `supported: boolean` + + Whether this capability is supported by the model. + +# Messages + +## Create + +`$ ant beta:messages create` + +**post** `/v1/messages` + +Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation. + +The Messages API can be used for either single queries or stateless multi-turn conversations. + +Learn more about the Messages API in our [user guide](https://docs.claude.com/en/docs/initial-setup) + +### Parameters + +- `--max-tokens: number` + + Body param: The maximum number of tokens to generate before stopping. + + Note that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate. + + Different models have different maximum values for this parameter. See [models](https://docs.claude.com/en/docs/models-overview) for details. + +- `--message: array of BetaMessageParam` + + Body param: Input messages. + + Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn. + + Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages. + + If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response. + + Example with a single `user` message: + + ```json + [{"role": "user", "content": "Hello, Claude"}] + ``` + + Example with multiple conversational turns: + + ```json + [ + {"role": "user", "content": "Hello there."}, + {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"}, + {"role": "user", "content": "Can you explain LLMs in plain English?"}, + ] + ``` + + Example with a partially-filled response from Claude: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("}, + ] + ``` + + Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent: + + ```json + {"role": "user", "content": "Hello, Claude"} + ``` + + ```json + {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]} + ``` + + See [input examples](https://docs.claude.com/en/api/messages-examples). + + Note that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. + + There is a limit of 100,000 messages in a single request. + +- `--model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + Body param: The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + +- `--cache-control: optional object { type, ttl }` + + Body param: Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request. + +- `--container: optional BetaContainerParams or string` + + Body param: Container identifier for reuse across requests. + +- `--context-management: optional object { edits }` + + Body param: Context management configuration. + + This allows you to control how Claude manages context across multiple requests, such as whether to clear function results or not. + +- `--inference-geo: optional string` + + Body param: Specifies the geographic region for inference processing. If not specified, the workspace's `default_inference_geo` is used. + +- `--mcp-server: optional array of BetaRequestMCPServerURLDefinition` + + Body param: MCP servers to be utilized in this request + +- `--metadata: optional object { user_id }` + + Body param: An object describing metadata about the request. + +- `--output-config: optional object { effort, format }` + + Body param: Configuration options for the model's output, such as the output format. + +- `--output-format: optional object { schema, type }` + + Body param: Deprecated: Use `output_config.format` instead. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) + + A schema to specify Claude's output format in responses. This parameter will be removed in a future release. + +- `--service-tier: optional "auto" or "standard_only"` + + Body param: Determines whether to use priority capacity (if available) or standard capacity for this request. + + Anthropic offers different levels of service for your API requests. See [service-tiers](https://docs.claude.com/en/api/service-tiers) for details. + +- `--speed: optional "standard" or "fast"` + + Body param: The inference speed mode for this request. `"fast"` enables high output-tokens-per-second inference. + +- `--stop-sequence: optional array of string` + + Body param: Custom text sequences that will cause the model to stop generating. + + Our models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `"end_turn"`. + + If you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `"stop_sequence"` and the response `stop_sequence` value will contain the matched stop sequence. + +- `--system: optional string or array of BetaTextBlockParam` + + Body param: System prompt. + + A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts). + +- `--temperature: optional number` + + Body param: Amount of randomness injected into the response. + + Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks. + + Note that even with `temperature` of `0.0`, the results will not be fully deterministic. + +- `--thinking: optional BetaThinkingConfigEnabled or BetaThinkingConfigDisabled or BetaThinkingConfigAdaptive` + + Body param: Configuration for enabling Claude's extended thinking. + + When enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit. + + See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details. + +- `--tool-choice: optional BetaToolChoiceAuto or BetaToolChoiceAny or BetaToolChoiceTool or BetaToolChoiceNone` + + Body param: How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all. + +- `--tool: optional array of BetaToolUnion` + + Body param: Definitions of tools that the model may use. + + If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks. + + There are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)). + + Each tool definition includes: + + * `name`: Name of the tool. + * `description`: Optional, but strongly-recommended description of the tool. + * `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks. + + For example, if you defined `tools` as: + + ```json + [ + { + "name": "get_stock_price", + "description": "Get the current stock price for a given ticker symbol.", + "input_schema": { + "type": "object", + "properties": { + "ticker": { + "type": "string", + "description": "The stock ticker symbol, e.g. AAPL for Apple Inc." + } + }, + "required": ["ticker"] + } + } + ] + ``` + + And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this: + + ```json + [ + { + "type": "tool_use", + "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "name": "get_stock_price", + "input": { "ticker": "^GSPC" } + } + ] + ``` + + You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message: + + ```json + [ + { + "type": "tool_result", + "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "content": "259.75 USD" + } + ] + ``` + + Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output. + + See our [guide](https://docs.claude.com/en/docs/tool-use) for more details. + +- `--top-k: optional number` + + Body param: Only sample from the top K options for each subsequent token. + + Used to remove "long tail" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277). + + Recommended for advanced use cases only. You usually only need to use `temperature`. + +- `--top-p: optional number` + + Body param: Use nucleus sampling. + + In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both. + + Recommended for advanced use cases only. You usually only need to use `temperature`. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_message: object { id, container, content, 8 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at, skills }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `skills: array of BetaSkill` + + Skills loaded in the container + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: string` + + Skill version or 'latest' for most recent version + + - `content: array of BetaContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `beta_text_block: object { citations, text, type }` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `beta_thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `beta_redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `beta_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_server_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_search_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebSearchToolResultError or array of BetaWebSearchResultBlock` + + - `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of BetaWebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_fetch_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock` + + - `beta_web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaCodeExecutionToolResultError or BetaCodeExecutionResultBlock or BetaEncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `beta_bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock` + + - `beta_bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `beta_text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock` + + - `beta_text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `beta_text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `beta_text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `beta_tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock` + + - `beta_tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `beta_mcp_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + The name of the MCP tool + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `beta_mcp_tool_result_block: object { content, is_error, tool_use_id, type }` + + - `content: string or array of BetaTextBlock` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_content: array of BetaTextBlock` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `is_error: boolean` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `beta_container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `beta_compaction_block: object { content, type }` + + A compaction block returned when autocompact is triggered. + + When content is None, it indicates the compaction failed to produce a valid + summary (e.g., malformed output from the model). Clients may round-trip + compaction blocks with null content; the server treats them as no-ops. + + - `content: string` + + Summary of compacted content, or null if compaction failed + + - `type: "compaction"` + + - `context_management: object { applied_edits }` + + Context management response. + + Information about context management strategies applied during the request. + + - `applied_edits: array of BetaClearToolUses20250919EditResponse or BetaClearThinking20251015EditResponse` + + List of context management edits that were applied. + + - `beta_clear_tool_uses_20250919_edit_response: object { cleared_input_tokens, cleared_tool_uses, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_tool_uses: number` + + Number of tool uses that were cleared. + + - `type: "clear_tool_uses_20250919"` + + The type of context management edit applied. + + - `beta_clear_thinking_20251015_edit_response: object { cleared_input_tokens, cleared_thinking_turns, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_thinking_turns: number` + + Number of thinking turns that were cleared. + + - `type: "clear_thinking_20251015"` + + The type of context management edit applied. + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 5 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"compaction"` + + - `"refusal"` + + - `"model_context_window_exceeded"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 7 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `iterations: array of BetaMessageIterationUsage or BetaCompactionIterationUsage` + + Per-iteration token usage breakdown. + + Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + + - Determine which iterations exceeded long context thresholds (>=200k tokens) + - Calculate the true context window size from the last iteration + - Understand token accumulation across server-side tool use loops + + - `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + + - `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `speed: "standard" or "fast"` + + The inference speed mode used for this request. + + - `"standard"` + + - `"fast"` + +### Example + +```cli +ant beta:messages create \ + --api-key my-anthropic-api-key \ + --max-tokens 1024 \ + --message '{content: [{text: x, type: text}], role: user}' \ + --model claude-opus-4-6 +``` + +## Count Tokens + +`$ ant beta:messages count-tokens` + +**post** `/v1/messages/count_tokens` + +Count the number of tokens in a Message. + +The Token Count API can be used to count the number of tokens in a Message, including tools, images, and documents, without creating it. + +Learn more about token counting in our [user guide](https://docs.claude.com/en/docs/build-with-claude/token-counting) + +### Parameters + +- `--message: array of BetaMessageParam` + + Body param: Input messages. + + Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn. + + Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages. + + If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response. + + Example with a single `user` message: + + ```json + [{"role": "user", "content": "Hello, Claude"}] + ``` + + Example with multiple conversational turns: + + ```json + [ + {"role": "user", "content": "Hello there."}, + {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"}, + {"role": "user", "content": "Can you explain LLMs in plain English?"}, + ] + ``` + + Example with a partially-filled response from Claude: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("}, + ] + ``` + + Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent: + + ```json + {"role": "user", "content": "Hello, Claude"} + ``` + + ```json + {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]} + ``` + + See [input examples](https://docs.claude.com/en/api/messages-examples). + + Note that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. + + There is a limit of 100,000 messages in a single request. + +- `--model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + Body param: The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + +- `--cache-control: optional object { type, ttl }` + + Body param: Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request. + +- `--context-management: optional object { edits }` + + Body param: Context management configuration. + + This allows you to control how Claude manages context across multiple requests, such as whether to clear function results or not. + +- `--mcp-server: optional array of BetaRequestMCPServerURLDefinition` + + Body param: MCP servers to be utilized in this request + +- `--output-config: optional object { effort, format }` + + Body param: Configuration options for the model's output, such as the output format. + +- `--output-format: optional object { schema, type }` + + Body param: Deprecated: Use `output_config.format` instead. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) + + A schema to specify Claude's output format in responses. This parameter will be removed in a future release. + +- `--speed: optional "standard" or "fast"` + + Body param: The inference speed mode for this request. `"fast"` enables high output-tokens-per-second inference. + +- `--system: optional string or array of BetaTextBlockParam` + + Body param: System prompt. + + A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts). + +- `--thinking: optional BetaThinkingConfigEnabled or BetaThinkingConfigDisabled or BetaThinkingConfigAdaptive` + + Body param: Configuration for enabling Claude's extended thinking. + + When enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit. + + See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details. + +- `--tool-choice: optional BetaToolChoiceAuto or BetaToolChoiceAny or BetaToolChoiceTool or BetaToolChoiceNone` + + Body param: How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all. + +- `--tool: optional array of BetaTool or BetaToolBash20241022 or BetaToolBash20250124 or 19 more` + + Body param: Definitions of tools that the model may use. + + If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks. + + There are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)). + + Each tool definition includes: + + * `name`: Name of the tool. + * `description`: Optional, but strongly-recommended description of the tool. + * `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks. + + For example, if you defined `tools` as: + + ```json + [ + { + "name": "get_stock_price", + "description": "Get the current stock price for a given ticker symbol.", + "input_schema": { + "type": "object", + "properties": { + "ticker": { + "type": "string", + "description": "The stock ticker symbol, e.g. AAPL for Apple Inc." + } + }, + "required": ["ticker"] + } + } + ] + ``` + + And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this: + + ```json + [ + { + "type": "tool_use", + "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "name": "get_stock_price", + "input": { "ticker": "^GSPC" } + } + ] + ``` + + You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message: + + ```json + [ + { + "type": "tool_result", + "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "content": "259.75 USD" + } + ] + ``` + + Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output. + + See our [guide](https://docs.claude.com/en/docs/tool-use) for more details. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_message_tokens_count: object { context_management, input_tokens }` + + - `context_management: object { original_input_tokens }` + + Information about context management applied to the message. + + - `original_input_tokens: number` + + The original token count before context management was applied + + - `input_tokens: number` + + The total number of tokens across the provided list of messages, system prompt, and tools. + +### Example + +```cli +ant beta:messages count-tokens \ + --api-key my-anthropic-api-key \ + --message '{content: [{text: x, type: text}], role: user}' \ + --model claude-mythos-preview +``` + +## Domain Types + +### Beta All Thinking Turns + +- `beta_all_thinking_turns: object { type }` + + - `type: "all"` + +### Beta Base64 Image Source + +- `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + +### Beta Base64 PDF Source + +- `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + +### Beta Bash Code Execution Output Block + +- `beta_bash_code_execution_output_block: object { file_id, type }` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + +### Beta Bash Code Execution Output Block Param + +- `beta_bash_code_execution_output_block_param: object { file_id, type }` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + +### Beta Bash Code Execution Result Block + +- `beta_bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + +### Beta Bash Code Execution Result Block Param + +- `beta_bash_code_execution_result_block_param: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + +### Beta Bash Code Execution Tool Result Block + +- `beta_bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock` + + - `beta_bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + +### Beta Bash Code Execution Tool Result Block Param + +- `beta_bash_code_execution_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: BetaBashCodeExecutionToolResultErrorParam or BetaBashCodeExecutionResultBlockParam` + + - `beta_bash_code_execution_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block_param: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Beta Bash Code Execution Tool Result Error + +- `beta_bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + +### Beta Bash Code Execution Tool Result Error Param + +- `beta_bash_code_execution_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + +### Beta Cache Control Ephemeral + +- `beta_cache_control_ephemeral: object { type, ttl }` + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Beta Cache Creation + +- `beta_cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + +### Beta Citation Char Location + +- `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + +### Beta Citation Char Location Param + +- `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + +### Beta Citation Config + +- `beta_citation_config: object { enabled }` + + - `enabled: boolean` + +### Beta Citation Content Block Location + +- `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + +### Beta Citation Content Block Location Param + +- `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + +### Beta Citation Page Location + +- `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + +### Beta Citation Page Location Param + +- `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + +### Beta Citation Search Result Location + +- `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + +### Beta Citation Search Result Location Param + +- `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + +### Beta Citation Web Search Result Location Param + +- `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + +### Beta Citations Config Param + +- `beta_citations_config_param: object { enabled }` + + - `enabled: optional boolean` + +### Beta Citations Delta + +- `beta_citations_delta: object { citation, type }` + + - `citation: BetaCitationCharLocation or BetaCitationPageLocation or BetaCitationContentBlockLocation or 2 more` + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `type: "citations_delta"` + +### Beta Citations Web Search Result Location + +- `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + +### Beta Clear Thinking 20251015 Edit + +- `beta_clear_thinking_20251015_edit: object { type, keep }` + + - `type: "clear_thinking_20251015"` + + - `keep: optional BetaThinkingTurns or BetaAllThinkingTurns or "all"` + + Number of most recent assistant turns to keep thinking blocks for. Older turns will have their thinking blocks removed. + + - `beta_thinking_turns: object { type, value }` + + - `type: "thinking_turns"` + + - `value: number` + + - `beta_all_thinking_turns: object { type }` + + - `type: "all"` + + - `union_member_2: "all"` + +### Beta Clear Thinking 20251015 Edit Response + +- `beta_clear_thinking_20251015_edit_response: object { cleared_input_tokens, cleared_thinking_turns, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_thinking_turns: number` + + Number of thinking turns that were cleared. + + - `type: "clear_thinking_20251015"` + + The type of context management edit applied. + +### Beta Clear Tool Uses 20250919 Edit + +- `beta_clear_tool_uses_20250919_edit: object { type, clear_at_least, clear_tool_inputs, 3 more }` + + - `type: "clear_tool_uses_20250919"` + + - `clear_at_least: optional object { type, value }` + + Minimum number of tokens that must be cleared when triggered. Context will only be modified if at least this many tokens can be removed. + + - `type: "input_tokens"` + + - `value: number` + + - `clear_tool_inputs: optional boolean or array of string` + + Whether to clear all tool inputs (bool) or specific tool inputs to clear (list) + + - `union_member_0: boolean` + + - `union_member_1: array of string` + + - `exclude_tools: optional array of string` + + Tool names whose uses are preserved from clearing + + - `keep: optional object { type, value }` + + Number of tool uses to retain in the conversation + + - `type: "tool_uses"` + + - `value: number` + + - `trigger: optional BetaInputTokensTrigger or BetaToolUsesTrigger` + + Condition that triggers the context management strategy + + - `beta_input_tokens_trigger: object { type, value }` + + - `type: "input_tokens"` + + - `value: number` + + - `beta_tool_uses_trigger: object { type, value }` + + - `type: "tool_uses"` + + - `value: number` + +### Beta Clear Tool Uses 20250919 Edit Response + +- `beta_clear_tool_uses_20250919_edit_response: object { cleared_input_tokens, cleared_tool_uses, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_tool_uses: number` + + Number of tool uses that were cleared. + + - `type: "clear_tool_uses_20250919"` + + The type of context management edit applied. + +### Beta Code Execution Output Block + +- `beta_code_execution_output_block: object { file_id, type }` + + - `file_id: string` + + - `type: "code_execution_output"` + +### Beta Code Execution Output Block Param + +- `beta_code_execution_output_block_param: object { file_id, type }` + + - `file_id: string` + + - `type: "code_execution_output"` + +### Beta Code Execution Result Block + +- `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + +### Beta Code Execution Result Block Param + +- `beta_code_execution_result_block_param: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + +### Beta Code Execution Tool 20250522 + +- `beta_code_execution_tool_20250522: object { name, type, allowed_callers, 3 more }` + + - `name: "code_execution"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "code_execution_20250522"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Code Execution Tool 20250825 + +- `beta_code_execution_tool_20250825: object { name, type, allowed_callers, 3 more }` + + - `name: "code_execution"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "code_execution_20250825"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Code Execution Tool 20260120 + +- `beta_code_execution_tool_20260120: object { name, type, allowed_callers, 3 more }` + + Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint). + + - `name: "code_execution"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "code_execution_20260120"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Code Execution Tool Result Block + +- `beta_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaCodeExecutionToolResultError or BetaCodeExecutionResultBlock or BetaEncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + +### Beta Code Execution Tool Result Block Content + +- `beta_code_execution_tool_result_block_content: BetaCodeExecutionToolResultError or BetaCodeExecutionResultBlock or BetaEncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + +### Beta Code Execution Tool Result Block Param + +- `beta_code_execution_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: BetaCodeExecutionToolResultErrorParam or BetaCodeExecutionResultBlockParam or BetaEncryptedCodeExecutionResultBlockParam` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block_param: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block_param: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Beta Code Execution Tool Result Block Param Content + +- `beta_code_execution_tool_result_block_param_content: BetaCodeExecutionToolResultErrorParam or BetaCodeExecutionResultBlockParam or BetaEncryptedCodeExecutionResultBlockParam` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block_param: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block_param: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + +### Beta Code Execution Tool Result Error + +- `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + +### Beta Code Execution Tool Result Error Code + +- `beta_code_execution_tool_result_error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + +### Beta Code Execution Tool Result Error Param + +- `beta_code_execution_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + +### Beta Compact 20260112 Edit + +- `beta_compact_20260112_edit: object { type, instructions, pause_after_compaction, trigger }` + + Automatically compact older context when reaching the configured trigger threshold. + + - `type: "compact_20260112"` + + - `instructions: optional string` + + Additional instructions for summarization. + + - `pause_after_compaction: optional boolean` + + Whether to pause after compaction and return the compaction block to the user. + + - `trigger: optional object { type, value }` + + When to trigger compaction. Defaults to 150000 input tokens. + + - `type: "input_tokens"` + + - `value: number` + +### Beta Compaction Block + +- `beta_compaction_block: object { content, type }` + + A compaction block returned when autocompact is triggered. + + When content is None, it indicates the compaction failed to produce a valid + summary (e.g., malformed output from the model). Clients may round-trip + compaction blocks with null content; the server treats them as no-ops. + + - `content: string` + + Summary of compacted content, or null if compaction failed + + - `type: "compaction"` + +### Beta Compaction Block Param + +- `beta_compaction_block_param: object { content, type, cache_control }` + + A compaction block containing summary of previous context. + + Users should round-trip these blocks from responses to subsequent requests + to maintain context across compaction boundaries. + + When content is None, the block represents a failed compaction. The server + treats these as no-ops. Empty string content is not allowed. + + - `content: string` + + Summary of previously compacted content, or null if compaction failed + + - `type: "compaction"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Beta Compaction Content Block Delta + +- `beta_compaction_content_block_delta: object { content, type }` + + - `content: string` + + - `type: "compaction_delta"` + +### Beta Compaction Iteration Usage + +- `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + +### Beta Container + +- `beta_container: object { id, expires_at, skills }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `skills: array of BetaSkill` + + Skills loaded in the container + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: string` + + Skill version or 'latest' for most recent version + +### Beta Container Params + +- `beta_container_params: object { id, skills }` + + Container parameters with skills to be loaded. + + - `id: optional string` + + Container id + + - `skills: optional array of BetaSkillParams` + + List of skills to load in the container + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: optional string` + + Skill version or 'latest' for most recent version + +### Beta Container Upload Block + +- `beta_container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + +### Beta Container Upload Block Param + +- `beta_container_upload_block_param: object { file_id, type, cache_control }` + + A content block that represents a file to be uploaded to the container + Files uploaded via this block will be available in the container's input directory. + + - `file_id: string` + + - `type: "container_upload"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Beta Content Block + +- `beta_content_block: BetaTextBlock or BetaThinkingBlock or BetaRedactedThinkingBlock or 12 more` + + Response model for a file uploaded to the container. + + - `beta_text_block: object { citations, text, type }` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `beta_thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `beta_redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `beta_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_server_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_search_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebSearchToolResultError or array of BetaWebSearchResultBlock` + + - `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of BetaWebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_fetch_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock` + + - `beta_web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaCodeExecutionToolResultError or BetaCodeExecutionResultBlock or BetaEncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `beta_bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock` + + - `beta_bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `beta_text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock` + + - `beta_text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `beta_text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `beta_text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `beta_tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock` + + - `beta_tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `beta_mcp_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + The name of the MCP tool + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `beta_mcp_tool_result_block: object { content, is_error, tool_use_id, type }` + + - `content: string or array of BetaTextBlock` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_content: array of BetaTextBlock` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `is_error: boolean` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `beta_container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `beta_compaction_block: object { content, type }` + + A compaction block returned when autocompact is triggered. + + When content is None, it indicates the compaction failed to produce a valid + summary (e.g., malformed output from the model). Clients may round-trip + compaction blocks with null content; the server treats them as no-ops. + + - `content: string` + + Summary of compacted content, or null if compaction failed + + - `type: "compaction"` + +### Beta Content Block Param + +- `beta_content_block_param: BetaTextBlockParam or BetaImageBlockParam or BetaRequestDocumentBlock or 16 more` + + Regular text content. + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_request_document_block: object { source, type, cache_control, 3 more }` + + - `source: BetaBase64PDFSource or BetaPlainTextSource or BetaContentBlockSource or 2 more` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `beta_content_block_source: object { content, type }` + + - `content: string or array of BetaContentBlockSourceContent` + + - `union_member_0: string` + + - `beta_content_block_source_content: array of BetaContentBlockSourceContent` + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "content"` + + - `beta_url_pdf_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_document_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "document"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `context: optional string` + + - `title: optional string` + + - `beta_search_result_block_param: object { content, source, title, 3 more }` + + - `content: array of BetaTextBlockParam` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `source: string` + + - `title: string` + + - `type: "search_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `beta_thinking_block_param: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `beta_redacted_thinking_block_param: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `beta_tool_use_block_param: object { id, input, name, 3 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_tool_result_block_param: object { tool_use_id, type, cache_control, 2 more }` + + - `tool_use_id: string` + + - `type: "tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `content: optional array of BetaTextBlockParam or BetaImageBlockParam or BetaSearchResultBlockParam or 2 more` + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_search_result_block_param: object { content, source, title, 3 more }` + + - `content: array of BetaTextBlockParam` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `source: string` + + - `title: string` + + - `type: "search_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `beta_request_document_block: object { source, type, cache_control, 3 more }` + + - `source: BetaBase64PDFSource or BetaPlainTextSource or BetaContentBlockSource or 2 more` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `beta_content_block_source: object { content, type }` + + - `content: string or array of BetaContentBlockSourceContent` + + - `union_member_0: string` + + - `beta_content_block_source_content: array of BetaContentBlockSourceContent` + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "content"` + + - `beta_url_pdf_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_document_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "document"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `context: optional string` + + - `title: optional string` + + - `beta_tool_reference_block_param: object { tool_name, type, cache_control }` + + Tool reference block that can be included in tool_result content. + + - `tool_name: string` + + - `type: "tool_reference"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `is_error: optional boolean` + + - `beta_server_tool_use_block_param: object { id, input, name, 3 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_search_tool_result_block_param: object { content, tool_use_id, type, 2 more }` + + - `content: array of BetaWebSearchResultBlockParam or BetaWebSearchToolRequestError` + + - `Result Block: array of BetaWebSearchResultBlockParam` + + - `encrypted_content: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `page_age: optional string` + + - `beta_web_search_tool_request_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_fetch_tool_result_block_param: object { content, tool_use_id, type, 2 more }` + + - `content: BetaWebFetchToolResultErrorBlockParam or BetaWebFetchBlockParam` + + - `beta_web_fetch_tool_result_error_block_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block_param: object { content, type, url, retrieved_at }` + + - `content: object { source, type, cache_control, 3 more }` + + - `source: BetaBase64PDFSource or BetaPlainTextSource or BetaContentBlockSource or 2 more` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `beta_content_block_source: object { content, type }` + + - `content: string or array of BetaContentBlockSourceContent` + + - `union_member_0: string` + + - `beta_content_block_source_content: array of BetaContentBlockSourceContent` + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "content"` + + - `beta_url_pdf_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_document_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "document"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `context: optional string` + + - `title: optional string` + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `retrieved_at: optional string` + + ISO 8601 timestamp when the content was retrieved + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_code_execution_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: BetaCodeExecutionToolResultErrorParam or BetaCodeExecutionResultBlockParam or BetaEncryptedCodeExecutionResultBlockParam` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block_param: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block_param: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_bash_code_execution_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: BetaBashCodeExecutionToolResultErrorParam or BetaBashCodeExecutionResultBlockParam` + + - `beta_bash_code_execution_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block_param: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_text_editor_code_execution_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: BetaTextEditorCodeExecutionToolResultErrorParam or BetaTextEditorCodeExecutionViewResultBlockParam or BetaTextEditorCodeExecutionCreateResultBlockParam or BetaTextEditorCodeExecutionStrReplaceResultBlockParam` + + - `beta_text_editor_code_execution_tool_result_error_param: object { error_code, type, error_message }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `error_message: optional string` + + - `beta_text_editor_code_execution_view_result_block_param: object { content, file_type, type, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `type: "text_editor_code_execution_view_result"` + + - `num_lines: optional number` + + - `start_line: optional number` + + - `total_lines: optional number` + + - `beta_text_editor_code_execution_create_result_block_param: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block_param: object { type, lines, new_lines, 3 more }` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `lines: optional array of string` + + - `new_lines: optional number` + + - `new_start: optional number` + + - `old_lines: optional number` + + - `old_start: optional number` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_tool_search_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: BetaToolSearchToolResultErrorParam or BetaToolSearchToolSearchResultBlockParam` + + - `beta_tool_search_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block_param: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlockParam` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_mcp_tool_use_block_param: object { id, input, name, 3 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_request_mcp_tool_result_block_param: object { tool_use_id, type, cache_control, 2 more }` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `content: optional string or array of BetaTextBlockParam` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_param_content: array of BetaTextBlockParam` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `is_error: optional boolean` + + - `beta_container_upload_block_param: object { file_id, type, cache_control }` + + A content block that represents a file to be uploaded to the container + Files uploaded via this block will be available in the container's input directory. + + - `file_id: string` + + - `type: "container_upload"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_compaction_block_param: object { content, type, cache_control }` + + A compaction block containing summary of previous context. + + Users should round-trip these blocks from responses to subsequent requests + to maintain context across compaction boundaries. + + When content is None, the block represents a failed compaction. The server + treats these as no-ops. Empty string content is not allowed. + + - `content: string` + + Summary of previously compacted content, or null if compaction failed + + - `type: "compaction"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Beta Content Block Source + +- `beta_content_block_source: object { content, type }` + + - `content: string or array of BetaContentBlockSourceContent` + + - `union_member_0: string` + + - `beta_content_block_source_content: array of BetaContentBlockSourceContent` + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "content"` + +### Beta Content Block Source Content + +- `beta_content_block_source_content: BetaTextBlockParam or BetaImageBlockParam` + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Beta Context Management Config + +- `beta_context_management_config: object { edits }` + + - `edits: optional array of BetaClearToolUses20250919Edit or BetaClearThinking20251015Edit or BetaCompact20260112Edit` + + List of context management edits to apply + + - `beta_clear_tool_uses_20250919_edit: object { type, clear_at_least, clear_tool_inputs, 3 more }` + + - `type: "clear_tool_uses_20250919"` + + - `clear_at_least: optional object { type, value }` + + Minimum number of tokens that must be cleared when triggered. Context will only be modified if at least this many tokens can be removed. + + - `type: "input_tokens"` + + - `value: number` + + - `clear_tool_inputs: optional boolean or array of string` + + Whether to clear all tool inputs (bool) or specific tool inputs to clear (list) + + - `union_member_0: boolean` + + - `union_member_1: array of string` + + - `exclude_tools: optional array of string` + + Tool names whose uses are preserved from clearing + + - `keep: optional object { type, value }` + + Number of tool uses to retain in the conversation + + - `type: "tool_uses"` + + - `value: number` + + - `trigger: optional BetaInputTokensTrigger or BetaToolUsesTrigger` + + Condition that triggers the context management strategy + + - `beta_input_tokens_trigger: object { type, value }` + + - `type: "input_tokens"` + + - `value: number` + + - `beta_tool_uses_trigger: object { type, value }` + + - `type: "tool_uses"` + + - `value: number` + + - `beta_clear_thinking_20251015_edit: object { type, keep }` + + - `type: "clear_thinking_20251015"` + + - `keep: optional BetaThinkingTurns or BetaAllThinkingTurns or "all"` + + Number of most recent assistant turns to keep thinking blocks for. Older turns will have their thinking blocks removed. + + - `beta_thinking_turns: object { type, value }` + + - `type: "thinking_turns"` + + - `value: number` + + - `beta_all_thinking_turns: object { type }` + + - `type: "all"` + + - `union_member_2: "all"` + + - `beta_compact_20260112_edit: object { type, instructions, pause_after_compaction, trigger }` + + Automatically compact older context when reaching the configured trigger threshold. + + - `type: "compact_20260112"` + + - `instructions: optional string` + + Additional instructions for summarization. + + - `pause_after_compaction: optional boolean` + + Whether to pause after compaction and return the compaction block to the user. + + - `trigger: optional object { type, value }` + + When to trigger compaction. Defaults to 150000 input tokens. + + - `type: "input_tokens"` + + - `value: number` + +### Beta Context Management Response + +- `beta_context_management_response: object { applied_edits }` + + - `applied_edits: array of BetaClearToolUses20250919EditResponse or BetaClearThinking20251015EditResponse` + + List of context management edits that were applied. + + - `beta_clear_tool_uses_20250919_edit_response: object { cleared_input_tokens, cleared_tool_uses, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_tool_uses: number` + + Number of tool uses that were cleared. + + - `type: "clear_tool_uses_20250919"` + + The type of context management edit applied. + + - `beta_clear_thinking_20251015_edit_response: object { cleared_input_tokens, cleared_thinking_turns, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_thinking_turns: number` + + Number of thinking turns that were cleared. + + - `type: "clear_thinking_20251015"` + + The type of context management edit applied. + +### Beta Count Tokens Context Management Response + +- `beta_count_tokens_context_management_response: object { original_input_tokens }` + + - `original_input_tokens: number` + + The original token count before context management was applied + +### Beta Direct Caller + +- `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + +### Beta Document Block + +- `beta_document_block: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + +### Beta Encrypted Code Execution Result Block + +- `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + +### Beta Encrypted Code Execution Result Block Param + +- `beta_encrypted_code_execution_result_block_param: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + +### Beta File Document Source + +- `beta_file_document_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + +### Beta File Image Source + +- `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + +### Beta Image Block Param + +- `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Beta Input JSON Delta + +- `beta_input_json_delta: object { partial_json, type }` + + - `partial_json: string` + + - `type: "input_json_delta"` + +### Beta Input Tokens Clear At Least + +- `beta_input_tokens_clear_at_least: object { type, value }` + + - `type: "input_tokens"` + + - `value: number` + +### Beta Input Tokens Trigger + +- `beta_input_tokens_trigger: object { type, value }` + + - `type: "input_tokens"` + + - `value: number` + +### Beta Iterations Usage + +- `beta_iterations_usage: array of BetaMessageIterationUsage or BetaCompactionIterationUsage` + + Per-iteration token usage breakdown. + + Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + + - Determine which iterations exceeded long context thresholds (>=200k tokens) + - Calculate the true context window size from the last iteration + - Understand token accumulation across server-side tool use loops + + - `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + + - `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + +### Beta JSON Output Format + +- `beta_json_output_format: object { schema, type }` + + - `schema: map[unknown]` + + The JSON schema of the format + + - `type: "json_schema"` + +### Beta MCP Tool Config + +- `beta_mcp_tool_config: object { defer_loading, enabled }` + + Configuration for a specific tool in an MCP toolset. + + - `defer_loading: optional boolean` + + - `enabled: optional boolean` + +### Beta MCP Tool Default Config + +- `beta_mcp_tool_default_config: object { defer_loading, enabled }` + + Default configuration for tools in an MCP toolset. + + - `defer_loading: optional boolean` + + - `enabled: optional boolean` + +### Beta MCP Tool Result Block + +- `beta_mcp_tool_result_block: object { content, is_error, tool_use_id, type }` + + - `content: string or array of BetaTextBlock` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_content: array of BetaTextBlock` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `is_error: boolean` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + +### Beta MCP Tool Use Block + +- `beta_mcp_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + The name of the MCP tool + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + +### Beta MCP Tool Use Block Param + +- `beta_mcp_tool_use_block_param: object { id, input, name, 3 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Beta MCP Toolset + +- `beta_mcp_toolset: object { mcp_server_name, type, cache_control, 2 more }` + + Configuration for a group of tools from an MCP server. + + Allows configuring enabled status and defer_loading for all tools + from an MCP server, with optional per-tool overrides. + + - `mcp_server_name: string` + + Name of the MCP server to configure tools for + + - `type: "mcp_toolset"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `configs: optional map[BetaMCPToolConfig]` + + Configuration overrides for specific tools, keyed by tool name + + - `defer_loading: optional boolean` + + - `enabled: optional boolean` + + - `default_config: optional object { defer_loading, enabled }` + + Default configuration applied to all tools from this server + + - `defer_loading: optional boolean` + + - `enabled: optional boolean` + +### Beta Memory Tool 20250818 + +- `beta_memory_tool_20250818: object { name, type, allowed_callers, 4 more }` + + - `name: "memory"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "memory_20250818"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Memory Tool 20250818 Command + +- `beta_memory_tool_20250818_command: BetaMemoryTool20250818ViewCommand or BetaMemoryTool20250818CreateCommand or BetaMemoryTool20250818StrReplaceCommand or 3 more` + + - `beta_memory_tool_20250818_view_command: object { command, path, view_range }` + + - `command: "view"` + + Command type identifier + + - `path: string` + + Path to directory or file to view + + - `view_range: optional array of number` + + Optional line range for viewing specific lines + + - `beta_memory_tool_20250818_create_command: object { command, file_text, path }` + + - `command: "create"` + + Command type identifier + + - `file_text: string` + + Content to write to the file + + - `path: string` + + Path where the file should be created + + - `beta_memory_tool_20250818_str_replace_command: object { command, new_str, old_str, path }` + + - `command: "str_replace"` + + Command type identifier + + - `new_str: string` + + Text to replace with + + - `old_str: string` + + Text to search for and replace + + - `path: string` + + Path to the file where text should be replaced + + - `beta_memory_tool_20250818_insert_command: object { command, insert_line, insert_text, path }` + + - `command: "insert"` + + Command type identifier + + - `insert_line: number` + + Line number where text should be inserted + + - `insert_text: string` + + Text to insert at the specified line + + - `path: string` + + Path to the file where text should be inserted + + - `beta_memory_tool_20250818_delete_command: object { command, path }` + + - `command: "delete"` + + Command type identifier + + - `path: string` + + Path to the file or directory to delete + + - `beta_memory_tool_20250818_rename_command: object { command, new_path, old_path }` + + - `command: "rename"` + + Command type identifier + + - `new_path: string` + + New path for the file or directory + + - `old_path: string` + + Current path of the file or directory + +### Beta Memory Tool 20250818 Create Command + +- `beta_memory_tool_20250818_create_command: object { command, file_text, path }` + + - `command: "create"` + + Command type identifier + + - `file_text: string` + + Content to write to the file + + - `path: string` + + Path where the file should be created + +### Beta Memory Tool 20250818 Delete Command + +- `beta_memory_tool_20250818_delete_command: object { command, path }` + + - `command: "delete"` + + Command type identifier + + - `path: string` + + Path to the file or directory to delete + +### Beta Memory Tool 20250818 Insert Command + +- `beta_memory_tool_20250818_insert_command: object { command, insert_line, insert_text, path }` + + - `command: "insert"` + + Command type identifier + + - `insert_line: number` + + Line number where text should be inserted + + - `insert_text: string` + + Text to insert at the specified line + + - `path: string` + + Path to the file where text should be inserted + +### Beta Memory Tool 20250818 Rename Command + +- `beta_memory_tool_20250818_rename_command: object { command, new_path, old_path }` + + - `command: "rename"` + + Command type identifier + + - `new_path: string` + + New path for the file or directory + + - `old_path: string` + + Current path of the file or directory + +### Beta Memory Tool 20250818 Str Replace Command + +- `beta_memory_tool_20250818_str_replace_command: object { command, new_str, old_str, path }` + + - `command: "str_replace"` + + Command type identifier + + - `new_str: string` + + Text to replace with + + - `old_str: string` + + Text to search for and replace + + - `path: string` + + Path to the file where text should be replaced + +### Beta Memory Tool 20250818 View Command + +- `beta_memory_tool_20250818_view_command: object { command, path, view_range }` + + - `command: "view"` + + Command type identifier + + - `path: string` + + Path to directory or file to view + + - `view_range: optional array of number` + + Optional line range for viewing specific lines + +### Beta Message + +- `beta_message: object { id, container, content, 8 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at, skills }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `skills: array of BetaSkill` + + Skills loaded in the container + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: string` + + Skill version or 'latest' for most recent version + + - `content: array of BetaContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `beta_text_block: object { citations, text, type }` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `beta_thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `beta_redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `beta_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_server_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_search_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebSearchToolResultError or array of BetaWebSearchResultBlock` + + - `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of BetaWebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_fetch_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock` + + - `beta_web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaCodeExecutionToolResultError or BetaCodeExecutionResultBlock or BetaEncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `beta_bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock` + + - `beta_bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `beta_text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock` + + - `beta_text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `beta_text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `beta_text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `beta_tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock` + + - `beta_tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `beta_mcp_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + The name of the MCP tool + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `beta_mcp_tool_result_block: object { content, is_error, tool_use_id, type }` + + - `content: string or array of BetaTextBlock` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_content: array of BetaTextBlock` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `is_error: boolean` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `beta_container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `beta_compaction_block: object { content, type }` + + A compaction block returned when autocompact is triggered. + + When content is None, it indicates the compaction failed to produce a valid + summary (e.g., malformed output from the model). Clients may round-trip + compaction blocks with null content; the server treats them as no-ops. + + - `content: string` + + Summary of compacted content, or null if compaction failed + + - `type: "compaction"` + + - `context_management: object { applied_edits }` + + Context management response. + + Information about context management strategies applied during the request. + + - `applied_edits: array of BetaClearToolUses20250919EditResponse or BetaClearThinking20251015EditResponse` + + List of context management edits that were applied. + + - `beta_clear_tool_uses_20250919_edit_response: object { cleared_input_tokens, cleared_tool_uses, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_tool_uses: number` + + Number of tool uses that were cleared. + + - `type: "clear_tool_uses_20250919"` + + The type of context management edit applied. + + - `beta_clear_thinking_20251015_edit_response: object { cleared_input_tokens, cleared_thinking_turns, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_thinking_turns: number` + + Number of thinking turns that were cleared. + + - `type: "clear_thinking_20251015"` + + The type of context management edit applied. + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 5 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"compaction"` + + - `"refusal"` + + - `"model_context_window_exceeded"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 7 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `iterations: array of BetaMessageIterationUsage or BetaCompactionIterationUsage` + + Per-iteration token usage breakdown. + + Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + + - Determine which iterations exceeded long context thresholds (>=200k tokens) + - Calculate the true context window size from the last iteration + - Understand token accumulation across server-side tool use loops + + - `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + + - `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `speed: "standard" or "fast"` + + The inference speed mode used for this request. + + - `"standard"` + + - `"fast"` + +### Beta Message Delta Usage + +- `beta_message_delta_usage: object { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 3 more }` + + - `cache_creation_input_tokens: number` + + The cumulative number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The cumulative number of input tokens read from the cache. + + - `input_tokens: number` + + The cumulative number of input tokens which were used. + + - `iterations: array of BetaMessageIterationUsage or BetaCompactionIterationUsage` + + Per-iteration token usage breakdown. + + Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + + - Determine which iterations exceeded long context thresholds (>=200k tokens) + - Calculate the true context window size from the last iteration + - Understand token accumulation across server-side tool use loops + + - `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + + - `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + + - `output_tokens: number` + + The cumulative number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + +### Beta Message Iteration Usage + +- `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + +### Beta Message Param + +- `beta_message_param: object { content, role }` + + - `content: array of BetaContentBlockParam` + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_request_document_block: object { source, type, cache_control, 3 more }` + + - `source: BetaBase64PDFSource or BetaPlainTextSource or BetaContentBlockSource or 2 more` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `beta_content_block_source: object { content, type }` + + - `content: string or array of BetaContentBlockSourceContent` + + - `union_member_0: string` + + - `beta_content_block_source_content: array of BetaContentBlockSourceContent` + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "content"` + + - `beta_url_pdf_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_document_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "document"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `context: optional string` + + - `title: optional string` + + - `beta_search_result_block_param: object { content, source, title, 3 more }` + + - `content: array of BetaTextBlockParam` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `source: string` + + - `title: string` + + - `type: "search_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `beta_thinking_block_param: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `beta_redacted_thinking_block_param: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `beta_tool_use_block_param: object { id, input, name, 3 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_tool_result_block_param: object { tool_use_id, type, cache_control, 2 more }` + + - `tool_use_id: string` + + - `type: "tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `content: optional array of BetaTextBlockParam or BetaImageBlockParam or BetaSearchResultBlockParam or 2 more` + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_search_result_block_param: object { content, source, title, 3 more }` + + - `content: array of BetaTextBlockParam` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `source: string` + + - `title: string` + + - `type: "search_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `beta_request_document_block: object { source, type, cache_control, 3 more }` + + - `source: BetaBase64PDFSource or BetaPlainTextSource or BetaContentBlockSource or 2 more` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `beta_content_block_source: object { content, type }` + + - `content: string or array of BetaContentBlockSourceContent` + + - `union_member_0: string` + + - `beta_content_block_source_content: array of BetaContentBlockSourceContent` + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "content"` + + - `beta_url_pdf_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_document_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "document"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `context: optional string` + + - `title: optional string` + + - `beta_tool_reference_block_param: object { tool_name, type, cache_control }` + + Tool reference block that can be included in tool_result content. + + - `tool_name: string` + + - `type: "tool_reference"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `is_error: optional boolean` + + - `beta_server_tool_use_block_param: object { id, input, name, 3 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_search_tool_result_block_param: object { content, tool_use_id, type, 2 more }` + + - `content: array of BetaWebSearchResultBlockParam or BetaWebSearchToolRequestError` + + - `Result Block: array of BetaWebSearchResultBlockParam` + + - `encrypted_content: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `page_age: optional string` + + - `beta_web_search_tool_request_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_fetch_tool_result_block_param: object { content, tool_use_id, type, 2 more }` + + - `content: BetaWebFetchToolResultErrorBlockParam or BetaWebFetchBlockParam` + + - `beta_web_fetch_tool_result_error_block_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block_param: object { content, type, url, retrieved_at }` + + - `content: object { source, type, cache_control, 3 more }` + + - `source: BetaBase64PDFSource or BetaPlainTextSource or BetaContentBlockSource or 2 more` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `beta_content_block_source: object { content, type }` + + - `content: string or array of BetaContentBlockSourceContent` + + - `union_member_0: string` + + - `beta_content_block_source_content: array of BetaContentBlockSourceContent` + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "content"` + + - `beta_url_pdf_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_document_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "document"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `context: optional string` + + - `title: optional string` + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `retrieved_at: optional string` + + ISO 8601 timestamp when the content was retrieved + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_code_execution_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: BetaCodeExecutionToolResultErrorParam or BetaCodeExecutionResultBlockParam or BetaEncryptedCodeExecutionResultBlockParam` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block_param: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block_param: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_bash_code_execution_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: BetaBashCodeExecutionToolResultErrorParam or BetaBashCodeExecutionResultBlockParam` + + - `beta_bash_code_execution_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block_param: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_text_editor_code_execution_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: BetaTextEditorCodeExecutionToolResultErrorParam or BetaTextEditorCodeExecutionViewResultBlockParam or BetaTextEditorCodeExecutionCreateResultBlockParam or BetaTextEditorCodeExecutionStrReplaceResultBlockParam` + + - `beta_text_editor_code_execution_tool_result_error_param: object { error_code, type, error_message }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `error_message: optional string` + + - `beta_text_editor_code_execution_view_result_block_param: object { content, file_type, type, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `type: "text_editor_code_execution_view_result"` + + - `num_lines: optional number` + + - `start_line: optional number` + + - `total_lines: optional number` + + - `beta_text_editor_code_execution_create_result_block_param: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block_param: object { type, lines, new_lines, 3 more }` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `lines: optional array of string` + + - `new_lines: optional number` + + - `new_start: optional number` + + - `old_lines: optional number` + + - `old_start: optional number` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_tool_search_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: BetaToolSearchToolResultErrorParam or BetaToolSearchToolSearchResultBlockParam` + + - `beta_tool_search_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block_param: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlockParam` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_mcp_tool_use_block_param: object { id, input, name, 3 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_request_mcp_tool_result_block_param: object { tool_use_id, type, cache_control, 2 more }` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `content: optional string or array of BetaTextBlockParam` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_param_content: array of BetaTextBlockParam` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `is_error: optional boolean` + + - `beta_container_upload_block_param: object { file_id, type, cache_control }` + + A content block that represents a file to be uploaded to the container + Files uploaded via this block will be available in the container's input directory. + + - `file_id: string` + + - `type: "container_upload"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_compaction_block_param: object { content, type, cache_control }` + + A compaction block containing summary of previous context. + + Users should round-trip these blocks from responses to subsequent requests + to maintain context across compaction boundaries. + + When content is None, the block represents a failed compaction. The server + treats these as no-ops. Empty string content is not allowed. + + - `content: string` + + Summary of previously compacted content, or null if compaction failed + + - `type: "compaction"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `role: "user" or "assistant"` + + - `"user"` + + - `"assistant"` + +### Beta Message Tokens Count + +- `beta_message_tokens_count: object { context_management, input_tokens }` + + - `context_management: object { original_input_tokens }` + + Information about context management applied to the message. + + - `original_input_tokens: number` + + The original token count before context management was applied + + - `input_tokens: number` + + The total number of tokens across the provided list of messages, system prompt, and tools. + +### Beta Metadata + +- `beta_metadata: object { user_id }` + + - `user_id: optional string` + + An external identifier for the user who is associated with the request. + + This should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number. + +### Beta Output Config + +- `beta_output_config: object { effort, format }` + + - `effort: optional "low" or "medium" or "high" or "max"` + + All possible effort levels. + + - `"low"` + + - `"medium"` + + - `"high"` + + - `"max"` + + - `format: optional object { schema, type }` + + A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) + + - `schema: map[unknown]` + + The JSON schema of the format + + - `type: "json_schema"` + +### Beta Plain Text Source + +- `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + +### Beta Raw Content Block Delta + +- `beta_raw_content_block_delta: BetaTextDelta or BetaInputJSONDelta or BetaCitationsDelta or 3 more` + + - `beta_text_delta: object { text, type }` + + - `text: string` + + - `type: "text_delta"` + + - `beta_input_json_delta: object { partial_json, type }` + + - `partial_json: string` + + - `type: "input_json_delta"` + + - `beta_citations_delta: object { citation, type }` + + - `citation: BetaCitationCharLocation or BetaCitationPageLocation or BetaCitationContentBlockLocation or 2 more` + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `type: "citations_delta"` + + - `beta_thinking_delta: object { thinking, type }` + + - `thinking: string` + + - `type: "thinking_delta"` + + - `beta_signature_delta: object { signature, type }` + + - `signature: string` + + - `type: "signature_delta"` + + - `beta_compaction_content_block_delta: object { content, type }` + + - `content: string` + + - `type: "compaction_delta"` + +### Beta Raw Content Block Delta Event + +- `beta_raw_content_block_delta_event: object { delta, index, type }` + + - `delta: BetaTextDelta or BetaInputJSONDelta or BetaCitationsDelta or 3 more` + + - `beta_text_delta: object { text, type }` + + - `text: string` + + - `type: "text_delta"` + + - `beta_input_json_delta: object { partial_json, type }` + + - `partial_json: string` + + - `type: "input_json_delta"` + + - `beta_citations_delta: object { citation, type }` + + - `citation: BetaCitationCharLocation or BetaCitationPageLocation or BetaCitationContentBlockLocation or 2 more` + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `type: "citations_delta"` + + - `beta_thinking_delta: object { thinking, type }` + + - `thinking: string` + + - `type: "thinking_delta"` + + - `beta_signature_delta: object { signature, type }` + + - `signature: string` + + - `type: "signature_delta"` + + - `beta_compaction_content_block_delta: object { content, type }` + + - `content: string` + + - `type: "compaction_delta"` + + - `index: number` + + - `type: "content_block_delta"` + +### Beta Raw Content Block Start Event + +- `beta_raw_content_block_start_event: object { content_block, index, type }` + + - `content_block: BetaTextBlock or BetaThinkingBlock or BetaRedactedThinkingBlock or 12 more` + + Response model for a file uploaded to the container. + + - `beta_text_block: object { citations, text, type }` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `beta_thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `beta_redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `beta_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_server_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_search_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebSearchToolResultError or array of BetaWebSearchResultBlock` + + - `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of BetaWebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_fetch_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock` + + - `beta_web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaCodeExecutionToolResultError or BetaCodeExecutionResultBlock or BetaEncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `beta_bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock` + + - `beta_bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `beta_text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock` + + - `beta_text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `beta_text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `beta_text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `beta_tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock` + + - `beta_tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `beta_mcp_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + The name of the MCP tool + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `beta_mcp_tool_result_block: object { content, is_error, tool_use_id, type }` + + - `content: string or array of BetaTextBlock` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_content: array of BetaTextBlock` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `is_error: boolean` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `beta_container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `beta_compaction_block: object { content, type }` + + A compaction block returned when autocompact is triggered. + + When content is None, it indicates the compaction failed to produce a valid + summary (e.g., malformed output from the model). Clients may round-trip + compaction blocks with null content; the server treats them as no-ops. + + - `content: string` + + Summary of compacted content, or null if compaction failed + + - `type: "compaction"` + + - `index: number` + + - `type: "content_block_start"` + +### Beta Raw Content Block Stop Event + +- `beta_raw_content_block_stop_event: object { index, type }` + + - `index: number` + + - `type: "content_block_stop"` + +### Beta Raw Message Delta Event + +- `beta_raw_message_delta_event: object { context_management, delta, type, usage }` + + - `context_management: object { applied_edits }` + + Information about context management strategies applied during the request + + - `applied_edits: array of BetaClearToolUses20250919EditResponse or BetaClearThinking20251015EditResponse` + + List of context management edits that were applied. + + - `beta_clear_tool_uses_20250919_edit_response: object { cleared_input_tokens, cleared_tool_uses, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_tool_uses: number` + + Number of tool uses that were cleared. + + - `type: "clear_tool_uses_20250919"` + + The type of context management edit applied. + + - `beta_clear_thinking_20251015_edit_response: object { cleared_input_tokens, cleared_thinking_turns, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_thinking_turns: number` + + Number of thinking turns that were cleared. + + - `type: "clear_thinking_20251015"` + + The type of context management edit applied. + + - `delta: object { container, stop_details, stop_reason, stop_sequence }` + + - `container: object { id, expires_at, skills }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `skills: array of BetaSkill` + + Skills loaded in the container + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: string` + + Skill version or 'latest' for most recent version + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 5 more` + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"compaction"` + + - `"refusal"` + + - `"model_context_window_exceeded"` + + - `stop_sequence: string` + + - `type: "message_delta"` + + - `usage: object { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 3 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation_input_tokens: number` + + The cumulative number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The cumulative number of input tokens read from the cache. + + - `input_tokens: number` + + The cumulative number of input tokens which were used. + + - `iterations: array of BetaMessageIterationUsage or BetaCompactionIterationUsage` + + Per-iteration token usage breakdown. + + Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + + - Determine which iterations exceeded long context thresholds (>=200k tokens) + - Calculate the true context window size from the last iteration + - Understand token accumulation across server-side tool use loops + + - `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + + - `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + + - `output_tokens: number` + + The cumulative number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + +### Beta Raw Message Start Event + +- `beta_raw_message_start_event: object { message, type }` + + - `message: object { id, container, content, 8 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at, skills }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `skills: array of BetaSkill` + + Skills loaded in the container + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: string` + + Skill version or 'latest' for most recent version + + - `content: array of BetaContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `beta_text_block: object { citations, text, type }` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `beta_thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `beta_redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `beta_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_server_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_search_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebSearchToolResultError or array of BetaWebSearchResultBlock` + + - `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of BetaWebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_fetch_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock` + + - `beta_web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaCodeExecutionToolResultError or BetaCodeExecutionResultBlock or BetaEncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `beta_bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock` + + - `beta_bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `beta_text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock` + + - `beta_text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `beta_text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `beta_text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `beta_tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock` + + - `beta_tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `beta_mcp_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + The name of the MCP tool + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `beta_mcp_tool_result_block: object { content, is_error, tool_use_id, type }` + + - `content: string or array of BetaTextBlock` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_content: array of BetaTextBlock` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `is_error: boolean` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `beta_container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `beta_compaction_block: object { content, type }` + + A compaction block returned when autocompact is triggered. + + When content is None, it indicates the compaction failed to produce a valid + summary (e.g., malformed output from the model). Clients may round-trip + compaction blocks with null content; the server treats them as no-ops. + + - `content: string` + + Summary of compacted content, or null if compaction failed + + - `type: "compaction"` + + - `context_management: object { applied_edits }` + + Context management response. + + Information about context management strategies applied during the request. + + - `applied_edits: array of BetaClearToolUses20250919EditResponse or BetaClearThinking20251015EditResponse` + + List of context management edits that were applied. + + - `beta_clear_tool_uses_20250919_edit_response: object { cleared_input_tokens, cleared_tool_uses, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_tool_uses: number` + + Number of tool uses that were cleared. + + - `type: "clear_tool_uses_20250919"` + + The type of context management edit applied. + + - `beta_clear_thinking_20251015_edit_response: object { cleared_input_tokens, cleared_thinking_turns, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_thinking_turns: number` + + Number of thinking turns that were cleared. + + - `type: "clear_thinking_20251015"` + + The type of context management edit applied. + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 5 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"compaction"` + + - `"refusal"` + + - `"model_context_window_exceeded"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 7 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `iterations: array of BetaMessageIterationUsage or BetaCompactionIterationUsage` + + Per-iteration token usage breakdown. + + Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + + - Determine which iterations exceeded long context thresholds (>=200k tokens) + - Calculate the true context window size from the last iteration + - Understand token accumulation across server-side tool use loops + + - `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + + - `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `speed: "standard" or "fast"` + + The inference speed mode used for this request. + + - `"standard"` + + - `"fast"` + + - `type: "message_start"` + +### Beta Raw Message Stop Event + +- `beta_raw_message_stop_event: object { type }` + + - `type: "message_stop"` + +### Beta Raw Message Stream Event + +- `beta_raw_message_stream_event: BetaRawMessageStartEvent or BetaRawMessageDeltaEvent or BetaRawMessageStopEvent or 3 more` + + - `beta_raw_message_start_event: object { message, type }` + + - `message: object { id, container, content, 8 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at, skills }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `skills: array of BetaSkill` + + Skills loaded in the container + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: string` + + Skill version or 'latest' for most recent version + + - `content: array of BetaContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `beta_text_block: object { citations, text, type }` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `beta_thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `beta_redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `beta_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_server_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_search_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebSearchToolResultError or array of BetaWebSearchResultBlock` + + - `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of BetaWebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_fetch_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock` + + - `beta_web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaCodeExecutionToolResultError or BetaCodeExecutionResultBlock or BetaEncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `beta_bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock` + + - `beta_bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `beta_text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock` + + - `beta_text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `beta_text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `beta_text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `beta_tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock` + + - `beta_tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `beta_mcp_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + The name of the MCP tool + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `beta_mcp_tool_result_block: object { content, is_error, tool_use_id, type }` + + - `content: string or array of BetaTextBlock` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_content: array of BetaTextBlock` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `is_error: boolean` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `beta_container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `beta_compaction_block: object { content, type }` + + A compaction block returned when autocompact is triggered. + + When content is None, it indicates the compaction failed to produce a valid + summary (e.g., malformed output from the model). Clients may round-trip + compaction blocks with null content; the server treats them as no-ops. + + - `content: string` + + Summary of compacted content, or null if compaction failed + + - `type: "compaction"` + + - `context_management: object { applied_edits }` + + Context management response. + + Information about context management strategies applied during the request. + + - `applied_edits: array of BetaClearToolUses20250919EditResponse or BetaClearThinking20251015EditResponse` + + List of context management edits that were applied. + + - `beta_clear_tool_uses_20250919_edit_response: object { cleared_input_tokens, cleared_tool_uses, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_tool_uses: number` + + Number of tool uses that were cleared. + + - `type: "clear_tool_uses_20250919"` + + The type of context management edit applied. + + - `beta_clear_thinking_20251015_edit_response: object { cleared_input_tokens, cleared_thinking_turns, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_thinking_turns: number` + + Number of thinking turns that were cleared. + + - `type: "clear_thinking_20251015"` + + The type of context management edit applied. + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 5 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"compaction"` + + - `"refusal"` + + - `"model_context_window_exceeded"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 7 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `iterations: array of BetaMessageIterationUsage or BetaCompactionIterationUsage` + + Per-iteration token usage breakdown. + + Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + + - Determine which iterations exceeded long context thresholds (>=200k tokens) + - Calculate the true context window size from the last iteration + - Understand token accumulation across server-side tool use loops + + - `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + + - `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `speed: "standard" or "fast"` + + The inference speed mode used for this request. + + - `"standard"` + + - `"fast"` + + - `type: "message_start"` + + - `beta_raw_message_delta_event: object { context_management, delta, type, usage }` + + - `context_management: object { applied_edits }` + + Information about context management strategies applied during the request + + - `applied_edits: array of BetaClearToolUses20250919EditResponse or BetaClearThinking20251015EditResponse` + + List of context management edits that were applied. + + - `beta_clear_tool_uses_20250919_edit_response: object { cleared_input_tokens, cleared_tool_uses, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_tool_uses: number` + + Number of tool uses that were cleared. + + - `type: "clear_tool_uses_20250919"` + + The type of context management edit applied. + + - `beta_clear_thinking_20251015_edit_response: object { cleared_input_tokens, cleared_thinking_turns, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_thinking_turns: number` + + Number of thinking turns that were cleared. + + - `type: "clear_thinking_20251015"` + + The type of context management edit applied. + + - `delta: object { container, stop_details, stop_reason, stop_sequence }` + + - `container: object { id, expires_at, skills }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `skills: array of BetaSkill` + + Skills loaded in the container + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: string` + + Skill version or 'latest' for most recent version + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 5 more` + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"compaction"` + + - `"refusal"` + + - `"model_context_window_exceeded"` + + - `stop_sequence: string` + + - `type: "message_delta"` + + - `usage: object { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 3 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation_input_tokens: number` + + The cumulative number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The cumulative number of input tokens read from the cache. + + - `input_tokens: number` + + The cumulative number of input tokens which were used. + + - `iterations: array of BetaMessageIterationUsage or BetaCompactionIterationUsage` + + Per-iteration token usage breakdown. + + Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + + - Determine which iterations exceeded long context thresholds (>=200k tokens) + - Calculate the true context window size from the last iteration + - Understand token accumulation across server-side tool use loops + + - `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + + - `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + + - `output_tokens: number` + + The cumulative number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `beta_raw_message_stop_event: object { type }` + + - `type: "message_stop"` + + - `beta_raw_content_block_start_event: object { content_block, index, type }` + + - `content_block: BetaTextBlock or BetaThinkingBlock or BetaRedactedThinkingBlock or 12 more` + + Response model for a file uploaded to the container. + + - `beta_text_block: object { citations, text, type }` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `beta_thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `beta_redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `beta_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_server_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_search_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebSearchToolResultError or array of BetaWebSearchResultBlock` + + - `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of BetaWebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_fetch_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock` + + - `beta_web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaCodeExecutionToolResultError or BetaCodeExecutionResultBlock or BetaEncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `beta_bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock` + + - `beta_bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `beta_text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock` + + - `beta_text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `beta_text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `beta_text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `beta_tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock` + + - `beta_tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `beta_mcp_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + The name of the MCP tool + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `beta_mcp_tool_result_block: object { content, is_error, tool_use_id, type }` + + - `content: string or array of BetaTextBlock` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_content: array of BetaTextBlock` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `is_error: boolean` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `beta_container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `beta_compaction_block: object { content, type }` + + A compaction block returned when autocompact is triggered. + + When content is None, it indicates the compaction failed to produce a valid + summary (e.g., malformed output from the model). Clients may round-trip + compaction blocks with null content; the server treats them as no-ops. + + - `content: string` + + Summary of compacted content, or null if compaction failed + + - `type: "compaction"` + + - `index: number` + + - `type: "content_block_start"` + + - `beta_raw_content_block_delta_event: object { delta, index, type }` + + - `delta: BetaTextDelta or BetaInputJSONDelta or BetaCitationsDelta or 3 more` + + - `beta_text_delta: object { text, type }` + + - `text: string` + + - `type: "text_delta"` + + - `beta_input_json_delta: object { partial_json, type }` + + - `partial_json: string` + + - `type: "input_json_delta"` + + - `beta_citations_delta: object { citation, type }` + + - `citation: BetaCitationCharLocation or BetaCitationPageLocation or BetaCitationContentBlockLocation or 2 more` + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `type: "citations_delta"` + + - `beta_thinking_delta: object { thinking, type }` + + - `thinking: string` + + - `type: "thinking_delta"` + + - `beta_signature_delta: object { signature, type }` + + - `signature: string` + + - `type: "signature_delta"` + + - `beta_compaction_content_block_delta: object { content, type }` + + - `content: string` + + - `type: "compaction_delta"` + + - `index: number` + + - `type: "content_block_delta"` + + - `beta_raw_content_block_stop_event: object { index, type }` + + - `index: number` + + - `type: "content_block_stop"` + +### Beta Redacted Thinking Block + +- `beta_redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + +### Beta Redacted Thinking Block Param + +- `beta_redacted_thinking_block_param: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + +### Beta Refusal Stop Details + +- `beta_refusal_stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + +### Beta Request Document Block + +- `beta_request_document_block: object { source, type, cache_control, 3 more }` + + - `source: BetaBase64PDFSource or BetaPlainTextSource or BetaContentBlockSource or 2 more` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `beta_content_block_source: object { content, type }` + + - `content: string or array of BetaContentBlockSourceContent` + + - `union_member_0: string` + + - `beta_content_block_source_content: array of BetaContentBlockSourceContent` + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "content"` + + - `beta_url_pdf_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_document_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "document"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `context: optional string` + + - `title: optional string` + +### Beta Request MCP Server Tool Configuration + +- `beta_request_mcp_server_tool_configuration: object { allowed_tools, enabled }` + + - `allowed_tools: optional array of string` + + - `enabled: optional boolean` + +### Beta Request MCP Server URL Definition + +- `beta_request_mcp_server_url_definition: object { name, type, url, 2 more }` + + - `name: string` + + - `type: "url"` + + - `url: string` + + - `authorization_token: optional string` + + - `tool_configuration: optional object { allowed_tools, enabled }` + + - `allowed_tools: optional array of string` + + - `enabled: optional boolean` + +### Beta Request MCP Tool Result Block Param + +- `beta_request_mcp_tool_result_block_param: object { tool_use_id, type, cache_control, 2 more }` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `content: optional string or array of BetaTextBlockParam` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_param_content: array of BetaTextBlockParam` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `is_error: optional boolean` + +### Beta Search Result Block Param + +- `beta_search_result_block_param: object { content, source, title, 3 more }` + + - `content: array of BetaTextBlockParam` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `source: string` + + - `title: string` + + - `type: "search_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + +### Beta Server Tool Caller + +- `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + +### Beta Server Tool Caller 20260120 + +- `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + +### Beta Server Tool Usage + +- `beta_server_tool_usage: object { web_fetch_requests, web_search_requests }` + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + +### Beta Server Tool Use Block + +- `beta_server_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + +### Beta Server Tool Use Block Param + +- `beta_server_tool_use_block_param: object { id, input, name, 3 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + +### Beta Signature Delta + +- `beta_signature_delta: object { signature, type }` + + - `signature: string` + + - `type: "signature_delta"` + +### Beta Skill + +- `beta_skill: object { skill_id, type, version }` + + A skill that was loaded in a container (response model). + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: string` + + Skill version or 'latest' for most recent version + +### Beta Skill Params + +- `beta_skill_params: object { skill_id, type, version }` + + Specification for a skill to be loaded in a container (request model). + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: optional string` + + Skill version or 'latest' for most recent version + +### Beta Stop Reason + +- `beta_stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 5 more` + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"compaction"` + + - `"refusal"` + + - `"model_context_window_exceeded"` + +### Beta Text Block + +- `beta_text_block: object { citations, text, type }` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + +### Beta Text Block Param + +- `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + +### Beta Text Citation + +- `beta_text_citation: BetaCitationCharLocation or BetaCitationPageLocation or BetaCitationContentBlockLocation or 2 more` + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + +### Beta Text Citation Param + +- `beta_text_citation_param: BetaCitationCharLocationParam or BetaCitationPageLocationParam or BetaCitationContentBlockLocationParam or 2 more` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + +### Beta Text Delta + +- `beta_text_delta: object { text, type }` + + - `text: string` + + - `type: "text_delta"` + +### Beta Text Editor Code Execution Create Result Block + +- `beta_text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + +### Beta Text Editor Code Execution Create Result Block Param + +- `beta_text_editor_code_execution_create_result_block_param: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + +### Beta Text Editor Code Execution Str Replace Result Block + +- `beta_text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + +### Beta Text Editor Code Execution Str Replace Result Block Param + +- `beta_text_editor_code_execution_str_replace_result_block_param: object { type, lines, new_lines, 3 more }` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `lines: optional array of string` + + - `new_lines: optional number` + + - `new_start: optional number` + + - `old_lines: optional number` + + - `old_start: optional number` + +### Beta Text Editor Code Execution Tool Result Block + +- `beta_text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock` + + - `beta_text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `beta_text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `beta_text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + +### Beta Text Editor Code Execution Tool Result Block Param + +- `beta_text_editor_code_execution_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: BetaTextEditorCodeExecutionToolResultErrorParam or BetaTextEditorCodeExecutionViewResultBlockParam or BetaTextEditorCodeExecutionCreateResultBlockParam or BetaTextEditorCodeExecutionStrReplaceResultBlockParam` + + - `beta_text_editor_code_execution_tool_result_error_param: object { error_code, type, error_message }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `error_message: optional string` + + - `beta_text_editor_code_execution_view_result_block_param: object { content, file_type, type, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `type: "text_editor_code_execution_view_result"` + + - `num_lines: optional number` + + - `start_line: optional number` + + - `total_lines: optional number` + + - `beta_text_editor_code_execution_create_result_block_param: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block_param: object { type, lines, new_lines, 3 more }` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `lines: optional array of string` + + - `new_lines: optional number` + + - `new_start: optional number` + + - `old_lines: optional number` + + - `old_start: optional number` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Beta Text Editor Code Execution Tool Result Error + +- `beta_text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + +### Beta Text Editor Code Execution Tool Result Error Param + +- `beta_text_editor_code_execution_tool_result_error_param: object { error_code, type, error_message }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `error_message: optional string` + +### Beta Text Editor Code Execution View Result Block + +- `beta_text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + +### Beta Text Editor Code Execution View Result Block Param + +- `beta_text_editor_code_execution_view_result_block_param: object { content, file_type, type, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `type: "text_editor_code_execution_view_result"` + + - `num_lines: optional number` + + - `start_line: optional number` + + - `total_lines: optional number` + +### Beta Thinking Block + +- `beta_thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + +### Beta Thinking Block Param + +- `beta_thinking_block_param: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + +### Beta Thinking Config Adaptive + +- `beta_thinking_config_adaptive: object { type, display }` + + - `type: "adaptive"` + + - `display: optional "summarized" or "omitted"` + + Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`. + + - `"summarized"` + + - `"omitted"` + +### Beta Thinking Config Disabled + +- `beta_thinking_config_disabled: object { type }` + + - `type: "disabled"` + +### Beta Thinking Config Enabled + +- `beta_thinking_config_enabled: object { budget_tokens, type, display }` + + - `budget_tokens: number` + + Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality. + + Must be ≥1024 and less than `max_tokens`. + + See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details. + + - `type: "enabled"` + + - `display: optional "summarized" or "omitted"` + + Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`. + + - `"summarized"` + + - `"omitted"` + +### Beta Thinking Config Param + +- `beta_thinking_config_param: BetaThinkingConfigEnabled or BetaThinkingConfigDisabled or BetaThinkingConfigAdaptive` + + Configuration for enabling Claude's extended thinking. + + When enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit. + + See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details. + + - `beta_thinking_config_enabled: object { budget_tokens, type, display }` + + - `budget_tokens: number` + + Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality. + + Must be ≥1024 and less than `max_tokens`. + + See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details. + + - `type: "enabled"` + + - `display: optional "summarized" or "omitted"` + + Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`. + + - `"summarized"` + + - `"omitted"` + + - `beta_thinking_config_disabled: object { type }` + + - `type: "disabled"` + + - `beta_thinking_config_adaptive: object { type, display }` + + - `type: "adaptive"` + + - `display: optional "summarized" or "omitted"` + + Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`. + + - `"summarized"` + + - `"omitted"` + +### Beta Thinking Delta + +- `beta_thinking_delta: object { thinking, type }` + + - `thinking: string` + + - `type: "thinking_delta"` + +### Beta Thinking Turns + +- `beta_thinking_turns: object { type, value }` + + - `type: "thinking_turns"` + + - `value: number` + +### Beta Tool + +- `beta_tool: object { input_schema, name, allowed_callers, 7 more }` + + - `input_schema: object { type, properties, required }` + + [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input. + + This defines the shape of the `input` that your tool accepts and that the model will produce. + + - `type: "object"` + + - `properties: optional map[unknown]` + + - `required: optional array of string` + + - `name: string` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `description: optional string` + + Description of what this tool does. + + Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema. + + - `eager_input_streaming: optional boolean` + + Enable eager input streaming for this tool. When true, tool input parameters will be streamed incrementally as they are generated, and types will be inferred on-the-fly rather than buffering the full JSON output. When false, streaming is disabled for this tool even if the fine-grained-tool-streaming beta is active. When null (default), uses the default behavior based on beta headers. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `type: optional "custom"` + + - `"custom"` + +### Beta Tool Bash 20241022 + +- `beta_tool_bash_20241022: object { name, type, allowed_callers, 4 more }` + + - `name: "bash"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "bash_20241022"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Tool Bash 20250124 + +- `beta_tool_bash_20250124: object { name, type, allowed_callers, 4 more }` + + - `name: "bash"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "bash_20250124"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Tool Choice + +- `beta_tool_choice: BetaToolChoiceAuto or BetaToolChoiceAny or BetaToolChoiceTool or BetaToolChoiceNone` + + How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all. + + - `beta_tool_choice_auto: object { type, disable_parallel_tool_use }` + + The model will automatically decide whether to use tools. + + - `type: "auto"` + + - `disable_parallel_tool_use: optional boolean` + + Whether to disable parallel tool use. + + Defaults to `false`. If set to `true`, the model will output at most one tool use. + + - `beta_tool_choice_any: object { type, disable_parallel_tool_use }` + + The model will use any available tools. + + - `type: "any"` + + - `disable_parallel_tool_use: optional boolean` + + Whether to disable parallel tool use. + + Defaults to `false`. If set to `true`, the model will output exactly one tool use. + + - `beta_tool_choice_tool: object { name, type, disable_parallel_tool_use }` + + The model will use the specified tool with `tool_choice.name`. + + - `name: string` + + The name of the tool to use. + + - `type: "tool"` + + - `disable_parallel_tool_use: optional boolean` + + Whether to disable parallel tool use. + + Defaults to `false`. If set to `true`, the model will output exactly one tool use. + + - `beta_tool_choice_none: object { type }` + + The model will not be allowed to use tools. + + - `type: "none"` + +### Beta Tool Choice Any + +- `beta_tool_choice_any: object { type, disable_parallel_tool_use }` + + The model will use any available tools. + + - `type: "any"` + + - `disable_parallel_tool_use: optional boolean` + + Whether to disable parallel tool use. + + Defaults to `false`. If set to `true`, the model will output exactly one tool use. + +### Beta Tool Choice Auto + +- `beta_tool_choice_auto: object { type, disable_parallel_tool_use }` + + The model will automatically decide whether to use tools. + + - `type: "auto"` + + - `disable_parallel_tool_use: optional boolean` + + Whether to disable parallel tool use. + + Defaults to `false`. If set to `true`, the model will output at most one tool use. + +### Beta Tool Choice None + +- `beta_tool_choice_none: object { type }` + + The model will not be allowed to use tools. + + - `type: "none"` + +### Beta Tool Choice Tool + +- `beta_tool_choice_tool: object { name, type, disable_parallel_tool_use }` + + The model will use the specified tool with `tool_choice.name`. + + - `name: string` + + The name of the tool to use. + + - `type: "tool"` + + - `disable_parallel_tool_use: optional boolean` + + Whether to disable parallel tool use. + + Defaults to `false`. If set to `true`, the model will output exactly one tool use. + +### Beta Tool Computer Use 20241022 + +- `beta_tool_computer_use_20241022: object { display_height_px, display_width_px, name, 7 more }` + + - `display_height_px: number` + + The height of the display in pixels. + + - `display_width_px: number` + + The width of the display in pixels. + + - `name: "computer"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "computer_20241022"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `display_number: optional number` + + The X11 display number (e.g. 0, 1) for the display. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Tool Computer Use 20250124 + +- `beta_tool_computer_use_20250124: object { display_height_px, display_width_px, name, 7 more }` + + - `display_height_px: number` + + The height of the display in pixels. + + - `display_width_px: number` + + The width of the display in pixels. + + - `name: "computer"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "computer_20250124"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `display_number: optional number` + + The X11 display number (e.g. 0, 1) for the display. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Tool Computer Use 20251124 + +- `beta_tool_computer_use_20251124: object { display_height_px, display_width_px, name, 8 more }` + + - `display_height_px: number` + + The height of the display in pixels. + + - `display_width_px: number` + + The width of the display in pixels. + + - `name: "computer"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "computer_20251124"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `display_number: optional number` + + The X11 display number (e.g. 0, 1) for the display. + + - `enable_zoom: optional boolean` + + Whether to enable an action to take a zoomed-in screenshot of the screen. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Tool Reference Block + +- `beta_tool_reference_block: object { tool_name, type }` + + - `tool_name: string` + + - `type: "tool_reference"` + +### Beta Tool Reference Block Param + +- `beta_tool_reference_block_param: object { tool_name, type, cache_control }` + + Tool reference block that can be included in tool_result content. + + - `tool_name: string` + + - `type: "tool_reference"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Beta Tool Result Block Param + +- `beta_tool_result_block_param: object { tool_use_id, type, cache_control, 2 more }` + + - `tool_use_id: string` + + - `type: "tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `content: optional array of BetaTextBlockParam or BetaImageBlockParam or BetaSearchResultBlockParam or 2 more` + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_search_result_block_param: object { content, source, title, 3 more }` + + - `content: array of BetaTextBlockParam` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `source: string` + + - `title: string` + + - `type: "search_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `beta_request_document_block: object { source, type, cache_control, 3 more }` + + - `source: BetaBase64PDFSource or BetaPlainTextSource or BetaContentBlockSource or 2 more` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `beta_content_block_source: object { content, type }` + + - `content: string or array of BetaContentBlockSourceContent` + + - `union_member_0: string` + + - `beta_content_block_source_content: array of BetaContentBlockSourceContent` + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "content"` + + - `beta_url_pdf_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_document_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "document"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `context: optional string` + + - `title: optional string` + + - `beta_tool_reference_block_param: object { tool_name, type, cache_control }` + + Tool reference block that can be included in tool_result content. + + - `tool_name: string` + + - `type: "tool_reference"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `is_error: optional boolean` + +### Beta Tool Search Tool Bm25 20251119 + +- `beta_tool_search_tool_bm25_20251119: object { name, type, allowed_callers, 3 more }` + + - `name: "tool_search_tool_bm25"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "tool_search_tool_bm25_20251119" or "tool_search_tool_bm25"` + + - `"tool_search_tool_bm25_20251119"` + + - `"tool_search_tool_bm25"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Tool Search Tool Regex 20251119 + +- `beta_tool_search_tool_regex_20251119: object { name, type, allowed_callers, 3 more }` + + - `name: "tool_search_tool_regex"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "tool_search_tool_regex_20251119" or "tool_search_tool_regex"` + + - `"tool_search_tool_regex_20251119"` + + - `"tool_search_tool_regex"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Tool Search Tool Result Block + +- `beta_tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock` + + - `beta_tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + +### Beta Tool Search Tool Result Block Param + +- `beta_tool_search_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: BetaToolSearchToolResultErrorParam or BetaToolSearchToolSearchResultBlockParam` + + - `beta_tool_search_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block_param: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlockParam` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Beta Tool Search Tool Result Error + +- `beta_tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + +### Beta Tool Search Tool Result Error Param + +- `beta_tool_search_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "tool_search_tool_result_error"` + +### Beta Tool Search Tool Search Result Block + +- `beta_tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + +### Beta Tool Search Tool Search Result Block Param + +- `beta_tool_search_tool_search_result_block_param: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlockParam` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "tool_search_tool_search_result"` + +### Beta Tool Text Editor 20241022 + +- `beta_tool_text_editor_20241022: object { name, type, allowed_callers, 4 more }` + + - `name: "str_replace_editor"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "text_editor_20241022"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Tool Text Editor 20250124 + +- `beta_tool_text_editor_20250124: object { name, type, allowed_callers, 4 more }` + + - `name: "str_replace_editor"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "text_editor_20250124"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Tool Text Editor 20250429 + +- `beta_tool_text_editor_20250429: object { name, type, allowed_callers, 4 more }` + + - `name: "str_replace_based_edit_tool"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "text_editor_20250429"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Tool Text Editor 20250728 + +- `beta_tool_text_editor_20250728: object { name, type, allowed_callers, 5 more }` + + - `name: "str_replace_based_edit_tool"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "text_editor_20250728"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `max_characters: optional number` + + Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Tool Union + +- `beta_tool_union: BetaTool or BetaToolBash20241022 or BetaToolBash20250124 or 19 more` + + Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint). + + - `beta_tool: object { input_schema, name, allowed_callers, 7 more }` + + - `input_schema: object { type, properties, required }` + + [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input. + + This defines the shape of the `input` that your tool accepts and that the model will produce. + + - `type: "object"` + + - `properties: optional map[unknown]` + + - `required: optional array of string` + + - `name: string` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `description: optional string` + + Description of what this tool does. + + Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema. + + - `eager_input_streaming: optional boolean` + + Enable eager input streaming for this tool. When true, tool input parameters will be streamed incrementally as they are generated, and types will be inferred on-the-fly rather than buffering the full JSON output. When false, streaming is disabled for this tool even if the fine-grained-tool-streaming beta is active. When null (default), uses the default behavior based on beta headers. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `type: optional "custom"` + + - `"custom"` + + - `beta_tool_bash_20241022: object { name, type, allowed_callers, 4 more }` + + - `name: "bash"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "bash_20241022"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_tool_bash_20250124: object { name, type, allowed_callers, 4 more }` + + - `name: "bash"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "bash_20250124"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_code_execution_tool_20250522: object { name, type, allowed_callers, 3 more }` + + - `name: "code_execution"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "code_execution_20250522"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_code_execution_tool_20250825: object { name, type, allowed_callers, 3 more }` + + - `name: "code_execution"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "code_execution_20250825"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_code_execution_tool_20260120: object { name, type, allowed_callers, 3 more }` + + Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint). + + - `name: "code_execution"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "code_execution_20260120"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_tool_computer_use_20241022: object { display_height_px, display_width_px, name, 7 more }` + + - `display_height_px: number` + + The height of the display in pixels. + + - `display_width_px: number` + + The width of the display in pixels. + + - `name: "computer"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "computer_20241022"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `display_number: optional number` + + The X11 display number (e.g. 0, 1) for the display. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_memory_tool_20250818: object { name, type, allowed_callers, 4 more }` + + - `name: "memory"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "memory_20250818"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_tool_computer_use_20250124: object { display_height_px, display_width_px, name, 7 more }` + + - `display_height_px: number` + + The height of the display in pixels. + + - `display_width_px: number` + + The width of the display in pixels. + + - `name: "computer"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "computer_20250124"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `display_number: optional number` + + The X11 display number (e.g. 0, 1) for the display. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_tool_text_editor_20241022: object { name, type, allowed_callers, 4 more }` + + - `name: "str_replace_editor"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "text_editor_20241022"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_tool_computer_use_20251124: object { display_height_px, display_width_px, name, 8 more }` + + - `display_height_px: number` + + The height of the display in pixels. + + - `display_width_px: number` + + The width of the display in pixels. + + - `name: "computer"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "computer_20251124"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `display_number: optional number` + + The X11 display number (e.g. 0, 1) for the display. + + - `enable_zoom: optional boolean` + + Whether to enable an action to take a zoomed-in screenshot of the screen. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_tool_text_editor_20250124: object { name, type, allowed_callers, 4 more }` + + - `name: "str_replace_editor"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "text_editor_20250124"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_tool_text_editor_20250429: object { name, type, allowed_callers, 4 more }` + + - `name: "str_replace_based_edit_tool"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "text_editor_20250429"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_tool_text_editor_20250728: object { name, type, allowed_callers, 5 more }` + + - `name: "str_replace_based_edit_tool"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "text_editor_20250728"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `max_characters: optional number` + + Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_web_search_tool_20250305: object { name, type, allowed_callers, 7 more }` + + - `name: "web_search"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_search_20250305"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`. + + - `blocked_domains: optional array of string` + + If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`. + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `user_location: optional object { type, city, country, 2 more }` + + Parameters for the user's location. Used to provide more relevant search results. + + - `type: "approximate"` + + - `city: optional string` + + The city of the user. + + - `country: optional string` + + The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user. + + - `region: optional string` + + The region of the user. + + - `timezone: optional string` + + The [IANA timezone](https://nodatime.org/TimeZones) of the user. + + - `beta_web_fetch_tool_20250910: object { name, type, allowed_callers, 8 more }` + + - `name: "web_fetch"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_fetch_20250910"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + List of domains to allow fetching from + + - `blocked_domains: optional array of string` + + List of domains to block fetching from + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + Citations configuration for fetched documents. Citations are disabled by default. + + - `enabled: optional boolean` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_content_tokens: optional number` + + Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_web_search_tool_20260209: object { name, type, allowed_callers, 7 more }` + + - `name: "web_search"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_search_20260209"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`. + + - `blocked_domains: optional array of string` + + If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`. + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `user_location: optional object { type, city, country, 2 more }` + + Parameters for the user's location. Used to provide more relevant search results. + + - `type: "approximate"` + + - `city: optional string` + + The city of the user. + + - `country: optional string` + + The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user. + + - `region: optional string` + + The region of the user. + + - `timezone: optional string` + + The [IANA timezone](https://nodatime.org/TimeZones) of the user. + + - `beta_web_fetch_tool_20260209: object { name, type, allowed_callers, 8 more }` + + - `name: "web_fetch"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_fetch_20260209"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + List of domains to allow fetching from + + - `blocked_domains: optional array of string` + + List of domains to block fetching from + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + Citations configuration for fetched documents. Citations are disabled by default. + + - `enabled: optional boolean` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_content_tokens: optional number` + + Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_web_fetch_tool_20260309: object { name, type, allowed_callers, 9 more }` + + Web fetch tool with use_cache parameter for bypassing cached content. + + - `name: "web_fetch"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_fetch_20260309"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + List of domains to allow fetching from + + - `blocked_domains: optional array of string` + + List of domains to block fetching from + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + Citations configuration for fetched documents. Citations are disabled by default. + + - `enabled: optional boolean` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_content_tokens: optional number` + + Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `use_cache: optional boolean` + + Whether to use cached content. Set to false to bypass the cache and fetch fresh content. Only set to false when the user explicitly requests fresh content or when fetching rapidly-changing sources. + + - `beta_tool_search_tool_bm25_20251119: object { name, type, allowed_callers, 3 more }` + + - `name: "tool_search_tool_bm25"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "tool_search_tool_bm25_20251119" or "tool_search_tool_bm25"` + + - `"tool_search_tool_bm25_20251119"` + + - `"tool_search_tool_bm25"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_tool_search_tool_regex_20251119: object { name, type, allowed_callers, 3 more }` + + - `name: "tool_search_tool_regex"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "tool_search_tool_regex_20251119" or "tool_search_tool_regex"` + + - `"tool_search_tool_regex_20251119"` + + - `"tool_search_tool_regex"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_mcp_toolset: object { mcp_server_name, type, cache_control, 2 more }` + + Configuration for a group of tools from an MCP server. + + Allows configuring enabled status and defer_loading for all tools + from an MCP server, with optional per-tool overrides. + + - `mcp_server_name: string` + + Name of the MCP server to configure tools for + + - `type: "mcp_toolset"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `configs: optional map[BetaMCPToolConfig]` + + Configuration overrides for specific tools, keyed by tool name + + - `defer_loading: optional boolean` + + - `enabled: optional boolean` + + - `default_config: optional object { defer_loading, enabled }` + + Default configuration applied to all tools from this server + + - `defer_loading: optional boolean` + + - `enabled: optional boolean` + +### Beta Tool Use Block + +- `beta_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + +### Beta Tool Use Block Param + +- `beta_tool_use_block_param: object { id, input, name, 3 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + +### Beta Tool Uses Keep + +- `beta_tool_uses_keep: object { type, value }` + + - `type: "tool_uses"` + + - `value: number` + +### Beta Tool Uses Trigger + +- `beta_tool_uses_trigger: object { type, value }` + + - `type: "tool_uses"` + + - `value: number` + +### Beta URL Image Source + +- `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + +### Beta URL PDF Source + +- `beta_url_pdf_source: object { type, url }` + + - `type: "url"` + + - `url: string` + +### Beta Usage + +- `beta_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 7 more }` + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `iterations: array of BetaMessageIterationUsage or BetaCompactionIterationUsage` + + Per-iteration token usage breakdown. + + Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + + - Determine which iterations exceeded long context thresholds (>=200k tokens) + - Calculate the true context window size from the last iteration + - Understand token accumulation across server-side tool use loops + + - `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + + - `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `speed: "standard" or "fast"` + + The inference speed mode used for this request. + + - `"standard"` + + - `"fast"` + +### Beta User Location + +- `beta_user_location: object { type, city, country, 2 more }` + + - `type: "approximate"` + + - `city: optional string` + + The city of the user. + + - `country: optional string` + + The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user. + + - `region: optional string` + + The region of the user. + + - `timezone: optional string` + + The [IANA timezone](https://nodatime.org/TimeZones) of the user. + +### Beta Web Fetch Block + +- `beta_web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + +### Beta Web Fetch Block Param + +- `beta_web_fetch_block_param: object { content, type, url, retrieved_at }` + + - `content: object { source, type, cache_control, 3 more }` + + - `source: BetaBase64PDFSource or BetaPlainTextSource or BetaContentBlockSource or 2 more` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `beta_content_block_source: object { content, type }` + + - `content: string or array of BetaContentBlockSourceContent` + + - `union_member_0: string` + + - `beta_content_block_source_content: array of BetaContentBlockSourceContent` + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "content"` + + - `beta_url_pdf_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_document_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "document"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `context: optional string` + + - `title: optional string` + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `retrieved_at: optional string` + + ISO 8601 timestamp when the content was retrieved + +### Beta Web Fetch Tool 20250910 + +- `beta_web_fetch_tool_20250910: object { name, type, allowed_callers, 8 more }` + + - `name: "web_fetch"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_fetch_20250910"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + List of domains to allow fetching from + + - `blocked_domains: optional array of string` + + List of domains to block fetching from + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + Citations configuration for fetched documents. Citations are disabled by default. + + - `enabled: optional boolean` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_content_tokens: optional number` + + Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Web Fetch Tool 20260209 + +- `beta_web_fetch_tool_20260209: object { name, type, allowed_callers, 8 more }` + + - `name: "web_fetch"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_fetch_20260209"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + List of domains to allow fetching from + + - `blocked_domains: optional array of string` + + List of domains to block fetching from + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + Citations configuration for fetched documents. Citations are disabled by default. + + - `enabled: optional boolean` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_content_tokens: optional number` + + Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Web Fetch Tool 20260309 + +- `beta_web_fetch_tool_20260309: object { name, type, allowed_callers, 9 more }` + + Web fetch tool with use_cache parameter for bypassing cached content. + + - `name: "web_fetch"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_fetch_20260309"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + List of domains to allow fetching from + + - `blocked_domains: optional array of string` + + List of domains to block fetching from + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + Citations configuration for fetched documents. Citations are disabled by default. + + - `enabled: optional boolean` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_content_tokens: optional number` + + Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `use_cache: optional boolean` + + Whether to use cached content. Set to false to bypass the cache and fetch fresh content. Only set to false when the user explicitly requests fresh content or when fetching rapidly-changing sources. + +### Beta Web Fetch Tool Result Block + +- `beta_web_fetch_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock` + + - `beta_web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + +### Beta Web Fetch Tool Result Block Param + +- `beta_web_fetch_tool_result_block_param: object { content, tool_use_id, type, 2 more }` + + - `content: BetaWebFetchToolResultErrorBlockParam or BetaWebFetchBlockParam` + + - `beta_web_fetch_tool_result_error_block_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block_param: object { content, type, url, retrieved_at }` + + - `content: object { source, type, cache_control, 3 more }` + + - `source: BetaBase64PDFSource or BetaPlainTextSource or BetaContentBlockSource or 2 more` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `beta_content_block_source: object { content, type }` + + - `content: string or array of BetaContentBlockSourceContent` + + - `union_member_0: string` + + - `beta_content_block_source_content: array of BetaContentBlockSourceContent` + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "content"` + + - `beta_url_pdf_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_document_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "document"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `context: optional string` + + - `title: optional string` + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `retrieved_at: optional string` + + ISO 8601 timestamp when the content was retrieved + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + +### Beta Web Fetch Tool Result Error Block + +- `beta_web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + +### Beta Web Fetch Tool Result Error Block Param + +- `beta_web_fetch_tool_result_error_block_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + +### Beta Web Fetch Tool Result Error Code + +- `beta_web_fetch_tool_result_error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + +### Beta Web Search Result Block + +- `beta_web_search_result_block: object { encrypted_content, page_age, title, 2 more }` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + +### Beta Web Search Result Block Param + +- `beta_web_search_result_block_param: object { encrypted_content, title, type, 2 more }` + + - `encrypted_content: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `page_age: optional string` + +### Beta Web Search Tool 20250305 + +- `beta_web_search_tool_20250305: object { name, type, allowed_callers, 7 more }` + + - `name: "web_search"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_search_20250305"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`. + + - `blocked_domains: optional array of string` + + If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`. + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `user_location: optional object { type, city, country, 2 more }` + + Parameters for the user's location. Used to provide more relevant search results. + + - `type: "approximate"` + + - `city: optional string` + + The city of the user. + + - `country: optional string` + + The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user. + + - `region: optional string` + + The region of the user. + + - `timezone: optional string` + + The [IANA timezone](https://nodatime.org/TimeZones) of the user. + +### Beta Web Search Tool 20260209 + +- `beta_web_search_tool_20260209: object { name, type, allowed_callers, 7 more }` + + - `name: "web_search"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_search_20260209"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`. + + - `blocked_domains: optional array of string` + + If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`. + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `user_location: optional object { type, city, country, 2 more }` + + Parameters for the user's location. Used to provide more relevant search results. + + - `type: "approximate"` + + - `city: optional string` + + The city of the user. + + - `country: optional string` + + The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user. + + - `region: optional string` + + The region of the user. + + - `timezone: optional string` + + The [IANA timezone](https://nodatime.org/TimeZones) of the user. + +### Beta Web Search Tool Request Error + +- `beta_web_search_tool_request_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + +### Beta Web Search Tool Result Block + +- `beta_web_search_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebSearchToolResultError or array of BetaWebSearchResultBlock` + + - `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of BetaWebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + +### Beta Web Search Tool Result Block Content + +- `beta_web_search_tool_result_block_content: BetaWebSearchToolResultError or array of BetaWebSearchResultBlock` + + - `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of BetaWebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + +### Beta Web Search Tool Result Block Param + +- `beta_web_search_tool_result_block_param: object { content, tool_use_id, type, 2 more }` + + - `content: array of BetaWebSearchResultBlockParam or BetaWebSearchToolRequestError` + + - `Result Block: array of BetaWebSearchResultBlockParam` + + - `encrypted_content: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `page_age: optional string` + + - `beta_web_search_tool_request_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + +### Beta Web Search Tool Result Block Param Content + +- `beta_web_search_tool_result_block_param_content: array of BetaWebSearchResultBlockParam or BetaWebSearchToolRequestError` + + - `Result Block: array of BetaWebSearchResultBlockParam` + + - `encrypted_content: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `page_age: optional string` + + - `beta_web_search_tool_request_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + +### Beta Web Search Tool Result Error + +- `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + +### Beta Web Search Tool Result Error Code + +- `beta_web_search_tool_result_error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + +# Batches + +## Create + +`$ ant beta:messages:batches create` + +**post** `/v1/messages/batches` + +Send a batch of Message creation requests. + +The Message Batches API can be used to process multiple Messages API requests at once. Once a Message Batch is created, it begins processing immediately. Batches can take up to 24 hours to complete. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--request: array of object { custom_id, params }` + + Body param: List of requests for prompt completion. Each is an individual request to create a Message. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_message_batch: object { id, archived_at, cancel_initiated_at, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: object { canceled, errored, expired, 2 more }` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + +### Example + +```cli +ant beta:messages:batches create \ + --api-key my-anthropic-api-key \ + --request '{custom_id: my-custom-id-1, params: {max_tokens: 1024, messages: [{content: [{text: x, type: text}], role: user}], model: claude-opus-4-6}}' +``` + +## Retrieve + +`$ ant beta:messages:batches retrieve` + +**get** `/v1/messages/batches/{message_batch_id}` + +This endpoint is idempotent and can be used to poll for Message Batch completion. To access the results of a Message Batch, make a request to the `results_url` field in the response. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--message-batch-id: string` + + ID of the Message Batch. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_message_batch: object { id, archived_at, cancel_initiated_at, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: object { canceled, errored, expired, 2 more }` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + +### Example + +```cli +ant beta:messages:batches retrieve \ + --api-key my-anthropic-api-key \ + --message-batch-id message_batch_id +``` + +## List + +`$ ant beta:messages:batches list` + +**get** `/v1/messages/batches` + +List all Message Batches within a Workspace. Most recently created batches are returned first. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--after-id: optional string` + + Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object. + +- `--before-id: optional string` + + Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object. + +- `--limit: optional number` + + Query param: Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaListResponse_MessageBatch_: object { data, first_id, has_more, last_id }` + + - `data: array of BetaMessageBatch` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: object { canceled, errored, expired, 2 more }` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + + - `first_id: string` + + First ID in the `data` list. Can be used as the `before_id` for the previous page. + + - `has_more: boolean` + + Indicates if there are more results in the requested page direction. + + - `last_id: string` + + Last ID in the `data` list. Can be used as the `after_id` for the next page. + +### Example + +```cli +ant beta:messages:batches list \ + --api-key my-anthropic-api-key +``` + +## Cancel + +`$ ant beta:messages:batches cancel` + +**post** `/v1/messages/batches/{message_batch_id}/cancel` + +Batches may be canceled any time before processing ends. Once cancellation is initiated, the batch enters a `canceling` state, at which time the system may complete any in-progress, non-interruptible requests before finalizing cancellation. + +The number of canceled requests is specified in `request_counts`. To determine which requests were canceled, check the individual results within the batch. Note that cancellation may not result in any canceled requests if they were non-interruptible. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--message-batch-id: string` + + ID of the Message Batch. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_message_batch: object { id, archived_at, cancel_initiated_at, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: object { canceled, errored, expired, 2 more }` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + +### Example + +```cli +ant beta:messages:batches cancel \ + --api-key my-anthropic-api-key \ + --message-batch-id message_batch_id +``` + +## Delete + +`$ ant beta:messages:batches delete` + +**delete** `/v1/messages/batches/{message_batch_id}` + +Delete a Message Batch. + +Message Batches can only be deleted once they've finished processing. If you'd like to delete an in-progress batch, you must first cancel it. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--message-batch-id: string` + + ID of the Message Batch. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_deleted_message_batch: object { id, type }` + + - `id: string` + + ID of the Message Batch. + + - `type: "message_batch_deleted"` + + Deleted object type. + + For Message Batches, this is always `"message_batch_deleted"`. + +### Example + +```cli +ant beta:messages:batches delete \ + --api-key my-anthropic-api-key \ + --message-batch-id message_batch_id +``` + +## Results + +`$ ant beta:messages:batches results` + +**get** `/v1/messages/batches/{message_batch_id}/results` + +Streams the results of a Message Batch as a `.jsonl` file. + +Each line in the file is a JSON object containing the result of a single request in the Message Batch. Results are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--message-batch-id: string` + + ID of the Message Batch. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_message_batch_individual_response: object { custom_id, result }` + + This is a single line in the response `.jsonl` file and does not represent the response as a whole. + + - `custom_id: string` + + Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order. + + Must be unique for each request within the Message Batch. + + - `result: BetaMessageBatchSucceededResult or BetaMessageBatchErroredResult or BetaMessageBatchCanceledResult or BetaMessageBatchExpiredResult` + + Processing result for this request. + + Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration. + + - `beta_message_batch_succeeded_result: object { message, type }` + + - `message: object { id, container, content, 8 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at, skills }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `skills: array of BetaSkill` + + Skills loaded in the container + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: string` + + Skill version or 'latest' for most recent version + + - `content: array of BetaContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `beta_text_block: object { citations, text, type }` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `beta_thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `beta_redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `beta_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_server_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_search_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebSearchToolResultError or array of BetaWebSearchResultBlock` + + - `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of BetaWebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_fetch_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock` + + - `beta_web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaCodeExecutionToolResultError or BetaCodeExecutionResultBlock or BetaEncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `beta_bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock` + + - `beta_bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `beta_text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock` + + - `beta_text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `beta_text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `beta_text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `beta_tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock` + + - `beta_tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `beta_mcp_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + The name of the MCP tool + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `beta_mcp_tool_result_block: object { content, is_error, tool_use_id, type }` + + - `content: string or array of BetaTextBlock` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_content: array of BetaTextBlock` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `is_error: boolean` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `beta_container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `beta_compaction_block: object { content, type }` + + A compaction block returned when autocompact is triggered. + + When content is None, it indicates the compaction failed to produce a valid + summary (e.g., malformed output from the model). Clients may round-trip + compaction blocks with null content; the server treats them as no-ops. + + - `content: string` + + Summary of compacted content, or null if compaction failed + + - `type: "compaction"` + + - `context_management: object { applied_edits }` + + Context management response. + + Information about context management strategies applied during the request. + + - `applied_edits: array of BetaClearToolUses20250919EditResponse or BetaClearThinking20251015EditResponse` + + List of context management edits that were applied. + + - `beta_clear_tool_uses_20250919_edit_response: object { cleared_input_tokens, cleared_tool_uses, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_tool_uses: number` + + Number of tool uses that were cleared. + + - `type: "clear_tool_uses_20250919"` + + The type of context management edit applied. + + - `beta_clear_thinking_20251015_edit_response: object { cleared_input_tokens, cleared_thinking_turns, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_thinking_turns: number` + + Number of thinking turns that were cleared. + + - `type: "clear_thinking_20251015"` + + The type of context management edit applied. + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 5 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"compaction"` + + - `"refusal"` + + - `"model_context_window_exceeded"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 7 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `iterations: array of BetaMessageIterationUsage or BetaCompactionIterationUsage` + + Per-iteration token usage breakdown. + + Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + + - Determine which iterations exceeded long context thresholds (>=200k tokens) + - Calculate the true context window size from the last iteration + - Understand token accumulation across server-side tool use loops + + - `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + + - `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `speed: "standard" or "fast"` + + The inference speed mode used for this request. + + - `"standard"` + + - `"fast"` + + - `type: "succeeded"` + + - `beta_message_batch_errored_result: object { error, type }` + + - `error: object { error, request_id, type }` + + - `error: BetaInvalidRequestError or BetaAuthenticationError or BetaBillingError or 6 more` + + - `beta_invalid_request_error: object { message, type }` + + - `message: string` + + - `type: "invalid_request_error"` + + - `beta_authentication_error: object { message, type }` + + - `message: string` + + - `type: "authentication_error"` + + - `beta_billing_error: object { message, type }` + + - `message: string` + + - `type: "billing_error"` + + - `beta_permission_error: object { message, type }` + + - `message: string` + + - `type: "permission_error"` + + - `beta_not_found_error: object { message, type }` + + - `message: string` + + - `type: "not_found_error"` + + - `beta_rate_limit_error: object { message, type }` + + - `message: string` + + - `type: "rate_limit_error"` + + - `beta_gateway_timeout_error: object { message, type }` + + - `message: string` + + - `type: "timeout_error"` + + - `beta_api_error: object { message, type }` + + - `message: string` + + - `type: "api_error"` + + - `beta_overloaded_error: object { message, type }` + + - `message: string` + + - `type: "overloaded_error"` + + - `request_id: string` + + - `type: "error"` + + - `type: "errored"` + + - `beta_message_batch_canceled_result: object { type }` + + - `type: "canceled"` + + - `beta_message_batch_expired_result: object { type }` + + - `type: "expired"` + +### Example + +```cli +ant beta:messages:batches results \ + --api-key my-anthropic-api-key \ + --message-batch-id message_batch_id +``` + +## Domain Types + +### Beta Deleted Message Batch + +- `beta_deleted_message_batch: object { id, type }` + + - `id: string` + + ID of the Message Batch. + + - `type: "message_batch_deleted"` + + Deleted object type. + + For Message Batches, this is always `"message_batch_deleted"`. + +### Beta Message Batch + +- `beta_message_batch: object { id, archived_at, cancel_initiated_at, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: object { canceled, errored, expired, 2 more }` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + +### Beta Message Batch Canceled Result + +- `beta_message_batch_canceled_result: object { type }` + + - `type: "canceled"` + +### Beta Message Batch Errored Result + +- `beta_message_batch_errored_result: object { error, type }` + + - `error: object { error, request_id, type }` + + - `error: BetaInvalidRequestError or BetaAuthenticationError or BetaBillingError or 6 more` + + - `beta_invalid_request_error: object { message, type }` + + - `message: string` + + - `type: "invalid_request_error"` + + - `beta_authentication_error: object { message, type }` + + - `message: string` + + - `type: "authentication_error"` + + - `beta_billing_error: object { message, type }` + + - `message: string` + + - `type: "billing_error"` + + - `beta_permission_error: object { message, type }` + + - `message: string` + + - `type: "permission_error"` + + - `beta_not_found_error: object { message, type }` + + - `message: string` + + - `type: "not_found_error"` + + - `beta_rate_limit_error: object { message, type }` + + - `message: string` + + - `type: "rate_limit_error"` + + - `beta_gateway_timeout_error: object { message, type }` + + - `message: string` + + - `type: "timeout_error"` + + - `beta_api_error: object { message, type }` + + - `message: string` + + - `type: "api_error"` + + - `beta_overloaded_error: object { message, type }` + + - `message: string` + + - `type: "overloaded_error"` + + - `request_id: string` + + - `type: "error"` + + - `type: "errored"` + +### Beta Message Batch Expired Result + +- `beta_message_batch_expired_result: object { type }` + + - `type: "expired"` + +### Beta Message Batch Individual Response + +- `beta_message_batch_individual_response: object { custom_id, result }` + + This is a single line in the response `.jsonl` file and does not represent the response as a whole. + + - `custom_id: string` + + Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order. + + Must be unique for each request within the Message Batch. + + - `result: BetaMessageBatchSucceededResult or BetaMessageBatchErroredResult or BetaMessageBatchCanceledResult or BetaMessageBatchExpiredResult` + + Processing result for this request. + + Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration. + + - `beta_message_batch_succeeded_result: object { message, type }` + + - `message: object { id, container, content, 8 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at, skills }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `skills: array of BetaSkill` + + Skills loaded in the container + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: string` + + Skill version or 'latest' for most recent version + + - `content: array of BetaContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `beta_text_block: object { citations, text, type }` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `beta_thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `beta_redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `beta_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_server_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_search_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebSearchToolResultError or array of BetaWebSearchResultBlock` + + - `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of BetaWebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_fetch_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock` + + - `beta_web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaCodeExecutionToolResultError or BetaCodeExecutionResultBlock or BetaEncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `beta_bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock` + + - `beta_bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `beta_text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock` + + - `beta_text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `beta_text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `beta_text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `beta_tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock` + + - `beta_tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `beta_mcp_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + The name of the MCP tool + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `beta_mcp_tool_result_block: object { content, is_error, tool_use_id, type }` + + - `content: string or array of BetaTextBlock` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_content: array of BetaTextBlock` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `is_error: boolean` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `beta_container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `beta_compaction_block: object { content, type }` + + A compaction block returned when autocompact is triggered. + + When content is None, it indicates the compaction failed to produce a valid + summary (e.g., malformed output from the model). Clients may round-trip + compaction blocks with null content; the server treats them as no-ops. + + - `content: string` + + Summary of compacted content, or null if compaction failed + + - `type: "compaction"` + + - `context_management: object { applied_edits }` + + Context management response. + + Information about context management strategies applied during the request. + + - `applied_edits: array of BetaClearToolUses20250919EditResponse or BetaClearThinking20251015EditResponse` + + List of context management edits that were applied. + + - `beta_clear_tool_uses_20250919_edit_response: object { cleared_input_tokens, cleared_tool_uses, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_tool_uses: number` + + Number of tool uses that were cleared. + + - `type: "clear_tool_uses_20250919"` + + The type of context management edit applied. + + - `beta_clear_thinking_20251015_edit_response: object { cleared_input_tokens, cleared_thinking_turns, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_thinking_turns: number` + + Number of thinking turns that were cleared. + + - `type: "clear_thinking_20251015"` + + The type of context management edit applied. + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 5 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"compaction"` + + - `"refusal"` + + - `"model_context_window_exceeded"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 7 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `iterations: array of BetaMessageIterationUsage or BetaCompactionIterationUsage` + + Per-iteration token usage breakdown. + + Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + + - Determine which iterations exceeded long context thresholds (>=200k tokens) + - Calculate the true context window size from the last iteration + - Understand token accumulation across server-side tool use loops + + - `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + + - `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `speed: "standard" or "fast"` + + The inference speed mode used for this request. + + - `"standard"` + + - `"fast"` + + - `type: "succeeded"` + + - `beta_message_batch_errored_result: object { error, type }` + + - `error: object { error, request_id, type }` + + - `error: BetaInvalidRequestError or BetaAuthenticationError or BetaBillingError or 6 more` + + - `beta_invalid_request_error: object { message, type }` + + - `message: string` + + - `type: "invalid_request_error"` + + - `beta_authentication_error: object { message, type }` + + - `message: string` + + - `type: "authentication_error"` + + - `beta_billing_error: object { message, type }` + + - `message: string` + + - `type: "billing_error"` + + - `beta_permission_error: object { message, type }` + + - `message: string` + + - `type: "permission_error"` + + - `beta_not_found_error: object { message, type }` + + - `message: string` + + - `type: "not_found_error"` + + - `beta_rate_limit_error: object { message, type }` + + - `message: string` + + - `type: "rate_limit_error"` + + - `beta_gateway_timeout_error: object { message, type }` + + - `message: string` + + - `type: "timeout_error"` + + - `beta_api_error: object { message, type }` + + - `message: string` + + - `type: "api_error"` + + - `beta_overloaded_error: object { message, type }` + + - `message: string` + + - `type: "overloaded_error"` + + - `request_id: string` + + - `type: "error"` + + - `type: "errored"` + + - `beta_message_batch_canceled_result: object { type }` + + - `type: "canceled"` + + - `beta_message_batch_expired_result: object { type }` + + - `type: "expired"` + +### Beta Message Batch Request Counts + +- `beta_message_batch_request_counts: object { canceled, errored, expired, 2 more }` + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + +### Beta Message Batch Result + +- `beta_message_batch_result: BetaMessageBatchSucceededResult or BetaMessageBatchErroredResult or BetaMessageBatchCanceledResult or BetaMessageBatchExpiredResult` + + Processing result for this request. + + Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration. + + - `beta_message_batch_succeeded_result: object { message, type }` + + - `message: object { id, container, content, 8 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at, skills }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `skills: array of BetaSkill` + + Skills loaded in the container + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: string` + + Skill version or 'latest' for most recent version + + - `content: array of BetaContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `beta_text_block: object { citations, text, type }` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `beta_thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `beta_redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `beta_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_server_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_search_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebSearchToolResultError or array of BetaWebSearchResultBlock` + + - `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of BetaWebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_fetch_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock` + + - `beta_web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaCodeExecutionToolResultError or BetaCodeExecutionResultBlock or BetaEncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `beta_bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock` + + - `beta_bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `beta_text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock` + + - `beta_text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `beta_text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `beta_text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `beta_tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock` + + - `beta_tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `beta_mcp_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + The name of the MCP tool + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `beta_mcp_tool_result_block: object { content, is_error, tool_use_id, type }` + + - `content: string or array of BetaTextBlock` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_content: array of BetaTextBlock` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `is_error: boolean` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `beta_container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `beta_compaction_block: object { content, type }` + + A compaction block returned when autocompact is triggered. + + When content is None, it indicates the compaction failed to produce a valid + summary (e.g., malformed output from the model). Clients may round-trip + compaction blocks with null content; the server treats them as no-ops. + + - `content: string` + + Summary of compacted content, or null if compaction failed + + - `type: "compaction"` + + - `context_management: object { applied_edits }` + + Context management response. + + Information about context management strategies applied during the request. + + - `applied_edits: array of BetaClearToolUses20250919EditResponse or BetaClearThinking20251015EditResponse` + + List of context management edits that were applied. + + - `beta_clear_tool_uses_20250919_edit_response: object { cleared_input_tokens, cleared_tool_uses, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_tool_uses: number` + + Number of tool uses that were cleared. + + - `type: "clear_tool_uses_20250919"` + + The type of context management edit applied. + + - `beta_clear_thinking_20251015_edit_response: object { cleared_input_tokens, cleared_thinking_turns, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_thinking_turns: number` + + Number of thinking turns that were cleared. + + - `type: "clear_thinking_20251015"` + + The type of context management edit applied. + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 5 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"compaction"` + + - `"refusal"` + + - `"model_context_window_exceeded"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 7 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `iterations: array of BetaMessageIterationUsage or BetaCompactionIterationUsage` + + Per-iteration token usage breakdown. + + Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + + - Determine which iterations exceeded long context thresholds (>=200k tokens) + - Calculate the true context window size from the last iteration + - Understand token accumulation across server-side tool use loops + + - `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + + - `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `speed: "standard" or "fast"` + + The inference speed mode used for this request. + + - `"standard"` + + - `"fast"` + + - `type: "succeeded"` + + - `beta_message_batch_errored_result: object { error, type }` + + - `error: object { error, request_id, type }` + + - `error: BetaInvalidRequestError or BetaAuthenticationError or BetaBillingError or 6 more` + + - `beta_invalid_request_error: object { message, type }` + + - `message: string` + + - `type: "invalid_request_error"` + + - `beta_authentication_error: object { message, type }` + + - `message: string` + + - `type: "authentication_error"` + + - `beta_billing_error: object { message, type }` + + - `message: string` + + - `type: "billing_error"` + + - `beta_permission_error: object { message, type }` + + - `message: string` + + - `type: "permission_error"` + + - `beta_not_found_error: object { message, type }` + + - `message: string` + + - `type: "not_found_error"` + + - `beta_rate_limit_error: object { message, type }` + + - `message: string` + + - `type: "rate_limit_error"` + + - `beta_gateway_timeout_error: object { message, type }` + + - `message: string` + + - `type: "timeout_error"` + + - `beta_api_error: object { message, type }` + + - `message: string` + + - `type: "api_error"` + + - `beta_overloaded_error: object { message, type }` + + - `message: string` + + - `type: "overloaded_error"` + + - `request_id: string` + + - `type: "error"` + + - `type: "errored"` + + - `beta_message_batch_canceled_result: object { type }` + + - `type: "canceled"` + + - `beta_message_batch_expired_result: object { type }` + + - `type: "expired"` + +### Beta Message Batch Succeeded Result + +- `beta_message_batch_succeeded_result: object { message, type }` + + - `message: object { id, container, content, 8 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at, skills }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `skills: array of BetaSkill` + + Skills loaded in the container + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: string` + + Skill version or 'latest' for most recent version + + - `content: array of BetaContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `beta_text_block: object { citations, text, type }` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `beta_thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `beta_redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `beta_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_server_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_search_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebSearchToolResultError or array of BetaWebSearchResultBlock` + + - `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of BetaWebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_fetch_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock` + + - `beta_web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaCodeExecutionToolResultError or BetaCodeExecutionResultBlock or BetaEncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `beta_bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock` + + - `beta_bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `beta_text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock` + + - `beta_text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `beta_text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `beta_text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `beta_tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock` + + - `beta_tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `beta_mcp_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + The name of the MCP tool + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `beta_mcp_tool_result_block: object { content, is_error, tool_use_id, type }` + + - `content: string or array of BetaTextBlock` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_content: array of BetaTextBlock` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `is_error: boolean` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `beta_container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `beta_compaction_block: object { content, type }` + + A compaction block returned when autocompact is triggered. + + When content is None, it indicates the compaction failed to produce a valid + summary (e.g., malformed output from the model). Clients may round-trip + compaction blocks with null content; the server treats them as no-ops. + + - `content: string` + + Summary of compacted content, or null if compaction failed + + - `type: "compaction"` + + - `context_management: object { applied_edits }` + + Context management response. + + Information about context management strategies applied during the request. + + - `applied_edits: array of BetaClearToolUses20250919EditResponse or BetaClearThinking20251015EditResponse` + + List of context management edits that were applied. + + - `beta_clear_tool_uses_20250919_edit_response: object { cleared_input_tokens, cleared_tool_uses, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_tool_uses: number` + + Number of tool uses that were cleared. + + - `type: "clear_tool_uses_20250919"` + + The type of context management edit applied. + + - `beta_clear_thinking_20251015_edit_response: object { cleared_input_tokens, cleared_thinking_turns, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_thinking_turns: number` + + Number of thinking turns that were cleared. + + - `type: "clear_thinking_20251015"` + + The type of context management edit applied. + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 5 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"compaction"` + + - `"refusal"` + + - `"model_context_window_exceeded"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 7 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `iterations: array of BetaMessageIterationUsage or BetaCompactionIterationUsage` + + Per-iteration token usage breakdown. + + Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + + - Determine which iterations exceeded long context thresholds (>=200k tokens) + - Calculate the true context window size from the last iteration + - Understand token accumulation across server-side tool use loops + + - `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + + - `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `speed: "standard" or "fast"` + + The inference speed mode used for this request. + + - `"standard"` + + - `"fast"` + + - `type: "succeeded"` + +# Agents + +## Create + +`$ ant beta:agents create` + +**post** `/v1/agents` + +Create Agent + +### Parameters + +- `--model: BetaManagedAgentsModelConfigParams` + + Body param: Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control + +- `--name: string` + + Body param: Human-readable name for the agent. 1-256 characters. + +- `--description: optional string` + + Body param: Description of what the agent does. Up to 2048 characters. + +- `--mcp-server: optional array of BetaManagedAgentsURLMCPServerParams` + + Body param: MCP servers this agent connects to. Maximum 20. Names must be unique within the array. + +- `--metadata: optional map[string]` + + Body param: Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars. + +- `--skill: optional array of BetaManagedAgentsSkillParams` + + Body param: Skills available to the agent. Maximum 20. + +- `--system: optional string` + + Body param: System prompt for the agent. Up to 100,000 characters. + +- `--tool: optional array of BetaManagedAgentsAgentToolset20260401Params or BetaManagedAgentsMCPToolsetParams or BetaManagedAgentsCustomToolParams` + + Body param: Tool configurations available to the agent. Maximum of 128 tools across all toolsets allowed. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_agent: object { id, archived_at, created_at, 11 more }` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```cli +ant beta:agents create \ + --api-key my-anthropic-api-key \ + --model '{id: claude-opus-4-6}' \ + --name 'My First Agent' +``` + +## List + +`$ ant beta:agents list` + +**get** `/v1/agents` + +List Agents + +### Parameters + +- `--created-at-gte: optional string` + + Query param: Return agents created at or after this time (inclusive). + +- `--created-at-lte: optional string` + + Query param: Return agents created at or before this time (inclusive). + +- `--include-archived: optional boolean` + + Query param: Include archived agents in results. Defaults to false. + +- `--limit: optional number` + + Query param: Maximum results per page. Default 20, maximum 100. + +- `--page: optional string` + + Query param: Opaque pagination cursor from a previous response. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaManagedAgentsListAgents: object { data, next_page }` + + Paginated list of agents. + + - `data: optional array of BetaManagedAgentsAgent` + + List of agents. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + + - `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```cli +ant beta:agents list \ + --api-key my-anthropic-api-key +``` + +## Retrieve + +`$ ant beta:agents retrieve` + +**get** `/v1/agents/{agent_id}` + +Get Agent + +### Parameters + +- `--agent-id: string` + + Path param: Path parameter agent_id + +- `--version: optional number` + + Query param: Agent version. Omit for the most recent version. Must be at least 1 if specified. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_agent: object { id, archived_at, created_at, 11 more }` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```cli +ant beta:agents retrieve \ + --api-key my-anthropic-api-key \ + --agent-id agent_011CZkYpogX7uDKUyvBTophP +``` + +## Update + +`$ ant beta:agents update` + +**post** `/v1/agents/{agent_id}` + +Update Agent + +### Parameters + +- `--agent-id: string` + + Path param: Path parameter agent_id + +- `--version: number` + + Body param: The agent's current version, used to prevent concurrent overwrites. Obtain this value from a create or retrieve response. The request fails if this does not match the server's current version. + +- `--description: optional string` + + Body param: Description. Up to 2048 characters. Omit to preserve; send empty string or null to clear. + +- `--mcp-server: optional array of BetaManagedAgentsURLMCPServerParams` + + Body param: MCP servers. Full replacement. Omit to preserve; send empty array or null to clear. Names must be unique. Maximum 20. + +- `--metadata: optional map[string]` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. The stored bag is limited to 16 keys (up to 64 chars each) with values up to 512 chars. + +- `--model: optional BetaManagedAgentsModelConfigParams` + + Body param: Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control. Omit to preserve. Cannot be cleared. + +- `--name: optional string` + + Body param: Human-readable name. 1-256 characters. Omit to preserve. Cannot be cleared. + +- `--skill: optional array of BetaManagedAgentsSkillParams` + + Body param: Skills. Full replacement. Omit to preserve; send empty array or null to clear. Maximum 20. + +- `--system: optional string` + + Body param: System prompt. Up to 100,000 characters. Omit to preserve; send empty string or null to clear. + +- `--tool: optional array of BetaManagedAgentsAgentToolset20260401Params or BetaManagedAgentsMCPToolsetParams or BetaManagedAgentsCustomToolParams` + + Body param: Tool configurations available to the agent. Full replacement. Omit to preserve; send empty array or null to clear. Maximum of 128 tools across all toolsets allowed. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_agent: object { id, archived_at, created_at, 11 more }` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```cli +ant beta:agents update \ + --api-key my-anthropic-api-key \ + --agent-id agent_011CZkYpogX7uDKUyvBTophP \ + --version 1 +``` + +## Archive + +`$ ant beta:agents archive` + +**post** `/v1/agents/{agent_id}/archive` + +Archive Agent + +### Parameters + +- `--agent-id: string` + + Path parameter agent_id + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_agent: object { id, archived_at, created_at, 11 more }` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```cli +ant beta:agents archive \ + --api-key my-anthropic-api-key \ + --agent-id agent_011CZkYpogX7uDKUyvBTophP +``` + +## Domain Types + +### Beta Managed Agents Agent + +- `beta_managed_agents_agent: object { id, archived_at, created_at, 11 more }` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Beta Managed Agents Agent Tool Config + +- `beta_managed_agents_agent_tool_config: object { enabled, name, permission_policy }` + + Configuration for a specific agent tool. + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Agent Tool Config Params + +- `beta_managed_agents_agent_tool_config_params: object { name, enabled, permission_policy }` + + Configuration override for a specific tool within a toolset. + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled: optional boolean` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Agent Toolset Default Config + +- `beta_managed_agents_agent_toolset_default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Agent Toolset Default Config Params + +- `beta_managed_agents_agent_toolset_default_config_params: object { enabled, permission_policy }` + + Default configuration for all tools in a toolset. + + - `enabled: optional boolean` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Agent Toolset20260401 + +- `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + +### Beta Managed Agents Agent Toolset20260401 Params + +- `beta_managed_agents_agent_toolset20260401_params: object { type, configs, default_config }` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `configs: optional array of BetaManagedAgentsAgentToolConfigParams` + + Per-tool configuration overrides. + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled: optional boolean` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: optional object { enabled, permission_policy }` + + Default configuration for all tools in a toolset. + + - `enabled: optional boolean` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Always Allow Policy + +- `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + +### Beta Managed Agents Always Ask Policy + +- `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Anthropic Skill + +- `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + +### Beta Managed Agents Anthropic Skill Params + +- `beta_managed_agents_anthropic_skill_params: object { skill_id, type, version }` + + An Anthropic-managed skill. + + - `skill_id: string` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: optional string` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents Custom Skill + +- `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + +### Beta Managed Agents Custom Skill Params + +- `beta_managed_agents_custom_skill_params: object { skill_id, type, version }` + + A user-created custom skill. + + - `skill_id: string` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: "custom"` + + - `"custom"` + + - `version: optional string` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents Custom Tool + +- `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + +### Beta Managed Agents Custom Tool Input Schema + +- `beta_managed_agents_custom_tool_input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + +### Beta Managed Agents Custom Tool Params + +- `beta_managed_agents_custom_tool_params: object { description, input_schema, name, type }` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: string` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: "custom"` + + - `"custom"` + +### Beta Managed Agents MCP Server URL Definition + +- `beta_managed_agents_mcp_server_url_definition: object { name, type, url }` + + URL-based MCP server connection as returned in API responses. + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + +### Beta Managed Agents MCP Tool Config + +- `beta_managed_agents_mcp_tool_config: object { enabled, name, permission_policy }` + + Resolved configuration for a specific MCP tool. + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents MCP Tool Config Params + +- `beta_managed_agents_mcp_tool_config_params: object { name, enabled, permission_policy }` + + Configuration override for a specific MCP tool. + + - `name: string` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled: optional boolean` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents MCP Toolset + +- `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + +### Beta Managed Agents MCP Toolset Default Config + +- `beta_managed_agents_mcp_toolset_default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents MCP Toolset Default Config Params + +- `beta_managed_agents_mcp_toolset_default_config_params: object { enabled, permission_policy }` + + Default configuration for all tools from an MCP server. + + - `enabled: optional boolean` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents MCP Toolset Params + +- `beta_managed_agents_mcp_toolset_params: object { mcp_server_name, type, configs, default_config }` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `mcp_server_name: string` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `configs: optional array of BetaManagedAgentsMCPToolConfigParams` + + Per-tool configuration overrides. + + - `name: string` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled: optional boolean` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: optional object { enabled, permission_policy }` + + Default configuration for all tools from an MCP server. + + - `enabled: optional boolean` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Model Config + +- `beta_managed_agents_model_config: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +### Beta Managed Agents Model Config Params + +- `beta_managed_agents_model_config_params: object { id, speed }` + + An object that defines additional configuration control over model use + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +### Beta Managed Agents Skill Params + +- `beta_managed_agents_skill_params: BetaManagedAgentsAnthropicSkillParams or BetaManagedAgentsCustomSkillParams` + + Skill to load in the session container. + + - `beta_managed_agents_anthropic_skill_params: object { skill_id, type, version }` + + An Anthropic-managed skill. + + - `skill_id: string` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: optional string` + + Version to pin. Defaults to latest if omitted. + + - `beta_managed_agents_custom_skill_params: object { skill_id, type, version }` + + A user-created custom skill. + + - `skill_id: string` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: "custom"` + + - `"custom"` + + - `version: optional string` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents URL MCP Server Params + +- `beta_managed_agents_url_mcp_server_params: object { name, type, url }` + + URL-based MCP server connection. + + - `name: string` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `type: "url"` + + - `"url"` + + - `url: string` + + Endpoint URL for the MCP server. + +# Versions + +## List + +`$ ant beta:agents:versions list` + +**get** `/v1/agents/{agent_id}/versions` + +List Agent Versions + +### Parameters + +- `--agent-id: string` + + Path param: Path parameter agent_id + +- `--limit: optional number` + + Query param: Maximum results per page. Default 20, maximum 100. + +- `--page: optional string` + + Query param: Opaque pagination cursor. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaManagedAgentsListAgentVersions: object { data, next_page }` + + Paginated list of agent versions. + + - `data: optional array of BetaManagedAgentsAgent` + + Agent versions. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + + - `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```cli +ant beta:agents:versions list \ + --api-key my-anthropic-api-key \ + --agent-id agent_011CZkYpogX7uDKUyvBTophP +``` + +# Environments + +## Create + +`$ ant beta:environments create` + +**post** `/v1/environments` + +Create a new environment with the specified configuration. + +### Parameters + +- `--name: string` + + Body param: Human-readable name for the environment + +- `--config: optional object { type, networking, packages }` + + Body param: Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + +- `--description: optional string` + + Body param: Optional description of the environment + +- `--metadata: optional map[string]` + + Body param: User-provided metadata key-value pairs + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_environment: object { id, archived_at, config, 6 more }` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: object { networking, packages, type }` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `beta_unrestricted_network: object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `beta_limited_network: object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `packages: object { apt, cargo, gem, 4 more }` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```cli +ant beta:environments create \ + --api-key my-anthropic-api-key \ + --name python-data-analysis +``` + +## List + +`$ ant beta:environments list` + +**get** `/v1/environments` + +List environments with pagination support. + +### Parameters + +- `--include-archived: optional boolean` + + Query param: Include archived environments in the response + +- `--limit: optional number` + + Query param: Maximum number of environments to return + +- `--page: optional string` + + Query param: Opaque cursor from previous response for pagination. Pass the `next_page` value from the previous response. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaEnvironmentListResponse: object { data, next_page }` + + Response when listing environments. + + This response model uses opaque cursor-based pagination. Use the `page` + query parameter with the value from `next_page` to fetch the next page. + + - `data: array of BetaEnvironment` + + List of environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: object { networking, packages, type }` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `beta_unrestricted_network: object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `beta_limited_network: object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `packages: object { apt, cargo, gem, 4 more }` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + + - `next_page: string` + + Token for fetching the next page of results. If `null`, there are no more results available. Pass this value to the `page` parameter in the next request. + +### Example + +```cli +ant beta:environments list \ + --api-key my-anthropic-api-key +``` + +## Retrieve + +`$ ant beta:environments retrieve` + +**get** `/v1/environments/{environment_id}` + +Retrieve a specific environment by ID. + +### Parameters + +- `--environment-id: string` + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_environment: object { id, archived_at, config, 6 more }` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: object { networking, packages, type }` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `beta_unrestricted_network: object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `beta_limited_network: object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `packages: object { apt, cargo, gem, 4 more }` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```cli +ant beta:environments retrieve \ + --api-key my-anthropic-api-key \ + --environment-id env_011CZkZ9X2dpNyB7HsEFoRfW +``` + +## Update + +`$ ant beta:environments update` + +**post** `/v1/environments/{environment_id}` + +Update an existing environment's configuration. + +### Parameters + +- `--environment-id: string` + + Path param + +- `--config: optional object { type, networking, packages }` + + Body param: Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + +- `--description: optional string` + + Body param: Updated description of the environment + +- `--metadata: optional map[string]` + + Body param: User-provided metadata key-value pairs. Set a value to null or empty string to delete the key. + +- `--name: optional string` + + Body param: Updated name for the environment + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_environment: object { id, archived_at, config, 6 more }` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: object { networking, packages, type }` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `beta_unrestricted_network: object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `beta_limited_network: object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `packages: object { apt, cargo, gem, 4 more }` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```cli +ant beta:environments update \ + --api-key my-anthropic-api-key \ + --environment-id env_011CZkZ9X2dpNyB7HsEFoRfW +``` + +## Delete + +`$ ant beta:environments delete` + +**delete** `/v1/environments/{environment_id}` + +Delete an environment by ID. Returns a confirmation of the deletion. + +### Parameters + +- `--environment-id: string` + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_environment_delete_response: object { id, type }` + + Response after deleting an environment. + + - `id: string` + + Environment identifier + + - `type: "environment_deleted"` + + The type of response + +### Example + +```cli +ant beta:environments delete \ + --api-key my-anthropic-api-key \ + --environment-id env_011CZkZ9X2dpNyB7HsEFoRfW +``` + +## Archive + +`$ ant beta:environments archive` + +**post** `/v1/environments/{environment_id}/archive` + +Archive an environment by ID. Archived environments cannot be used to create new sessions. + +### Parameters + +- `--environment-id: string` + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_environment: object { id, archived_at, config, 6 more }` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: object { networking, packages, type }` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `beta_unrestricted_network: object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `beta_limited_network: object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `packages: object { apt, cargo, gem, 4 more }` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```cli +ant beta:environments archive \ + --api-key my-anthropic-api-key \ + --environment-id env_011CZkZ9X2dpNyB7HsEFoRfW +``` + +## Domain Types + +### Beta Cloud Config + +- `beta_cloud_config: object { networking, packages, type }` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `beta_unrestricted_network: object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `beta_limited_network: object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `packages: object { apt, cargo, gem, 4 more }` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + +### Beta Cloud Config Params + +- `beta_cloud_config_params: object { type, networking, packages }` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "cloud"` + + Environment type + + - `networking: optional BetaUnrestrictedNetwork or BetaLimitedNetworkParams` + + Network configuration policy. Omit on update to preserve the existing value. + + - `beta_unrestricted_network: object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `beta_limited_network_params: object { type, allow_mcp_servers, allow_package_managers, allowed_hosts }` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "limited"` + + Network policy type + + - `allow_mcp_servers: optional boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: optional boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: optional array of string` + + Specifies domains the container can reach. + + - `packages: optional object { apt, cargo, gem, 4 more }` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: optional array of string` + + Ubuntu/Debian packages to install + + - `cargo: optional array of string` + + Rust packages to install + + - `gem: optional array of string` + + Ruby packages to install + + - `go: optional array of string` + + Go packages to install + + - `npm: optional array of string` + + Node.js packages to install + + - `pip: optional array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + +### Beta Environment + +- `beta_environment: object { id, archived_at, config, 6 more }` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: object { networking, packages, type }` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `beta_unrestricted_network: object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `beta_limited_network: object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `packages: object { apt, cargo, gem, 4 more }` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Beta Environment Delete Response + +- `beta_environment_delete_response: object { id, type }` + + Response after deleting an environment. + + - `id: string` + + Environment identifier + + - `type: "environment_deleted"` + + The type of response + +### Beta Limited Network + +- `beta_limited_network: object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + +### Beta Limited Network Params + +- `beta_limited_network_params: object { type, allow_mcp_servers, allow_package_managers, allowed_hosts }` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "limited"` + + Network policy type + + - `allow_mcp_servers: optional boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: optional boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: optional array of string` + + Specifies domains the container can reach. + +### Beta Packages + +- `beta_packages: object { apt, cargo, gem, 4 more }` + + Packages (and their versions) available in this environment. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + +### Beta Packages Params + +- `beta_packages_params: object { apt, cargo, gem, 4 more }` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: optional array of string` + + Ubuntu/Debian packages to install + + - `cargo: optional array of string` + + Rust packages to install + + - `gem: optional array of string` + + Ruby packages to install + + - `go: optional array of string` + + Go packages to install + + - `npm: optional array of string` + + Node.js packages to install + + - `pip: optional array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + +### Beta Unrestricted Network + +- `beta_unrestricted_network: object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + +# Sessions + +## Create + +`$ ant beta:sessions create` + +**post** `/v1/sessions` + +Create Session + +### Parameters + +- `--agent: string or BetaManagedAgentsAgentParams` + + Body param: Agent identifier. Accepts the `agent` ID string, which pins the latest version for the session, or an `agent` object with both id and version specified. + +- `--environment-id: string` + + Body param: ID of the `environment` defining the container configuration for this session. + +- `--metadata: optional map[string]` + + Body param: Arbitrary key-value metadata attached to the session. + +- `--resource: optional array of BetaManagedAgentsGitHubRepositoryResourceParams or BetaManagedAgentsFileResourceParams` + + Body param: Resources (e.g. repositories, files) to mount into the session's container. + +- `--title: optional string` + + Body param: Human-readable session title. + +- `--vault-id: optional array of string` + + Body param: Vault IDs for stored credentials the agent can use during the session. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_session: object { id, agent, archived_at, 11 more }` + + A Managed Agents `session`. + + - `id: string` + + - `agent: object { id, description, mcp_servers, 7 more }` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: object { active_seconds, duration_seconds }` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: object { cache_creation, cache_read_input_tokens, input_tokens, output_tokens }` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```cli +ant beta:sessions create \ + --api-key my-anthropic-api-key \ + --agent agent_011CZkYpogX7uDKUyvBTophP \ + --environment-id env_011CZkZ9X2dpNyB7HsEFoRfW +``` + +## List + +`$ ant beta:sessions list` + +**get** `/v1/sessions` + +List Sessions + +### Parameters + +- `--agent-id: optional string` + + Query param: Filter sessions created with this agent ID. + +- `--agent-version: optional number` + + Query param: Filter by agent version. Only applies when agent_id is also set. + +- `--created-at-gt: optional string` + + Query param: Return sessions created after this time (exclusive). + +- `--created-at-gte: optional string` + + Query param: Return sessions created at or after this time (inclusive). + +- `--created-at-lt: optional string` + + Query param: Return sessions created before this time (exclusive). + +- `--created-at-lte: optional string` + + Query param: Return sessions created at or before this time (inclusive). + +- `--include-archived: optional boolean` + + Query param: When true, includes archived sessions. Default: false (exclude archived). + +- `--limit: optional number` + + Query param: Maximum number of results to return. + +- `--order: optional "asc" or "desc"` + + Query param: Sort direction for results, ordered by created_at. Defaults to desc (newest first). + +- `--page: optional string` + + Query param: Opaque pagination cursor from a previous response's next_page. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaManagedAgentsListSessions: object { data, next_page }` + + Paginated list of sessions. + + - `data: optional array of BetaManagedAgentsSession` + + List of sessions. + + - `id: string` + + - `agent: object { id, description, mcp_servers, 7 more }` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: object { active_seconds, duration_seconds }` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: object { cache_creation, cache_read_input_tokens, input_tokens, output_tokens }` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + + - `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```cli +ant beta:sessions list \ + --api-key my-anthropic-api-key +``` + +## Retrieve + +`$ ant beta:sessions retrieve` + +**get** `/v1/sessions/{session_id}` + +Get Session + +### Parameters + +- `--session-id: string` + + Path parameter session_id + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_session: object { id, agent, archived_at, 11 more }` + + A Managed Agents `session`. + + - `id: string` + + - `agent: object { id, description, mcp_servers, 7 more }` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: object { active_seconds, duration_seconds }` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: object { cache_creation, cache_read_input_tokens, input_tokens, output_tokens }` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```cli +ant beta:sessions retrieve \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 +``` + +## Update + +`$ ant beta:sessions update` + +**post** `/v1/sessions/{session_id}` + +Update Session + +### Parameters + +- `--session-id: string` + + Path param: Path parameter session_id + +- `--metadata: optional map[string]` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. + +- `--title: optional string` + + Body param: Human-readable session title. + +- `--vault-id: optional array of string` + + Body param: Vault IDs (`vlt_*`) to attach to the session. Not yet supported; requests setting this field are rejected. Reserved for future use. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_session: object { id, agent, archived_at, 11 more }` + + A Managed Agents `session`. + + - `id: string` + + - `agent: object { id, description, mcp_servers, 7 more }` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: object { active_seconds, duration_seconds }` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: object { cache_creation, cache_read_input_tokens, input_tokens, output_tokens }` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```cli +ant beta:sessions update \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 +``` + +## Delete + +`$ ant beta:sessions delete` + +**delete** `/v1/sessions/{session_id}` + +Delete Session + +### Parameters + +- `--session-id: string` + + Path parameter session_id + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_deleted_session: object { id, type }` + + Confirmation that a `session` has been permanently deleted. + + - `id: string` + + - `type: "session_deleted"` + + - `"session_deleted"` + +### Example + +```cli +ant beta:sessions delete \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 +``` + +## Archive + +`$ ant beta:sessions archive` + +**post** `/v1/sessions/{session_id}/archive` + +Archive Session + +### Parameters + +- `--session-id: string` + + Path parameter session_id + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_session: object { id, agent, archived_at, 11 more }` + + A Managed Agents `session`. + + - `id: string` + + - `agent: object { id, description, mcp_servers, 7 more }` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: object { active_seconds, duration_seconds }` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: object { cache_creation, cache_read_input_tokens, input_tokens, output_tokens }` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```cli +ant beta:sessions archive \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 +``` + +## Domain Types + +### Beta Managed Agents Agent Params + +- `beta_managed_agents_agent_params: object { id, type, version }` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `id: string` + + The `agent` ID. + + - `type: "agent"` + + - `"agent"` + + - `version: optional number` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + +### Beta Managed Agents Branch Checkout + +- `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + +### Beta Managed Agents Cache Creation Usage + +- `beta_managed_agents_cache_creation_usage: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + +### Beta Managed Agents Commit Checkout + +- `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + +### Beta Managed Agents Deleted Session + +- `beta_managed_agents_deleted_session: object { id, type }` + + Confirmation that a `session` has been permanently deleted. + + - `id: string` + + - `type: "session_deleted"` + + - `"session_deleted"` + +### Beta Managed Agents File Resource Params + +- `beta_managed_agents_file_resource_params: object { file_id, type, mount_path }` + + Mount a file uploaded via the Files API into the session. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `mount_path: optional string` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +### Beta Managed Agents GitHub Repository Resource Params + +- `beta_managed_agents_github_repository_resource_params: object { authorization_token, type, url, 2 more }` + + Mount a GitHub repository into the session's container. + + - `authorization_token: string` + + GitHub authorization token used to clone the repository. + + - `type: "github_repository"` + + - `"github_repository"` + + - `url: string` + + Github URL of the repository + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `mount_path: optional string` + + Mount path in the container. Defaults to `/workspace/`. + +### Beta Managed Agents Session + +- `beta_managed_agents_session: object { id, agent, archived_at, 11 more }` + + A Managed Agents `session`. + + - `id: string` + + - `agent: object { id, description, mcp_servers, 7 more }` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: object { active_seconds, duration_seconds }` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: object { cache_creation, cache_read_input_tokens, input_tokens, output_tokens }` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Beta Managed Agents Session Agent + +- `beta_managed_agents_session_agent: object { id, description, mcp_servers, 7 more }` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + +### Beta Managed Agents Session Stats + +- `beta_managed_agents_session_stats: object { active_seconds, duration_seconds }` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + +### Beta Managed Agents Session Usage + +- `beta_managed_agents_session_usage: object { cache_creation, cache_read_input_tokens, input_tokens, output_tokens }` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + +# Events + +## List + +`$ ant beta:sessions:events list` + +**get** `/v1/sessions/{session_id}/events` + +List Events + +### Parameters + +- `--session-id: string` + + Path param: Path parameter session_id + +- `--limit: optional number` + + Query param: Query parameter for limit + +- `--order: optional "asc" or "desc"` + + Query param: Sort direction for results, ordered by created_at. Defaults to asc (chronological). + +- `--page: optional string` + + Query param: Opaque pagination cursor from a previous response's next_page. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaManagedAgentsListSessionEvents: object { data, next_page }` + + Paginated list of events for a `session`. + + - `data: optional array of BetaManagedAgentsSessionEvent` + + Events for the session, ordered by `created_at`. + + - `beta_managed_agents_user_message_event: object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_interrupt_event: object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_tool_confirmation_event: object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_custom_tool_result_event: object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_agent_custom_tool_use_event: object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `beta_managed_agents_agent_message_event: object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `beta_managed_agents_agent_thinking_event: object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `beta_managed_agents_agent_mcp_tool_use_event: object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `beta_managed_agents_agent_mcp_tool_result_event: object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `beta_managed_agents_agent_tool_use_event: object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `beta_managed_agents_agent_tool_result_event: object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `beta_managed_agents_agent_thread_context_compacted_event: object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `beta_managed_agents_session_error_event: object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `beta_managed_agents_unknown_error: object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `beta_managed_agents_model_overloaded_error: object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `beta_managed_agents_model_rate_limited_error: object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `beta_managed_agents_model_request_failed_error: object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `beta_managed_agents_mcp_connection_failed_error: object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `beta_managed_agents_mcp_authentication_failed_error: object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `beta_managed_agents_billing_error: object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `beta_managed_agents_session_status_rescheduled_event: object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `beta_managed_agents_session_status_running_event: object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `beta_managed_agents_session_status_idle_event: object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `beta_managed_agents_session_end_turn: object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `beta_managed_agents_session_requires_action: object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `beta_managed_agents_session_retries_exhausted: object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `beta_managed_agents_session_status_terminated_event: object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `beta_managed_agents_span_model_request_start_event: object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `beta_managed_agents_span_model_request_end_event: object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: object { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 2 more }` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `beta_managed_agents_session_deleted_event: object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + + - `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```cli +ant beta:sessions:events list \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 +``` + +## Send + +`$ ant beta:sessions:events send` + +**post** `/v1/sessions/{session_id}/events` + +Send Events + +### Parameters + +- `--session-id: string` + + Path param: Path parameter session_id + +- `--event: array of BetaManagedAgentsEventParams` + + Body param: Events to send to the `session`. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_send_session_events: object { data }` + + Events that were successfully sent to the session. + + - `data: optional array of BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or BetaManagedAgentsUserCustomToolResultEvent` + + Sent events + + - `beta_managed_agents_user_message_event: object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_interrupt_event: object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_tool_confirmation_event: object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_custom_tool_result_event: object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Example + +```cli +ant beta:sessions:events send \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 \ + --event "{content: [{text: 'Where is my order #1234?', type: text}], type: user.message}" +``` + +## Stream + +`$ ant beta:sessions:events stream` + +**get** `/v1/sessions/{session_id}/events/stream` + +Stream Events + +### Parameters + +- `--session-id: string` + + Path parameter session_id + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_stream_session_events: BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or 17 more` + + Server-sent event in the session stream. + + - `beta_managed_agents_user_message_event: object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_interrupt_event: object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_tool_confirmation_event: object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_custom_tool_result_event: object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_agent_custom_tool_use_event: object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `beta_managed_agents_agent_message_event: object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `beta_managed_agents_agent_thinking_event: object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `beta_managed_agents_agent_mcp_tool_use_event: object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `beta_managed_agents_agent_mcp_tool_result_event: object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `beta_managed_agents_agent_tool_use_event: object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `beta_managed_agents_agent_tool_result_event: object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `beta_managed_agents_agent_thread_context_compacted_event: object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `beta_managed_agents_session_error_event: object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `beta_managed_agents_unknown_error: object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `beta_managed_agents_model_overloaded_error: object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `beta_managed_agents_model_rate_limited_error: object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `beta_managed_agents_model_request_failed_error: object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `beta_managed_agents_mcp_connection_failed_error: object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `beta_managed_agents_mcp_authentication_failed_error: object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `beta_managed_agents_billing_error: object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `beta_managed_agents_session_status_rescheduled_event: object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `beta_managed_agents_session_status_running_event: object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `beta_managed_agents_session_status_idle_event: object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `beta_managed_agents_session_end_turn: object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `beta_managed_agents_session_requires_action: object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `beta_managed_agents_session_retries_exhausted: object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `beta_managed_agents_session_status_terminated_event: object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `beta_managed_agents_span_model_request_start_event: object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `beta_managed_agents_span_model_request_end_event: object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: object { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 2 more }` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `beta_managed_agents_session_deleted_event: object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Example + +```cli +ant beta:sessions:events stream \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 +``` + +## Domain Types + +### Beta Managed Agents Agent Custom Tool Use Event + +- `beta_managed_agents_agent_custom_tool_use_event: object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + +### Beta Managed Agents Agent MCP Tool Result Event + +- `beta_managed_agents_agent_mcp_tool_result_event: object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent MCP Tool Use Event + +- `beta_managed_agents_agent_mcp_tool_use_event: object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + +### Beta Managed Agents Agent Message Event + +- `beta_managed_agents_agent_message_event: object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + +### Beta Managed Agents Agent Thinking Event + +- `beta_managed_agents_agent_thinking_event: object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + +### Beta Managed Agents Agent Thread Context Compacted Event + +- `beta_managed_agents_agent_thread_context_compacted_event: object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + +### Beta Managed Agents Agent Tool Result Event + +- `beta_managed_agents_agent_tool_result_event: object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent Tool Use Event + +- `beta_managed_agents_agent_tool_use_event: object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + +### Beta Managed Agents Base64 Document Source + +- `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + +### Beta Managed Agents Base64 Image Source + +- `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + +### Beta Managed Agents Billing Error + +- `beta_managed_agents_billing_error: object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + +### Beta Managed Agents Document Block + +- `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + +### Beta Managed Agents Event Params + +- `beta_managed_agents_event_params: BetaManagedAgentsUserMessageEventParams or BetaManagedAgentsUserInterruptEventParams or BetaManagedAgentsUserToolConfirmationEventParams or BetaManagedAgentsUserCustomToolResultEventParams` + + Union type for event parameters that can be sent to a session. + + - `beta_managed_agents_user_message_event_params: object { content, type }` + + Parameters for sending a user message to the session. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks for the user message. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `beta_managed_agents_user_interrupt_event_params: object { type }` + + Parameters for sending an interrupt to pause the agent. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `beta_managed_agents_user_tool_confirmation_event_params: object { result, tool_use_id, type, deny_message }` + + Parameters for confirming or denying a tool execution request. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `beta_managed_agents_user_custom_tool_result_event_params: object { custom_tool_use_id, type, content, is_error }` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents File Document Source + +- `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + +### Beta Managed Agents File Image Source + +- `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + +### Beta Managed Agents Image Block + +- `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + +### Beta Managed Agents MCP Authentication Failed Error + +- `beta_managed_agents_mcp_authentication_failed_error: object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + +### Beta Managed Agents MCP Connection Failed Error + +- `beta_managed_agents_mcp_connection_failed_error: object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + +### Beta Managed Agents Model Overloaded Error + +- `beta_managed_agents_model_overloaded_error: object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + +### Beta Managed Agents Model Rate Limited Error + +- `beta_managed_agents_model_rate_limited_error: object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + +### Beta Managed Agents Model Request Failed Error + +- `beta_managed_agents_model_request_failed_error: object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + +### Beta Managed Agents Plain Text Document Source + +- `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + +### Beta Managed Agents Retry Status Exhausted + +- `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + +### Beta Managed Agents Retry Status Retrying + +- `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + +### Beta Managed Agents Retry Status Terminal + +- `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + +### Beta Managed Agents Send Session Events + +- `beta_managed_agents_send_session_events: object { data }` + + Events that were successfully sent to the session. + + - `data: optional array of BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or BetaManagedAgentsUserCustomToolResultEvent` + + Sent events + + - `beta_managed_agents_user_message_event: object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_interrupt_event: object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_tool_confirmation_event: object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_custom_tool_result_event: object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents Session Deleted Event + +- `beta_managed_agents_session_deleted_event: object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Beta Managed Agents Session End Turn + +- `beta_managed_agents_session_end_turn: object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + +### Beta Managed Agents Session Error Event + +- `beta_managed_agents_session_error_event: object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `beta_managed_agents_unknown_error: object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `beta_managed_agents_model_overloaded_error: object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `beta_managed_agents_model_rate_limited_error: object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `beta_managed_agents_model_request_failed_error: object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `beta_managed_agents_mcp_connection_failed_error: object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `beta_managed_agents_mcp_authentication_failed_error: object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `beta_managed_agents_billing_error: object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + +### Beta Managed Agents Session Event + +- `beta_managed_agents_session_event: BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or 17 more` + + Union type for all event types in a session. + + - `beta_managed_agents_user_message_event: object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_interrupt_event: object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_tool_confirmation_event: object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_custom_tool_result_event: object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_agent_custom_tool_use_event: object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `beta_managed_agents_agent_message_event: object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `beta_managed_agents_agent_thinking_event: object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `beta_managed_agents_agent_mcp_tool_use_event: object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `beta_managed_agents_agent_mcp_tool_result_event: object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `beta_managed_agents_agent_tool_use_event: object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `beta_managed_agents_agent_tool_result_event: object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `beta_managed_agents_agent_thread_context_compacted_event: object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `beta_managed_agents_session_error_event: object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `beta_managed_agents_unknown_error: object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `beta_managed_agents_model_overloaded_error: object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `beta_managed_agents_model_rate_limited_error: object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `beta_managed_agents_model_request_failed_error: object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `beta_managed_agents_mcp_connection_failed_error: object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `beta_managed_agents_mcp_authentication_failed_error: object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `beta_managed_agents_billing_error: object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `beta_managed_agents_session_status_rescheduled_event: object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `beta_managed_agents_session_status_running_event: object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `beta_managed_agents_session_status_idle_event: object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `beta_managed_agents_session_end_turn: object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `beta_managed_agents_session_requires_action: object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `beta_managed_agents_session_retries_exhausted: object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `beta_managed_agents_session_status_terminated_event: object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `beta_managed_agents_span_model_request_start_event: object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `beta_managed_agents_span_model_request_end_event: object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: object { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 2 more }` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `beta_managed_agents_session_deleted_event: object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Beta Managed Agents Session Requires Action + +- `beta_managed_agents_session_requires_action: object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + +### Beta Managed Agents Session Retries Exhausted + +- `beta_managed_agents_session_retries_exhausted: object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + +### Beta Managed Agents Session Status Idle Event + +- `beta_managed_agents_session_status_idle_event: object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `beta_managed_agents_session_end_turn: object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `beta_managed_agents_session_requires_action: object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `beta_managed_agents_session_retries_exhausted: object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + +### Beta Managed Agents Session Status Rescheduled Event + +- `beta_managed_agents_session_status_rescheduled_event: object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + +### Beta Managed Agents Session Status Running Event + +- `beta_managed_agents_session_status_running_event: object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + +### Beta Managed Agents Session Status Terminated Event + +- `beta_managed_agents_session_status_terminated_event: object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + +### Beta Managed Agents Span Model Request End Event + +- `beta_managed_agents_span_model_request_end_event: object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: object { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 2 more }` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + +### Beta Managed Agents Span Model Request Start Event + +- `beta_managed_agents_span_model_request_start_event: object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + +### Beta Managed Agents Span Model Usage + +- `beta_managed_agents_span_model_usage: object { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 2 more }` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +### Beta Managed Agents Stream Session Events + +- `beta_managed_agents_stream_session_events: BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or 17 more` + + Server-sent event in the session stream. + + - `beta_managed_agents_user_message_event: object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_interrupt_event: object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_tool_confirmation_event: object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_custom_tool_result_event: object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_agent_custom_tool_use_event: object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `beta_managed_agents_agent_message_event: object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `beta_managed_agents_agent_thinking_event: object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `beta_managed_agents_agent_mcp_tool_use_event: object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `beta_managed_agents_agent_mcp_tool_result_event: object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `beta_managed_agents_agent_tool_use_event: object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `beta_managed_agents_agent_tool_result_event: object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `beta_managed_agents_agent_thread_context_compacted_event: object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `beta_managed_agents_session_error_event: object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `beta_managed_agents_unknown_error: object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `beta_managed_agents_model_overloaded_error: object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `beta_managed_agents_model_rate_limited_error: object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `beta_managed_agents_model_request_failed_error: object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `beta_managed_agents_mcp_connection_failed_error: object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `beta_managed_agents_mcp_authentication_failed_error: object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `beta_managed_agents_billing_error: object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `beta_managed_agents_session_status_rescheduled_event: object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `beta_managed_agents_session_status_running_event: object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `beta_managed_agents_session_status_idle_event: object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `beta_managed_agents_session_end_turn: object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `beta_managed_agents_session_requires_action: object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `beta_managed_agents_session_retries_exhausted: object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `beta_managed_agents_session_status_terminated_event: object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `beta_managed_agents_span_model_request_start_event: object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `beta_managed_agents_span_model_request_end_event: object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: object { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 2 more }` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `beta_managed_agents_session_deleted_event: object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Beta Managed Agents Text Block + +- `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + +### Beta Managed Agents Unknown Error + +- `beta_managed_agents_unknown_error: object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + +### Beta Managed Agents URL Document Source + +- `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + +### Beta Managed Agents URL Image Source + +- `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + +### Beta Managed Agents User Custom Tool Result Event + +- `beta_managed_agents_user_custom_tool_result_event: object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Custom Tool Result Event Params + +- `beta_managed_agents_user_custom_tool_result_event_params: object { custom_tool_use_id, type, content, is_error }` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents User Interrupt Event + +- `beta_managed_agents_user_interrupt_event: object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Interrupt Event Params + +- `beta_managed_agents_user_interrupt_event_params: object { type }` + + Parameters for sending an interrupt to pause the agent. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + +### Beta Managed Agents User Message Event + +- `beta_managed_agents_user_message_event: object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Message Event Params + +- `beta_managed_agents_user_message_event_params: object { content, type }` + + Parameters for sending a user message to the session. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks for the user message. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + +### Beta Managed Agents User Tool Confirmation Event + +- `beta_managed_agents_user_tool_confirmation_event: object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Tool Confirmation Event Params + +- `beta_managed_agents_user_tool_confirmation_event_params: object { result, tool_use_id, type, deny_message }` + + Parameters for confirming or denying a tool execution request. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + +# Resources + +## Add + +`$ ant beta:sessions:resources add` + +**post** `/v1/sessions/{session_id}/resources` + +Add Session Resource + +### Parameters + +- `--session-id: string` + + Path param: Path parameter session_id + +- `--file-id: string` + + Body param: ID of a previously uploaded file. + +- `--type: "file"` + + Body param + +- `--mount-path: optional string` + + Body param: Mount path in the container. Defaults to `/mnt/session/uploads/`. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```cli +ant beta:sessions:resources add \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 \ + --file-id file_011CNha8iCJcU1wXNR6q4V8w \ + --type file +``` + +## List + +`$ ant beta:sessions:resources list` + +**get** `/v1/sessions/{session_id}/resources` + +List Session Resources + +### Parameters + +- `--session-id: string` + + Path param: Path parameter session_id + +- `--limit: optional number` + + Query param: Maximum number of resources to return per page (max 1000). If omitted, returns all resources. + +- `--page: optional string` + + Query param: Opaque cursor from a previous response's next_page field. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaManagedAgentsListSessionResources: object { data, next_page }` + + Paginated list of resources attached to a session. + + - `data: array of BetaManagedAgentsSessionResource` + + Resources for the session, ordered by `created_at`. + + - `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```cli +ant beta:sessions:resources list \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 +``` + +## Retrieve + +`$ ant beta:sessions:resources retrieve` + +**get** `/v1/sessions/{session_id}/resources/{resource_id}` + +Get Session Resource + +### Parameters + +- `--session-id: string` + + Path param: Path parameter session_id + +- `--resource-id: string` + + Path param: Path parameter resource_id + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaSessionResourceGetResponse: BetaManagedAgentsGitHubRepositoryResource or BetaManagedAgentsFileResource` + + The requested session resource. + + - `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```cli +ant beta:sessions:resources retrieve \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 \ + --resource-id sesrsc_011CZkZBJq5dWxk9fVLNcPht +``` + +## Update + +`$ ant beta:sessions:resources update` + +**post** `/v1/sessions/{session_id}/resources/{resource_id}` + +Update Session Resource + +### Parameters + +- `--session-id: string` + + Path param: Path parameter session_id + +- `--resource-id: string` + + Path param: Path parameter resource_id + +- `--authorization-token: string` + + Body param: New authorization token for the resource. Currently only `github_repository` resources support token rotation. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaSessionResourceUpdateResponse: BetaManagedAgentsGitHubRepositoryResource or BetaManagedAgentsFileResource` + + The updated session resource. + + - `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```cli +ant beta:sessions:resources update \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 \ + --resource-id sesrsc_011CZkZBJq5dWxk9fVLNcPht \ + --authorization-token ghp_exampletoken +``` + +## Delete + +`$ ant beta:sessions:resources delete` + +**delete** `/v1/sessions/{session_id}/resources/{resource_id}` + +Delete Session Resource + +### Parameters + +- `--session-id: string` + + Path param: Path parameter session_id + +- `--resource-id: string` + + Path param: Path parameter resource_id + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_delete_session_resource: object { id, type }` + + Confirmation of resource deletion. + + - `id: string` + + - `type: "session_resource_deleted"` + + - `"session_resource_deleted"` + +### Example + +```cli +ant beta:sessions:resources delete \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 \ + --resource-id sesrsc_011CZkZBJq5dWxk9fVLNcPht +``` + +## Domain Types + +### Beta Managed Agents Delete Session Resource + +- `beta_managed_agents_delete_session_resource: object { id, type }` + + Confirmation of resource deletion. + + - `id: string` + + - `type: "session_resource_deleted"` + + - `"session_resource_deleted"` + +### Beta Managed Agents File Resource + +- `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents GitHub Repository Resource + +- `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + +### Beta Managed Agents Session Resource + +- `beta_managed_agents_session_resource: BetaManagedAgentsGitHubRepositoryResource or BetaManagedAgentsFileResource` + + - `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +# Vaults + +## Create + +`$ ant beta:vaults create` + +**post** `/v1/vaults` + +Create Vault + +### Parameters + +- `--display-name: string` + + Body param: Human-readable name for the vault. 1-255 characters. + +- `--metadata: optional map[string]` + + Body param: Arbitrary key-value metadata to attach to the vault. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_vault: object { id, archived_at, created_at, 4 more }` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```cli +ant beta:vaults create \ + --api-key my-anthropic-api-key \ + --display-name 'Example vault' +``` + +## List + +`$ ant beta:vaults list` + +**get** `/v1/vaults` + +List Vaults + +### Parameters + +- `--include-archived: optional boolean` + + Query param: Whether to include archived vaults in the results. + +- `--limit: optional number` + + Query param: Maximum number of vaults to return per page. Defaults to 20, maximum 100. + +- `--page: optional string` + + Query param: Opaque pagination token from a previous `list_vaults` response. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaManagedAgentsListVaultsResponse: object { data, next_page }` + + Response containing a paginated list of vaults. + + - `data: optional array of BetaManagedAgentsVault` + + List of vaults. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `next_page: optional string` + + Pagination token for the next page, or null if no more results. + +### Example + +```cli +ant beta:vaults list \ + --api-key my-anthropic-api-key +``` + +## Retrieve + +`$ ant beta:vaults retrieve` + +**get** `/v1/vaults/{vault_id}` + +Get Vault + +### Parameters + +- `--vault-id: string` + + Path parameter vault_id + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_vault: object { id, archived_at, created_at, 4 more }` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```cli +ant beta:vaults retrieve \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv +``` + +## Update + +`$ ant beta:vaults update` + +**post** `/v1/vaults/{vault_id}` + +Update Vault + +### Parameters + +- `--vault-id: string` + + Path param: Path parameter vault_id + +- `--display-name: optional string` + + Body param: Updated human-readable name for the vault. 1-255 characters. + +- `--metadata: optional map[string]` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_vault: object { id, archived_at, created_at, 4 more }` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```cli +ant beta:vaults update \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv +``` + +## Delete + +`$ ant beta:vaults delete` + +**delete** `/v1/vaults/{vault_id}` + +Delete Vault + +### Parameters + +- `--vault-id: string` + + Path parameter vault_id + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_deleted_vault: object { id, type }` + + Confirmation of a deleted vault. + + - `id: string` + + Unique identifier of the deleted vault. + + - `type: "vault_deleted"` + + - `"vault_deleted"` + +### Example + +```cli +ant beta:vaults delete \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv +``` + +## Archive + +`$ ant beta:vaults archive` + +**post** `/v1/vaults/{vault_id}/archive` + +Archive Vault + +### Parameters + +- `--vault-id: string` + + Path parameter vault_id + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_vault: object { id, archived_at, created_at, 4 more }` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```cli +ant beta:vaults archive \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv +``` + +## Domain Types + +### Beta Managed Agents Deleted Vault + +- `beta_managed_agents_deleted_vault: object { id, type }` + + Confirmation of a deleted vault. + + - `id: string` + + Unique identifier of the deleted vault. + + - `type: "vault_deleted"` + + - `"vault_deleted"` + +### Beta Managed Agents Vault + +- `beta_managed_agents_vault: object { id, archived_at, created_at, 4 more }` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +# Credentials + +## Create + +`$ ant beta:vaults:credentials create` + +**post** `/v1/vaults/{vault_id}/credentials` + +Create Credential + +### Parameters + +- `--vault-id: string` + + Path param: Path parameter vault_id + +- `--auth: BetaManagedAgentsMCPOAuthCreateParams or BetaManagedAgentsStaticBearerCreateParams` + + Body param: Authentication details for creating a credential. + +- `--display-name: optional string` + + Body param: Human-readable name for the credential. Up to 255 characters. + +- `--metadata: optional map[string]` + + Body param: Arbitrary key-value metadata to attach to the credential. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_credential: object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `beta_managed_agents_mcp_oauth_auth_response: object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional object { client_id, token_endpoint, token_endpoint_auth, 2 more }` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_response: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_response: object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_response: object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `beta_managed_agents_static_bearer_auth_response: object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Example + +```cli +ant beta:vaults:credentials create \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv \ + --auth '{token: bearer_exampletoken, mcp_server_url: https://example-server.modelcontextprotocol.io/sse, type: static_bearer}' +``` + +## List + +`$ ant beta:vaults:credentials list` + +**get** `/v1/vaults/{vault_id}/credentials` + +List Credentials + +### Parameters + +- `--vault-id: string` + + Path param: Path parameter vault_id + +- `--include-archived: optional boolean` + + Query param: Whether to include archived credentials in the results. + +- `--limit: optional number` + + Query param: Maximum number of credentials to return per page. Defaults to 20, maximum 100. + +- `--page: optional string` + + Query param: Opaque pagination token from a previous `list_credentials` response. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaManagedAgentsListCredentialsResponse: object { data, next_page }` + + Response containing a paginated list of credentials. + + - `data: optional array of BetaManagedAgentsCredential` + + List of credentials. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `beta_managed_agents_mcp_oauth_auth_response: object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional object { client_id, token_endpoint, token_endpoint_auth, 2 more }` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_response: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_response: object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_response: object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `beta_managed_agents_static_bearer_auth_response: object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + + - `next_page: optional string` + + Pagination token for the next page, or null if no more results. + +### Example + +```cli +ant beta:vaults:credentials list \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv +``` + +## Retrieve + +`$ ant beta:vaults:credentials retrieve` + +**get** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Get Credential + +### Parameters + +- `--vault-id: string` + + Path param: Path parameter vault_id + +- `--credential-id: string` + + Path param: Path parameter credential_id + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_credential: object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `beta_managed_agents_mcp_oauth_auth_response: object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional object { client_id, token_endpoint, token_endpoint_auth, 2 more }` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_response: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_response: object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_response: object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `beta_managed_agents_static_bearer_auth_response: object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Example + +```cli +ant beta:vaults:credentials retrieve \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv \ + --credential-id vcrd_011CZkZEMt8gZan2iYOQfSkw +``` + +## Update + +`$ ant beta:vaults:credentials update` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Update Credential + +### Parameters + +- `--vault-id: string` + + Path param: Path parameter vault_id + +- `--credential-id: string` + + Path param: Path parameter credential_id + +- `--auth: optional BetaManagedAgentsMCPOAuthUpdateParams or BetaManagedAgentsStaticBearerUpdateParams` + + Body param: Updated authentication details for a credential. + +- `--display-name: optional string` + + Body param: Updated human-readable name for the credential. 1-255 characters. + +- `--metadata: optional map[string]` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_credential: object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `beta_managed_agents_mcp_oauth_auth_response: object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional object { client_id, token_endpoint, token_endpoint_auth, 2 more }` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_response: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_response: object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_response: object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `beta_managed_agents_static_bearer_auth_response: object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Example + +```cli +ant beta:vaults:credentials update \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv \ + --credential-id vcrd_011CZkZEMt8gZan2iYOQfSkw +``` + +## Delete + +`$ ant beta:vaults:credentials delete` + +**delete** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Delete Credential + +### Parameters + +- `--vault-id: string` + + Path param: Path parameter vault_id + +- `--credential-id: string` + + Path param: Path parameter credential_id + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_deleted_credential: object { id, type }` + + Confirmation of a deleted credential. + + - `id: string` + + Unique identifier of the deleted credential. + + - `type: "vault_credential_deleted"` + + - `"vault_credential_deleted"` + +### Example + +```cli +ant beta:vaults:credentials delete \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv \ + --credential-id vcrd_011CZkZEMt8gZan2iYOQfSkw +``` + +## Archive + +`$ ant beta:vaults:credentials archive` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}/archive` + +Archive Credential + +### Parameters + +- `--vault-id: string` + + Path param: Path parameter vault_id + +- `--credential-id: string` + + Path param: Path parameter credential_id + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_credential: object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `beta_managed_agents_mcp_oauth_auth_response: object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional object { client_id, token_endpoint, token_endpoint_auth, 2 more }` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_response: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_response: object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_response: object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `beta_managed_agents_static_bearer_auth_response: object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Example + +```cli +ant beta:vaults:credentials archive \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv \ + --credential-id vcrd_011CZkZEMt8gZan2iYOQfSkw +``` + +## Domain Types + +### Beta Managed Agents Credential + +- `beta_managed_agents_credential: object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `beta_managed_agents_mcp_oauth_auth_response: object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional object { client_id, token_endpoint, token_endpoint_auth, 2 more }` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_response: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_response: object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_response: object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `beta_managed_agents_static_bearer_auth_response: object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Beta Managed Agents Deleted Credential + +- `beta_managed_agents_deleted_credential: object { id, type }` + + Confirmation of a deleted credential. + + - `id: string` + + Unique identifier of the deleted credential. + + - `type: "vault_credential_deleted"` + + - `"vault_credential_deleted"` + +### Beta Managed Agents MCP OAuth Auth Response + +- `beta_managed_agents_mcp_oauth_auth_response: object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional object { client_id, token_endpoint, token_endpoint_auth, 2 more }` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_response: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_response: object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_response: object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Create Params + +- `beta_managed_agents_mcp_oauth_create_params: object { access_token, mcp_server_url, type, 2 more }` + + Parameters for creating an MCP OAuth credential. + + - `access_token: string` + + OAuth access token. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional object { client_id, refresh_token, token_endpoint, 3 more }` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: string` + + OAuth client ID. + + - `refresh_token: string` + + OAuth refresh token. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam or BetaManagedAgentsTokenEndpointAuthBasicParam or BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_param: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_param: object { client_secret, type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_param: object { client_secret, type }` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Params + +- `beta_managed_agents_mcp_oauth_refresh_params: object { client_id, refresh_token, token_endpoint, 3 more }` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: string` + + OAuth client ID. + + - `refresh_token: string` + + OAuth refresh token. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam or BetaManagedAgentsTokenEndpointAuthBasicParam or BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_param: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_param: object { client_secret, type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_param: object { client_secret, type }` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Response + +- `beta_managed_agents_mcp_oauth_refresh_response: object { client_id, token_endpoint, token_endpoint_auth, 2 more }` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_response: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_response: object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_response: object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Update Params + +- `beta_managed_agents_mcp_oauth_refresh_update_params: object { refresh_token, scope, token_endpoint_auth }` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: optional string` + + Updated OAuth refresh token. + + - `scope: optional string` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: optional BetaManagedAgentsTokenEndpointAuthBasicUpdateParam or BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `beta_managed_agents_token_endpoint_auth_basic_update_param: object { type, client_secret }` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret: optional string` + + Updated OAuth client secret. + + - `beta_managed_agents_token_endpoint_auth_post_update_param: object { type, client_secret }` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret: optional string` + + Updated OAuth client secret. + +### Beta Managed Agents MCP OAuth Update Params + +- `beta_managed_agents_mcp_oauth_update_params: object { type, access_token, expires_at, refresh }` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `access_token: optional string` + + Updated OAuth access token. + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional object { refresh_token, scope, token_endpoint_auth }` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: optional string` + + Updated OAuth refresh token. + + - `scope: optional string` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: optional BetaManagedAgentsTokenEndpointAuthBasicUpdateParam or BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `beta_managed_agents_token_endpoint_auth_basic_update_param: object { type, client_secret }` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret: optional string` + + Updated OAuth client secret. + + - `beta_managed_agents_token_endpoint_auth_post_update_param: object { type, client_secret }` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret: optional string` + + Updated OAuth client secret. + +### Beta Managed Agents Static Bearer Auth Response + +- `beta_managed_agents_static_bearer_auth_response: object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + +### Beta Managed Agents Static Bearer Create Params + +- `beta_managed_agents_static_bearer_create_params: object { token, mcp_server_url, type }` + + Parameters for creating a static bearer token credential. + + - `token: string` + + Static bearer token value. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + +### Beta Managed Agents Static Bearer Update Params + +- `beta_managed_agents_static_bearer_update_params: object { type, token }` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `token: optional string` + + Updated static bearer token value. + +### Beta Managed Agents Token Endpoint Auth Basic Param + +- `beta_managed_agents_token_endpoint_auth_basic_param: object { client_secret, type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + +### Beta Managed Agents Token Endpoint Auth Basic Response + +- `beta_managed_agents_token_endpoint_auth_basic_response: object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + +### Beta Managed Agents Token Endpoint Auth Basic Update Param + +- `beta_managed_agents_token_endpoint_auth_basic_update_param: object { type, client_secret }` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret: optional string` + + Updated OAuth client secret. + +### Beta Managed Agents Token Endpoint Auth None Param + +- `beta_managed_agents_token_endpoint_auth_none_param: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + +### Beta Managed Agents Token Endpoint Auth None Response + +- `beta_managed_agents_token_endpoint_auth_none_response: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + +### Beta Managed Agents Token Endpoint Auth Post Param + +- `beta_managed_agents_token_endpoint_auth_post_param: object { client_secret, type }` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + +### Beta Managed Agents Token Endpoint Auth Post Response + +- `beta_managed_agents_token_endpoint_auth_post_response: object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + +### Beta Managed Agents Token Endpoint Auth Post Update Param + +- `beta_managed_agents_token_endpoint_auth_post_update_param: object { type, client_secret }` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret: optional string` + + Updated OAuth client secret. + +# Files + +## Upload + +`$ ant beta:files upload` + +**post** `/v1/files` + +Upload File + +### Parameters + +- `--file: string` + + Body param: The file to upload + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `file_metadata: object { id, created_at, filename, 5 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `created_at: string` + + RFC 3339 datetime string representing when the file was created. + + - `filename: string` + + Original filename of the uploaded file. + + - `mime_type: string` + + MIME type of the file. + + - `size_bytes: number` + + Size of the file in bytes. + + - `type: "file"` + + Object type. + + For files, this is always `"file"`. + + - `downloadable: optional boolean` + + Whether the file can be downloaded. + + - `scope: optional object { id, type }` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + +### Example + +```cli +ant beta:files upload \ + --api-key my-anthropic-api-key \ + --file 'Example data' +``` + +## List + +`$ ant beta:files list` + +**get** `/v1/files` + +List Files + +### Parameters + +- `--after-id: optional string` + + Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object. + +- `--before-id: optional string` + + Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object. + +- `--limit: optional number` + + Query param: Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + +- `--scope-id: optional string` + + Query param: Filter by scope ID. Only returns files associated with the specified scope (e.g., a session ID). + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaFileListResponse: object { data, first_id, has_more, last_id }` + + - `data: array of FileMetadata` + + List of file metadata objects. + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `created_at: string` + + RFC 3339 datetime string representing when the file was created. + + - `filename: string` + + Original filename of the uploaded file. + + - `mime_type: string` + + MIME type of the file. + + - `size_bytes: number` + + Size of the file in bytes. + + - `type: "file"` + + Object type. + + For files, this is always `"file"`. + + - `downloadable: optional boolean` + + Whether the file can be downloaded. + + - `scope: optional object { id, type }` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + + - `first_id: optional string` + + ID of the first file in this page of results. + + - `has_more: optional boolean` + + Whether there are more results available. + + - `last_id: optional string` + + ID of the last file in this page of results. + +### Example + +```cli +ant beta:files list \ + --api-key my-anthropic-api-key +``` + +## Download + +`$ ant beta:files download` + +**get** `/v1/files/{file_id}/content` + +Download File + +### Parameters + +- `--file-id: string` + + ID of the File. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `unnamed_schema_0: file path` + +### Example + +```cli +ant beta:files download \ + --api-key my-anthropic-api-key \ + --file-id file_id +``` + +## Retrieve Metadata + +`$ ant beta:files retrieve-metadata` + +**get** `/v1/files/{file_id}` + +Get File Metadata + +### Parameters + +- `--file-id: string` + + ID of the File. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `file_metadata: object { id, created_at, filename, 5 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `created_at: string` + + RFC 3339 datetime string representing when the file was created. + + - `filename: string` + + Original filename of the uploaded file. + + - `mime_type: string` + + MIME type of the file. + + - `size_bytes: number` + + Size of the file in bytes. + + - `type: "file"` + + Object type. + + For files, this is always `"file"`. + + - `downloadable: optional boolean` + + Whether the file can be downloaded. + + - `scope: optional object { id, type }` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + +### Example + +```cli +ant beta:files retrieve-metadata \ + --api-key my-anthropic-api-key \ + --file-id file_id +``` + +## Delete + +`$ ant beta:files delete` + +**delete** `/v1/files/{file_id}` + +Delete File + +### Parameters + +- `--file-id: string` + + ID of the File. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `deleted_file: object { id, type }` + + - `id: string` + + ID of the deleted file. + + - `type: optional "file_deleted"` + + Deleted object type. + + For file deletion, this is always `"file_deleted"`. + + - `"file_deleted"` + +### Example + +```cli +ant beta:files delete \ + --api-key my-anthropic-api-key \ + --file-id file_id +``` + +## Domain Types + +### Beta File Scope + +- `beta_file_scope: object { id, type }` + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + +### Deleted File + +- `deleted_file: object { id, type }` + + - `id: string` + + ID of the deleted file. + + - `type: optional "file_deleted"` + + Deleted object type. + + For file deletion, this is always `"file_deleted"`. + + - `"file_deleted"` + +### File Metadata + +- `file_metadata: object { id, created_at, filename, 5 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `created_at: string` + + RFC 3339 datetime string representing when the file was created. + + - `filename: string` + + Original filename of the uploaded file. + + - `mime_type: string` + + MIME type of the file. + + - `size_bytes: number` + + Size of the file in bytes. + + - `type: "file"` + + Object type. + + For files, this is always `"file"`. + + - `downloadable: optional boolean` + + Whether the file can be downloaded. + + - `scope: optional object { id, type }` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + +# Skills + +## Create + +`$ ant beta:skills create` + +**post** `/v1/skills` + +Create Skill + +### Parameters + +- `--display-title: optional string` + + Body param: Display title for the skill. + + This is a human-readable label that is not included in the prompt sent to the model. + +- `--file: optional array of string` + + Body param: Files to upload for the skill. + + All files must be in the same top-level directory and must include a SKILL.md file at the root of that directory. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaSkillNewResponse: object { id, created_at, display_title, 4 more }` + + - `id: string` + + Unique identifier for the skill. + + The format and length of IDs may change over time. + + - `created_at: string` + + ISO 8601 timestamp of when the skill was created. + + - `display_title: string` + + Display title for the skill. + + This is a human-readable label that is not included in the prompt sent to the model. + + - `latest_version: string` + + The latest version identifier for the skill. + + This represents the most recent version of the skill that has been created. + + - `source: string` + + Source of the skill. + + This may be one of the following values: + + * `"custom"`: the skill was created by a user + * `"anthropic"`: the skill was created by Anthropic + + - `type: string` + + Object type. + + For Skills, this is always `"skill"`. + + - `updated_at: string` + + ISO 8601 timestamp of when the skill was last updated. + +### Example + +```cli +ant beta:skills create \ + --api-key my-anthropic-api-key +``` + +## List + +`$ ant beta:skills list` + +**get** `/v1/skills` + +List Skills + +### Parameters + +- `--limit: optional number` + + Query param: Number of results to return per page. + + Maximum value is 100. Defaults to 20. + +- `--page: optional string` + + Query param: Pagination token for fetching a specific page of results. + + Pass the value from a previous response's `next_page` field to get the next page of results. + +- `--source: optional string` + + Query param: Filter skills by source. + + If provided, only skills from the specified source will be returned: + + * `"custom"`: only return user-created skills + * `"anthropic"`: only return Anthropic-created skills + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaListSkillsResponse: object { data, has_more, next_page }` + + - `data: array of object { id, created_at, display_title, 4 more }` + + List of skills. + + - `id: string` + + Unique identifier for the skill. + + The format and length of IDs may change over time. + + - `created_at: string` + + ISO 8601 timestamp of when the skill was created. + + - `display_title: string` + + Display title for the skill. + + This is a human-readable label that is not included in the prompt sent to the model. + + - `latest_version: string` + + The latest version identifier for the skill. + + This represents the most recent version of the skill that has been created. + + - `source: string` + + Source of the skill. + + This may be one of the following values: + + * `"custom"`: the skill was created by a user + * `"anthropic"`: the skill was created by Anthropic + + - `type: string` + + Object type. + + For Skills, this is always `"skill"`. + + - `updated_at: string` + + ISO 8601 timestamp of when the skill was last updated. + + - `has_more: boolean` + + Whether there are more results available. + + If `true`, there are additional results that can be fetched using the `next_page` token. + + - `next_page: string` + + Token for fetching the next page of results. + + If `null`, there are no more results available. Pass this value to the `page_token` parameter in the next request to get the next page. + +### Example + +```cli +ant beta:skills list \ + --api-key my-anthropic-api-key +``` + +## Retrieve + +`$ ant beta:skills retrieve` + +**get** `/v1/skills/{skill_id}` + +Get Skill + +### Parameters + +- `--skill-id: string` + + Unique identifier for the skill. + + The format and length of IDs may change over time. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaSkillGetResponse: object { id, created_at, display_title, 4 more }` + + - `id: string` + + Unique identifier for the skill. + + The format and length of IDs may change over time. + + - `created_at: string` + + ISO 8601 timestamp of when the skill was created. + + - `display_title: string` + + Display title for the skill. + + This is a human-readable label that is not included in the prompt sent to the model. + + - `latest_version: string` + + The latest version identifier for the skill. + + This represents the most recent version of the skill that has been created. + + - `source: string` + + Source of the skill. + + This may be one of the following values: + + * `"custom"`: the skill was created by a user + * `"anthropic"`: the skill was created by Anthropic + + - `type: string` + + Object type. + + For Skills, this is always `"skill"`. + + - `updated_at: string` + + ISO 8601 timestamp of when the skill was last updated. + +### Example + +```cli +ant beta:skills retrieve \ + --api-key my-anthropic-api-key \ + --skill-id skill_id +``` + +## Delete + +`$ ant beta:skills delete` + +**delete** `/v1/skills/{skill_id}` + +Delete Skill + +### Parameters + +- `--skill-id: string` + + Unique identifier for the skill. + + The format and length of IDs may change over time. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaSkillDeleteResponse: object { id, type }` + + - `id: string` + + Unique identifier for the skill. + + The format and length of IDs may change over time. + + - `type: string` + + Deleted object type. + + For Skills, this is always `"skill_deleted"`. + +### Example + +```cli +ant beta:skills delete \ + --api-key my-anthropic-api-key \ + --skill-id skill_id +``` + +# Versions + +## Create + +`$ ant beta:skills:versions create` + +**post** `/v1/skills/{skill_id}/versions` + +Create Skill Version + +### Parameters + +- `--skill-id: string` + + Path param: Unique identifier for the skill. + + The format and length of IDs may change over time. + +- `--file: optional array of string` + + Body param: Files to upload for the skill. + + All files must be in the same top-level directory and must include a SKILL.md file at the root of that directory. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaSkillVersionNewResponse: object { id, created_at, description, 5 more }` + + - `id: string` + + Unique identifier for the skill version. + + The format and length of IDs may change over time. + + - `created_at: string` + + ISO 8601 timestamp of when the skill version was created. + + - `description: string` + + Description of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + + - `directory: string` + + Directory name of the skill version. + + This is the top-level directory name that was extracted from the uploaded files. + + - `name: string` + + Human-readable name of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + + - `skill_id: string` + + Identifier for the skill that this version belongs to. + + - `type: string` + + Object type. + + For Skill Versions, this is always `"skill_version"`. + + - `version: string` + + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + +### Example + +```cli +ant beta:skills:versions create \ + --api-key my-anthropic-api-key \ + --skill-id skill_id +``` + +## List + +`$ ant beta:skills:versions list` + +**get** `/v1/skills/{skill_id}/versions` + +List Skill Versions + +### Parameters + +- `--skill-id: string` + + Path param: Unique identifier for the skill. + + The format and length of IDs may change over time. + +- `--limit: optional number` + + Query param: Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + +- `--page: optional string` + + Query param: Optionally set to the `next_page` token from the previous response. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaListSkillVersionsResponse: object { data, has_more, next_page }` + + - `data: array of object { id, created_at, description, 5 more }` + + List of skill versions. + + - `id: string` + + Unique identifier for the skill version. + + The format and length of IDs may change over time. + + - `created_at: string` + + ISO 8601 timestamp of when the skill version was created. + + - `description: string` + + Description of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + + - `directory: string` + + Directory name of the skill version. + + This is the top-level directory name that was extracted from the uploaded files. + + - `name: string` + + Human-readable name of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + + - `skill_id: string` + + Identifier for the skill that this version belongs to. + + - `type: string` + + Object type. + + For Skill Versions, this is always `"skill_version"`. + + - `version: string` + + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + + - `has_more: boolean` + + Indicates if there are more results in the requested page direction. + + - `next_page: string` + + Token to provide in as `page` in the subsequent request to retrieve the next page of data. + +### Example + +```cli +ant beta:skills:versions list \ + --api-key my-anthropic-api-key \ + --skill-id skill_id +``` + +## Retrieve + +`$ ant beta:skills:versions retrieve` + +**get** `/v1/skills/{skill_id}/versions/{version}` + +Get Skill Version + +### Parameters + +- `--skill-id: string` + + Path param: Unique identifier for the skill. + + The format and length of IDs may change over time. + +- `--version: string` + + Path param: Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaSkillVersionGetResponse: object { id, created_at, description, 5 more }` + + - `id: string` + + Unique identifier for the skill version. + + The format and length of IDs may change over time. + + - `created_at: string` + + ISO 8601 timestamp of when the skill version was created. + + - `description: string` + + Description of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + + - `directory: string` + + Directory name of the skill version. + + This is the top-level directory name that was extracted from the uploaded files. + + - `name: string` + + Human-readable name of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + + - `skill_id: string` + + Identifier for the skill that this version belongs to. + + - `type: string` + + Object type. + + For Skill Versions, this is always `"skill_version"`. + + - `version: string` + + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + +### Example + +```cli +ant beta:skills:versions retrieve \ + --api-key my-anthropic-api-key \ + --skill-id skill_id \ + --version version +``` + +## Delete + +`$ ant beta:skills:versions delete` + +**delete** `/v1/skills/{skill_id}/versions/{version}` + +Delete Skill Version + +### Parameters + +- `--skill-id: string` + + Path param: Unique identifier for the skill. + + The format and length of IDs may change over time. + +- `--version: string` + + Path param: Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaSkillVersionDeleteResponse: object { id, type }` + + - `id: string` + + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + + - `type: string` + + Deleted object type. + + For Skill Versions, this is always `"skill_version_deleted"`. + +### Example + +```cli +ant beta:skills:versions delete \ + --api-key my-anthropic-api-key \ + --skill-id skill_id \ + --version version +``` diff --git a/content/en/api/cli/beta/agents.md b/content/en/api/cli/beta/agents.md new file mode 100644 index 000000000..30d8fcb78 --- /dev/null +++ b/content/en/api/cli/beta/agents.md @@ -0,0 +1,3224 @@ +# Agents + +## Create + +`$ ant beta:agents create` + +**post** `/v1/agents` + +Create Agent + +### Parameters + +- `--model: BetaManagedAgentsModelConfigParams` + + Body param: Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control + +- `--name: string` + + Body param: Human-readable name for the agent. 1-256 characters. + +- `--description: optional string` + + Body param: Description of what the agent does. Up to 2048 characters. + +- `--mcp-server: optional array of BetaManagedAgentsURLMCPServerParams` + + Body param: MCP servers this agent connects to. Maximum 20. Names must be unique within the array. + +- `--metadata: optional map[string]` + + Body param: Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars. + +- `--skill: optional array of BetaManagedAgentsSkillParams` + + Body param: Skills available to the agent. Maximum 20. + +- `--system: optional string` + + Body param: System prompt for the agent. Up to 100,000 characters. + +- `--tool: optional array of BetaManagedAgentsAgentToolset20260401Params or BetaManagedAgentsMCPToolsetParams or BetaManagedAgentsCustomToolParams` + + Body param: Tool configurations available to the agent. Maximum of 128 tools across all toolsets allowed. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_agent: object { id, archived_at, created_at, 11 more }` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```cli +ant beta:agents create \ + --api-key my-anthropic-api-key \ + --model '{id: claude-opus-4-6}' \ + --name 'My First Agent' +``` + +## List + +`$ ant beta:agents list` + +**get** `/v1/agents` + +List Agents + +### Parameters + +- `--created-at-gte: optional string` + + Query param: Return agents created at or after this time (inclusive). + +- `--created-at-lte: optional string` + + Query param: Return agents created at or before this time (inclusive). + +- `--include-archived: optional boolean` + + Query param: Include archived agents in results. Defaults to false. + +- `--limit: optional number` + + Query param: Maximum results per page. Default 20, maximum 100. + +- `--page: optional string` + + Query param: Opaque pagination cursor from a previous response. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaManagedAgentsListAgents: object { data, next_page }` + + Paginated list of agents. + + - `data: optional array of BetaManagedAgentsAgent` + + List of agents. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + + - `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```cli +ant beta:agents list \ + --api-key my-anthropic-api-key +``` + +## Retrieve + +`$ ant beta:agents retrieve` + +**get** `/v1/agents/{agent_id}` + +Get Agent + +### Parameters + +- `--agent-id: string` + + Path param: Path parameter agent_id + +- `--version: optional number` + + Query param: Agent version. Omit for the most recent version. Must be at least 1 if specified. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_agent: object { id, archived_at, created_at, 11 more }` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```cli +ant beta:agents retrieve \ + --api-key my-anthropic-api-key \ + --agent-id agent_011CZkYpogX7uDKUyvBTophP +``` + +## Update + +`$ ant beta:agents update` + +**post** `/v1/agents/{agent_id}` + +Update Agent + +### Parameters + +- `--agent-id: string` + + Path param: Path parameter agent_id + +- `--version: number` + + Body param: The agent's current version, used to prevent concurrent overwrites. Obtain this value from a create or retrieve response. The request fails if this does not match the server's current version. + +- `--description: optional string` + + Body param: Description. Up to 2048 characters. Omit to preserve; send empty string or null to clear. + +- `--mcp-server: optional array of BetaManagedAgentsURLMCPServerParams` + + Body param: MCP servers. Full replacement. Omit to preserve; send empty array or null to clear. Names must be unique. Maximum 20. + +- `--metadata: optional map[string]` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. The stored bag is limited to 16 keys (up to 64 chars each) with values up to 512 chars. + +- `--model: optional BetaManagedAgentsModelConfigParams` + + Body param: Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control. Omit to preserve. Cannot be cleared. + +- `--name: optional string` + + Body param: Human-readable name. 1-256 characters. Omit to preserve. Cannot be cleared. + +- `--skill: optional array of BetaManagedAgentsSkillParams` + + Body param: Skills. Full replacement. Omit to preserve; send empty array or null to clear. Maximum 20. + +- `--system: optional string` + + Body param: System prompt. Up to 100,000 characters. Omit to preserve; send empty string or null to clear. + +- `--tool: optional array of BetaManagedAgentsAgentToolset20260401Params or BetaManagedAgentsMCPToolsetParams or BetaManagedAgentsCustomToolParams` + + Body param: Tool configurations available to the agent. Full replacement. Omit to preserve; send empty array or null to clear. Maximum of 128 tools across all toolsets allowed. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_agent: object { id, archived_at, created_at, 11 more }` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```cli +ant beta:agents update \ + --api-key my-anthropic-api-key \ + --agent-id agent_011CZkYpogX7uDKUyvBTophP \ + --version 1 +``` + +## Archive + +`$ ant beta:agents archive` + +**post** `/v1/agents/{agent_id}/archive` + +Archive Agent + +### Parameters + +- `--agent-id: string` + + Path parameter agent_id + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_agent: object { id, archived_at, created_at, 11 more }` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```cli +ant beta:agents archive \ + --api-key my-anthropic-api-key \ + --agent-id agent_011CZkYpogX7uDKUyvBTophP +``` + +## Domain Types + +### Beta Managed Agents Agent + +- `beta_managed_agents_agent: object { id, archived_at, created_at, 11 more }` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Beta Managed Agents Agent Tool Config + +- `beta_managed_agents_agent_tool_config: object { enabled, name, permission_policy }` + + Configuration for a specific agent tool. + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Agent Tool Config Params + +- `beta_managed_agents_agent_tool_config_params: object { name, enabled, permission_policy }` + + Configuration override for a specific tool within a toolset. + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled: optional boolean` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Agent Toolset Default Config + +- `beta_managed_agents_agent_toolset_default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Agent Toolset Default Config Params + +- `beta_managed_agents_agent_toolset_default_config_params: object { enabled, permission_policy }` + + Default configuration for all tools in a toolset. + + - `enabled: optional boolean` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Agent Toolset20260401 + +- `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + +### Beta Managed Agents Agent Toolset20260401 Params + +- `beta_managed_agents_agent_toolset20260401_params: object { type, configs, default_config }` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `configs: optional array of BetaManagedAgentsAgentToolConfigParams` + + Per-tool configuration overrides. + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled: optional boolean` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: optional object { enabled, permission_policy }` + + Default configuration for all tools in a toolset. + + - `enabled: optional boolean` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Always Allow Policy + +- `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + +### Beta Managed Agents Always Ask Policy + +- `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Anthropic Skill + +- `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + +### Beta Managed Agents Anthropic Skill Params + +- `beta_managed_agents_anthropic_skill_params: object { skill_id, type, version }` + + An Anthropic-managed skill. + + - `skill_id: string` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: optional string` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents Custom Skill + +- `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + +### Beta Managed Agents Custom Skill Params + +- `beta_managed_agents_custom_skill_params: object { skill_id, type, version }` + + A user-created custom skill. + + - `skill_id: string` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: "custom"` + + - `"custom"` + + - `version: optional string` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents Custom Tool + +- `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + +### Beta Managed Agents Custom Tool Input Schema + +- `beta_managed_agents_custom_tool_input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + +### Beta Managed Agents Custom Tool Params + +- `beta_managed_agents_custom_tool_params: object { description, input_schema, name, type }` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: string` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: "custom"` + + - `"custom"` + +### Beta Managed Agents MCP Server URL Definition + +- `beta_managed_agents_mcp_server_url_definition: object { name, type, url }` + + URL-based MCP server connection as returned in API responses. + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + +### Beta Managed Agents MCP Tool Config + +- `beta_managed_agents_mcp_tool_config: object { enabled, name, permission_policy }` + + Resolved configuration for a specific MCP tool. + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents MCP Tool Config Params + +- `beta_managed_agents_mcp_tool_config_params: object { name, enabled, permission_policy }` + + Configuration override for a specific MCP tool. + + - `name: string` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled: optional boolean` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents MCP Toolset + +- `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + +### Beta Managed Agents MCP Toolset Default Config + +- `beta_managed_agents_mcp_toolset_default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents MCP Toolset Default Config Params + +- `beta_managed_agents_mcp_toolset_default_config_params: object { enabled, permission_policy }` + + Default configuration for all tools from an MCP server. + + - `enabled: optional boolean` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents MCP Toolset Params + +- `beta_managed_agents_mcp_toolset_params: object { mcp_server_name, type, configs, default_config }` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `mcp_server_name: string` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `configs: optional array of BetaManagedAgentsMCPToolConfigParams` + + Per-tool configuration overrides. + + - `name: string` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled: optional boolean` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: optional object { enabled, permission_policy }` + + Default configuration for all tools from an MCP server. + + - `enabled: optional boolean` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy: optional BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Model Config + +- `beta_managed_agents_model_config: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +### Beta Managed Agents Model Config Params + +- `beta_managed_agents_model_config_params: object { id, speed }` + + An object that defines additional configuration control over model use + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +### Beta Managed Agents Skill Params + +- `beta_managed_agents_skill_params: BetaManagedAgentsAnthropicSkillParams or BetaManagedAgentsCustomSkillParams` + + Skill to load in the session container. + + - `beta_managed_agents_anthropic_skill_params: object { skill_id, type, version }` + + An Anthropic-managed skill. + + - `skill_id: string` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: optional string` + + Version to pin. Defaults to latest if omitted. + + - `beta_managed_agents_custom_skill_params: object { skill_id, type, version }` + + A user-created custom skill. + + - `skill_id: string` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: "custom"` + + - `"custom"` + + - `version: optional string` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents URL MCP Server Params + +- `beta_managed_agents_url_mcp_server_params: object { name, type, url }` + + URL-based MCP server connection. + + - `name: string` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `type: "url"` + + - `"url"` + + - `url: string` + + Endpoint URL for the MCP server. + +# Versions + +## List + +`$ ant beta:agents:versions list` + +**get** `/v1/agents/{agent_id}/versions` + +List Agent Versions + +### Parameters + +- `--agent-id: string` + + Path param: Path parameter agent_id + +- `--limit: optional number` + + Query param: Maximum results per page. Default 20, maximum 100. + +- `--page: optional string` + + Query param: Opaque pagination cursor. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaManagedAgentsListAgentVersions: object { data, next_page }` + + Paginated list of agent versions. + + - `data: optional array of BetaManagedAgentsAgent` + + Agent versions. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + + - `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```cli +ant beta:agents:versions list \ + --api-key my-anthropic-api-key \ + --agent-id agent_011CZkYpogX7uDKUyvBTophP +``` diff --git a/content/en/api/cli/beta/agents/archive.md b/content/en/api/cli/beta/agents/archive.md new file mode 100644 index 000000000..2deff6b6e --- /dev/null +++ b/content/en/api/cli/beta/agents/archive.md @@ -0,0 +1,315 @@ +## Archive + +`$ ant beta:agents archive` + +**post** `/v1/agents/{agent_id}/archive` + +Archive Agent + +### Parameters + +- `--agent-id: string` + + Path parameter agent_id + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_agent: object { id, archived_at, created_at, 11 more }` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```cli +ant beta:agents archive \ + --api-key my-anthropic-api-key \ + --agent-id agent_011CZkYpogX7uDKUyvBTophP +``` diff --git a/content/en/api/cli/beta/agents/create.md b/content/en/api/cli/beta/agents/create.md new file mode 100644 index 000000000..8a31871e6 --- /dev/null +++ b/content/en/api/cli/beta/agents/create.md @@ -0,0 +1,344 @@ +## Create + +`$ ant beta:agents create` + +**post** `/v1/agents` + +Create Agent + +### Parameters + +- `--model: BetaManagedAgentsModelConfigParams` + + Body param: Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control + +- `--name: string` + + Body param: Human-readable name for the agent. 1-256 characters. + +- `--description: optional string` + + Body param: Description of what the agent does. Up to 2048 characters. + +- `--mcp-server: optional array of BetaManagedAgentsURLMCPServerParams` + + Body param: MCP servers this agent connects to. Maximum 20. Names must be unique within the array. + +- `--metadata: optional map[string]` + + Body param: Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars. + +- `--skill: optional array of BetaManagedAgentsSkillParams` + + Body param: Skills available to the agent. Maximum 20. + +- `--system: optional string` + + Body param: System prompt for the agent. Up to 100,000 characters. + +- `--tool: optional array of BetaManagedAgentsAgentToolset20260401Params or BetaManagedAgentsMCPToolsetParams or BetaManagedAgentsCustomToolParams` + + Body param: Tool configurations available to the agent. Maximum of 128 tools across all toolsets allowed. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_agent: object { id, archived_at, created_at, 11 more }` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```cli +ant beta:agents create \ + --api-key my-anthropic-api-key \ + --model '{id: claude-opus-4-6}' \ + --name 'My First Agent' +``` diff --git a/content/en/api/cli/beta/agents/list.md b/content/en/api/cli/beta/agents/list.md new file mode 100644 index 000000000..aa29354b2 --- /dev/null +++ b/content/en/api/cli/beta/agents/list.md @@ -0,0 +1,338 @@ +## List + +`$ ant beta:agents list` + +**get** `/v1/agents` + +List Agents + +### Parameters + +- `--created-at-gte: optional string` + + Query param: Return agents created at or after this time (inclusive). + +- `--created-at-lte: optional string` + + Query param: Return agents created at or before this time (inclusive). + +- `--include-archived: optional boolean` + + Query param: Include archived agents in results. Defaults to false. + +- `--limit: optional number` + + Query param: Maximum results per page. Default 20, maximum 100. + +- `--page: optional string` + + Query param: Opaque pagination cursor from a previous response. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaManagedAgentsListAgents: object { data, next_page }` + + Paginated list of agents. + + - `data: optional array of BetaManagedAgentsAgent` + + List of agents. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + + - `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```cli +ant beta:agents list \ + --api-key my-anthropic-api-key +``` diff --git a/content/en/api/cli/beta/agents/retrieve.md b/content/en/api/cli/beta/agents/retrieve.md new file mode 100644 index 000000000..5a4fd15e2 --- /dev/null +++ b/content/en/api/cli/beta/agents/retrieve.md @@ -0,0 +1,319 @@ +## Retrieve + +`$ ant beta:agents retrieve` + +**get** `/v1/agents/{agent_id}` + +Get Agent + +### Parameters + +- `--agent-id: string` + + Path param: Path parameter agent_id + +- `--version: optional number` + + Query param: Agent version. Omit for the most recent version. Must be at least 1 if specified. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_agent: object { id, archived_at, created_at, 11 more }` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```cli +ant beta:agents retrieve \ + --api-key my-anthropic-api-key \ + --agent-id agent_011CZkYpogX7uDKUyvBTophP +``` diff --git a/content/en/api/cli/beta/agents/update.md b/content/en/api/cli/beta/agents/update.md new file mode 100644 index 000000000..4028251d0 --- /dev/null +++ b/content/en/api/cli/beta/agents/update.md @@ -0,0 +1,352 @@ +## Update + +`$ ant beta:agents update` + +**post** `/v1/agents/{agent_id}` + +Update Agent + +### Parameters + +- `--agent-id: string` + + Path param: Path parameter agent_id + +- `--version: number` + + Body param: The agent's current version, used to prevent concurrent overwrites. Obtain this value from a create or retrieve response. The request fails if this does not match the server's current version. + +- `--description: optional string` + + Body param: Description. Up to 2048 characters. Omit to preserve; send empty string or null to clear. + +- `--mcp-server: optional array of BetaManagedAgentsURLMCPServerParams` + + Body param: MCP servers. Full replacement. Omit to preserve; send empty array or null to clear. Names must be unique. Maximum 20. + +- `--metadata: optional map[string]` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. The stored bag is limited to 16 keys (up to 64 chars each) with values up to 512 chars. + +- `--model: optional BetaManagedAgentsModelConfigParams` + + Body param: Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control. Omit to preserve. Cannot be cleared. + +- `--name: optional string` + + Body param: Human-readable name. 1-256 characters. Omit to preserve. Cannot be cleared. + +- `--skill: optional array of BetaManagedAgentsSkillParams` + + Body param: Skills. Full replacement. Omit to preserve; send empty array or null to clear. Maximum 20. + +- `--system: optional string` + + Body param: System prompt. Up to 100,000 characters. Omit to preserve; send empty string or null to clear. + +- `--tool: optional array of BetaManagedAgentsAgentToolset20260401Params or BetaManagedAgentsMCPToolsetParams or BetaManagedAgentsCustomToolParams` + + Body param: Tool configurations available to the agent. Full replacement. Omit to preserve; send empty array or null to clear. Maximum of 128 tools across all toolsets allowed. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_agent: object { id, archived_at, created_at, 11 more }` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```cli +ant beta:agents update \ + --api-key my-anthropic-api-key \ + --agent-id agent_011CZkYpogX7uDKUyvBTophP \ + --version 1 +``` diff --git a/content/en/api/cli/beta/agents/versions.md b/content/en/api/cli/beta/agents/versions.md new file mode 100644 index 000000000..78f70fea6 --- /dev/null +++ b/content/en/api/cli/beta/agents/versions.md @@ -0,0 +1,333 @@ +# Versions + +## List + +`$ ant beta:agents:versions list` + +**get** `/v1/agents/{agent_id}/versions` + +List Agent Versions + +### Parameters + +- `--agent-id: string` + + Path param: Path parameter agent_id + +- `--limit: optional number` + + Query param: Maximum results per page. Default 20, maximum 100. + +- `--page: optional string` + + Query param: Opaque pagination cursor. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaManagedAgentsListAgentVersions: object { data, next_page }` + + Paginated list of agent versions. + + - `data: optional array of BetaManagedAgentsAgent` + + Agent versions. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + + - `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```cli +ant beta:agents:versions list \ + --api-key my-anthropic-api-key \ + --agent-id agent_011CZkYpogX7uDKUyvBTophP +``` diff --git a/content/en/api/cli/beta/agents/versions/list.md b/content/en/api/cli/beta/agents/versions/list.md new file mode 100644 index 000000000..a69689a21 --- /dev/null +++ b/content/en/api/cli/beta/agents/versions/list.md @@ -0,0 +1,331 @@ +## List + +`$ ant beta:agents:versions list` + +**get** `/v1/agents/{agent_id}/versions` + +List Agent Versions + +### Parameters + +- `--agent-id: string` + + Path param: Path parameter agent_id + +- `--limit: optional number` + + Query param: Maximum results per page. Default 20, maximum 100. + +- `--page: optional string` + + Query param: Opaque pagination cursor. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaManagedAgentsListAgentVersions: object { data, next_page }` + + Paginated list of agent versions. + + - `data: optional array of BetaManagedAgentsAgent` + + Agent versions. + + - `id: string` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: map[string]` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + + - `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```cli +ant beta:agents:versions list \ + --api-key my-anthropic-api-key \ + --agent-id agent_011CZkYpogX7uDKUyvBTophP +``` diff --git a/content/en/api/cli/beta/environments.md b/content/en/api/cli/beta/environments.md new file mode 100644 index 000000000..12a6a548d --- /dev/null +++ b/content/en/api/cli/beta/environments.md @@ -0,0 +1,1196 @@ +# Environments + +## Create + +`$ ant beta:environments create` + +**post** `/v1/environments` + +Create a new environment with the specified configuration. + +### Parameters + +- `--name: string` + + Body param: Human-readable name for the environment + +- `--config: optional object { type, networking, packages }` + + Body param: Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + +- `--description: optional string` + + Body param: Optional description of the environment + +- `--metadata: optional map[string]` + + Body param: User-provided metadata key-value pairs + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_environment: object { id, archived_at, config, 6 more }` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: object { networking, packages, type }` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `beta_unrestricted_network: object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `beta_limited_network: object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `packages: object { apt, cargo, gem, 4 more }` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```cli +ant beta:environments create \ + --api-key my-anthropic-api-key \ + --name python-data-analysis +``` + +## List + +`$ ant beta:environments list` + +**get** `/v1/environments` + +List environments with pagination support. + +### Parameters + +- `--include-archived: optional boolean` + + Query param: Include archived environments in the response + +- `--limit: optional number` + + Query param: Maximum number of environments to return + +- `--page: optional string` + + Query param: Opaque cursor from previous response for pagination. Pass the `next_page` value from the previous response. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaEnvironmentListResponse: object { data, next_page }` + + Response when listing environments. + + This response model uses opaque cursor-based pagination. Use the `page` + query parameter with the value from `next_page` to fetch the next page. + + - `data: array of BetaEnvironment` + + List of environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: object { networking, packages, type }` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `beta_unrestricted_network: object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `beta_limited_network: object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `packages: object { apt, cargo, gem, 4 more }` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + + - `next_page: string` + + Token for fetching the next page of results. If `null`, there are no more results available. Pass this value to the `page` parameter in the next request. + +### Example + +```cli +ant beta:environments list \ + --api-key my-anthropic-api-key +``` + +## Retrieve + +`$ ant beta:environments retrieve` + +**get** `/v1/environments/{environment_id}` + +Retrieve a specific environment by ID. + +### Parameters + +- `--environment-id: string` + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_environment: object { id, archived_at, config, 6 more }` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: object { networking, packages, type }` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `beta_unrestricted_network: object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `beta_limited_network: object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `packages: object { apt, cargo, gem, 4 more }` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```cli +ant beta:environments retrieve \ + --api-key my-anthropic-api-key \ + --environment-id env_011CZkZ9X2dpNyB7HsEFoRfW +``` + +## Update + +`$ ant beta:environments update` + +**post** `/v1/environments/{environment_id}` + +Update an existing environment's configuration. + +### Parameters + +- `--environment-id: string` + + Path param + +- `--config: optional object { type, networking, packages }` + + Body param: Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + +- `--description: optional string` + + Body param: Updated description of the environment + +- `--metadata: optional map[string]` + + Body param: User-provided metadata key-value pairs. Set a value to null or empty string to delete the key. + +- `--name: optional string` + + Body param: Updated name for the environment + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_environment: object { id, archived_at, config, 6 more }` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: object { networking, packages, type }` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `beta_unrestricted_network: object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `beta_limited_network: object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `packages: object { apt, cargo, gem, 4 more }` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```cli +ant beta:environments update \ + --api-key my-anthropic-api-key \ + --environment-id env_011CZkZ9X2dpNyB7HsEFoRfW +``` + +## Delete + +`$ ant beta:environments delete` + +**delete** `/v1/environments/{environment_id}` + +Delete an environment by ID. Returns a confirmation of the deletion. + +### Parameters + +- `--environment-id: string` + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_environment_delete_response: object { id, type }` + + Response after deleting an environment. + + - `id: string` + + Environment identifier + + - `type: "environment_deleted"` + + The type of response + +### Example + +```cli +ant beta:environments delete \ + --api-key my-anthropic-api-key \ + --environment-id env_011CZkZ9X2dpNyB7HsEFoRfW +``` + +## Archive + +`$ ant beta:environments archive` + +**post** `/v1/environments/{environment_id}/archive` + +Archive an environment by ID. Archived environments cannot be used to create new sessions. + +### Parameters + +- `--environment-id: string` + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_environment: object { id, archived_at, config, 6 more }` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: object { networking, packages, type }` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `beta_unrestricted_network: object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `beta_limited_network: object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `packages: object { apt, cargo, gem, 4 more }` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```cli +ant beta:environments archive \ + --api-key my-anthropic-api-key \ + --environment-id env_011CZkZ9X2dpNyB7HsEFoRfW +``` + +## Domain Types + +### Beta Cloud Config + +- `beta_cloud_config: object { networking, packages, type }` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `beta_unrestricted_network: object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `beta_limited_network: object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `packages: object { apt, cargo, gem, 4 more }` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + +### Beta Cloud Config Params + +- `beta_cloud_config_params: object { type, networking, packages }` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "cloud"` + + Environment type + + - `networking: optional BetaUnrestrictedNetwork or BetaLimitedNetworkParams` + + Network configuration policy. Omit on update to preserve the existing value. + + - `beta_unrestricted_network: object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `beta_limited_network_params: object { type, allow_mcp_servers, allow_package_managers, allowed_hosts }` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "limited"` + + Network policy type + + - `allow_mcp_servers: optional boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: optional boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: optional array of string` + + Specifies domains the container can reach. + + - `packages: optional object { apt, cargo, gem, 4 more }` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: optional array of string` + + Ubuntu/Debian packages to install + + - `cargo: optional array of string` + + Rust packages to install + + - `gem: optional array of string` + + Ruby packages to install + + - `go: optional array of string` + + Go packages to install + + - `npm: optional array of string` + + Node.js packages to install + + - `pip: optional array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + +### Beta Environment + +- `beta_environment: object { id, archived_at, config, 6 more }` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: object { networking, packages, type }` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `beta_unrestricted_network: object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `beta_limited_network: object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `packages: object { apt, cargo, gem, 4 more }` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Beta Environment Delete Response + +- `beta_environment_delete_response: object { id, type }` + + Response after deleting an environment. + + - `id: string` + + Environment identifier + + - `type: "environment_deleted"` + + The type of response + +### Beta Limited Network + +- `beta_limited_network: object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + +### Beta Limited Network Params + +- `beta_limited_network_params: object { type, allow_mcp_servers, allow_package_managers, allowed_hosts }` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "limited"` + + Network policy type + + - `allow_mcp_servers: optional boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: optional boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: optional array of string` + + Specifies domains the container can reach. + +### Beta Packages + +- `beta_packages: object { apt, cargo, gem, 4 more }` + + Packages (and their versions) available in this environment. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + +### Beta Packages Params + +- `beta_packages_params: object { apt, cargo, gem, 4 more }` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: optional array of string` + + Ubuntu/Debian packages to install + + - `cargo: optional array of string` + + Rust packages to install + + - `gem: optional array of string` + + Ruby packages to install + + - `go: optional array of string` + + Go packages to install + + - `npm: optional array of string` + + Node.js packages to install + + - `pip: optional array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + +### Beta Unrestricted Network + +- `beta_unrestricted_network: object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type diff --git a/content/en/api/cli/beta/environments/archive.md b/content/en/api/cli/beta/environments/archive.md new file mode 100644 index 000000000..b5302e1eb --- /dev/null +++ b/content/en/api/cli/beta/environments/archive.md @@ -0,0 +1,135 @@ +## Archive + +`$ ant beta:environments archive` + +**post** `/v1/environments/{environment_id}/archive` + +Archive an environment by ID. Archived environments cannot be used to create new sessions. + +### Parameters + +- `--environment-id: string` + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_environment: object { id, archived_at, config, 6 more }` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: object { networking, packages, type }` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `beta_unrestricted_network: object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `beta_limited_network: object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `packages: object { apt, cargo, gem, 4 more }` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```cli +ant beta:environments archive \ + --api-key my-anthropic-api-key \ + --environment-id env_011CZkZ9X2dpNyB7HsEFoRfW +``` diff --git a/content/en/api/cli/beta/environments/create.md b/content/en/api/cli/beta/environments/create.md new file mode 100644 index 000000000..63f39842d --- /dev/null +++ b/content/en/api/cli/beta/environments/create.md @@ -0,0 +1,152 @@ +## Create + +`$ ant beta:environments create` + +**post** `/v1/environments` + +Create a new environment with the specified configuration. + +### Parameters + +- `--name: string` + + Body param: Human-readable name for the environment + +- `--config: optional object { type, networking, packages }` + + Body param: Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + +- `--description: optional string` + + Body param: Optional description of the environment + +- `--metadata: optional map[string]` + + Body param: User-provided metadata key-value pairs + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_environment: object { id, archived_at, config, 6 more }` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: object { networking, packages, type }` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `beta_unrestricted_network: object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `beta_limited_network: object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `packages: object { apt, cargo, gem, 4 more }` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```cli +ant beta:environments create \ + --api-key my-anthropic-api-key \ + --name python-data-analysis +``` diff --git a/content/en/api/cli/beta/environments/delete.md b/content/en/api/cli/beta/environments/delete.md new file mode 100644 index 000000000..52ef19e2c --- /dev/null +++ b/content/en/api/cli/beta/environments/delete.md @@ -0,0 +1,37 @@ +## Delete + +`$ ant beta:environments delete` + +**delete** `/v1/environments/{environment_id}` + +Delete an environment by ID. Returns a confirmation of the deletion. + +### Parameters + +- `--environment-id: string` + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_environment_delete_response: object { id, type }` + + Response after deleting an environment. + + - `id: string` + + Environment identifier + + - `type: "environment_deleted"` + + The type of response + +### Example + +```cli +ant beta:environments delete \ + --api-key my-anthropic-api-key \ + --environment-id env_011CZkZ9X2dpNyB7HsEFoRfW +``` diff --git a/content/en/api/cli/beta/environments/list.md b/content/en/api/cli/beta/environments/list.md new file mode 100644 index 000000000..a880e66a9 --- /dev/null +++ b/content/en/api/cli/beta/environments/list.md @@ -0,0 +1,155 @@ +## List + +`$ ant beta:environments list` + +**get** `/v1/environments` + +List environments with pagination support. + +### Parameters + +- `--include-archived: optional boolean` + + Query param: Include archived environments in the response + +- `--limit: optional number` + + Query param: Maximum number of environments to return + +- `--page: optional string` + + Query param: Opaque cursor from previous response for pagination. Pass the `next_page` value from the previous response. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaEnvironmentListResponse: object { data, next_page }` + + Response when listing environments. + + This response model uses opaque cursor-based pagination. Use the `page` + query parameter with the value from `next_page` to fetch the next page. + + - `data: array of BetaEnvironment` + + List of environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: object { networking, packages, type }` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `beta_unrestricted_network: object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `beta_limited_network: object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `packages: object { apt, cargo, gem, 4 more }` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + + - `next_page: string` + + Token for fetching the next page of results. If `null`, there are no more results available. Pass this value to the `page` parameter in the next request. + +### Example + +```cli +ant beta:environments list \ + --api-key my-anthropic-api-key +``` diff --git a/content/en/api/cli/beta/environments/retrieve.md b/content/en/api/cli/beta/environments/retrieve.md new file mode 100644 index 000000000..785eba30c --- /dev/null +++ b/content/en/api/cli/beta/environments/retrieve.md @@ -0,0 +1,135 @@ +## Retrieve + +`$ ant beta:environments retrieve` + +**get** `/v1/environments/{environment_id}` + +Retrieve a specific environment by ID. + +### Parameters + +- `--environment-id: string` + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_environment: object { id, archived_at, config, 6 more }` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: object { networking, packages, type }` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `beta_unrestricted_network: object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `beta_limited_network: object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `packages: object { apt, cargo, gem, 4 more }` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```cli +ant beta:environments retrieve \ + --api-key my-anthropic-api-key \ + --environment-id env_011CZkZ9X2dpNyB7HsEFoRfW +``` diff --git a/content/en/api/cli/beta/environments/update.md b/content/en/api/cli/beta/environments/update.md new file mode 100644 index 000000000..e131fbe97 --- /dev/null +++ b/content/en/api/cli/beta/environments/update.md @@ -0,0 +1,156 @@ +## Update + +`$ ant beta:environments update` + +**post** `/v1/environments/{environment_id}` + +Update an existing environment's configuration. + +### Parameters + +- `--environment-id: string` + + Path param + +- `--config: optional object { type, networking, packages }` + + Body param: Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + +- `--description: optional string` + + Body param: Updated description of the environment + +- `--metadata: optional map[string]` + + Body param: User-provided metadata key-value pairs. Set a value to null or empty string to delete the key. + +- `--name: optional string` + + Body param: Updated name for the environment + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_environment: object { id, archived_at, config, 6 more }` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: object { networking, packages, type }` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork` + + Network configuration policy. + + - `beta_unrestricted_network: object { type }` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `beta_limited_network: object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: array of string` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `packages: object { apt, cargo, gem, 4 more }` + + Package manager configuration. + + - `apt: array of string` + + Ubuntu/Debian packages to install + + - `cargo: array of string` + + Rust packages to install + + - `gem: array of string` + + Ruby packages to install + + - `go: array of string` + + Go packages to install + + - `npm: array of string` + + Node.js packages to install + + - `pip: array of string` + + Python packages to install + + - `type: optional "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: map[string]` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```cli +ant beta:environments update \ + --api-key my-anthropic-api-key \ + --environment-id env_011CZkZ9X2dpNyB7HsEFoRfW +``` diff --git a/content/en/api/cli/beta/files.md b/content/en/api/cli/beta/files.md index c816c74e5..1d6bcfda2 100644 --- a/content/en/api/cli/beta/files.md +++ b/content/en/api/cli/beta/files.md @@ -1 +1,402 @@ -Not Found - Claude API Docs
      \ No newline at end of file +# Files + +## Upload + +`$ ant beta:files upload` + +**post** `/v1/files` + +Upload File + +### Parameters + +- `--file: string` + + Body param: The file to upload + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `file_metadata: object { id, created_at, filename, 5 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `created_at: string` + + RFC 3339 datetime string representing when the file was created. + + - `filename: string` + + Original filename of the uploaded file. + + - `mime_type: string` + + MIME type of the file. + + - `size_bytes: number` + + Size of the file in bytes. + + - `type: "file"` + + Object type. + + For files, this is always `"file"`. + + - `downloadable: optional boolean` + + Whether the file can be downloaded. + + - `scope: optional object { id, type }` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + +### Example + +```cli +ant beta:files upload \ + --api-key my-anthropic-api-key \ + --file 'Example data' +``` + +## List + +`$ ant beta:files list` + +**get** `/v1/files` + +List Files + +### Parameters + +- `--after-id: optional string` + + Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object. + +- `--before-id: optional string` + + Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object. + +- `--limit: optional number` + + Query param: Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + +- `--scope-id: optional string` + + Query param: Filter by scope ID. Only returns files associated with the specified scope (e.g., a session ID). + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaFileListResponse: object { data, first_id, has_more, last_id }` + + - `data: array of FileMetadata` + + List of file metadata objects. + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `created_at: string` + + RFC 3339 datetime string representing when the file was created. + + - `filename: string` + + Original filename of the uploaded file. + + - `mime_type: string` + + MIME type of the file. + + - `size_bytes: number` + + Size of the file in bytes. + + - `type: "file"` + + Object type. + + For files, this is always `"file"`. + + - `downloadable: optional boolean` + + Whether the file can be downloaded. + + - `scope: optional object { id, type }` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + + - `first_id: optional string` + + ID of the first file in this page of results. + + - `has_more: optional boolean` + + Whether there are more results available. + + - `last_id: optional string` + + ID of the last file in this page of results. + +### Example + +```cli +ant beta:files list \ + --api-key my-anthropic-api-key +``` + +## Download + +`$ ant beta:files download` + +**get** `/v1/files/{file_id}/content` + +Download File + +### Parameters + +- `--file-id: string` + + ID of the File. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `unnamed_schema_0: file path` + +### Example + +```cli +ant beta:files download \ + --api-key my-anthropic-api-key \ + --file-id file_id +``` + +## Retrieve Metadata + +`$ ant beta:files retrieve-metadata` + +**get** `/v1/files/{file_id}` + +Get File Metadata + +### Parameters + +- `--file-id: string` + + ID of the File. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `file_metadata: object { id, created_at, filename, 5 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `created_at: string` + + RFC 3339 datetime string representing when the file was created. + + - `filename: string` + + Original filename of the uploaded file. + + - `mime_type: string` + + MIME type of the file. + + - `size_bytes: number` + + Size of the file in bytes. + + - `type: "file"` + + Object type. + + For files, this is always `"file"`. + + - `downloadable: optional boolean` + + Whether the file can be downloaded. + + - `scope: optional object { id, type }` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + +### Example + +```cli +ant beta:files retrieve-metadata \ + --api-key my-anthropic-api-key \ + --file-id file_id +``` + +## Delete + +`$ ant beta:files delete` + +**delete** `/v1/files/{file_id}` + +Delete File + +### Parameters + +- `--file-id: string` + + ID of the File. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `deleted_file: object { id, type }` + + - `id: string` + + ID of the deleted file. + + - `type: optional "file_deleted"` + + Deleted object type. + + For file deletion, this is always `"file_deleted"`. + + - `"file_deleted"` + +### Example + +```cli +ant beta:files delete \ + --api-key my-anthropic-api-key \ + --file-id file_id +``` + +## Domain Types + +### Beta File Scope + +- `beta_file_scope: object { id, type }` + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + +### Deleted File + +- `deleted_file: object { id, type }` + + - `id: string` + + ID of the deleted file. + + - `type: optional "file_deleted"` + + Deleted object type. + + For file deletion, this is always `"file_deleted"`. + + - `"file_deleted"` + +### File Metadata + +- `file_metadata: object { id, created_at, filename, 5 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `created_at: string` + + RFC 3339 datetime string representing when the file was created. + + - `filename: string` + + Original filename of the uploaded file. + + - `mime_type: string` + + MIME type of the file. + + - `size_bytes: number` + + Size of the file in bytes. + + - `type: "file"` + + Object type. + + For files, this is always `"file"`. + + - `downloadable: optional boolean` + + Whether the file can be downloaded. + + - `scope: optional object { id, type }` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). diff --git a/content/en/api/cli/beta/files/delete.md b/content/en/api/cli/beta/files/delete.md index 5d7020f86..a102891af 100644 --- a/content/en/api/cli/beta/files/delete.md +++ b/content/en/api/cli/beta/files/delete.md @@ -1 +1,41 @@ -Not Found - Claude API Docs
        \ No newline at end of file +## Delete + +`$ ant beta:files delete` + +**delete** `/v1/files/{file_id}` + +Delete File + +### Parameters + +- `--file-id: string` + + ID of the File. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `deleted_file: object { id, type }` + + - `id: string` + + ID of the deleted file. + + - `type: optional "file_deleted"` + + Deleted object type. + + For file deletion, this is always `"file_deleted"`. + + - `"file_deleted"` + +### Example + +```cli +ant beta:files delete \ + --api-key my-anthropic-api-key \ + --file-id file_id +``` diff --git a/content/en/api/cli/beta/files/download.md b/content/en/api/cli/beta/files/download.md index f1012e8cb..2370f46ce 100644 --- a/content/en/api/cli/beta/files/download.md +++ b/content/en/api/cli/beta/files/download.md @@ -1 +1,29 @@ -Not Found - Claude API Docs
          \ No newline at end of file +## Download + +`$ ant beta:files download` + +**get** `/v1/files/{file_id}/content` + +Download File + +### Parameters + +- `--file-id: string` + + ID of the File. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `unnamed_schema_0: file path` + +### Example + +```cli +ant beta:files download \ + --api-key my-anthropic-api-key \ + --file-id file_id +``` diff --git a/content/en/api/cli/beta/files/list.md b/content/en/api/cli/beta/files/list.md index 38038a879..b2f3261e5 100644 --- a/content/en/api/cli/beta/files/list.md +++ b/content/en/api/cli/beta/files/list.md @@ -1 +1,102 @@ -Not Found - Claude API Docs
            \ No newline at end of file +## List + +`$ ant beta:files list` + +**get** `/v1/files` + +List Files + +### Parameters + +- `--after-id: optional string` + + Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object. + +- `--before-id: optional string` + + Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object. + +- `--limit: optional number` + + Query param: Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + +- `--scope-id: optional string` + + Query param: Filter by scope ID. Only returns files associated with the specified scope (e.g., a session ID). + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaFileListResponse: object { data, first_id, has_more, last_id }` + + - `data: array of FileMetadata` + + List of file metadata objects. + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `created_at: string` + + RFC 3339 datetime string representing when the file was created. + + - `filename: string` + + Original filename of the uploaded file. + + - `mime_type: string` + + MIME type of the file. + + - `size_bytes: number` + + Size of the file in bytes. + + - `type: "file"` + + Object type. + + For files, this is always `"file"`. + + - `downloadable: optional boolean` + + Whether the file can be downloaded. + + - `scope: optional object { id, type }` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + + - `first_id: optional string` + + ID of the first file in this page of results. + + - `has_more: optional boolean` + + Whether there are more results available. + + - `last_id: optional string` + + ID of the last file in this page of results. + +### Example + +```cli +ant beta:files list \ + --api-key my-anthropic-api-key +``` diff --git a/content/en/api/cli/beta/files/retrieve_metadata.md b/content/en/api/cli/beta/files/retrieve_metadata.md index 0dd556855..8bf47132b 100644 --- a/content/en/api/cli/beta/files/retrieve_metadata.md +++ b/content/en/api/cli/beta/files/retrieve_metadata.md @@ -1 +1,73 @@ -Not Found - Claude API Docs
              \ No newline at end of file +## Retrieve Metadata + +`$ ant beta:files retrieve-metadata` + +**get** `/v1/files/{file_id}` + +Get File Metadata + +### Parameters + +- `--file-id: string` + + ID of the File. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `file_metadata: object { id, created_at, filename, 5 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `created_at: string` + + RFC 3339 datetime string representing when the file was created. + + - `filename: string` + + Original filename of the uploaded file. + + - `mime_type: string` + + MIME type of the file. + + - `size_bytes: number` + + Size of the file in bytes. + + - `type: "file"` + + Object type. + + For files, this is always `"file"`. + + - `downloadable: optional boolean` + + Whether the file can be downloaded. + + - `scope: optional object { id, type }` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + +### Example + +```cli +ant beta:files retrieve-metadata \ + --api-key my-anthropic-api-key \ + --file-id file_id +``` diff --git a/content/en/api/cli/beta/files/upload.md b/content/en/api/cli/beta/files/upload.md index 85784587f..c31aae6e1 100644 --- a/content/en/api/cli/beta/files/upload.md +++ b/content/en/api/cli/beta/files/upload.md @@ -1 +1,73 @@ -Not Found - Claude API Docs
                \ No newline at end of file +## Upload + +`$ ant beta:files upload` + +**post** `/v1/files` + +Upload File + +### Parameters + +- `--file: string` + + Body param: The file to upload + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `file_metadata: object { id, created_at, filename, 5 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `created_at: string` + + RFC 3339 datetime string representing when the file was created. + + - `filename: string` + + Original filename of the uploaded file. + + - `mime_type: string` + + MIME type of the file. + + - `size_bytes: number` + + Size of the file in bytes. + + - `type: "file"` + + Object type. + + For files, this is always `"file"`. + + - `downloadable: optional boolean` + + Whether the file can be downloaded. + + - `scope: optional object { id, type }` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + +### Example + +```cli +ant beta:files upload \ + --api-key my-anthropic-api-key \ + --file 'Example data' +``` diff --git a/content/en/api/cli/beta/messages.md b/content/en/api/cli/beta/messages.md index 74089d159..670b94b34 100644 --- a/content/en/api/cli/beta/messages.md +++ b/content/en/api/cli/beta/messages.md @@ -1 +1,26439 @@ -Not Found - Claude API Docs
                  \ No newline at end of file +# Messages + +## Create + +`$ ant beta:messages create` + +**post** `/v1/messages` + +Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation. + +The Messages API can be used for either single queries or stateless multi-turn conversations. + +Learn more about the Messages API in our [user guide](https://docs.claude.com/en/docs/initial-setup) + +### Parameters + +- `--max-tokens: number` + + Body param: The maximum number of tokens to generate before stopping. + + Note that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate. + + Different models have different maximum values for this parameter. See [models](https://docs.claude.com/en/docs/models-overview) for details. + +- `--message: array of BetaMessageParam` + + Body param: Input messages. + + Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn. + + Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages. + + If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response. + + Example with a single `user` message: + + ```json + [{"role": "user", "content": "Hello, Claude"}] + ``` + + Example with multiple conversational turns: + + ```json + [ + {"role": "user", "content": "Hello there."}, + {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"}, + {"role": "user", "content": "Can you explain LLMs in plain English?"}, + ] + ``` + + Example with a partially-filled response from Claude: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("}, + ] + ``` + + Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent: + + ```json + {"role": "user", "content": "Hello, Claude"} + ``` + + ```json + {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]} + ``` + + See [input examples](https://docs.claude.com/en/api/messages-examples). + + Note that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. + + There is a limit of 100,000 messages in a single request. + +- `--model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + Body param: The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + +- `--cache-control: optional object { type, ttl }` + + Body param: Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request. + +- `--container: optional BetaContainerParams or string` + + Body param: Container identifier for reuse across requests. + +- `--context-management: optional object { edits }` + + Body param: Context management configuration. + + This allows you to control how Claude manages context across multiple requests, such as whether to clear function results or not. + +- `--inference-geo: optional string` + + Body param: Specifies the geographic region for inference processing. If not specified, the workspace's `default_inference_geo` is used. + +- `--mcp-server: optional array of BetaRequestMCPServerURLDefinition` + + Body param: MCP servers to be utilized in this request + +- `--metadata: optional object { user_id }` + + Body param: An object describing metadata about the request. + +- `--output-config: optional object { effort, format }` + + Body param: Configuration options for the model's output, such as the output format. + +- `--output-format: optional object { schema, type }` + + Body param: Deprecated: Use `output_config.format` instead. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) + + A schema to specify Claude's output format in responses. This parameter will be removed in a future release. + +- `--service-tier: optional "auto" or "standard_only"` + + Body param: Determines whether to use priority capacity (if available) or standard capacity for this request. + + Anthropic offers different levels of service for your API requests. See [service-tiers](https://docs.claude.com/en/api/service-tiers) for details. + +- `--speed: optional "standard" or "fast"` + + Body param: The inference speed mode for this request. `"fast"` enables high output-tokens-per-second inference. + +- `--stop-sequence: optional array of string` + + Body param: Custom text sequences that will cause the model to stop generating. + + Our models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `"end_turn"`. + + If you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `"stop_sequence"` and the response `stop_sequence` value will contain the matched stop sequence. + +- `--system: optional string or array of BetaTextBlockParam` + + Body param: System prompt. + + A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts). + +- `--temperature: optional number` + + Body param: Amount of randomness injected into the response. + + Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks. + + Note that even with `temperature` of `0.0`, the results will not be fully deterministic. + +- `--thinking: optional BetaThinkingConfigEnabled or BetaThinkingConfigDisabled or BetaThinkingConfigAdaptive` + + Body param: Configuration for enabling Claude's extended thinking. + + When enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit. + + See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details. + +- `--tool-choice: optional BetaToolChoiceAuto or BetaToolChoiceAny or BetaToolChoiceTool or BetaToolChoiceNone` + + Body param: How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all. + +- `--tool: optional array of BetaToolUnion` + + Body param: Definitions of tools that the model may use. + + If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks. + + There are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)). + + Each tool definition includes: + + * `name`: Name of the tool. + * `description`: Optional, but strongly-recommended description of the tool. + * `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks. + + For example, if you defined `tools` as: + + ```json + [ + { + "name": "get_stock_price", + "description": "Get the current stock price for a given ticker symbol.", + "input_schema": { + "type": "object", + "properties": { + "ticker": { + "type": "string", + "description": "The stock ticker symbol, e.g. AAPL for Apple Inc." + } + }, + "required": ["ticker"] + } + } + ] + ``` + + And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this: + + ```json + [ + { + "type": "tool_use", + "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "name": "get_stock_price", + "input": { "ticker": "^GSPC" } + } + ] + ``` + + You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message: + + ```json + [ + { + "type": "tool_result", + "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "content": "259.75 USD" + } + ] + ``` + + Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output. + + See our [guide](https://docs.claude.com/en/docs/tool-use) for more details. + +- `--top-k: optional number` + + Body param: Only sample from the top K options for each subsequent token. + + Used to remove "long tail" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277). + + Recommended for advanced use cases only. You usually only need to use `temperature`. + +- `--top-p: optional number` + + Body param: Use nucleus sampling. + + In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both. + + Recommended for advanced use cases only. You usually only need to use `temperature`. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_message: object { id, container, content, 8 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at, skills }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `skills: array of BetaSkill` + + Skills loaded in the container + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: string` + + Skill version or 'latest' for most recent version + + - `content: array of BetaContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `beta_text_block: object { citations, text, type }` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `beta_thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `beta_redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `beta_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_server_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_search_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebSearchToolResultError or array of BetaWebSearchResultBlock` + + - `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of BetaWebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_fetch_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock` + + - `beta_web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaCodeExecutionToolResultError or BetaCodeExecutionResultBlock or BetaEncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `beta_bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock` + + - `beta_bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `beta_text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock` + + - `beta_text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `beta_text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `beta_text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `beta_tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock` + + - `beta_tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `beta_mcp_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + The name of the MCP tool + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `beta_mcp_tool_result_block: object { content, is_error, tool_use_id, type }` + + - `content: string or array of BetaTextBlock` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_content: array of BetaTextBlock` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `is_error: boolean` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `beta_container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `beta_compaction_block: object { content, type }` + + A compaction block returned when autocompact is triggered. + + When content is None, it indicates the compaction failed to produce a valid + summary (e.g., malformed output from the model). Clients may round-trip + compaction blocks with null content; the server treats them as no-ops. + + - `content: string` + + Summary of compacted content, or null if compaction failed + + - `type: "compaction"` + + - `context_management: object { applied_edits }` + + Context management response. + + Information about context management strategies applied during the request. + + - `applied_edits: array of BetaClearToolUses20250919EditResponse or BetaClearThinking20251015EditResponse` + + List of context management edits that were applied. + + - `beta_clear_tool_uses_20250919_edit_response: object { cleared_input_tokens, cleared_tool_uses, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_tool_uses: number` + + Number of tool uses that were cleared. + + - `type: "clear_tool_uses_20250919"` + + The type of context management edit applied. + + - `beta_clear_thinking_20251015_edit_response: object { cleared_input_tokens, cleared_thinking_turns, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_thinking_turns: number` + + Number of thinking turns that were cleared. + + - `type: "clear_thinking_20251015"` + + The type of context management edit applied. + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 5 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"compaction"` + + - `"refusal"` + + - `"model_context_window_exceeded"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 7 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `iterations: array of BetaMessageIterationUsage or BetaCompactionIterationUsage` + + Per-iteration token usage breakdown. + + Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + + - Determine which iterations exceeded long context thresholds (>=200k tokens) + - Calculate the true context window size from the last iteration + - Understand token accumulation across server-side tool use loops + + - `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + + - `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `speed: "standard" or "fast"` + + The inference speed mode used for this request. + + - `"standard"` + + - `"fast"` + +### Example + +```cli +ant beta:messages create \ + --api-key my-anthropic-api-key \ + --max-tokens 1024 \ + --message '{content: [{text: x, type: text}], role: user}' \ + --model claude-opus-4-6 +``` + +## Count Tokens + +`$ ant beta:messages count-tokens` + +**post** `/v1/messages/count_tokens` + +Count the number of tokens in a Message. + +The Token Count API can be used to count the number of tokens in a Message, including tools, images, and documents, without creating it. + +Learn more about token counting in our [user guide](https://docs.claude.com/en/docs/build-with-claude/token-counting) + +### Parameters + +- `--message: array of BetaMessageParam` + + Body param: Input messages. + + Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn. + + Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages. + + If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response. + + Example with a single `user` message: + + ```json + [{"role": "user", "content": "Hello, Claude"}] + ``` + + Example with multiple conversational turns: + + ```json + [ + {"role": "user", "content": "Hello there."}, + {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"}, + {"role": "user", "content": "Can you explain LLMs in plain English?"}, + ] + ``` + + Example with a partially-filled response from Claude: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("}, + ] + ``` + + Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent: + + ```json + {"role": "user", "content": "Hello, Claude"} + ``` + + ```json + {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]} + ``` + + See [input examples](https://docs.claude.com/en/api/messages-examples). + + Note that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. + + There is a limit of 100,000 messages in a single request. + +- `--model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + Body param: The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + +- `--cache-control: optional object { type, ttl }` + + Body param: Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request. + +- `--context-management: optional object { edits }` + + Body param: Context management configuration. + + This allows you to control how Claude manages context across multiple requests, such as whether to clear function results or not. + +- `--mcp-server: optional array of BetaRequestMCPServerURLDefinition` + + Body param: MCP servers to be utilized in this request + +- `--output-config: optional object { effort, format }` + + Body param: Configuration options for the model's output, such as the output format. + +- `--output-format: optional object { schema, type }` + + Body param: Deprecated: Use `output_config.format` instead. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) + + A schema to specify Claude's output format in responses. This parameter will be removed in a future release. + +- `--speed: optional "standard" or "fast"` + + Body param: The inference speed mode for this request. `"fast"` enables high output-tokens-per-second inference. + +- `--system: optional string or array of BetaTextBlockParam` + + Body param: System prompt. + + A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts). + +- `--thinking: optional BetaThinkingConfigEnabled or BetaThinkingConfigDisabled or BetaThinkingConfigAdaptive` + + Body param: Configuration for enabling Claude's extended thinking. + + When enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit. + + See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details. + +- `--tool-choice: optional BetaToolChoiceAuto or BetaToolChoiceAny or BetaToolChoiceTool or BetaToolChoiceNone` + + Body param: How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all. + +- `--tool: optional array of BetaTool or BetaToolBash20241022 or BetaToolBash20250124 or 19 more` + + Body param: Definitions of tools that the model may use. + + If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks. + + There are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)). + + Each tool definition includes: + + * `name`: Name of the tool. + * `description`: Optional, but strongly-recommended description of the tool. + * `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks. + + For example, if you defined `tools` as: + + ```json + [ + { + "name": "get_stock_price", + "description": "Get the current stock price for a given ticker symbol.", + "input_schema": { + "type": "object", + "properties": { + "ticker": { + "type": "string", + "description": "The stock ticker symbol, e.g. AAPL for Apple Inc." + } + }, + "required": ["ticker"] + } + } + ] + ``` + + And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this: + + ```json + [ + { + "type": "tool_use", + "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "name": "get_stock_price", + "input": { "ticker": "^GSPC" } + } + ] + ``` + + You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message: + + ```json + [ + { + "type": "tool_result", + "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "content": "259.75 USD" + } + ] + ``` + + Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output. + + See our [guide](https://docs.claude.com/en/docs/tool-use) for more details. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_message_tokens_count: object { context_management, input_tokens }` + + - `context_management: object { original_input_tokens }` + + Information about context management applied to the message. + + - `original_input_tokens: number` + + The original token count before context management was applied + + - `input_tokens: number` + + The total number of tokens across the provided list of messages, system prompt, and tools. + +### Example + +```cli +ant beta:messages count-tokens \ + --api-key my-anthropic-api-key \ + --message '{content: [{text: x, type: text}], role: user}' \ + --model claude-mythos-preview +``` + +## Domain Types + +### Beta All Thinking Turns + +- `beta_all_thinking_turns: object { type }` + + - `type: "all"` + +### Beta Base64 Image Source + +- `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + +### Beta Base64 PDF Source + +- `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + +### Beta Bash Code Execution Output Block + +- `beta_bash_code_execution_output_block: object { file_id, type }` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + +### Beta Bash Code Execution Output Block Param + +- `beta_bash_code_execution_output_block_param: object { file_id, type }` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + +### Beta Bash Code Execution Result Block + +- `beta_bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + +### Beta Bash Code Execution Result Block Param + +- `beta_bash_code_execution_result_block_param: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + +### Beta Bash Code Execution Tool Result Block + +- `beta_bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock` + + - `beta_bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + +### Beta Bash Code Execution Tool Result Block Param + +- `beta_bash_code_execution_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: BetaBashCodeExecutionToolResultErrorParam or BetaBashCodeExecutionResultBlockParam` + + - `beta_bash_code_execution_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block_param: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Beta Bash Code Execution Tool Result Error + +- `beta_bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + +### Beta Bash Code Execution Tool Result Error Param + +- `beta_bash_code_execution_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + +### Beta Cache Control Ephemeral + +- `beta_cache_control_ephemeral: object { type, ttl }` + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Beta Cache Creation + +- `beta_cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + +### Beta Citation Char Location + +- `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + +### Beta Citation Char Location Param + +- `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + +### Beta Citation Config + +- `beta_citation_config: object { enabled }` + + - `enabled: boolean` + +### Beta Citation Content Block Location + +- `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + +### Beta Citation Content Block Location Param + +- `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + +### Beta Citation Page Location + +- `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + +### Beta Citation Page Location Param + +- `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + +### Beta Citation Search Result Location + +- `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + +### Beta Citation Search Result Location Param + +- `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + +### Beta Citation Web Search Result Location Param + +- `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + +### Beta Citations Config Param + +- `beta_citations_config_param: object { enabled }` + + - `enabled: optional boolean` + +### Beta Citations Delta + +- `beta_citations_delta: object { citation, type }` + + - `citation: BetaCitationCharLocation or BetaCitationPageLocation or BetaCitationContentBlockLocation or 2 more` + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `type: "citations_delta"` + +### Beta Citations Web Search Result Location + +- `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + +### Beta Clear Thinking 20251015 Edit + +- `beta_clear_thinking_20251015_edit: object { type, keep }` + + - `type: "clear_thinking_20251015"` + + - `keep: optional BetaThinkingTurns or BetaAllThinkingTurns or "all"` + + Number of most recent assistant turns to keep thinking blocks for. Older turns will have their thinking blocks removed. + + - `beta_thinking_turns: object { type, value }` + + - `type: "thinking_turns"` + + - `value: number` + + - `beta_all_thinking_turns: object { type }` + + - `type: "all"` + + - `union_member_2: "all"` + +### Beta Clear Thinking 20251015 Edit Response + +- `beta_clear_thinking_20251015_edit_response: object { cleared_input_tokens, cleared_thinking_turns, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_thinking_turns: number` + + Number of thinking turns that were cleared. + + - `type: "clear_thinking_20251015"` + + The type of context management edit applied. + +### Beta Clear Tool Uses 20250919 Edit + +- `beta_clear_tool_uses_20250919_edit: object { type, clear_at_least, clear_tool_inputs, 3 more }` + + - `type: "clear_tool_uses_20250919"` + + - `clear_at_least: optional object { type, value }` + + Minimum number of tokens that must be cleared when triggered. Context will only be modified if at least this many tokens can be removed. + + - `type: "input_tokens"` + + - `value: number` + + - `clear_tool_inputs: optional boolean or array of string` + + Whether to clear all tool inputs (bool) or specific tool inputs to clear (list) + + - `union_member_0: boolean` + + - `union_member_1: array of string` + + - `exclude_tools: optional array of string` + + Tool names whose uses are preserved from clearing + + - `keep: optional object { type, value }` + + Number of tool uses to retain in the conversation + + - `type: "tool_uses"` + + - `value: number` + + - `trigger: optional BetaInputTokensTrigger or BetaToolUsesTrigger` + + Condition that triggers the context management strategy + + - `beta_input_tokens_trigger: object { type, value }` + + - `type: "input_tokens"` + + - `value: number` + + - `beta_tool_uses_trigger: object { type, value }` + + - `type: "tool_uses"` + + - `value: number` + +### Beta Clear Tool Uses 20250919 Edit Response + +- `beta_clear_tool_uses_20250919_edit_response: object { cleared_input_tokens, cleared_tool_uses, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_tool_uses: number` + + Number of tool uses that were cleared. + + - `type: "clear_tool_uses_20250919"` + + The type of context management edit applied. + +### Beta Code Execution Output Block + +- `beta_code_execution_output_block: object { file_id, type }` + + - `file_id: string` + + - `type: "code_execution_output"` + +### Beta Code Execution Output Block Param + +- `beta_code_execution_output_block_param: object { file_id, type }` + + - `file_id: string` + + - `type: "code_execution_output"` + +### Beta Code Execution Result Block + +- `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + +### Beta Code Execution Result Block Param + +- `beta_code_execution_result_block_param: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + +### Beta Code Execution Tool 20250522 + +- `beta_code_execution_tool_20250522: object { name, type, allowed_callers, 3 more }` + + - `name: "code_execution"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "code_execution_20250522"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Code Execution Tool 20250825 + +- `beta_code_execution_tool_20250825: object { name, type, allowed_callers, 3 more }` + + - `name: "code_execution"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "code_execution_20250825"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Code Execution Tool 20260120 + +- `beta_code_execution_tool_20260120: object { name, type, allowed_callers, 3 more }` + + Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint). + + - `name: "code_execution"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "code_execution_20260120"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Code Execution Tool Result Block + +- `beta_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaCodeExecutionToolResultError or BetaCodeExecutionResultBlock or BetaEncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + +### Beta Code Execution Tool Result Block Content + +- `beta_code_execution_tool_result_block_content: BetaCodeExecutionToolResultError or BetaCodeExecutionResultBlock or BetaEncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + +### Beta Code Execution Tool Result Block Param + +- `beta_code_execution_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: BetaCodeExecutionToolResultErrorParam or BetaCodeExecutionResultBlockParam or BetaEncryptedCodeExecutionResultBlockParam` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block_param: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block_param: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Beta Code Execution Tool Result Block Param Content + +- `beta_code_execution_tool_result_block_param_content: BetaCodeExecutionToolResultErrorParam or BetaCodeExecutionResultBlockParam or BetaEncryptedCodeExecutionResultBlockParam` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block_param: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block_param: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + +### Beta Code Execution Tool Result Error + +- `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + +### Beta Code Execution Tool Result Error Code + +- `beta_code_execution_tool_result_error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + +### Beta Code Execution Tool Result Error Param + +- `beta_code_execution_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + +### Beta Compact 20260112 Edit + +- `beta_compact_20260112_edit: object { type, instructions, pause_after_compaction, trigger }` + + Automatically compact older context when reaching the configured trigger threshold. + + - `type: "compact_20260112"` + + - `instructions: optional string` + + Additional instructions for summarization. + + - `pause_after_compaction: optional boolean` + + Whether to pause after compaction and return the compaction block to the user. + + - `trigger: optional object { type, value }` + + When to trigger compaction. Defaults to 150000 input tokens. + + - `type: "input_tokens"` + + - `value: number` + +### Beta Compaction Block + +- `beta_compaction_block: object { content, type }` + + A compaction block returned when autocompact is triggered. + + When content is None, it indicates the compaction failed to produce a valid + summary (e.g., malformed output from the model). Clients may round-trip + compaction blocks with null content; the server treats them as no-ops. + + - `content: string` + + Summary of compacted content, or null if compaction failed + + - `type: "compaction"` + +### Beta Compaction Block Param + +- `beta_compaction_block_param: object { content, type, cache_control }` + + A compaction block containing summary of previous context. + + Users should round-trip these blocks from responses to subsequent requests + to maintain context across compaction boundaries. + + When content is None, the block represents a failed compaction. The server + treats these as no-ops. Empty string content is not allowed. + + - `content: string` + + Summary of previously compacted content, or null if compaction failed + + - `type: "compaction"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Beta Compaction Content Block Delta + +- `beta_compaction_content_block_delta: object { content, type }` + + - `content: string` + + - `type: "compaction_delta"` + +### Beta Compaction Iteration Usage + +- `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + +### Beta Container + +- `beta_container: object { id, expires_at, skills }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `skills: array of BetaSkill` + + Skills loaded in the container + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: string` + + Skill version or 'latest' for most recent version + +### Beta Container Params + +- `beta_container_params: object { id, skills }` + + Container parameters with skills to be loaded. + + - `id: optional string` + + Container id + + - `skills: optional array of BetaSkillParams` + + List of skills to load in the container + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: optional string` + + Skill version or 'latest' for most recent version + +### Beta Container Upload Block + +- `beta_container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + +### Beta Container Upload Block Param + +- `beta_container_upload_block_param: object { file_id, type, cache_control }` + + A content block that represents a file to be uploaded to the container + Files uploaded via this block will be available in the container's input directory. + + - `file_id: string` + + - `type: "container_upload"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Beta Content Block + +- `beta_content_block: BetaTextBlock or BetaThinkingBlock or BetaRedactedThinkingBlock or 12 more` + + Response model for a file uploaded to the container. + + - `beta_text_block: object { citations, text, type }` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `beta_thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `beta_redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `beta_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_server_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_search_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebSearchToolResultError or array of BetaWebSearchResultBlock` + + - `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of BetaWebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_fetch_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock` + + - `beta_web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaCodeExecutionToolResultError or BetaCodeExecutionResultBlock or BetaEncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `beta_bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock` + + - `beta_bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `beta_text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock` + + - `beta_text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `beta_text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `beta_text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `beta_tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock` + + - `beta_tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `beta_mcp_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + The name of the MCP tool + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `beta_mcp_tool_result_block: object { content, is_error, tool_use_id, type }` + + - `content: string or array of BetaTextBlock` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_content: array of BetaTextBlock` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `is_error: boolean` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `beta_container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `beta_compaction_block: object { content, type }` + + A compaction block returned when autocompact is triggered. + + When content is None, it indicates the compaction failed to produce a valid + summary (e.g., malformed output from the model). Clients may round-trip + compaction blocks with null content; the server treats them as no-ops. + + - `content: string` + + Summary of compacted content, or null if compaction failed + + - `type: "compaction"` + +### Beta Content Block Param + +- `beta_content_block_param: BetaTextBlockParam or BetaImageBlockParam or BetaRequestDocumentBlock or 16 more` + + Regular text content. + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_request_document_block: object { source, type, cache_control, 3 more }` + + - `source: BetaBase64PDFSource or BetaPlainTextSource or BetaContentBlockSource or 2 more` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `beta_content_block_source: object { content, type }` + + - `content: string or array of BetaContentBlockSourceContent` + + - `union_member_0: string` + + - `beta_content_block_source_content: array of BetaContentBlockSourceContent` + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "content"` + + - `beta_url_pdf_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_document_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "document"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `context: optional string` + + - `title: optional string` + + - `beta_search_result_block_param: object { content, source, title, 3 more }` + + - `content: array of BetaTextBlockParam` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `source: string` + + - `title: string` + + - `type: "search_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `beta_thinking_block_param: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `beta_redacted_thinking_block_param: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `beta_tool_use_block_param: object { id, input, name, 3 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_tool_result_block_param: object { tool_use_id, type, cache_control, 2 more }` + + - `tool_use_id: string` + + - `type: "tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `content: optional array of BetaTextBlockParam or BetaImageBlockParam or BetaSearchResultBlockParam or 2 more` + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_search_result_block_param: object { content, source, title, 3 more }` + + - `content: array of BetaTextBlockParam` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `source: string` + + - `title: string` + + - `type: "search_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `beta_request_document_block: object { source, type, cache_control, 3 more }` + + - `source: BetaBase64PDFSource or BetaPlainTextSource or BetaContentBlockSource or 2 more` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `beta_content_block_source: object { content, type }` + + - `content: string or array of BetaContentBlockSourceContent` + + - `union_member_0: string` + + - `beta_content_block_source_content: array of BetaContentBlockSourceContent` + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "content"` + + - `beta_url_pdf_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_document_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "document"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `context: optional string` + + - `title: optional string` + + - `beta_tool_reference_block_param: object { tool_name, type, cache_control }` + + Tool reference block that can be included in tool_result content. + + - `tool_name: string` + + - `type: "tool_reference"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `is_error: optional boolean` + + - `beta_server_tool_use_block_param: object { id, input, name, 3 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_search_tool_result_block_param: object { content, tool_use_id, type, 2 more }` + + - `content: array of BetaWebSearchResultBlockParam or BetaWebSearchToolRequestError` + + - `Result Block: array of BetaWebSearchResultBlockParam` + + - `encrypted_content: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `page_age: optional string` + + - `beta_web_search_tool_request_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_fetch_tool_result_block_param: object { content, tool_use_id, type, 2 more }` + + - `content: BetaWebFetchToolResultErrorBlockParam or BetaWebFetchBlockParam` + + - `beta_web_fetch_tool_result_error_block_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block_param: object { content, type, url, retrieved_at }` + + - `content: object { source, type, cache_control, 3 more }` + + - `source: BetaBase64PDFSource or BetaPlainTextSource or BetaContentBlockSource or 2 more` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `beta_content_block_source: object { content, type }` + + - `content: string or array of BetaContentBlockSourceContent` + + - `union_member_0: string` + + - `beta_content_block_source_content: array of BetaContentBlockSourceContent` + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "content"` + + - `beta_url_pdf_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_document_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "document"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `context: optional string` + + - `title: optional string` + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `retrieved_at: optional string` + + ISO 8601 timestamp when the content was retrieved + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_code_execution_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: BetaCodeExecutionToolResultErrorParam or BetaCodeExecutionResultBlockParam or BetaEncryptedCodeExecutionResultBlockParam` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block_param: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block_param: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_bash_code_execution_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: BetaBashCodeExecutionToolResultErrorParam or BetaBashCodeExecutionResultBlockParam` + + - `beta_bash_code_execution_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block_param: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_text_editor_code_execution_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: BetaTextEditorCodeExecutionToolResultErrorParam or BetaTextEditorCodeExecutionViewResultBlockParam or BetaTextEditorCodeExecutionCreateResultBlockParam or BetaTextEditorCodeExecutionStrReplaceResultBlockParam` + + - `beta_text_editor_code_execution_tool_result_error_param: object { error_code, type, error_message }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `error_message: optional string` + + - `beta_text_editor_code_execution_view_result_block_param: object { content, file_type, type, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `type: "text_editor_code_execution_view_result"` + + - `num_lines: optional number` + + - `start_line: optional number` + + - `total_lines: optional number` + + - `beta_text_editor_code_execution_create_result_block_param: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block_param: object { type, lines, new_lines, 3 more }` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `lines: optional array of string` + + - `new_lines: optional number` + + - `new_start: optional number` + + - `old_lines: optional number` + + - `old_start: optional number` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_tool_search_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: BetaToolSearchToolResultErrorParam or BetaToolSearchToolSearchResultBlockParam` + + - `beta_tool_search_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block_param: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlockParam` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_mcp_tool_use_block_param: object { id, input, name, 3 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_request_mcp_tool_result_block_param: object { tool_use_id, type, cache_control, 2 more }` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `content: optional string or array of BetaTextBlockParam` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_param_content: array of BetaTextBlockParam` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `is_error: optional boolean` + + - `beta_container_upload_block_param: object { file_id, type, cache_control }` + + A content block that represents a file to be uploaded to the container + Files uploaded via this block will be available in the container's input directory. + + - `file_id: string` + + - `type: "container_upload"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_compaction_block_param: object { content, type, cache_control }` + + A compaction block containing summary of previous context. + + Users should round-trip these blocks from responses to subsequent requests + to maintain context across compaction boundaries. + + When content is None, the block represents a failed compaction. The server + treats these as no-ops. Empty string content is not allowed. + + - `content: string` + + Summary of previously compacted content, or null if compaction failed + + - `type: "compaction"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Beta Content Block Source + +- `beta_content_block_source: object { content, type }` + + - `content: string or array of BetaContentBlockSourceContent` + + - `union_member_0: string` + + - `beta_content_block_source_content: array of BetaContentBlockSourceContent` + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "content"` + +### Beta Content Block Source Content + +- `beta_content_block_source_content: BetaTextBlockParam or BetaImageBlockParam` + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Beta Context Management Config + +- `beta_context_management_config: object { edits }` + + - `edits: optional array of BetaClearToolUses20250919Edit or BetaClearThinking20251015Edit or BetaCompact20260112Edit` + + List of context management edits to apply + + - `beta_clear_tool_uses_20250919_edit: object { type, clear_at_least, clear_tool_inputs, 3 more }` + + - `type: "clear_tool_uses_20250919"` + + - `clear_at_least: optional object { type, value }` + + Minimum number of tokens that must be cleared when triggered. Context will only be modified if at least this many tokens can be removed. + + - `type: "input_tokens"` + + - `value: number` + + - `clear_tool_inputs: optional boolean or array of string` + + Whether to clear all tool inputs (bool) or specific tool inputs to clear (list) + + - `union_member_0: boolean` + + - `union_member_1: array of string` + + - `exclude_tools: optional array of string` + + Tool names whose uses are preserved from clearing + + - `keep: optional object { type, value }` + + Number of tool uses to retain in the conversation + + - `type: "tool_uses"` + + - `value: number` + + - `trigger: optional BetaInputTokensTrigger or BetaToolUsesTrigger` + + Condition that triggers the context management strategy + + - `beta_input_tokens_trigger: object { type, value }` + + - `type: "input_tokens"` + + - `value: number` + + - `beta_tool_uses_trigger: object { type, value }` + + - `type: "tool_uses"` + + - `value: number` + + - `beta_clear_thinking_20251015_edit: object { type, keep }` + + - `type: "clear_thinking_20251015"` + + - `keep: optional BetaThinkingTurns or BetaAllThinkingTurns or "all"` + + Number of most recent assistant turns to keep thinking blocks for. Older turns will have their thinking blocks removed. + + - `beta_thinking_turns: object { type, value }` + + - `type: "thinking_turns"` + + - `value: number` + + - `beta_all_thinking_turns: object { type }` + + - `type: "all"` + + - `union_member_2: "all"` + + - `beta_compact_20260112_edit: object { type, instructions, pause_after_compaction, trigger }` + + Automatically compact older context when reaching the configured trigger threshold. + + - `type: "compact_20260112"` + + - `instructions: optional string` + + Additional instructions for summarization. + + - `pause_after_compaction: optional boolean` + + Whether to pause after compaction and return the compaction block to the user. + + - `trigger: optional object { type, value }` + + When to trigger compaction. Defaults to 150000 input tokens. + + - `type: "input_tokens"` + + - `value: number` + +### Beta Context Management Response + +- `beta_context_management_response: object { applied_edits }` + + - `applied_edits: array of BetaClearToolUses20250919EditResponse or BetaClearThinking20251015EditResponse` + + List of context management edits that were applied. + + - `beta_clear_tool_uses_20250919_edit_response: object { cleared_input_tokens, cleared_tool_uses, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_tool_uses: number` + + Number of tool uses that were cleared. + + - `type: "clear_tool_uses_20250919"` + + The type of context management edit applied. + + - `beta_clear_thinking_20251015_edit_response: object { cleared_input_tokens, cleared_thinking_turns, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_thinking_turns: number` + + Number of thinking turns that were cleared. + + - `type: "clear_thinking_20251015"` + + The type of context management edit applied. + +### Beta Count Tokens Context Management Response + +- `beta_count_tokens_context_management_response: object { original_input_tokens }` + + - `original_input_tokens: number` + + The original token count before context management was applied + +### Beta Direct Caller + +- `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + +### Beta Document Block + +- `beta_document_block: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + +### Beta Encrypted Code Execution Result Block + +- `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + +### Beta Encrypted Code Execution Result Block Param + +- `beta_encrypted_code_execution_result_block_param: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + +### Beta File Document Source + +- `beta_file_document_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + +### Beta File Image Source + +- `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + +### Beta Image Block Param + +- `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Beta Input JSON Delta + +- `beta_input_json_delta: object { partial_json, type }` + + - `partial_json: string` + + - `type: "input_json_delta"` + +### Beta Input Tokens Clear At Least + +- `beta_input_tokens_clear_at_least: object { type, value }` + + - `type: "input_tokens"` + + - `value: number` + +### Beta Input Tokens Trigger + +- `beta_input_tokens_trigger: object { type, value }` + + - `type: "input_tokens"` + + - `value: number` + +### Beta Iterations Usage + +- `beta_iterations_usage: array of BetaMessageIterationUsage or BetaCompactionIterationUsage` + + Per-iteration token usage breakdown. + + Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + + - Determine which iterations exceeded long context thresholds (>=200k tokens) + - Calculate the true context window size from the last iteration + - Understand token accumulation across server-side tool use loops + + - `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + + - `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + +### Beta JSON Output Format + +- `beta_json_output_format: object { schema, type }` + + - `schema: map[unknown]` + + The JSON schema of the format + + - `type: "json_schema"` + +### Beta MCP Tool Config + +- `beta_mcp_tool_config: object { defer_loading, enabled }` + + Configuration for a specific tool in an MCP toolset. + + - `defer_loading: optional boolean` + + - `enabled: optional boolean` + +### Beta MCP Tool Default Config + +- `beta_mcp_tool_default_config: object { defer_loading, enabled }` + + Default configuration for tools in an MCP toolset. + + - `defer_loading: optional boolean` + + - `enabled: optional boolean` + +### Beta MCP Tool Result Block + +- `beta_mcp_tool_result_block: object { content, is_error, tool_use_id, type }` + + - `content: string or array of BetaTextBlock` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_content: array of BetaTextBlock` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `is_error: boolean` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + +### Beta MCP Tool Use Block + +- `beta_mcp_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + The name of the MCP tool + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + +### Beta MCP Tool Use Block Param + +- `beta_mcp_tool_use_block_param: object { id, input, name, 3 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Beta MCP Toolset + +- `beta_mcp_toolset: object { mcp_server_name, type, cache_control, 2 more }` + + Configuration for a group of tools from an MCP server. + + Allows configuring enabled status and defer_loading for all tools + from an MCP server, with optional per-tool overrides. + + - `mcp_server_name: string` + + Name of the MCP server to configure tools for + + - `type: "mcp_toolset"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `configs: optional map[BetaMCPToolConfig]` + + Configuration overrides for specific tools, keyed by tool name + + - `defer_loading: optional boolean` + + - `enabled: optional boolean` + + - `default_config: optional object { defer_loading, enabled }` + + Default configuration applied to all tools from this server + + - `defer_loading: optional boolean` + + - `enabled: optional boolean` + +### Beta Memory Tool 20250818 + +- `beta_memory_tool_20250818: object { name, type, allowed_callers, 4 more }` + + - `name: "memory"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "memory_20250818"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Memory Tool 20250818 Command + +- `beta_memory_tool_20250818_command: BetaMemoryTool20250818ViewCommand or BetaMemoryTool20250818CreateCommand or BetaMemoryTool20250818StrReplaceCommand or 3 more` + + - `beta_memory_tool_20250818_view_command: object { command, path, view_range }` + + - `command: "view"` + + Command type identifier + + - `path: string` + + Path to directory or file to view + + - `view_range: optional array of number` + + Optional line range for viewing specific lines + + - `beta_memory_tool_20250818_create_command: object { command, file_text, path }` + + - `command: "create"` + + Command type identifier + + - `file_text: string` + + Content to write to the file + + - `path: string` + + Path where the file should be created + + - `beta_memory_tool_20250818_str_replace_command: object { command, new_str, old_str, path }` + + - `command: "str_replace"` + + Command type identifier + + - `new_str: string` + + Text to replace with + + - `old_str: string` + + Text to search for and replace + + - `path: string` + + Path to the file where text should be replaced + + - `beta_memory_tool_20250818_insert_command: object { command, insert_line, insert_text, path }` + + - `command: "insert"` + + Command type identifier + + - `insert_line: number` + + Line number where text should be inserted + + - `insert_text: string` + + Text to insert at the specified line + + - `path: string` + + Path to the file where text should be inserted + + - `beta_memory_tool_20250818_delete_command: object { command, path }` + + - `command: "delete"` + + Command type identifier + + - `path: string` + + Path to the file or directory to delete + + - `beta_memory_tool_20250818_rename_command: object { command, new_path, old_path }` + + - `command: "rename"` + + Command type identifier + + - `new_path: string` + + New path for the file or directory + + - `old_path: string` + + Current path of the file or directory + +### Beta Memory Tool 20250818 Create Command + +- `beta_memory_tool_20250818_create_command: object { command, file_text, path }` + + - `command: "create"` + + Command type identifier + + - `file_text: string` + + Content to write to the file + + - `path: string` + + Path where the file should be created + +### Beta Memory Tool 20250818 Delete Command + +- `beta_memory_tool_20250818_delete_command: object { command, path }` + + - `command: "delete"` + + Command type identifier + + - `path: string` + + Path to the file or directory to delete + +### Beta Memory Tool 20250818 Insert Command + +- `beta_memory_tool_20250818_insert_command: object { command, insert_line, insert_text, path }` + + - `command: "insert"` + + Command type identifier + + - `insert_line: number` + + Line number where text should be inserted + + - `insert_text: string` + + Text to insert at the specified line + + - `path: string` + + Path to the file where text should be inserted + +### Beta Memory Tool 20250818 Rename Command + +- `beta_memory_tool_20250818_rename_command: object { command, new_path, old_path }` + + - `command: "rename"` + + Command type identifier + + - `new_path: string` + + New path for the file or directory + + - `old_path: string` + + Current path of the file or directory + +### Beta Memory Tool 20250818 Str Replace Command + +- `beta_memory_tool_20250818_str_replace_command: object { command, new_str, old_str, path }` + + - `command: "str_replace"` + + Command type identifier + + - `new_str: string` + + Text to replace with + + - `old_str: string` + + Text to search for and replace + + - `path: string` + + Path to the file where text should be replaced + +### Beta Memory Tool 20250818 View Command + +- `beta_memory_tool_20250818_view_command: object { command, path, view_range }` + + - `command: "view"` + + Command type identifier + + - `path: string` + + Path to directory or file to view + + - `view_range: optional array of number` + + Optional line range for viewing specific lines + +### Beta Message + +- `beta_message: object { id, container, content, 8 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at, skills }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `skills: array of BetaSkill` + + Skills loaded in the container + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: string` + + Skill version or 'latest' for most recent version + + - `content: array of BetaContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `beta_text_block: object { citations, text, type }` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `beta_thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `beta_redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `beta_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_server_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_search_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebSearchToolResultError or array of BetaWebSearchResultBlock` + + - `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of BetaWebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_fetch_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock` + + - `beta_web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaCodeExecutionToolResultError or BetaCodeExecutionResultBlock or BetaEncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `beta_bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock` + + - `beta_bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `beta_text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock` + + - `beta_text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `beta_text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `beta_text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `beta_tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock` + + - `beta_tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `beta_mcp_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + The name of the MCP tool + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `beta_mcp_tool_result_block: object { content, is_error, tool_use_id, type }` + + - `content: string or array of BetaTextBlock` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_content: array of BetaTextBlock` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `is_error: boolean` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `beta_container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `beta_compaction_block: object { content, type }` + + A compaction block returned when autocompact is triggered. + + When content is None, it indicates the compaction failed to produce a valid + summary (e.g., malformed output from the model). Clients may round-trip + compaction blocks with null content; the server treats them as no-ops. + + - `content: string` + + Summary of compacted content, or null if compaction failed + + - `type: "compaction"` + + - `context_management: object { applied_edits }` + + Context management response. + + Information about context management strategies applied during the request. + + - `applied_edits: array of BetaClearToolUses20250919EditResponse or BetaClearThinking20251015EditResponse` + + List of context management edits that were applied. + + - `beta_clear_tool_uses_20250919_edit_response: object { cleared_input_tokens, cleared_tool_uses, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_tool_uses: number` + + Number of tool uses that were cleared. + + - `type: "clear_tool_uses_20250919"` + + The type of context management edit applied. + + - `beta_clear_thinking_20251015_edit_response: object { cleared_input_tokens, cleared_thinking_turns, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_thinking_turns: number` + + Number of thinking turns that were cleared. + + - `type: "clear_thinking_20251015"` + + The type of context management edit applied. + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 5 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"compaction"` + + - `"refusal"` + + - `"model_context_window_exceeded"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 7 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `iterations: array of BetaMessageIterationUsage or BetaCompactionIterationUsage` + + Per-iteration token usage breakdown. + + Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + + - Determine which iterations exceeded long context thresholds (>=200k tokens) + - Calculate the true context window size from the last iteration + - Understand token accumulation across server-side tool use loops + + - `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + + - `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `speed: "standard" or "fast"` + + The inference speed mode used for this request. + + - `"standard"` + + - `"fast"` + +### Beta Message Delta Usage + +- `beta_message_delta_usage: object { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 3 more }` + + - `cache_creation_input_tokens: number` + + The cumulative number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The cumulative number of input tokens read from the cache. + + - `input_tokens: number` + + The cumulative number of input tokens which were used. + + - `iterations: array of BetaMessageIterationUsage or BetaCompactionIterationUsage` + + Per-iteration token usage breakdown. + + Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + + - Determine which iterations exceeded long context thresholds (>=200k tokens) + - Calculate the true context window size from the last iteration + - Understand token accumulation across server-side tool use loops + + - `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + + - `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + + - `output_tokens: number` + + The cumulative number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + +### Beta Message Iteration Usage + +- `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + +### Beta Message Param + +- `beta_message_param: object { content, role }` + + - `content: array of BetaContentBlockParam` + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_request_document_block: object { source, type, cache_control, 3 more }` + + - `source: BetaBase64PDFSource or BetaPlainTextSource or BetaContentBlockSource or 2 more` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `beta_content_block_source: object { content, type }` + + - `content: string or array of BetaContentBlockSourceContent` + + - `union_member_0: string` + + - `beta_content_block_source_content: array of BetaContentBlockSourceContent` + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "content"` + + - `beta_url_pdf_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_document_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "document"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `context: optional string` + + - `title: optional string` + + - `beta_search_result_block_param: object { content, source, title, 3 more }` + + - `content: array of BetaTextBlockParam` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `source: string` + + - `title: string` + + - `type: "search_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `beta_thinking_block_param: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `beta_redacted_thinking_block_param: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `beta_tool_use_block_param: object { id, input, name, 3 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_tool_result_block_param: object { tool_use_id, type, cache_control, 2 more }` + + - `tool_use_id: string` + + - `type: "tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `content: optional array of BetaTextBlockParam or BetaImageBlockParam or BetaSearchResultBlockParam or 2 more` + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_search_result_block_param: object { content, source, title, 3 more }` + + - `content: array of BetaTextBlockParam` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `source: string` + + - `title: string` + + - `type: "search_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `beta_request_document_block: object { source, type, cache_control, 3 more }` + + - `source: BetaBase64PDFSource or BetaPlainTextSource or BetaContentBlockSource or 2 more` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `beta_content_block_source: object { content, type }` + + - `content: string or array of BetaContentBlockSourceContent` + + - `union_member_0: string` + + - `beta_content_block_source_content: array of BetaContentBlockSourceContent` + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "content"` + + - `beta_url_pdf_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_document_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "document"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `context: optional string` + + - `title: optional string` + + - `beta_tool_reference_block_param: object { tool_name, type, cache_control }` + + Tool reference block that can be included in tool_result content. + + - `tool_name: string` + + - `type: "tool_reference"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `is_error: optional boolean` + + - `beta_server_tool_use_block_param: object { id, input, name, 3 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_search_tool_result_block_param: object { content, tool_use_id, type, 2 more }` + + - `content: array of BetaWebSearchResultBlockParam or BetaWebSearchToolRequestError` + + - `Result Block: array of BetaWebSearchResultBlockParam` + + - `encrypted_content: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `page_age: optional string` + + - `beta_web_search_tool_request_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_fetch_tool_result_block_param: object { content, tool_use_id, type, 2 more }` + + - `content: BetaWebFetchToolResultErrorBlockParam or BetaWebFetchBlockParam` + + - `beta_web_fetch_tool_result_error_block_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block_param: object { content, type, url, retrieved_at }` + + - `content: object { source, type, cache_control, 3 more }` + + - `source: BetaBase64PDFSource or BetaPlainTextSource or BetaContentBlockSource or 2 more` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `beta_content_block_source: object { content, type }` + + - `content: string or array of BetaContentBlockSourceContent` + + - `union_member_0: string` + + - `beta_content_block_source_content: array of BetaContentBlockSourceContent` + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "content"` + + - `beta_url_pdf_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_document_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "document"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `context: optional string` + + - `title: optional string` + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `retrieved_at: optional string` + + ISO 8601 timestamp when the content was retrieved + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_code_execution_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: BetaCodeExecutionToolResultErrorParam or BetaCodeExecutionResultBlockParam or BetaEncryptedCodeExecutionResultBlockParam` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block_param: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block_param: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_bash_code_execution_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: BetaBashCodeExecutionToolResultErrorParam or BetaBashCodeExecutionResultBlockParam` + + - `beta_bash_code_execution_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block_param: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_text_editor_code_execution_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: BetaTextEditorCodeExecutionToolResultErrorParam or BetaTextEditorCodeExecutionViewResultBlockParam or BetaTextEditorCodeExecutionCreateResultBlockParam or BetaTextEditorCodeExecutionStrReplaceResultBlockParam` + + - `beta_text_editor_code_execution_tool_result_error_param: object { error_code, type, error_message }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `error_message: optional string` + + - `beta_text_editor_code_execution_view_result_block_param: object { content, file_type, type, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `type: "text_editor_code_execution_view_result"` + + - `num_lines: optional number` + + - `start_line: optional number` + + - `total_lines: optional number` + + - `beta_text_editor_code_execution_create_result_block_param: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block_param: object { type, lines, new_lines, 3 more }` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `lines: optional array of string` + + - `new_lines: optional number` + + - `new_start: optional number` + + - `old_lines: optional number` + + - `old_start: optional number` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_tool_search_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: BetaToolSearchToolResultErrorParam or BetaToolSearchToolSearchResultBlockParam` + + - `beta_tool_search_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block_param: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlockParam` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_mcp_tool_use_block_param: object { id, input, name, 3 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_request_mcp_tool_result_block_param: object { tool_use_id, type, cache_control, 2 more }` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `content: optional string or array of BetaTextBlockParam` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_param_content: array of BetaTextBlockParam` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `is_error: optional boolean` + + - `beta_container_upload_block_param: object { file_id, type, cache_control }` + + A content block that represents a file to be uploaded to the container + Files uploaded via this block will be available in the container's input directory. + + - `file_id: string` + + - `type: "container_upload"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_compaction_block_param: object { content, type, cache_control }` + + A compaction block containing summary of previous context. + + Users should round-trip these blocks from responses to subsequent requests + to maintain context across compaction boundaries. + + When content is None, the block represents a failed compaction. The server + treats these as no-ops. Empty string content is not allowed. + + - `content: string` + + Summary of previously compacted content, or null if compaction failed + + - `type: "compaction"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `role: "user" or "assistant"` + + - `"user"` + + - `"assistant"` + +### Beta Message Tokens Count + +- `beta_message_tokens_count: object { context_management, input_tokens }` + + - `context_management: object { original_input_tokens }` + + Information about context management applied to the message. + + - `original_input_tokens: number` + + The original token count before context management was applied + + - `input_tokens: number` + + The total number of tokens across the provided list of messages, system prompt, and tools. + +### Beta Metadata + +- `beta_metadata: object { user_id }` + + - `user_id: optional string` + + An external identifier for the user who is associated with the request. + + This should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number. + +### Beta Output Config + +- `beta_output_config: object { effort, format }` + + - `effort: optional "low" or "medium" or "high" or "max"` + + All possible effort levels. + + - `"low"` + + - `"medium"` + + - `"high"` + + - `"max"` + + - `format: optional object { schema, type }` + + A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) + + - `schema: map[unknown]` + + The JSON schema of the format + + - `type: "json_schema"` + +### Beta Plain Text Source + +- `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + +### Beta Raw Content Block Delta + +- `beta_raw_content_block_delta: BetaTextDelta or BetaInputJSONDelta or BetaCitationsDelta or 3 more` + + - `beta_text_delta: object { text, type }` + + - `text: string` + + - `type: "text_delta"` + + - `beta_input_json_delta: object { partial_json, type }` + + - `partial_json: string` + + - `type: "input_json_delta"` + + - `beta_citations_delta: object { citation, type }` + + - `citation: BetaCitationCharLocation or BetaCitationPageLocation or BetaCitationContentBlockLocation or 2 more` + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `type: "citations_delta"` + + - `beta_thinking_delta: object { thinking, type }` + + - `thinking: string` + + - `type: "thinking_delta"` + + - `beta_signature_delta: object { signature, type }` + + - `signature: string` + + - `type: "signature_delta"` + + - `beta_compaction_content_block_delta: object { content, type }` + + - `content: string` + + - `type: "compaction_delta"` + +### Beta Raw Content Block Delta Event + +- `beta_raw_content_block_delta_event: object { delta, index, type }` + + - `delta: BetaTextDelta or BetaInputJSONDelta or BetaCitationsDelta or 3 more` + + - `beta_text_delta: object { text, type }` + + - `text: string` + + - `type: "text_delta"` + + - `beta_input_json_delta: object { partial_json, type }` + + - `partial_json: string` + + - `type: "input_json_delta"` + + - `beta_citations_delta: object { citation, type }` + + - `citation: BetaCitationCharLocation or BetaCitationPageLocation or BetaCitationContentBlockLocation or 2 more` + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `type: "citations_delta"` + + - `beta_thinking_delta: object { thinking, type }` + + - `thinking: string` + + - `type: "thinking_delta"` + + - `beta_signature_delta: object { signature, type }` + + - `signature: string` + + - `type: "signature_delta"` + + - `beta_compaction_content_block_delta: object { content, type }` + + - `content: string` + + - `type: "compaction_delta"` + + - `index: number` + + - `type: "content_block_delta"` + +### Beta Raw Content Block Start Event + +- `beta_raw_content_block_start_event: object { content_block, index, type }` + + - `content_block: BetaTextBlock or BetaThinkingBlock or BetaRedactedThinkingBlock or 12 more` + + Response model for a file uploaded to the container. + + - `beta_text_block: object { citations, text, type }` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `beta_thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `beta_redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `beta_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_server_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_search_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebSearchToolResultError or array of BetaWebSearchResultBlock` + + - `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of BetaWebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_fetch_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock` + + - `beta_web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaCodeExecutionToolResultError or BetaCodeExecutionResultBlock or BetaEncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `beta_bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock` + + - `beta_bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `beta_text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock` + + - `beta_text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `beta_text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `beta_text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `beta_tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock` + + - `beta_tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `beta_mcp_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + The name of the MCP tool + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `beta_mcp_tool_result_block: object { content, is_error, tool_use_id, type }` + + - `content: string or array of BetaTextBlock` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_content: array of BetaTextBlock` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `is_error: boolean` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `beta_container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `beta_compaction_block: object { content, type }` + + A compaction block returned when autocompact is triggered. + + When content is None, it indicates the compaction failed to produce a valid + summary (e.g., malformed output from the model). Clients may round-trip + compaction blocks with null content; the server treats them as no-ops. + + - `content: string` + + Summary of compacted content, or null if compaction failed + + - `type: "compaction"` + + - `index: number` + + - `type: "content_block_start"` + +### Beta Raw Content Block Stop Event + +- `beta_raw_content_block_stop_event: object { index, type }` + + - `index: number` + + - `type: "content_block_stop"` + +### Beta Raw Message Delta Event + +- `beta_raw_message_delta_event: object { context_management, delta, type, usage }` + + - `context_management: object { applied_edits }` + + Information about context management strategies applied during the request + + - `applied_edits: array of BetaClearToolUses20250919EditResponse or BetaClearThinking20251015EditResponse` + + List of context management edits that were applied. + + - `beta_clear_tool_uses_20250919_edit_response: object { cleared_input_tokens, cleared_tool_uses, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_tool_uses: number` + + Number of tool uses that were cleared. + + - `type: "clear_tool_uses_20250919"` + + The type of context management edit applied. + + - `beta_clear_thinking_20251015_edit_response: object { cleared_input_tokens, cleared_thinking_turns, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_thinking_turns: number` + + Number of thinking turns that were cleared. + + - `type: "clear_thinking_20251015"` + + The type of context management edit applied. + + - `delta: object { container, stop_details, stop_reason, stop_sequence }` + + - `container: object { id, expires_at, skills }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `skills: array of BetaSkill` + + Skills loaded in the container + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: string` + + Skill version or 'latest' for most recent version + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 5 more` + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"compaction"` + + - `"refusal"` + + - `"model_context_window_exceeded"` + + - `stop_sequence: string` + + - `type: "message_delta"` + + - `usage: object { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 3 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation_input_tokens: number` + + The cumulative number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The cumulative number of input tokens read from the cache. + + - `input_tokens: number` + + The cumulative number of input tokens which were used. + + - `iterations: array of BetaMessageIterationUsage or BetaCompactionIterationUsage` + + Per-iteration token usage breakdown. + + Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + + - Determine which iterations exceeded long context thresholds (>=200k tokens) + - Calculate the true context window size from the last iteration + - Understand token accumulation across server-side tool use loops + + - `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + + - `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + + - `output_tokens: number` + + The cumulative number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + +### Beta Raw Message Start Event + +- `beta_raw_message_start_event: object { message, type }` + + - `message: object { id, container, content, 8 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at, skills }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `skills: array of BetaSkill` + + Skills loaded in the container + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: string` + + Skill version or 'latest' for most recent version + + - `content: array of BetaContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `beta_text_block: object { citations, text, type }` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `beta_thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `beta_redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `beta_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_server_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_search_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebSearchToolResultError or array of BetaWebSearchResultBlock` + + - `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of BetaWebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_fetch_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock` + + - `beta_web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaCodeExecutionToolResultError or BetaCodeExecutionResultBlock or BetaEncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `beta_bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock` + + - `beta_bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `beta_text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock` + + - `beta_text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `beta_text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `beta_text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `beta_tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock` + + - `beta_tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `beta_mcp_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + The name of the MCP tool + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `beta_mcp_tool_result_block: object { content, is_error, tool_use_id, type }` + + - `content: string or array of BetaTextBlock` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_content: array of BetaTextBlock` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `is_error: boolean` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `beta_container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `beta_compaction_block: object { content, type }` + + A compaction block returned when autocompact is triggered. + + When content is None, it indicates the compaction failed to produce a valid + summary (e.g., malformed output from the model). Clients may round-trip + compaction blocks with null content; the server treats them as no-ops. + + - `content: string` + + Summary of compacted content, or null if compaction failed + + - `type: "compaction"` + + - `context_management: object { applied_edits }` + + Context management response. + + Information about context management strategies applied during the request. + + - `applied_edits: array of BetaClearToolUses20250919EditResponse or BetaClearThinking20251015EditResponse` + + List of context management edits that were applied. + + - `beta_clear_tool_uses_20250919_edit_response: object { cleared_input_tokens, cleared_tool_uses, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_tool_uses: number` + + Number of tool uses that were cleared. + + - `type: "clear_tool_uses_20250919"` + + The type of context management edit applied. + + - `beta_clear_thinking_20251015_edit_response: object { cleared_input_tokens, cleared_thinking_turns, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_thinking_turns: number` + + Number of thinking turns that were cleared. + + - `type: "clear_thinking_20251015"` + + The type of context management edit applied. + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 5 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"compaction"` + + - `"refusal"` + + - `"model_context_window_exceeded"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 7 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `iterations: array of BetaMessageIterationUsage or BetaCompactionIterationUsage` + + Per-iteration token usage breakdown. + + Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + + - Determine which iterations exceeded long context thresholds (>=200k tokens) + - Calculate the true context window size from the last iteration + - Understand token accumulation across server-side tool use loops + + - `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + + - `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `speed: "standard" or "fast"` + + The inference speed mode used for this request. + + - `"standard"` + + - `"fast"` + + - `type: "message_start"` + +### Beta Raw Message Stop Event + +- `beta_raw_message_stop_event: object { type }` + + - `type: "message_stop"` + +### Beta Raw Message Stream Event + +- `beta_raw_message_stream_event: BetaRawMessageStartEvent or BetaRawMessageDeltaEvent or BetaRawMessageStopEvent or 3 more` + + - `beta_raw_message_start_event: object { message, type }` + + - `message: object { id, container, content, 8 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at, skills }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `skills: array of BetaSkill` + + Skills loaded in the container + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: string` + + Skill version or 'latest' for most recent version + + - `content: array of BetaContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `beta_text_block: object { citations, text, type }` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `beta_thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `beta_redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `beta_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_server_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_search_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebSearchToolResultError or array of BetaWebSearchResultBlock` + + - `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of BetaWebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_fetch_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock` + + - `beta_web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaCodeExecutionToolResultError or BetaCodeExecutionResultBlock or BetaEncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `beta_bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock` + + - `beta_bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `beta_text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock` + + - `beta_text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `beta_text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `beta_text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `beta_tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock` + + - `beta_tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `beta_mcp_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + The name of the MCP tool + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `beta_mcp_tool_result_block: object { content, is_error, tool_use_id, type }` + + - `content: string or array of BetaTextBlock` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_content: array of BetaTextBlock` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `is_error: boolean` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `beta_container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `beta_compaction_block: object { content, type }` + + A compaction block returned when autocompact is triggered. + + When content is None, it indicates the compaction failed to produce a valid + summary (e.g., malformed output from the model). Clients may round-trip + compaction blocks with null content; the server treats them as no-ops. + + - `content: string` + + Summary of compacted content, or null if compaction failed + + - `type: "compaction"` + + - `context_management: object { applied_edits }` + + Context management response. + + Information about context management strategies applied during the request. + + - `applied_edits: array of BetaClearToolUses20250919EditResponse or BetaClearThinking20251015EditResponse` + + List of context management edits that were applied. + + - `beta_clear_tool_uses_20250919_edit_response: object { cleared_input_tokens, cleared_tool_uses, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_tool_uses: number` + + Number of tool uses that were cleared. + + - `type: "clear_tool_uses_20250919"` + + The type of context management edit applied. + + - `beta_clear_thinking_20251015_edit_response: object { cleared_input_tokens, cleared_thinking_turns, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_thinking_turns: number` + + Number of thinking turns that were cleared. + + - `type: "clear_thinking_20251015"` + + The type of context management edit applied. + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 5 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"compaction"` + + - `"refusal"` + + - `"model_context_window_exceeded"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 7 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `iterations: array of BetaMessageIterationUsage or BetaCompactionIterationUsage` + + Per-iteration token usage breakdown. + + Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + + - Determine which iterations exceeded long context thresholds (>=200k tokens) + - Calculate the true context window size from the last iteration + - Understand token accumulation across server-side tool use loops + + - `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + + - `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `speed: "standard" or "fast"` + + The inference speed mode used for this request. + + - `"standard"` + + - `"fast"` + + - `type: "message_start"` + + - `beta_raw_message_delta_event: object { context_management, delta, type, usage }` + + - `context_management: object { applied_edits }` + + Information about context management strategies applied during the request + + - `applied_edits: array of BetaClearToolUses20250919EditResponse or BetaClearThinking20251015EditResponse` + + List of context management edits that were applied. + + - `beta_clear_tool_uses_20250919_edit_response: object { cleared_input_tokens, cleared_tool_uses, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_tool_uses: number` + + Number of tool uses that were cleared. + + - `type: "clear_tool_uses_20250919"` + + The type of context management edit applied. + + - `beta_clear_thinking_20251015_edit_response: object { cleared_input_tokens, cleared_thinking_turns, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_thinking_turns: number` + + Number of thinking turns that were cleared. + + - `type: "clear_thinking_20251015"` + + The type of context management edit applied. + + - `delta: object { container, stop_details, stop_reason, stop_sequence }` + + - `container: object { id, expires_at, skills }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `skills: array of BetaSkill` + + Skills loaded in the container + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: string` + + Skill version or 'latest' for most recent version + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 5 more` + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"compaction"` + + - `"refusal"` + + - `"model_context_window_exceeded"` + + - `stop_sequence: string` + + - `type: "message_delta"` + + - `usage: object { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 3 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation_input_tokens: number` + + The cumulative number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The cumulative number of input tokens read from the cache. + + - `input_tokens: number` + + The cumulative number of input tokens which were used. + + - `iterations: array of BetaMessageIterationUsage or BetaCompactionIterationUsage` + + Per-iteration token usage breakdown. + + Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + + - Determine which iterations exceeded long context thresholds (>=200k tokens) + - Calculate the true context window size from the last iteration + - Understand token accumulation across server-side tool use loops + + - `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + + - `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + + - `output_tokens: number` + + The cumulative number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `beta_raw_message_stop_event: object { type }` + + - `type: "message_stop"` + + - `beta_raw_content_block_start_event: object { content_block, index, type }` + + - `content_block: BetaTextBlock or BetaThinkingBlock or BetaRedactedThinkingBlock or 12 more` + + Response model for a file uploaded to the container. + + - `beta_text_block: object { citations, text, type }` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `beta_thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `beta_redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `beta_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_server_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_search_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebSearchToolResultError or array of BetaWebSearchResultBlock` + + - `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of BetaWebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_fetch_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock` + + - `beta_web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaCodeExecutionToolResultError or BetaCodeExecutionResultBlock or BetaEncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `beta_bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock` + + - `beta_bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `beta_text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock` + + - `beta_text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `beta_text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `beta_text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `beta_tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock` + + - `beta_tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `beta_mcp_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + The name of the MCP tool + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `beta_mcp_tool_result_block: object { content, is_error, tool_use_id, type }` + + - `content: string or array of BetaTextBlock` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_content: array of BetaTextBlock` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `is_error: boolean` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `beta_container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `beta_compaction_block: object { content, type }` + + A compaction block returned when autocompact is triggered. + + When content is None, it indicates the compaction failed to produce a valid + summary (e.g., malformed output from the model). Clients may round-trip + compaction blocks with null content; the server treats them as no-ops. + + - `content: string` + + Summary of compacted content, or null if compaction failed + + - `type: "compaction"` + + - `index: number` + + - `type: "content_block_start"` + + - `beta_raw_content_block_delta_event: object { delta, index, type }` + + - `delta: BetaTextDelta or BetaInputJSONDelta or BetaCitationsDelta or 3 more` + + - `beta_text_delta: object { text, type }` + + - `text: string` + + - `type: "text_delta"` + + - `beta_input_json_delta: object { partial_json, type }` + + - `partial_json: string` + + - `type: "input_json_delta"` + + - `beta_citations_delta: object { citation, type }` + + - `citation: BetaCitationCharLocation or BetaCitationPageLocation or BetaCitationContentBlockLocation or 2 more` + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `type: "citations_delta"` + + - `beta_thinking_delta: object { thinking, type }` + + - `thinking: string` + + - `type: "thinking_delta"` + + - `beta_signature_delta: object { signature, type }` + + - `signature: string` + + - `type: "signature_delta"` + + - `beta_compaction_content_block_delta: object { content, type }` + + - `content: string` + + - `type: "compaction_delta"` + + - `index: number` + + - `type: "content_block_delta"` + + - `beta_raw_content_block_stop_event: object { index, type }` + + - `index: number` + + - `type: "content_block_stop"` + +### Beta Redacted Thinking Block + +- `beta_redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + +### Beta Redacted Thinking Block Param + +- `beta_redacted_thinking_block_param: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + +### Beta Refusal Stop Details + +- `beta_refusal_stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + +### Beta Request Document Block + +- `beta_request_document_block: object { source, type, cache_control, 3 more }` + + - `source: BetaBase64PDFSource or BetaPlainTextSource or BetaContentBlockSource or 2 more` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `beta_content_block_source: object { content, type }` + + - `content: string or array of BetaContentBlockSourceContent` + + - `union_member_0: string` + + - `beta_content_block_source_content: array of BetaContentBlockSourceContent` + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "content"` + + - `beta_url_pdf_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_document_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "document"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `context: optional string` + + - `title: optional string` + +### Beta Request MCP Server Tool Configuration + +- `beta_request_mcp_server_tool_configuration: object { allowed_tools, enabled }` + + - `allowed_tools: optional array of string` + + - `enabled: optional boolean` + +### Beta Request MCP Server URL Definition + +- `beta_request_mcp_server_url_definition: object { name, type, url, 2 more }` + + - `name: string` + + - `type: "url"` + + - `url: string` + + - `authorization_token: optional string` + + - `tool_configuration: optional object { allowed_tools, enabled }` + + - `allowed_tools: optional array of string` + + - `enabled: optional boolean` + +### Beta Request MCP Tool Result Block Param + +- `beta_request_mcp_tool_result_block_param: object { tool_use_id, type, cache_control, 2 more }` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `content: optional string or array of BetaTextBlockParam` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_param_content: array of BetaTextBlockParam` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `is_error: optional boolean` + +### Beta Search Result Block Param + +- `beta_search_result_block_param: object { content, source, title, 3 more }` + + - `content: array of BetaTextBlockParam` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `source: string` + + - `title: string` + + - `type: "search_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + +### Beta Server Tool Caller + +- `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + +### Beta Server Tool Caller 20260120 + +- `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + +### Beta Server Tool Usage + +- `beta_server_tool_usage: object { web_fetch_requests, web_search_requests }` + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + +### Beta Server Tool Use Block + +- `beta_server_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + +### Beta Server Tool Use Block Param + +- `beta_server_tool_use_block_param: object { id, input, name, 3 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + +### Beta Signature Delta + +- `beta_signature_delta: object { signature, type }` + + - `signature: string` + + - `type: "signature_delta"` + +### Beta Skill + +- `beta_skill: object { skill_id, type, version }` + + A skill that was loaded in a container (response model). + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: string` + + Skill version or 'latest' for most recent version + +### Beta Skill Params + +- `beta_skill_params: object { skill_id, type, version }` + + Specification for a skill to be loaded in a container (request model). + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: optional string` + + Skill version or 'latest' for most recent version + +### Beta Stop Reason + +- `beta_stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 5 more` + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"compaction"` + + - `"refusal"` + + - `"model_context_window_exceeded"` + +### Beta Text Block + +- `beta_text_block: object { citations, text, type }` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + +### Beta Text Block Param + +- `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + +### Beta Text Citation + +- `beta_text_citation: BetaCitationCharLocation or BetaCitationPageLocation or BetaCitationContentBlockLocation or 2 more` + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + +### Beta Text Citation Param + +- `beta_text_citation_param: BetaCitationCharLocationParam or BetaCitationPageLocationParam or BetaCitationContentBlockLocationParam or 2 more` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + +### Beta Text Delta + +- `beta_text_delta: object { text, type }` + + - `text: string` + + - `type: "text_delta"` + +### Beta Text Editor Code Execution Create Result Block + +- `beta_text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + +### Beta Text Editor Code Execution Create Result Block Param + +- `beta_text_editor_code_execution_create_result_block_param: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + +### Beta Text Editor Code Execution Str Replace Result Block + +- `beta_text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + +### Beta Text Editor Code Execution Str Replace Result Block Param + +- `beta_text_editor_code_execution_str_replace_result_block_param: object { type, lines, new_lines, 3 more }` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `lines: optional array of string` + + - `new_lines: optional number` + + - `new_start: optional number` + + - `old_lines: optional number` + + - `old_start: optional number` + +### Beta Text Editor Code Execution Tool Result Block + +- `beta_text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock` + + - `beta_text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `beta_text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `beta_text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + +### Beta Text Editor Code Execution Tool Result Block Param + +- `beta_text_editor_code_execution_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: BetaTextEditorCodeExecutionToolResultErrorParam or BetaTextEditorCodeExecutionViewResultBlockParam or BetaTextEditorCodeExecutionCreateResultBlockParam or BetaTextEditorCodeExecutionStrReplaceResultBlockParam` + + - `beta_text_editor_code_execution_tool_result_error_param: object { error_code, type, error_message }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `error_message: optional string` + + - `beta_text_editor_code_execution_view_result_block_param: object { content, file_type, type, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `type: "text_editor_code_execution_view_result"` + + - `num_lines: optional number` + + - `start_line: optional number` + + - `total_lines: optional number` + + - `beta_text_editor_code_execution_create_result_block_param: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block_param: object { type, lines, new_lines, 3 more }` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `lines: optional array of string` + + - `new_lines: optional number` + + - `new_start: optional number` + + - `old_lines: optional number` + + - `old_start: optional number` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Beta Text Editor Code Execution Tool Result Error + +- `beta_text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + +### Beta Text Editor Code Execution Tool Result Error Param + +- `beta_text_editor_code_execution_tool_result_error_param: object { error_code, type, error_message }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `error_message: optional string` + +### Beta Text Editor Code Execution View Result Block + +- `beta_text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + +### Beta Text Editor Code Execution View Result Block Param + +- `beta_text_editor_code_execution_view_result_block_param: object { content, file_type, type, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `type: "text_editor_code_execution_view_result"` + + - `num_lines: optional number` + + - `start_line: optional number` + + - `total_lines: optional number` + +### Beta Thinking Block + +- `beta_thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + +### Beta Thinking Block Param + +- `beta_thinking_block_param: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + +### Beta Thinking Config Adaptive + +- `beta_thinking_config_adaptive: object { type, display }` + + - `type: "adaptive"` + + - `display: optional "summarized" or "omitted"` + + Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`. + + - `"summarized"` + + - `"omitted"` + +### Beta Thinking Config Disabled + +- `beta_thinking_config_disabled: object { type }` + + - `type: "disabled"` + +### Beta Thinking Config Enabled + +- `beta_thinking_config_enabled: object { budget_tokens, type, display }` + + - `budget_tokens: number` + + Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality. + + Must be ≥1024 and less than `max_tokens`. + + See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details. + + - `type: "enabled"` + + - `display: optional "summarized" or "omitted"` + + Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`. + + - `"summarized"` + + - `"omitted"` + +### Beta Thinking Config Param + +- `beta_thinking_config_param: BetaThinkingConfigEnabled or BetaThinkingConfigDisabled or BetaThinkingConfigAdaptive` + + Configuration for enabling Claude's extended thinking. + + When enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit. + + See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details. + + - `beta_thinking_config_enabled: object { budget_tokens, type, display }` + + - `budget_tokens: number` + + Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality. + + Must be ≥1024 and less than `max_tokens`. + + See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details. + + - `type: "enabled"` + + - `display: optional "summarized" or "omitted"` + + Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`. + + - `"summarized"` + + - `"omitted"` + + - `beta_thinking_config_disabled: object { type }` + + - `type: "disabled"` + + - `beta_thinking_config_adaptive: object { type, display }` + + - `type: "adaptive"` + + - `display: optional "summarized" or "omitted"` + + Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`. + + - `"summarized"` + + - `"omitted"` + +### Beta Thinking Delta + +- `beta_thinking_delta: object { thinking, type }` + + - `thinking: string` + + - `type: "thinking_delta"` + +### Beta Thinking Turns + +- `beta_thinking_turns: object { type, value }` + + - `type: "thinking_turns"` + + - `value: number` + +### Beta Tool + +- `beta_tool: object { input_schema, name, allowed_callers, 7 more }` + + - `input_schema: object { type, properties, required }` + + [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input. + + This defines the shape of the `input` that your tool accepts and that the model will produce. + + - `type: "object"` + + - `properties: optional map[unknown]` + + - `required: optional array of string` + + - `name: string` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `description: optional string` + + Description of what this tool does. + + Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema. + + - `eager_input_streaming: optional boolean` + + Enable eager input streaming for this tool. When true, tool input parameters will be streamed incrementally as they are generated, and types will be inferred on-the-fly rather than buffering the full JSON output. When false, streaming is disabled for this tool even if the fine-grained-tool-streaming beta is active. When null (default), uses the default behavior based on beta headers. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `type: optional "custom"` + + - `"custom"` + +### Beta Tool Bash 20241022 + +- `beta_tool_bash_20241022: object { name, type, allowed_callers, 4 more }` + + - `name: "bash"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "bash_20241022"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Tool Bash 20250124 + +- `beta_tool_bash_20250124: object { name, type, allowed_callers, 4 more }` + + - `name: "bash"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "bash_20250124"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Tool Choice + +- `beta_tool_choice: BetaToolChoiceAuto or BetaToolChoiceAny or BetaToolChoiceTool or BetaToolChoiceNone` + + How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all. + + - `beta_tool_choice_auto: object { type, disable_parallel_tool_use }` + + The model will automatically decide whether to use tools. + + - `type: "auto"` + + - `disable_parallel_tool_use: optional boolean` + + Whether to disable parallel tool use. + + Defaults to `false`. If set to `true`, the model will output at most one tool use. + + - `beta_tool_choice_any: object { type, disable_parallel_tool_use }` + + The model will use any available tools. + + - `type: "any"` + + - `disable_parallel_tool_use: optional boolean` + + Whether to disable parallel tool use. + + Defaults to `false`. If set to `true`, the model will output exactly one tool use. + + - `beta_tool_choice_tool: object { name, type, disable_parallel_tool_use }` + + The model will use the specified tool with `tool_choice.name`. + + - `name: string` + + The name of the tool to use. + + - `type: "tool"` + + - `disable_parallel_tool_use: optional boolean` + + Whether to disable parallel tool use. + + Defaults to `false`. If set to `true`, the model will output exactly one tool use. + + - `beta_tool_choice_none: object { type }` + + The model will not be allowed to use tools. + + - `type: "none"` + +### Beta Tool Choice Any + +- `beta_tool_choice_any: object { type, disable_parallel_tool_use }` + + The model will use any available tools. + + - `type: "any"` + + - `disable_parallel_tool_use: optional boolean` + + Whether to disable parallel tool use. + + Defaults to `false`. If set to `true`, the model will output exactly one tool use. + +### Beta Tool Choice Auto + +- `beta_tool_choice_auto: object { type, disable_parallel_tool_use }` + + The model will automatically decide whether to use tools. + + - `type: "auto"` + + - `disable_parallel_tool_use: optional boolean` + + Whether to disable parallel tool use. + + Defaults to `false`. If set to `true`, the model will output at most one tool use. + +### Beta Tool Choice None + +- `beta_tool_choice_none: object { type }` + + The model will not be allowed to use tools. + + - `type: "none"` + +### Beta Tool Choice Tool + +- `beta_tool_choice_tool: object { name, type, disable_parallel_tool_use }` + + The model will use the specified tool with `tool_choice.name`. + + - `name: string` + + The name of the tool to use. + + - `type: "tool"` + + - `disable_parallel_tool_use: optional boolean` + + Whether to disable parallel tool use. + + Defaults to `false`. If set to `true`, the model will output exactly one tool use. + +### Beta Tool Computer Use 20241022 + +- `beta_tool_computer_use_20241022: object { display_height_px, display_width_px, name, 7 more }` + + - `display_height_px: number` + + The height of the display in pixels. + + - `display_width_px: number` + + The width of the display in pixels. + + - `name: "computer"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "computer_20241022"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `display_number: optional number` + + The X11 display number (e.g. 0, 1) for the display. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Tool Computer Use 20250124 + +- `beta_tool_computer_use_20250124: object { display_height_px, display_width_px, name, 7 more }` + + - `display_height_px: number` + + The height of the display in pixels. + + - `display_width_px: number` + + The width of the display in pixels. + + - `name: "computer"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "computer_20250124"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `display_number: optional number` + + The X11 display number (e.g. 0, 1) for the display. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Tool Computer Use 20251124 + +- `beta_tool_computer_use_20251124: object { display_height_px, display_width_px, name, 8 more }` + + - `display_height_px: number` + + The height of the display in pixels. + + - `display_width_px: number` + + The width of the display in pixels. + + - `name: "computer"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "computer_20251124"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `display_number: optional number` + + The X11 display number (e.g. 0, 1) for the display. + + - `enable_zoom: optional boolean` + + Whether to enable an action to take a zoomed-in screenshot of the screen. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Tool Reference Block + +- `beta_tool_reference_block: object { tool_name, type }` + + - `tool_name: string` + + - `type: "tool_reference"` + +### Beta Tool Reference Block Param + +- `beta_tool_reference_block_param: object { tool_name, type, cache_control }` + + Tool reference block that can be included in tool_result content. + + - `tool_name: string` + + - `type: "tool_reference"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Beta Tool Result Block Param + +- `beta_tool_result_block_param: object { tool_use_id, type, cache_control, 2 more }` + + - `tool_use_id: string` + + - `type: "tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `content: optional array of BetaTextBlockParam or BetaImageBlockParam or BetaSearchResultBlockParam or 2 more` + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `beta_search_result_block_param: object { content, source, title, 3 more }` + + - `content: array of BetaTextBlockParam` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `source: string` + + - `title: string` + + - `type: "search_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `beta_request_document_block: object { source, type, cache_control, 3 more }` + + - `source: BetaBase64PDFSource or BetaPlainTextSource or BetaContentBlockSource or 2 more` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `beta_content_block_source: object { content, type }` + + - `content: string or array of BetaContentBlockSourceContent` + + - `union_member_0: string` + + - `beta_content_block_source_content: array of BetaContentBlockSourceContent` + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "content"` + + - `beta_url_pdf_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_document_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "document"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `context: optional string` + + - `title: optional string` + + - `beta_tool_reference_block_param: object { tool_name, type, cache_control }` + + Tool reference block that can be included in tool_result content. + + - `tool_name: string` + + - `type: "tool_reference"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `is_error: optional boolean` + +### Beta Tool Search Tool Bm25 20251119 + +- `beta_tool_search_tool_bm25_20251119: object { name, type, allowed_callers, 3 more }` + + - `name: "tool_search_tool_bm25"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "tool_search_tool_bm25_20251119" or "tool_search_tool_bm25"` + + - `"tool_search_tool_bm25_20251119"` + + - `"tool_search_tool_bm25"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Tool Search Tool Regex 20251119 + +- `beta_tool_search_tool_regex_20251119: object { name, type, allowed_callers, 3 more }` + + - `name: "tool_search_tool_regex"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "tool_search_tool_regex_20251119" or "tool_search_tool_regex"` + + - `"tool_search_tool_regex_20251119"` + + - `"tool_search_tool_regex"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Tool Search Tool Result Block + +- `beta_tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock` + + - `beta_tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + +### Beta Tool Search Tool Result Block Param + +- `beta_tool_search_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: BetaToolSearchToolResultErrorParam or BetaToolSearchToolSearchResultBlockParam` + + - `beta_tool_search_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block_param: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlockParam` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Beta Tool Search Tool Result Error + +- `beta_tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + +### Beta Tool Search Tool Result Error Param + +- `beta_tool_search_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "tool_search_tool_result_error"` + +### Beta Tool Search Tool Search Result Block + +- `beta_tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + +### Beta Tool Search Tool Search Result Block Param + +- `beta_tool_search_tool_search_result_block_param: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlockParam` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "tool_search_tool_search_result"` + +### Beta Tool Text Editor 20241022 + +- `beta_tool_text_editor_20241022: object { name, type, allowed_callers, 4 more }` + + - `name: "str_replace_editor"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "text_editor_20241022"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Tool Text Editor 20250124 + +- `beta_tool_text_editor_20250124: object { name, type, allowed_callers, 4 more }` + + - `name: "str_replace_editor"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "text_editor_20250124"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Tool Text Editor 20250429 + +- `beta_tool_text_editor_20250429: object { name, type, allowed_callers, 4 more }` + + - `name: "str_replace_based_edit_tool"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "text_editor_20250429"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Tool Text Editor 20250728 + +- `beta_tool_text_editor_20250728: object { name, type, allowed_callers, 5 more }` + + - `name: "str_replace_based_edit_tool"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "text_editor_20250728"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `max_characters: optional number` + + Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Tool Union + +- `beta_tool_union: BetaTool or BetaToolBash20241022 or BetaToolBash20250124 or 19 more` + + Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint). + + - `beta_tool: object { input_schema, name, allowed_callers, 7 more }` + + - `input_schema: object { type, properties, required }` + + [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input. + + This defines the shape of the `input` that your tool accepts and that the model will produce. + + - `type: "object"` + + - `properties: optional map[unknown]` + + - `required: optional array of string` + + - `name: string` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `description: optional string` + + Description of what this tool does. + + Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema. + + - `eager_input_streaming: optional boolean` + + Enable eager input streaming for this tool. When true, tool input parameters will be streamed incrementally as they are generated, and types will be inferred on-the-fly rather than buffering the full JSON output. When false, streaming is disabled for this tool even if the fine-grained-tool-streaming beta is active. When null (default), uses the default behavior based on beta headers. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `type: optional "custom"` + + - `"custom"` + + - `beta_tool_bash_20241022: object { name, type, allowed_callers, 4 more }` + + - `name: "bash"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "bash_20241022"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_tool_bash_20250124: object { name, type, allowed_callers, 4 more }` + + - `name: "bash"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "bash_20250124"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_code_execution_tool_20250522: object { name, type, allowed_callers, 3 more }` + + - `name: "code_execution"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "code_execution_20250522"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_code_execution_tool_20250825: object { name, type, allowed_callers, 3 more }` + + - `name: "code_execution"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "code_execution_20250825"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_code_execution_tool_20260120: object { name, type, allowed_callers, 3 more }` + + Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint). + + - `name: "code_execution"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "code_execution_20260120"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_tool_computer_use_20241022: object { display_height_px, display_width_px, name, 7 more }` + + - `display_height_px: number` + + The height of the display in pixels. + + - `display_width_px: number` + + The width of the display in pixels. + + - `name: "computer"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "computer_20241022"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `display_number: optional number` + + The X11 display number (e.g. 0, 1) for the display. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_memory_tool_20250818: object { name, type, allowed_callers, 4 more }` + + - `name: "memory"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "memory_20250818"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_tool_computer_use_20250124: object { display_height_px, display_width_px, name, 7 more }` + + - `display_height_px: number` + + The height of the display in pixels. + + - `display_width_px: number` + + The width of the display in pixels. + + - `name: "computer"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "computer_20250124"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `display_number: optional number` + + The X11 display number (e.g. 0, 1) for the display. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_tool_text_editor_20241022: object { name, type, allowed_callers, 4 more }` + + - `name: "str_replace_editor"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "text_editor_20241022"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_tool_computer_use_20251124: object { display_height_px, display_width_px, name, 8 more }` + + - `display_height_px: number` + + The height of the display in pixels. + + - `display_width_px: number` + + The width of the display in pixels. + + - `name: "computer"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "computer_20251124"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `display_number: optional number` + + The X11 display number (e.g. 0, 1) for the display. + + - `enable_zoom: optional boolean` + + Whether to enable an action to take a zoomed-in screenshot of the screen. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_tool_text_editor_20250124: object { name, type, allowed_callers, 4 more }` + + - `name: "str_replace_editor"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "text_editor_20250124"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_tool_text_editor_20250429: object { name, type, allowed_callers, 4 more }` + + - `name: "str_replace_based_edit_tool"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "text_editor_20250429"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_tool_text_editor_20250728: object { name, type, allowed_callers, 5 more }` + + - `name: "str_replace_based_edit_tool"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "text_editor_20250728"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `max_characters: optional number` + + Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_web_search_tool_20250305: object { name, type, allowed_callers, 7 more }` + + - `name: "web_search"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_search_20250305"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`. + + - `blocked_domains: optional array of string` + + If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`. + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `user_location: optional object { type, city, country, 2 more }` + + Parameters for the user's location. Used to provide more relevant search results. + + - `type: "approximate"` + + - `city: optional string` + + The city of the user. + + - `country: optional string` + + The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user. + + - `region: optional string` + + The region of the user. + + - `timezone: optional string` + + The [IANA timezone](https://nodatime.org/TimeZones) of the user. + + - `beta_web_fetch_tool_20250910: object { name, type, allowed_callers, 8 more }` + + - `name: "web_fetch"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_fetch_20250910"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + List of domains to allow fetching from + + - `blocked_domains: optional array of string` + + List of domains to block fetching from + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + Citations configuration for fetched documents. Citations are disabled by default. + + - `enabled: optional boolean` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_content_tokens: optional number` + + Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_web_search_tool_20260209: object { name, type, allowed_callers, 7 more }` + + - `name: "web_search"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_search_20260209"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`. + + - `blocked_domains: optional array of string` + + If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`. + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `user_location: optional object { type, city, country, 2 more }` + + Parameters for the user's location. Used to provide more relevant search results. + + - `type: "approximate"` + + - `city: optional string` + + The city of the user. + + - `country: optional string` + + The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user. + + - `region: optional string` + + The region of the user. + + - `timezone: optional string` + + The [IANA timezone](https://nodatime.org/TimeZones) of the user. + + - `beta_web_fetch_tool_20260209: object { name, type, allowed_callers, 8 more }` + + - `name: "web_fetch"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_fetch_20260209"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + List of domains to allow fetching from + + - `blocked_domains: optional array of string` + + List of domains to block fetching from + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + Citations configuration for fetched documents. Citations are disabled by default. + + - `enabled: optional boolean` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_content_tokens: optional number` + + Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_web_fetch_tool_20260309: object { name, type, allowed_callers, 9 more }` + + Web fetch tool with use_cache parameter for bypassing cached content. + + - `name: "web_fetch"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_fetch_20260309"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + List of domains to allow fetching from + + - `blocked_domains: optional array of string` + + List of domains to block fetching from + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + Citations configuration for fetched documents. Citations are disabled by default. + + - `enabled: optional boolean` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_content_tokens: optional number` + + Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `use_cache: optional boolean` + + Whether to use cached content. Set to false to bypass the cache and fetch fresh content. Only set to false when the user explicitly requests fresh content or when fetching rapidly-changing sources. + + - `beta_tool_search_tool_bm25_20251119: object { name, type, allowed_callers, 3 more }` + + - `name: "tool_search_tool_bm25"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "tool_search_tool_bm25_20251119" or "tool_search_tool_bm25"` + + - `"tool_search_tool_bm25_20251119"` + + - `"tool_search_tool_bm25"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_tool_search_tool_regex_20251119: object { name, type, allowed_callers, 3 more }` + + - `name: "tool_search_tool_regex"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "tool_search_tool_regex_20251119" or "tool_search_tool_regex"` + + - `"tool_search_tool_regex_20251119"` + + - `"tool_search_tool_regex"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `beta_mcp_toolset: object { mcp_server_name, type, cache_control, 2 more }` + + Configuration for a group of tools from an MCP server. + + Allows configuring enabled status and defer_loading for all tools + from an MCP server, with optional per-tool overrides. + + - `mcp_server_name: string` + + Name of the MCP server to configure tools for + + - `type: "mcp_toolset"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `configs: optional map[BetaMCPToolConfig]` + + Configuration overrides for specific tools, keyed by tool name + + - `defer_loading: optional boolean` + + - `enabled: optional boolean` + + - `default_config: optional object { defer_loading, enabled }` + + Default configuration applied to all tools from this server + + - `defer_loading: optional boolean` + + - `enabled: optional boolean` + +### Beta Tool Use Block + +- `beta_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + +### Beta Tool Use Block Param + +- `beta_tool_use_block_param: object { id, input, name, 3 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + +### Beta Tool Uses Keep + +- `beta_tool_uses_keep: object { type, value }` + + - `type: "tool_uses"` + + - `value: number` + +### Beta Tool Uses Trigger + +- `beta_tool_uses_trigger: object { type, value }` + + - `type: "tool_uses"` + + - `value: number` + +### Beta URL Image Source + +- `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + +### Beta URL PDF Source + +- `beta_url_pdf_source: object { type, url }` + + - `type: "url"` + + - `url: string` + +### Beta Usage + +- `beta_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 7 more }` + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `iterations: array of BetaMessageIterationUsage or BetaCompactionIterationUsage` + + Per-iteration token usage breakdown. + + Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + + - Determine which iterations exceeded long context thresholds (>=200k tokens) + - Calculate the true context window size from the last iteration + - Understand token accumulation across server-side tool use loops + + - `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + + - `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `speed: "standard" or "fast"` + + The inference speed mode used for this request. + + - `"standard"` + + - `"fast"` + +### Beta User Location + +- `beta_user_location: object { type, city, country, 2 more }` + + - `type: "approximate"` + + - `city: optional string` + + The city of the user. + + - `country: optional string` + + The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user. + + - `region: optional string` + + The region of the user. + + - `timezone: optional string` + + The [IANA timezone](https://nodatime.org/TimeZones) of the user. + +### Beta Web Fetch Block + +- `beta_web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + +### Beta Web Fetch Block Param + +- `beta_web_fetch_block_param: object { content, type, url, retrieved_at }` + + - `content: object { source, type, cache_control, 3 more }` + + - `source: BetaBase64PDFSource or BetaPlainTextSource or BetaContentBlockSource or 2 more` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `beta_content_block_source: object { content, type }` + + - `content: string or array of BetaContentBlockSourceContent` + + - `union_member_0: string` + + - `beta_content_block_source_content: array of BetaContentBlockSourceContent` + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "content"` + + - `beta_url_pdf_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_document_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "document"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `context: optional string` + + - `title: optional string` + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `retrieved_at: optional string` + + ISO 8601 timestamp when the content was retrieved + +### Beta Web Fetch Tool 20250910 + +- `beta_web_fetch_tool_20250910: object { name, type, allowed_callers, 8 more }` + + - `name: "web_fetch"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_fetch_20250910"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + List of domains to allow fetching from + + - `blocked_domains: optional array of string` + + List of domains to block fetching from + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + Citations configuration for fetched documents. Citations are disabled by default. + + - `enabled: optional boolean` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_content_tokens: optional number` + + Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Web Fetch Tool 20260209 + +- `beta_web_fetch_tool_20260209: object { name, type, allowed_callers, 8 more }` + + - `name: "web_fetch"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_fetch_20260209"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + List of domains to allow fetching from + + - `blocked_domains: optional array of string` + + List of domains to block fetching from + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + Citations configuration for fetched documents. Citations are disabled by default. + + - `enabled: optional boolean` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_content_tokens: optional number` + + Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Beta Web Fetch Tool 20260309 + +- `beta_web_fetch_tool_20260309: object { name, type, allowed_callers, 9 more }` + + Web fetch tool with use_cache parameter for bypassing cached content. + + - `name: "web_fetch"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_fetch_20260309"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + List of domains to allow fetching from + + - `blocked_domains: optional array of string` + + List of domains to block fetching from + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + Citations configuration for fetched documents. Citations are disabled by default. + + - `enabled: optional boolean` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_content_tokens: optional number` + + Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `use_cache: optional boolean` + + Whether to use cached content. Set to false to bypass the cache and fetch fresh content. Only set to false when the user explicitly requests fresh content or when fetching rapidly-changing sources. + +### Beta Web Fetch Tool Result Block + +- `beta_web_fetch_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock` + + - `beta_web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + +### Beta Web Fetch Tool Result Block Param + +- `beta_web_fetch_tool_result_block_param: object { content, tool_use_id, type, 2 more }` + + - `content: BetaWebFetchToolResultErrorBlockParam or BetaWebFetchBlockParam` + + - `beta_web_fetch_tool_result_error_block_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block_param: object { content, type, url, retrieved_at }` + + - `content: object { source, type, cache_control, 3 more }` + + - `source: BetaBase64PDFSource or BetaPlainTextSource or BetaContentBlockSource or 2 more` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `beta_content_block_source: object { content, type }` + + - `content: string or array of BetaContentBlockSourceContent` + + - `union_member_0: string` + + - `beta_content_block_source_content: array of BetaContentBlockSourceContent` + + - `beta_text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of BetaTextCitationParam` + + - `beta_citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `beta_image_block_param: object { source, type, cache_control }` + + - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource` + + - `beta_base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `beta_url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_image_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "content"` + + - `beta_url_pdf_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `beta_file_document_source: object { file_id, type }` + + - `file_id: string` + + - `type: "file"` + + - `type: "document"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `context: optional string` + + - `title: optional string` + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `retrieved_at: optional string` + + ISO 8601 timestamp when the content was retrieved + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + +### Beta Web Fetch Tool Result Error Block + +- `beta_web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + +### Beta Web Fetch Tool Result Error Block Param + +- `beta_web_fetch_tool_result_error_block_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + +### Beta Web Fetch Tool Result Error Code + +- `beta_web_fetch_tool_result_error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + +### Beta Web Search Result Block + +- `beta_web_search_result_block: object { encrypted_content, page_age, title, 2 more }` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + +### Beta Web Search Result Block Param + +- `beta_web_search_result_block_param: object { encrypted_content, title, type, 2 more }` + + - `encrypted_content: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `page_age: optional string` + +### Beta Web Search Tool 20250305 + +- `beta_web_search_tool_20250305: object { name, type, allowed_callers, 7 more }` + + - `name: "web_search"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_search_20250305"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`. + + - `blocked_domains: optional array of string` + + If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`. + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `user_location: optional object { type, city, country, 2 more }` + + Parameters for the user's location. Used to provide more relevant search results. + + - `type: "approximate"` + + - `city: optional string` + + The city of the user. + + - `country: optional string` + + The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user. + + - `region: optional string` + + The region of the user. + + - `timezone: optional string` + + The [IANA timezone](https://nodatime.org/TimeZones) of the user. + +### Beta Web Search Tool 20260209 + +- `beta_web_search_tool_20260209: object { name, type, allowed_callers, 7 more }` + + - `name: "web_search"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_search_20260209"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`. + + - `blocked_domains: optional array of string` + + If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`. + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `user_location: optional object { type, city, country, 2 more }` + + Parameters for the user's location. Used to provide more relevant search results. + + - `type: "approximate"` + + - `city: optional string` + + The city of the user. + + - `country: optional string` + + The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user. + + - `region: optional string` + + The region of the user. + + - `timezone: optional string` + + The [IANA timezone](https://nodatime.org/TimeZones) of the user. + +### Beta Web Search Tool Request Error + +- `beta_web_search_tool_request_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + +### Beta Web Search Tool Result Block + +- `beta_web_search_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebSearchToolResultError or array of BetaWebSearchResultBlock` + + - `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of BetaWebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + +### Beta Web Search Tool Result Block Content + +- `beta_web_search_tool_result_block_content: BetaWebSearchToolResultError or array of BetaWebSearchResultBlock` + + - `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of BetaWebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + +### Beta Web Search Tool Result Block Param + +- `beta_web_search_tool_result_block_param: object { content, tool_use_id, type, 2 more }` + + - `content: array of BetaWebSearchResultBlockParam or BetaWebSearchToolRequestError` + + - `Result Block: array of BetaWebSearchResultBlockParam` + + - `encrypted_content: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `page_age: optional string` + + - `beta_web_search_tool_request_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + +### Beta Web Search Tool Result Block Param Content + +- `beta_web_search_tool_result_block_param_content: array of BetaWebSearchResultBlockParam or BetaWebSearchToolRequestError` + + - `Result Block: array of BetaWebSearchResultBlockParam` + + - `encrypted_content: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `page_age: optional string` + + - `beta_web_search_tool_request_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + +### Beta Web Search Tool Result Error + +- `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + +### Beta Web Search Tool Result Error Code + +- `beta_web_search_tool_result_error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + +# Batches + +## Create + +`$ ant beta:messages:batches create` + +**post** `/v1/messages/batches` + +Send a batch of Message creation requests. + +The Message Batches API can be used to process multiple Messages API requests at once. Once a Message Batch is created, it begins processing immediately. Batches can take up to 24 hours to complete. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--request: array of object { custom_id, params }` + + Body param: List of requests for prompt completion. Each is an individual request to create a Message. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_message_batch: object { id, archived_at, cancel_initiated_at, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: object { canceled, errored, expired, 2 more }` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + +### Example + +```cli +ant beta:messages:batches create \ + --api-key my-anthropic-api-key \ + --request '{custom_id: my-custom-id-1, params: {max_tokens: 1024, messages: [{content: [{text: x, type: text}], role: user}], model: claude-opus-4-6}}' +``` + +## Retrieve + +`$ ant beta:messages:batches retrieve` + +**get** `/v1/messages/batches/{message_batch_id}` + +This endpoint is idempotent and can be used to poll for Message Batch completion. To access the results of a Message Batch, make a request to the `results_url` field in the response. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--message-batch-id: string` + + ID of the Message Batch. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_message_batch: object { id, archived_at, cancel_initiated_at, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: object { canceled, errored, expired, 2 more }` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + +### Example + +```cli +ant beta:messages:batches retrieve \ + --api-key my-anthropic-api-key \ + --message-batch-id message_batch_id +``` + +## List + +`$ ant beta:messages:batches list` + +**get** `/v1/messages/batches` + +List all Message Batches within a Workspace. Most recently created batches are returned first. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--after-id: optional string` + + Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object. + +- `--before-id: optional string` + + Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object. + +- `--limit: optional number` + + Query param: Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaListResponse_MessageBatch_: object { data, first_id, has_more, last_id }` + + - `data: array of BetaMessageBatch` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: object { canceled, errored, expired, 2 more }` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + + - `first_id: string` + + First ID in the `data` list. Can be used as the `before_id` for the previous page. + + - `has_more: boolean` + + Indicates if there are more results in the requested page direction. + + - `last_id: string` + + Last ID in the `data` list. Can be used as the `after_id` for the next page. + +### Example + +```cli +ant beta:messages:batches list \ + --api-key my-anthropic-api-key +``` + +## Cancel + +`$ ant beta:messages:batches cancel` + +**post** `/v1/messages/batches/{message_batch_id}/cancel` + +Batches may be canceled any time before processing ends. Once cancellation is initiated, the batch enters a `canceling` state, at which time the system may complete any in-progress, non-interruptible requests before finalizing cancellation. + +The number of canceled requests is specified in `request_counts`. To determine which requests were canceled, check the individual results within the batch. Note that cancellation may not result in any canceled requests if they were non-interruptible. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--message-batch-id: string` + + ID of the Message Batch. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_message_batch: object { id, archived_at, cancel_initiated_at, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: object { canceled, errored, expired, 2 more }` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + +### Example + +```cli +ant beta:messages:batches cancel \ + --api-key my-anthropic-api-key \ + --message-batch-id message_batch_id +``` + +## Delete + +`$ ant beta:messages:batches delete` + +**delete** `/v1/messages/batches/{message_batch_id}` + +Delete a Message Batch. + +Message Batches can only be deleted once they've finished processing. If you'd like to delete an in-progress batch, you must first cancel it. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--message-batch-id: string` + + ID of the Message Batch. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_deleted_message_batch: object { id, type }` + + - `id: string` + + ID of the Message Batch. + + - `type: "message_batch_deleted"` + + Deleted object type. + + For Message Batches, this is always `"message_batch_deleted"`. + +### Example + +```cli +ant beta:messages:batches delete \ + --api-key my-anthropic-api-key \ + --message-batch-id message_batch_id +``` + +## Results + +`$ ant beta:messages:batches results` + +**get** `/v1/messages/batches/{message_batch_id}/results` + +Streams the results of a Message Batch as a `.jsonl` file. + +Each line in the file is a JSON object containing the result of a single request in the Message Batch. Results are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--message-batch-id: string` + + ID of the Message Batch. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_message_batch_individual_response: object { custom_id, result }` + + This is a single line in the response `.jsonl` file and does not represent the response as a whole. + + - `custom_id: string` + + Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order. + + Must be unique for each request within the Message Batch. + + - `result: BetaMessageBatchSucceededResult or BetaMessageBatchErroredResult or BetaMessageBatchCanceledResult or BetaMessageBatchExpiredResult` + + Processing result for this request. + + Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration. + + - `beta_message_batch_succeeded_result: object { message, type }` + + - `message: object { id, container, content, 8 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at, skills }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `skills: array of BetaSkill` + + Skills loaded in the container + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: string` + + Skill version or 'latest' for most recent version + + - `content: array of BetaContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `beta_text_block: object { citations, text, type }` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `beta_thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `beta_redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `beta_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_server_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_search_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebSearchToolResultError or array of BetaWebSearchResultBlock` + + - `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of BetaWebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_fetch_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock` + + - `beta_web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaCodeExecutionToolResultError or BetaCodeExecutionResultBlock or BetaEncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `beta_bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock` + + - `beta_bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `beta_text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock` + + - `beta_text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `beta_text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `beta_text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `beta_tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock` + + - `beta_tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `beta_mcp_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + The name of the MCP tool + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `beta_mcp_tool_result_block: object { content, is_error, tool_use_id, type }` + + - `content: string or array of BetaTextBlock` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_content: array of BetaTextBlock` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `is_error: boolean` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `beta_container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `beta_compaction_block: object { content, type }` + + A compaction block returned when autocompact is triggered. + + When content is None, it indicates the compaction failed to produce a valid + summary (e.g., malformed output from the model). Clients may round-trip + compaction blocks with null content; the server treats them as no-ops. + + - `content: string` + + Summary of compacted content, or null if compaction failed + + - `type: "compaction"` + + - `context_management: object { applied_edits }` + + Context management response. + + Information about context management strategies applied during the request. + + - `applied_edits: array of BetaClearToolUses20250919EditResponse or BetaClearThinking20251015EditResponse` + + List of context management edits that were applied. + + - `beta_clear_tool_uses_20250919_edit_response: object { cleared_input_tokens, cleared_tool_uses, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_tool_uses: number` + + Number of tool uses that were cleared. + + - `type: "clear_tool_uses_20250919"` + + The type of context management edit applied. + + - `beta_clear_thinking_20251015_edit_response: object { cleared_input_tokens, cleared_thinking_turns, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_thinking_turns: number` + + Number of thinking turns that were cleared. + + - `type: "clear_thinking_20251015"` + + The type of context management edit applied. + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 5 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"compaction"` + + - `"refusal"` + + - `"model_context_window_exceeded"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 7 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `iterations: array of BetaMessageIterationUsage or BetaCompactionIterationUsage` + + Per-iteration token usage breakdown. + + Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + + - Determine which iterations exceeded long context thresholds (>=200k tokens) + - Calculate the true context window size from the last iteration + - Understand token accumulation across server-side tool use loops + + - `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + + - `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `speed: "standard" or "fast"` + + The inference speed mode used for this request. + + - `"standard"` + + - `"fast"` + + - `type: "succeeded"` + + - `beta_message_batch_errored_result: object { error, type }` + + - `error: object { error, request_id, type }` + + - `error: BetaInvalidRequestError or BetaAuthenticationError or BetaBillingError or 6 more` + + - `beta_invalid_request_error: object { message, type }` + + - `message: string` + + - `type: "invalid_request_error"` + + - `beta_authentication_error: object { message, type }` + + - `message: string` + + - `type: "authentication_error"` + + - `beta_billing_error: object { message, type }` + + - `message: string` + + - `type: "billing_error"` + + - `beta_permission_error: object { message, type }` + + - `message: string` + + - `type: "permission_error"` + + - `beta_not_found_error: object { message, type }` + + - `message: string` + + - `type: "not_found_error"` + + - `beta_rate_limit_error: object { message, type }` + + - `message: string` + + - `type: "rate_limit_error"` + + - `beta_gateway_timeout_error: object { message, type }` + + - `message: string` + + - `type: "timeout_error"` + + - `beta_api_error: object { message, type }` + + - `message: string` + + - `type: "api_error"` + + - `beta_overloaded_error: object { message, type }` + + - `message: string` + + - `type: "overloaded_error"` + + - `request_id: string` + + - `type: "error"` + + - `type: "errored"` + + - `beta_message_batch_canceled_result: object { type }` + + - `type: "canceled"` + + - `beta_message_batch_expired_result: object { type }` + + - `type: "expired"` + +### Example + +```cli +ant beta:messages:batches results \ + --api-key my-anthropic-api-key \ + --message-batch-id message_batch_id +``` + +## Domain Types + +### Beta Deleted Message Batch + +- `beta_deleted_message_batch: object { id, type }` + + - `id: string` + + ID of the Message Batch. + + - `type: "message_batch_deleted"` + + Deleted object type. + + For Message Batches, this is always `"message_batch_deleted"`. + +### Beta Message Batch + +- `beta_message_batch: object { id, archived_at, cancel_initiated_at, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: object { canceled, errored, expired, 2 more }` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + +### Beta Message Batch Canceled Result + +- `beta_message_batch_canceled_result: object { type }` + + - `type: "canceled"` + +### Beta Message Batch Errored Result + +- `beta_message_batch_errored_result: object { error, type }` + + - `error: object { error, request_id, type }` + + - `error: BetaInvalidRequestError or BetaAuthenticationError or BetaBillingError or 6 more` + + - `beta_invalid_request_error: object { message, type }` + + - `message: string` + + - `type: "invalid_request_error"` + + - `beta_authentication_error: object { message, type }` + + - `message: string` + + - `type: "authentication_error"` + + - `beta_billing_error: object { message, type }` + + - `message: string` + + - `type: "billing_error"` + + - `beta_permission_error: object { message, type }` + + - `message: string` + + - `type: "permission_error"` + + - `beta_not_found_error: object { message, type }` + + - `message: string` + + - `type: "not_found_error"` + + - `beta_rate_limit_error: object { message, type }` + + - `message: string` + + - `type: "rate_limit_error"` + + - `beta_gateway_timeout_error: object { message, type }` + + - `message: string` + + - `type: "timeout_error"` + + - `beta_api_error: object { message, type }` + + - `message: string` + + - `type: "api_error"` + + - `beta_overloaded_error: object { message, type }` + + - `message: string` + + - `type: "overloaded_error"` + + - `request_id: string` + + - `type: "error"` + + - `type: "errored"` + +### Beta Message Batch Expired Result + +- `beta_message_batch_expired_result: object { type }` + + - `type: "expired"` + +### Beta Message Batch Individual Response + +- `beta_message_batch_individual_response: object { custom_id, result }` + + This is a single line in the response `.jsonl` file and does not represent the response as a whole. + + - `custom_id: string` + + Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order. + + Must be unique for each request within the Message Batch. + + - `result: BetaMessageBatchSucceededResult or BetaMessageBatchErroredResult or BetaMessageBatchCanceledResult or BetaMessageBatchExpiredResult` + + Processing result for this request. + + Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration. + + - `beta_message_batch_succeeded_result: object { message, type }` + + - `message: object { id, container, content, 8 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at, skills }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `skills: array of BetaSkill` + + Skills loaded in the container + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: string` + + Skill version or 'latest' for most recent version + + - `content: array of BetaContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `beta_text_block: object { citations, text, type }` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `beta_thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `beta_redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `beta_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_server_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_search_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebSearchToolResultError or array of BetaWebSearchResultBlock` + + - `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of BetaWebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_fetch_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock` + + - `beta_web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaCodeExecutionToolResultError or BetaCodeExecutionResultBlock or BetaEncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `beta_bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock` + + - `beta_bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `beta_text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock` + + - `beta_text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `beta_text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `beta_text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `beta_tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock` + + - `beta_tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `beta_mcp_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + The name of the MCP tool + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `beta_mcp_tool_result_block: object { content, is_error, tool_use_id, type }` + + - `content: string or array of BetaTextBlock` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_content: array of BetaTextBlock` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `is_error: boolean` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `beta_container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `beta_compaction_block: object { content, type }` + + A compaction block returned when autocompact is triggered. + + When content is None, it indicates the compaction failed to produce a valid + summary (e.g., malformed output from the model). Clients may round-trip + compaction blocks with null content; the server treats them as no-ops. + + - `content: string` + + Summary of compacted content, or null if compaction failed + + - `type: "compaction"` + + - `context_management: object { applied_edits }` + + Context management response. + + Information about context management strategies applied during the request. + + - `applied_edits: array of BetaClearToolUses20250919EditResponse or BetaClearThinking20251015EditResponse` + + List of context management edits that were applied. + + - `beta_clear_tool_uses_20250919_edit_response: object { cleared_input_tokens, cleared_tool_uses, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_tool_uses: number` + + Number of tool uses that were cleared. + + - `type: "clear_tool_uses_20250919"` + + The type of context management edit applied. + + - `beta_clear_thinking_20251015_edit_response: object { cleared_input_tokens, cleared_thinking_turns, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_thinking_turns: number` + + Number of thinking turns that were cleared. + + - `type: "clear_thinking_20251015"` + + The type of context management edit applied. + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 5 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"compaction"` + + - `"refusal"` + + - `"model_context_window_exceeded"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 7 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `iterations: array of BetaMessageIterationUsage or BetaCompactionIterationUsage` + + Per-iteration token usage breakdown. + + Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + + - Determine which iterations exceeded long context thresholds (>=200k tokens) + - Calculate the true context window size from the last iteration + - Understand token accumulation across server-side tool use loops + + - `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + + - `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `speed: "standard" or "fast"` + + The inference speed mode used for this request. + + - `"standard"` + + - `"fast"` + + - `type: "succeeded"` + + - `beta_message_batch_errored_result: object { error, type }` + + - `error: object { error, request_id, type }` + + - `error: BetaInvalidRequestError or BetaAuthenticationError or BetaBillingError or 6 more` + + - `beta_invalid_request_error: object { message, type }` + + - `message: string` + + - `type: "invalid_request_error"` + + - `beta_authentication_error: object { message, type }` + + - `message: string` + + - `type: "authentication_error"` + + - `beta_billing_error: object { message, type }` + + - `message: string` + + - `type: "billing_error"` + + - `beta_permission_error: object { message, type }` + + - `message: string` + + - `type: "permission_error"` + + - `beta_not_found_error: object { message, type }` + + - `message: string` + + - `type: "not_found_error"` + + - `beta_rate_limit_error: object { message, type }` + + - `message: string` + + - `type: "rate_limit_error"` + + - `beta_gateway_timeout_error: object { message, type }` + + - `message: string` + + - `type: "timeout_error"` + + - `beta_api_error: object { message, type }` + + - `message: string` + + - `type: "api_error"` + + - `beta_overloaded_error: object { message, type }` + + - `message: string` + + - `type: "overloaded_error"` + + - `request_id: string` + + - `type: "error"` + + - `type: "errored"` + + - `beta_message_batch_canceled_result: object { type }` + + - `type: "canceled"` + + - `beta_message_batch_expired_result: object { type }` + + - `type: "expired"` + +### Beta Message Batch Request Counts + +- `beta_message_batch_request_counts: object { canceled, errored, expired, 2 more }` + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + +### Beta Message Batch Result + +- `beta_message_batch_result: BetaMessageBatchSucceededResult or BetaMessageBatchErroredResult or BetaMessageBatchCanceledResult or BetaMessageBatchExpiredResult` + + Processing result for this request. + + Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration. + + - `beta_message_batch_succeeded_result: object { message, type }` + + - `message: object { id, container, content, 8 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at, skills }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `skills: array of BetaSkill` + + Skills loaded in the container + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: string` + + Skill version or 'latest' for most recent version + + - `content: array of BetaContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `beta_text_block: object { citations, text, type }` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `beta_thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `beta_redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `beta_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_server_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_search_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebSearchToolResultError or array of BetaWebSearchResultBlock` + + - `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of BetaWebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_fetch_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock` + + - `beta_web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaCodeExecutionToolResultError or BetaCodeExecutionResultBlock or BetaEncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `beta_bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock` + + - `beta_bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `beta_text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock` + + - `beta_text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `beta_text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `beta_text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `beta_tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock` + + - `beta_tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `beta_mcp_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + The name of the MCP tool + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `beta_mcp_tool_result_block: object { content, is_error, tool_use_id, type }` + + - `content: string or array of BetaTextBlock` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_content: array of BetaTextBlock` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `is_error: boolean` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `beta_container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `beta_compaction_block: object { content, type }` + + A compaction block returned when autocompact is triggered. + + When content is None, it indicates the compaction failed to produce a valid + summary (e.g., malformed output from the model). Clients may round-trip + compaction blocks with null content; the server treats them as no-ops. + + - `content: string` + + Summary of compacted content, or null if compaction failed + + - `type: "compaction"` + + - `context_management: object { applied_edits }` + + Context management response. + + Information about context management strategies applied during the request. + + - `applied_edits: array of BetaClearToolUses20250919EditResponse or BetaClearThinking20251015EditResponse` + + List of context management edits that were applied. + + - `beta_clear_tool_uses_20250919_edit_response: object { cleared_input_tokens, cleared_tool_uses, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_tool_uses: number` + + Number of tool uses that were cleared. + + - `type: "clear_tool_uses_20250919"` + + The type of context management edit applied. + + - `beta_clear_thinking_20251015_edit_response: object { cleared_input_tokens, cleared_thinking_turns, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_thinking_turns: number` + + Number of thinking turns that were cleared. + + - `type: "clear_thinking_20251015"` + + The type of context management edit applied. + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 5 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"compaction"` + + - `"refusal"` + + - `"model_context_window_exceeded"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 7 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `iterations: array of BetaMessageIterationUsage or BetaCompactionIterationUsage` + + Per-iteration token usage breakdown. + + Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + + - Determine which iterations exceeded long context thresholds (>=200k tokens) + - Calculate the true context window size from the last iteration + - Understand token accumulation across server-side tool use loops + + - `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + + - `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `speed: "standard" or "fast"` + + The inference speed mode used for this request. + + - `"standard"` + + - `"fast"` + + - `type: "succeeded"` + + - `beta_message_batch_errored_result: object { error, type }` + + - `error: object { error, request_id, type }` + + - `error: BetaInvalidRequestError or BetaAuthenticationError or BetaBillingError or 6 more` + + - `beta_invalid_request_error: object { message, type }` + + - `message: string` + + - `type: "invalid_request_error"` + + - `beta_authentication_error: object { message, type }` + + - `message: string` + + - `type: "authentication_error"` + + - `beta_billing_error: object { message, type }` + + - `message: string` + + - `type: "billing_error"` + + - `beta_permission_error: object { message, type }` + + - `message: string` + + - `type: "permission_error"` + + - `beta_not_found_error: object { message, type }` + + - `message: string` + + - `type: "not_found_error"` + + - `beta_rate_limit_error: object { message, type }` + + - `message: string` + + - `type: "rate_limit_error"` + + - `beta_gateway_timeout_error: object { message, type }` + + - `message: string` + + - `type: "timeout_error"` + + - `beta_api_error: object { message, type }` + + - `message: string` + + - `type: "api_error"` + + - `beta_overloaded_error: object { message, type }` + + - `message: string` + + - `type: "overloaded_error"` + + - `request_id: string` + + - `type: "error"` + + - `type: "errored"` + + - `beta_message_batch_canceled_result: object { type }` + + - `type: "canceled"` + + - `beta_message_batch_expired_result: object { type }` + + - `type: "expired"` + +### Beta Message Batch Succeeded Result + +- `beta_message_batch_succeeded_result: object { message, type }` + + - `message: object { id, container, content, 8 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at, skills }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `skills: array of BetaSkill` + + Skills loaded in the container + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: string` + + Skill version or 'latest' for most recent version + + - `content: array of BetaContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `beta_text_block: object { citations, text, type }` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `beta_thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `beta_redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `beta_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_server_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_search_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebSearchToolResultError or array of BetaWebSearchResultBlock` + + - `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of BetaWebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_fetch_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock` + + - `beta_web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaCodeExecutionToolResultError or BetaCodeExecutionResultBlock or BetaEncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `beta_bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock` + + - `beta_bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `beta_text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock` + + - `beta_text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `beta_text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `beta_text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `beta_tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock` + + - `beta_tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `beta_mcp_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + The name of the MCP tool + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `beta_mcp_tool_result_block: object { content, is_error, tool_use_id, type }` + + - `content: string or array of BetaTextBlock` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_content: array of BetaTextBlock` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `is_error: boolean` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `beta_container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `beta_compaction_block: object { content, type }` + + A compaction block returned when autocompact is triggered. + + When content is None, it indicates the compaction failed to produce a valid + summary (e.g., malformed output from the model). Clients may round-trip + compaction blocks with null content; the server treats them as no-ops. + + - `content: string` + + Summary of compacted content, or null if compaction failed + + - `type: "compaction"` + + - `context_management: object { applied_edits }` + + Context management response. + + Information about context management strategies applied during the request. + + - `applied_edits: array of BetaClearToolUses20250919EditResponse or BetaClearThinking20251015EditResponse` + + List of context management edits that were applied. + + - `beta_clear_tool_uses_20250919_edit_response: object { cleared_input_tokens, cleared_tool_uses, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_tool_uses: number` + + Number of tool uses that were cleared. + + - `type: "clear_tool_uses_20250919"` + + The type of context management edit applied. + + - `beta_clear_thinking_20251015_edit_response: object { cleared_input_tokens, cleared_thinking_turns, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_thinking_turns: number` + + Number of thinking turns that were cleared. + + - `type: "clear_thinking_20251015"` + + The type of context management edit applied. + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 5 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"compaction"` + + - `"refusal"` + + - `"model_context_window_exceeded"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 7 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `iterations: array of BetaMessageIterationUsage or BetaCompactionIterationUsage` + + Per-iteration token usage breakdown. + + Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + + - Determine which iterations exceeded long context thresholds (>=200k tokens) + - Calculate the true context window size from the last iteration + - Understand token accumulation across server-side tool use loops + + - `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + + - `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `speed: "standard" or "fast"` + + The inference speed mode used for this request. + + - `"standard"` + + - `"fast"` + + - `type: "succeeded"` diff --git a/content/en/api/cli/beta/messages/batches.md b/content/en/api/cli/beta/messages/batches.md index 21907b0d4..337681201 100644 --- a/content/en/api/cli/beta/messages/batches.md +++ b/content/en/api/cli/beta/messages/batches.md @@ -1 +1,5402 @@ -Not Found - Claude API Docs
                    \ No newline at end of file +# Batches + +## Create + +`$ ant beta:messages:batches create` + +**post** `/v1/messages/batches` + +Send a batch of Message creation requests. + +The Message Batches API can be used to process multiple Messages API requests at once. Once a Message Batch is created, it begins processing immediately. Batches can take up to 24 hours to complete. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--request: array of object { custom_id, params }` + + Body param: List of requests for prompt completion. Each is an individual request to create a Message. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_message_batch: object { id, archived_at, cancel_initiated_at, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: object { canceled, errored, expired, 2 more }` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + +### Example + +```cli +ant beta:messages:batches create \ + --api-key my-anthropic-api-key \ + --request '{custom_id: my-custom-id-1, params: {max_tokens: 1024, messages: [{content: [{text: x, type: text}], role: user}], model: claude-opus-4-6}}' +``` + +## Retrieve + +`$ ant beta:messages:batches retrieve` + +**get** `/v1/messages/batches/{message_batch_id}` + +This endpoint is idempotent and can be used to poll for Message Batch completion. To access the results of a Message Batch, make a request to the `results_url` field in the response. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--message-batch-id: string` + + ID of the Message Batch. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_message_batch: object { id, archived_at, cancel_initiated_at, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: object { canceled, errored, expired, 2 more }` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + +### Example + +```cli +ant beta:messages:batches retrieve \ + --api-key my-anthropic-api-key \ + --message-batch-id message_batch_id +``` + +## List + +`$ ant beta:messages:batches list` + +**get** `/v1/messages/batches` + +List all Message Batches within a Workspace. Most recently created batches are returned first. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--after-id: optional string` + + Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object. + +- `--before-id: optional string` + + Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object. + +- `--limit: optional number` + + Query param: Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaListResponse_MessageBatch_: object { data, first_id, has_more, last_id }` + + - `data: array of BetaMessageBatch` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: object { canceled, errored, expired, 2 more }` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + + - `first_id: string` + + First ID in the `data` list. Can be used as the `before_id` for the previous page. + + - `has_more: boolean` + + Indicates if there are more results in the requested page direction. + + - `last_id: string` + + Last ID in the `data` list. Can be used as the `after_id` for the next page. + +### Example + +```cli +ant beta:messages:batches list \ + --api-key my-anthropic-api-key +``` + +## Cancel + +`$ ant beta:messages:batches cancel` + +**post** `/v1/messages/batches/{message_batch_id}/cancel` + +Batches may be canceled any time before processing ends. Once cancellation is initiated, the batch enters a `canceling` state, at which time the system may complete any in-progress, non-interruptible requests before finalizing cancellation. + +The number of canceled requests is specified in `request_counts`. To determine which requests were canceled, check the individual results within the batch. Note that cancellation may not result in any canceled requests if they were non-interruptible. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--message-batch-id: string` + + ID of the Message Batch. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_message_batch: object { id, archived_at, cancel_initiated_at, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: object { canceled, errored, expired, 2 more }` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + +### Example + +```cli +ant beta:messages:batches cancel \ + --api-key my-anthropic-api-key \ + --message-batch-id message_batch_id +``` + +## Delete + +`$ ant beta:messages:batches delete` + +**delete** `/v1/messages/batches/{message_batch_id}` + +Delete a Message Batch. + +Message Batches can only be deleted once they've finished processing. If you'd like to delete an in-progress batch, you must first cancel it. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--message-batch-id: string` + + ID of the Message Batch. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_deleted_message_batch: object { id, type }` + + - `id: string` + + ID of the Message Batch. + + - `type: "message_batch_deleted"` + + Deleted object type. + + For Message Batches, this is always `"message_batch_deleted"`. + +### Example + +```cli +ant beta:messages:batches delete \ + --api-key my-anthropic-api-key \ + --message-batch-id message_batch_id +``` + +## Results + +`$ ant beta:messages:batches results` + +**get** `/v1/messages/batches/{message_batch_id}/results` + +Streams the results of a Message Batch as a `.jsonl` file. + +Each line in the file is a JSON object containing the result of a single request in the Message Batch. Results are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--message-batch-id: string` + + ID of the Message Batch. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_message_batch_individual_response: object { custom_id, result }` + + This is a single line in the response `.jsonl` file and does not represent the response as a whole. + + - `custom_id: string` + + Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order. + + Must be unique for each request within the Message Batch. + + - `result: BetaMessageBatchSucceededResult or BetaMessageBatchErroredResult or BetaMessageBatchCanceledResult or BetaMessageBatchExpiredResult` + + Processing result for this request. + + Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration. + + - `beta_message_batch_succeeded_result: object { message, type }` + + - `message: object { id, container, content, 8 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at, skills }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `skills: array of BetaSkill` + + Skills loaded in the container + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: string` + + Skill version or 'latest' for most recent version + + - `content: array of BetaContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `beta_text_block: object { citations, text, type }` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `beta_thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `beta_redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `beta_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_server_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_search_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebSearchToolResultError or array of BetaWebSearchResultBlock` + + - `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of BetaWebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_fetch_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock` + + - `beta_web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaCodeExecutionToolResultError or BetaCodeExecutionResultBlock or BetaEncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `beta_bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock` + + - `beta_bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `beta_text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock` + + - `beta_text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `beta_text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `beta_text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `beta_tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock` + + - `beta_tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `beta_mcp_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + The name of the MCP tool + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `beta_mcp_tool_result_block: object { content, is_error, tool_use_id, type }` + + - `content: string or array of BetaTextBlock` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_content: array of BetaTextBlock` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `is_error: boolean` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `beta_container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `beta_compaction_block: object { content, type }` + + A compaction block returned when autocompact is triggered. + + When content is None, it indicates the compaction failed to produce a valid + summary (e.g., malformed output from the model). Clients may round-trip + compaction blocks with null content; the server treats them as no-ops. + + - `content: string` + + Summary of compacted content, or null if compaction failed + + - `type: "compaction"` + + - `context_management: object { applied_edits }` + + Context management response. + + Information about context management strategies applied during the request. + + - `applied_edits: array of BetaClearToolUses20250919EditResponse or BetaClearThinking20251015EditResponse` + + List of context management edits that were applied. + + - `beta_clear_tool_uses_20250919_edit_response: object { cleared_input_tokens, cleared_tool_uses, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_tool_uses: number` + + Number of tool uses that were cleared. + + - `type: "clear_tool_uses_20250919"` + + The type of context management edit applied. + + - `beta_clear_thinking_20251015_edit_response: object { cleared_input_tokens, cleared_thinking_turns, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_thinking_turns: number` + + Number of thinking turns that were cleared. + + - `type: "clear_thinking_20251015"` + + The type of context management edit applied. + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 5 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"compaction"` + + - `"refusal"` + + - `"model_context_window_exceeded"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 7 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `iterations: array of BetaMessageIterationUsage or BetaCompactionIterationUsage` + + Per-iteration token usage breakdown. + + Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + + - Determine which iterations exceeded long context thresholds (>=200k tokens) + - Calculate the true context window size from the last iteration + - Understand token accumulation across server-side tool use loops + + - `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + + - `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `speed: "standard" or "fast"` + + The inference speed mode used for this request. + + - `"standard"` + + - `"fast"` + + - `type: "succeeded"` + + - `beta_message_batch_errored_result: object { error, type }` + + - `error: object { error, request_id, type }` + + - `error: BetaInvalidRequestError or BetaAuthenticationError or BetaBillingError or 6 more` + + - `beta_invalid_request_error: object { message, type }` + + - `message: string` + + - `type: "invalid_request_error"` + + - `beta_authentication_error: object { message, type }` + + - `message: string` + + - `type: "authentication_error"` + + - `beta_billing_error: object { message, type }` + + - `message: string` + + - `type: "billing_error"` + + - `beta_permission_error: object { message, type }` + + - `message: string` + + - `type: "permission_error"` + + - `beta_not_found_error: object { message, type }` + + - `message: string` + + - `type: "not_found_error"` + + - `beta_rate_limit_error: object { message, type }` + + - `message: string` + + - `type: "rate_limit_error"` + + - `beta_gateway_timeout_error: object { message, type }` + + - `message: string` + + - `type: "timeout_error"` + + - `beta_api_error: object { message, type }` + + - `message: string` + + - `type: "api_error"` + + - `beta_overloaded_error: object { message, type }` + + - `message: string` + + - `type: "overloaded_error"` + + - `request_id: string` + + - `type: "error"` + + - `type: "errored"` + + - `beta_message_batch_canceled_result: object { type }` + + - `type: "canceled"` + + - `beta_message_batch_expired_result: object { type }` + + - `type: "expired"` + +### Example + +```cli +ant beta:messages:batches results \ + --api-key my-anthropic-api-key \ + --message-batch-id message_batch_id +``` + +## Domain Types + +### Beta Deleted Message Batch + +- `beta_deleted_message_batch: object { id, type }` + + - `id: string` + + ID of the Message Batch. + + - `type: "message_batch_deleted"` + + Deleted object type. + + For Message Batches, this is always `"message_batch_deleted"`. + +### Beta Message Batch + +- `beta_message_batch: object { id, archived_at, cancel_initiated_at, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: object { canceled, errored, expired, 2 more }` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + +### Beta Message Batch Canceled Result + +- `beta_message_batch_canceled_result: object { type }` + + - `type: "canceled"` + +### Beta Message Batch Errored Result + +- `beta_message_batch_errored_result: object { error, type }` + + - `error: object { error, request_id, type }` + + - `error: BetaInvalidRequestError or BetaAuthenticationError or BetaBillingError or 6 more` + + - `beta_invalid_request_error: object { message, type }` + + - `message: string` + + - `type: "invalid_request_error"` + + - `beta_authentication_error: object { message, type }` + + - `message: string` + + - `type: "authentication_error"` + + - `beta_billing_error: object { message, type }` + + - `message: string` + + - `type: "billing_error"` + + - `beta_permission_error: object { message, type }` + + - `message: string` + + - `type: "permission_error"` + + - `beta_not_found_error: object { message, type }` + + - `message: string` + + - `type: "not_found_error"` + + - `beta_rate_limit_error: object { message, type }` + + - `message: string` + + - `type: "rate_limit_error"` + + - `beta_gateway_timeout_error: object { message, type }` + + - `message: string` + + - `type: "timeout_error"` + + - `beta_api_error: object { message, type }` + + - `message: string` + + - `type: "api_error"` + + - `beta_overloaded_error: object { message, type }` + + - `message: string` + + - `type: "overloaded_error"` + + - `request_id: string` + + - `type: "error"` + + - `type: "errored"` + +### Beta Message Batch Expired Result + +- `beta_message_batch_expired_result: object { type }` + + - `type: "expired"` + +### Beta Message Batch Individual Response + +- `beta_message_batch_individual_response: object { custom_id, result }` + + This is a single line in the response `.jsonl` file and does not represent the response as a whole. + + - `custom_id: string` + + Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order. + + Must be unique for each request within the Message Batch. + + - `result: BetaMessageBatchSucceededResult or BetaMessageBatchErroredResult or BetaMessageBatchCanceledResult or BetaMessageBatchExpiredResult` + + Processing result for this request. + + Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration. + + - `beta_message_batch_succeeded_result: object { message, type }` + + - `message: object { id, container, content, 8 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at, skills }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `skills: array of BetaSkill` + + Skills loaded in the container + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: string` + + Skill version or 'latest' for most recent version + + - `content: array of BetaContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `beta_text_block: object { citations, text, type }` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `beta_thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `beta_redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `beta_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_server_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_search_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebSearchToolResultError or array of BetaWebSearchResultBlock` + + - `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of BetaWebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_fetch_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock` + + - `beta_web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaCodeExecutionToolResultError or BetaCodeExecutionResultBlock or BetaEncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `beta_bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock` + + - `beta_bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `beta_text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock` + + - `beta_text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `beta_text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `beta_text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `beta_tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock` + + - `beta_tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `beta_mcp_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + The name of the MCP tool + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `beta_mcp_tool_result_block: object { content, is_error, tool_use_id, type }` + + - `content: string or array of BetaTextBlock` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_content: array of BetaTextBlock` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `is_error: boolean` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `beta_container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `beta_compaction_block: object { content, type }` + + A compaction block returned when autocompact is triggered. + + When content is None, it indicates the compaction failed to produce a valid + summary (e.g., malformed output from the model). Clients may round-trip + compaction blocks with null content; the server treats them as no-ops. + + - `content: string` + + Summary of compacted content, or null if compaction failed + + - `type: "compaction"` + + - `context_management: object { applied_edits }` + + Context management response. + + Information about context management strategies applied during the request. + + - `applied_edits: array of BetaClearToolUses20250919EditResponse or BetaClearThinking20251015EditResponse` + + List of context management edits that were applied. + + - `beta_clear_tool_uses_20250919_edit_response: object { cleared_input_tokens, cleared_tool_uses, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_tool_uses: number` + + Number of tool uses that were cleared. + + - `type: "clear_tool_uses_20250919"` + + The type of context management edit applied. + + - `beta_clear_thinking_20251015_edit_response: object { cleared_input_tokens, cleared_thinking_turns, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_thinking_turns: number` + + Number of thinking turns that were cleared. + + - `type: "clear_thinking_20251015"` + + The type of context management edit applied. + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 5 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"compaction"` + + - `"refusal"` + + - `"model_context_window_exceeded"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 7 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `iterations: array of BetaMessageIterationUsage or BetaCompactionIterationUsage` + + Per-iteration token usage breakdown. + + Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + + - Determine which iterations exceeded long context thresholds (>=200k tokens) + - Calculate the true context window size from the last iteration + - Understand token accumulation across server-side tool use loops + + - `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + + - `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `speed: "standard" or "fast"` + + The inference speed mode used for this request. + + - `"standard"` + + - `"fast"` + + - `type: "succeeded"` + + - `beta_message_batch_errored_result: object { error, type }` + + - `error: object { error, request_id, type }` + + - `error: BetaInvalidRequestError or BetaAuthenticationError or BetaBillingError or 6 more` + + - `beta_invalid_request_error: object { message, type }` + + - `message: string` + + - `type: "invalid_request_error"` + + - `beta_authentication_error: object { message, type }` + + - `message: string` + + - `type: "authentication_error"` + + - `beta_billing_error: object { message, type }` + + - `message: string` + + - `type: "billing_error"` + + - `beta_permission_error: object { message, type }` + + - `message: string` + + - `type: "permission_error"` + + - `beta_not_found_error: object { message, type }` + + - `message: string` + + - `type: "not_found_error"` + + - `beta_rate_limit_error: object { message, type }` + + - `message: string` + + - `type: "rate_limit_error"` + + - `beta_gateway_timeout_error: object { message, type }` + + - `message: string` + + - `type: "timeout_error"` + + - `beta_api_error: object { message, type }` + + - `message: string` + + - `type: "api_error"` + + - `beta_overloaded_error: object { message, type }` + + - `message: string` + + - `type: "overloaded_error"` + + - `request_id: string` + + - `type: "error"` + + - `type: "errored"` + + - `beta_message_batch_canceled_result: object { type }` + + - `type: "canceled"` + + - `beta_message_batch_expired_result: object { type }` + + - `type: "expired"` + +### Beta Message Batch Request Counts + +- `beta_message_batch_request_counts: object { canceled, errored, expired, 2 more }` + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + +### Beta Message Batch Result + +- `beta_message_batch_result: BetaMessageBatchSucceededResult or BetaMessageBatchErroredResult or BetaMessageBatchCanceledResult or BetaMessageBatchExpiredResult` + + Processing result for this request. + + Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration. + + - `beta_message_batch_succeeded_result: object { message, type }` + + - `message: object { id, container, content, 8 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at, skills }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `skills: array of BetaSkill` + + Skills loaded in the container + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: string` + + Skill version or 'latest' for most recent version + + - `content: array of BetaContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `beta_text_block: object { citations, text, type }` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `beta_thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `beta_redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `beta_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_server_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_search_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebSearchToolResultError or array of BetaWebSearchResultBlock` + + - `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of BetaWebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_fetch_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock` + + - `beta_web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaCodeExecutionToolResultError or BetaCodeExecutionResultBlock or BetaEncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `beta_bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock` + + - `beta_bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `beta_text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock` + + - `beta_text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `beta_text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `beta_text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `beta_tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock` + + - `beta_tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `beta_mcp_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + The name of the MCP tool + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `beta_mcp_tool_result_block: object { content, is_error, tool_use_id, type }` + + - `content: string or array of BetaTextBlock` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_content: array of BetaTextBlock` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `is_error: boolean` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `beta_container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `beta_compaction_block: object { content, type }` + + A compaction block returned when autocompact is triggered. + + When content is None, it indicates the compaction failed to produce a valid + summary (e.g., malformed output from the model). Clients may round-trip + compaction blocks with null content; the server treats them as no-ops. + + - `content: string` + + Summary of compacted content, or null if compaction failed + + - `type: "compaction"` + + - `context_management: object { applied_edits }` + + Context management response. + + Information about context management strategies applied during the request. + + - `applied_edits: array of BetaClearToolUses20250919EditResponse or BetaClearThinking20251015EditResponse` + + List of context management edits that were applied. + + - `beta_clear_tool_uses_20250919_edit_response: object { cleared_input_tokens, cleared_tool_uses, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_tool_uses: number` + + Number of tool uses that were cleared. + + - `type: "clear_tool_uses_20250919"` + + The type of context management edit applied. + + - `beta_clear_thinking_20251015_edit_response: object { cleared_input_tokens, cleared_thinking_turns, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_thinking_turns: number` + + Number of thinking turns that were cleared. + + - `type: "clear_thinking_20251015"` + + The type of context management edit applied. + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 5 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"compaction"` + + - `"refusal"` + + - `"model_context_window_exceeded"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 7 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `iterations: array of BetaMessageIterationUsage or BetaCompactionIterationUsage` + + Per-iteration token usage breakdown. + + Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + + - Determine which iterations exceeded long context thresholds (>=200k tokens) + - Calculate the true context window size from the last iteration + - Understand token accumulation across server-side tool use loops + + - `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + + - `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `speed: "standard" or "fast"` + + The inference speed mode used for this request. + + - `"standard"` + + - `"fast"` + + - `type: "succeeded"` + + - `beta_message_batch_errored_result: object { error, type }` + + - `error: object { error, request_id, type }` + + - `error: BetaInvalidRequestError or BetaAuthenticationError or BetaBillingError or 6 more` + + - `beta_invalid_request_error: object { message, type }` + + - `message: string` + + - `type: "invalid_request_error"` + + - `beta_authentication_error: object { message, type }` + + - `message: string` + + - `type: "authentication_error"` + + - `beta_billing_error: object { message, type }` + + - `message: string` + + - `type: "billing_error"` + + - `beta_permission_error: object { message, type }` + + - `message: string` + + - `type: "permission_error"` + + - `beta_not_found_error: object { message, type }` + + - `message: string` + + - `type: "not_found_error"` + + - `beta_rate_limit_error: object { message, type }` + + - `message: string` + + - `type: "rate_limit_error"` + + - `beta_gateway_timeout_error: object { message, type }` + + - `message: string` + + - `type: "timeout_error"` + + - `beta_api_error: object { message, type }` + + - `message: string` + + - `type: "api_error"` + + - `beta_overloaded_error: object { message, type }` + + - `message: string` + + - `type: "overloaded_error"` + + - `request_id: string` + + - `type: "error"` + + - `type: "errored"` + + - `beta_message_batch_canceled_result: object { type }` + + - `type: "canceled"` + + - `beta_message_batch_expired_result: object { type }` + + - `type: "expired"` + +### Beta Message Batch Succeeded Result + +- `beta_message_batch_succeeded_result: object { message, type }` + + - `message: object { id, container, content, 8 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at, skills }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `skills: array of BetaSkill` + + Skills loaded in the container + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: string` + + Skill version or 'latest' for most recent version + + - `content: array of BetaContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `beta_text_block: object { citations, text, type }` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `beta_thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `beta_redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `beta_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_server_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_search_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebSearchToolResultError or array of BetaWebSearchResultBlock` + + - `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of BetaWebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_fetch_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock` + + - `beta_web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaCodeExecutionToolResultError or BetaCodeExecutionResultBlock or BetaEncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `beta_bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock` + + - `beta_bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `beta_text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock` + + - `beta_text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `beta_text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `beta_text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `beta_tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock` + + - `beta_tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `beta_mcp_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + The name of the MCP tool + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `beta_mcp_tool_result_block: object { content, is_error, tool_use_id, type }` + + - `content: string or array of BetaTextBlock` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_content: array of BetaTextBlock` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `is_error: boolean` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `beta_container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `beta_compaction_block: object { content, type }` + + A compaction block returned when autocompact is triggered. + + When content is None, it indicates the compaction failed to produce a valid + summary (e.g., malformed output from the model). Clients may round-trip + compaction blocks with null content; the server treats them as no-ops. + + - `content: string` + + Summary of compacted content, or null if compaction failed + + - `type: "compaction"` + + - `context_management: object { applied_edits }` + + Context management response. + + Information about context management strategies applied during the request. + + - `applied_edits: array of BetaClearToolUses20250919EditResponse or BetaClearThinking20251015EditResponse` + + List of context management edits that were applied. + + - `beta_clear_tool_uses_20250919_edit_response: object { cleared_input_tokens, cleared_tool_uses, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_tool_uses: number` + + Number of tool uses that were cleared. + + - `type: "clear_tool_uses_20250919"` + + The type of context management edit applied. + + - `beta_clear_thinking_20251015_edit_response: object { cleared_input_tokens, cleared_thinking_turns, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_thinking_turns: number` + + Number of thinking turns that were cleared. + + - `type: "clear_thinking_20251015"` + + The type of context management edit applied. + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 5 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"compaction"` + + - `"refusal"` + + - `"model_context_window_exceeded"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 7 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `iterations: array of BetaMessageIterationUsage or BetaCompactionIterationUsage` + + Per-iteration token usage breakdown. + + Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + + - Determine which iterations exceeded long context thresholds (>=200k tokens) + - Calculate the true context window size from the last iteration + - Understand token accumulation across server-side tool use loops + + - `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + + - `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `speed: "standard" or "fast"` + + The inference speed mode used for this request. + + - `"standard"` + + - `"fast"` + + - `type: "succeeded"` diff --git a/content/en/api/cli/beta/messages/batches/cancel.md b/content/en/api/cli/beta/messages/batches/cancel.md index 34f803607..d35ceb563 100644 --- a/content/en/api/cli/beta/messages/batches/cancel.md +++ b/content/en/api/cli/beta/messages/batches/cancel.md @@ -1 +1,117 @@ -Not Found - Claude API Docs
                      \ No newline at end of file +## Cancel + +`$ ant beta:messages:batches cancel` + +**post** `/v1/messages/batches/{message_batch_id}/cancel` + +Batches may be canceled any time before processing ends. Once cancellation is initiated, the batch enters a `canceling` state, at which time the system may complete any in-progress, non-interruptible requests before finalizing cancellation. + +The number of canceled requests is specified in `request_counts`. To determine which requests were canceled, check the individual results within the batch. Note that cancellation may not result in any canceled requests if they were non-interruptible. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--message-batch-id: string` + + ID of the Message Batch. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_message_batch: object { id, archived_at, cancel_initiated_at, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: object { canceled, errored, expired, 2 more }` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + +### Example + +```cli +ant beta:messages:batches cancel \ + --api-key my-anthropic-api-key \ + --message-batch-id message_batch_id +``` diff --git a/content/en/api/cli/beta/messages/batches/create.md b/content/en/api/cli/beta/messages/batches/create.md index e7133e01b..6484771fb 100644 --- a/content/en/api/cli/beta/messages/batches/create.md +++ b/content/en/api/cli/beta/messages/batches/create.md @@ -1 +1,117 @@ -Not Found - Claude API Docs
                        \ No newline at end of file +## Create + +`$ ant beta:messages:batches create` + +**post** `/v1/messages/batches` + +Send a batch of Message creation requests. + +The Message Batches API can be used to process multiple Messages API requests at once. Once a Message Batch is created, it begins processing immediately. Batches can take up to 24 hours to complete. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--request: array of object { custom_id, params }` + + Body param: List of requests for prompt completion. Each is an individual request to create a Message. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_message_batch: object { id, archived_at, cancel_initiated_at, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: object { canceled, errored, expired, 2 more }` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + +### Example + +```cli +ant beta:messages:batches create \ + --api-key my-anthropic-api-key \ + --request '{custom_id: my-custom-id-1, params: {max_tokens: 1024, messages: [{content: [{text: x, type: text}], role: user}], model: claude-opus-4-6}}' +``` diff --git a/content/en/api/cli/beta/messages/batches/delete.md b/content/en/api/cli/beta/messages/batches/delete.md index 09246687f..12b3f5b4d 100644 --- a/content/en/api/cli/beta/messages/batches/delete.md +++ b/content/en/api/cli/beta/messages/batches/delete.md @@ -1 +1,43 @@ -Not Found - Claude API Docs
                          \ No newline at end of file +## Delete + +`$ ant beta:messages:batches delete` + +**delete** `/v1/messages/batches/{message_batch_id}` + +Delete a Message Batch. + +Message Batches can only be deleted once they've finished processing. If you'd like to delete an in-progress batch, you must first cancel it. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--message-batch-id: string` + + ID of the Message Batch. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_deleted_message_batch: object { id, type }` + + - `id: string` + + ID of the Message Batch. + + - `type: "message_batch_deleted"` + + Deleted object type. + + For Message Batches, this is always `"message_batch_deleted"`. + +### Example + +```cli +ant beta:messages:batches delete \ + --api-key my-anthropic-api-key \ + --message-batch-id message_batch_id +``` diff --git a/content/en/api/cli/beta/messages/batches/list.md b/content/en/api/cli/beta/messages/batches/list.md index e6c80d8df..063832a75 100644 --- a/content/en/api/cli/beta/messages/batches/list.md +++ b/content/en/api/cli/beta/messages/batches/list.md @@ -1 +1,138 @@ -Not Found - Claude API Docs
                            \ No newline at end of file +## List + +`$ ant beta:messages:batches list` + +**get** `/v1/messages/batches` + +List all Message Batches within a Workspace. Most recently created batches are returned first. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--after-id: optional string` + + Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object. + +- `--before-id: optional string` + + Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object. + +- `--limit: optional number` + + Query param: Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaListResponse_MessageBatch_: object { data, first_id, has_more, last_id }` + + - `data: array of BetaMessageBatch` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: object { canceled, errored, expired, 2 more }` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + + - `first_id: string` + + First ID in the `data` list. Can be used as the `before_id` for the previous page. + + - `has_more: boolean` + + Indicates if there are more results in the requested page direction. + + - `last_id: string` + + Last ID in the `data` list. Can be used as the `after_id` for the next page. + +### Example + +```cli +ant beta:messages:batches list \ + --api-key my-anthropic-api-key +``` diff --git a/content/en/api/cli/beta/messages/batches/results.md b/content/en/api/cli/beta/messages/batches/results.md index 41b01b9f6..3e9eb868a 100644 --- a/content/en/api/cli/beta/messages/batches/results.md +++ b/content/en/api/cli/beta/messages/batches/results.md @@ -1 +1,1209 @@ -Not Found - Claude API Docs
                              \ No newline at end of file +## Results + +`$ ant beta:messages:batches results` + +**get** `/v1/messages/batches/{message_batch_id}/results` + +Streams the results of a Message Batch as a `.jsonl` file. + +Each line in the file is a JSON object containing the result of a single request in the Message Batch. Results are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--message-batch-id: string` + + ID of the Message Batch. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_message_batch_individual_response: object { custom_id, result }` + + This is a single line in the response `.jsonl` file and does not represent the response as a whole. + + - `custom_id: string` + + Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order. + + Must be unique for each request within the Message Batch. + + - `result: BetaMessageBatchSucceededResult or BetaMessageBatchErroredResult or BetaMessageBatchCanceledResult or BetaMessageBatchExpiredResult` + + Processing result for this request. + + Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration. + + - `beta_message_batch_succeeded_result: object { message, type }` + + - `message: object { id, container, content, 8 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at, skills }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `skills: array of BetaSkill` + + Skills loaded in the container + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: string` + + Skill version or 'latest' for most recent version + + - `content: array of BetaContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `beta_text_block: object { citations, text, type }` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `beta_thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `beta_redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `beta_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_server_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_search_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebSearchToolResultError or array of BetaWebSearchResultBlock` + + - `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of BetaWebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_fetch_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock` + + - `beta_web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaCodeExecutionToolResultError or BetaCodeExecutionResultBlock or BetaEncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `beta_bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock` + + - `beta_bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `beta_text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock` + + - `beta_text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `beta_text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `beta_text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `beta_tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock` + + - `beta_tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `beta_mcp_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + The name of the MCP tool + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `beta_mcp_tool_result_block: object { content, is_error, tool_use_id, type }` + + - `content: string or array of BetaTextBlock` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_content: array of BetaTextBlock` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `is_error: boolean` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `beta_container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `beta_compaction_block: object { content, type }` + + A compaction block returned when autocompact is triggered. + + When content is None, it indicates the compaction failed to produce a valid + summary (e.g., malformed output from the model). Clients may round-trip + compaction blocks with null content; the server treats them as no-ops. + + - `content: string` + + Summary of compacted content, or null if compaction failed + + - `type: "compaction"` + + - `context_management: object { applied_edits }` + + Context management response. + + Information about context management strategies applied during the request. + + - `applied_edits: array of BetaClearToolUses20250919EditResponse or BetaClearThinking20251015EditResponse` + + List of context management edits that were applied. + + - `beta_clear_tool_uses_20250919_edit_response: object { cleared_input_tokens, cleared_tool_uses, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_tool_uses: number` + + Number of tool uses that were cleared. + + - `type: "clear_tool_uses_20250919"` + + The type of context management edit applied. + + - `beta_clear_thinking_20251015_edit_response: object { cleared_input_tokens, cleared_thinking_turns, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_thinking_turns: number` + + Number of thinking turns that were cleared. + + - `type: "clear_thinking_20251015"` + + The type of context management edit applied. + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 5 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"compaction"` + + - `"refusal"` + + - `"model_context_window_exceeded"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 7 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `iterations: array of BetaMessageIterationUsage or BetaCompactionIterationUsage` + + Per-iteration token usage breakdown. + + Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + + - Determine which iterations exceeded long context thresholds (>=200k tokens) + - Calculate the true context window size from the last iteration + - Understand token accumulation across server-side tool use loops + + - `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + + - `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `speed: "standard" or "fast"` + + The inference speed mode used for this request. + + - `"standard"` + + - `"fast"` + + - `type: "succeeded"` + + - `beta_message_batch_errored_result: object { error, type }` + + - `error: object { error, request_id, type }` + + - `error: BetaInvalidRequestError or BetaAuthenticationError or BetaBillingError or 6 more` + + - `beta_invalid_request_error: object { message, type }` + + - `message: string` + + - `type: "invalid_request_error"` + + - `beta_authentication_error: object { message, type }` + + - `message: string` + + - `type: "authentication_error"` + + - `beta_billing_error: object { message, type }` + + - `message: string` + + - `type: "billing_error"` + + - `beta_permission_error: object { message, type }` + + - `message: string` + + - `type: "permission_error"` + + - `beta_not_found_error: object { message, type }` + + - `message: string` + + - `type: "not_found_error"` + + - `beta_rate_limit_error: object { message, type }` + + - `message: string` + + - `type: "rate_limit_error"` + + - `beta_gateway_timeout_error: object { message, type }` + + - `message: string` + + - `type: "timeout_error"` + + - `beta_api_error: object { message, type }` + + - `message: string` + + - `type: "api_error"` + + - `beta_overloaded_error: object { message, type }` + + - `message: string` + + - `type: "overloaded_error"` + + - `request_id: string` + + - `type: "error"` + + - `type: "errored"` + + - `beta_message_batch_canceled_result: object { type }` + + - `type: "canceled"` + + - `beta_message_batch_expired_result: object { type }` + + - `type: "expired"` + +### Example + +```cli +ant beta:messages:batches results \ + --api-key my-anthropic-api-key \ + --message-batch-id message_batch_id +``` diff --git a/content/en/api/cli/beta/messages/batches/retrieve.md b/content/en/api/cli/beta/messages/batches/retrieve.md index 99d190af7..6ab5cd4a0 100644 --- a/content/en/api/cli/beta/messages/batches/retrieve.md +++ b/content/en/api/cli/beta/messages/batches/retrieve.md @@ -1 +1,115 @@ -Not Found - Claude API Docs
                                \ No newline at end of file +## Retrieve + +`$ ant beta:messages:batches retrieve` + +**get** `/v1/messages/batches/{message_batch_id}` + +This endpoint is idempotent and can be used to poll for Message Batch completion. To access the results of a Message Batch, make a request to the `results_url` field in the response. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--message-batch-id: string` + + ID of the Message Batch. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_message_batch: object { id, archived_at, cancel_initiated_at, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: object { canceled, errored, expired, 2 more }` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + +### Example + +```cli +ant beta:messages:batches retrieve \ + --api-key my-anthropic-api-key \ + --message-batch-id message_batch_id +``` diff --git a/content/en/api/cli/beta/messages/count_tokens.md b/content/en/api/cli/beta/messages/count_tokens.md index c8646c0dc..3f3116683 100644 --- a/content/en/api/cli/beta/messages/count_tokens.md +++ b/content/en/api/cli/beta/messages/count_tokens.md @@ -1 +1,209 @@ -Not Found - Claude API Docs
                                  \ No newline at end of file +## Count Tokens + +`$ ant beta:messages count-tokens` + +**post** `/v1/messages/count_tokens` + +Count the number of tokens in a Message. + +The Token Count API can be used to count the number of tokens in a Message, including tools, images, and documents, without creating it. + +Learn more about token counting in our [user guide](https://docs.claude.com/en/docs/build-with-claude/token-counting) + +### Parameters + +- `--message: array of BetaMessageParam` + + Body param: Input messages. + + Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn. + + Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages. + + If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response. + + Example with a single `user` message: + + ```json + [{"role": "user", "content": "Hello, Claude"}] + ``` + + Example with multiple conversational turns: + + ```json + [ + {"role": "user", "content": "Hello there."}, + {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"}, + {"role": "user", "content": "Can you explain LLMs in plain English?"}, + ] + ``` + + Example with a partially-filled response from Claude: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("}, + ] + ``` + + Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent: + + ```json + {"role": "user", "content": "Hello, Claude"} + ``` + + ```json + {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]} + ``` + + See [input examples](https://docs.claude.com/en/api/messages-examples). + + Note that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. + + There is a limit of 100,000 messages in a single request. + +- `--model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + Body param: The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + +- `--cache-control: optional object { type, ttl }` + + Body param: Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request. + +- `--context-management: optional object { edits }` + + Body param: Context management configuration. + + This allows you to control how Claude manages context across multiple requests, such as whether to clear function results or not. + +- `--mcp-server: optional array of BetaRequestMCPServerURLDefinition` + + Body param: MCP servers to be utilized in this request + +- `--output-config: optional object { effort, format }` + + Body param: Configuration options for the model's output, such as the output format. + +- `--output-format: optional object { schema, type }` + + Body param: Deprecated: Use `output_config.format` instead. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) + + A schema to specify Claude's output format in responses. This parameter will be removed in a future release. + +- `--speed: optional "standard" or "fast"` + + Body param: The inference speed mode for this request. `"fast"` enables high output-tokens-per-second inference. + +- `--system: optional string or array of BetaTextBlockParam` + + Body param: System prompt. + + A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts). + +- `--thinking: optional BetaThinkingConfigEnabled or BetaThinkingConfigDisabled or BetaThinkingConfigAdaptive` + + Body param: Configuration for enabling Claude's extended thinking. + + When enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit. + + See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details. + +- `--tool-choice: optional BetaToolChoiceAuto or BetaToolChoiceAny or BetaToolChoiceTool or BetaToolChoiceNone` + + Body param: How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all. + +- `--tool: optional array of BetaTool or BetaToolBash20241022 or BetaToolBash20250124 or 19 more` + + Body param: Definitions of tools that the model may use. + + If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks. + + There are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)). + + Each tool definition includes: + + * `name`: Name of the tool. + * `description`: Optional, but strongly-recommended description of the tool. + * `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks. + + For example, if you defined `tools` as: + + ```json + [ + { + "name": "get_stock_price", + "description": "Get the current stock price for a given ticker symbol.", + "input_schema": { + "type": "object", + "properties": { + "ticker": { + "type": "string", + "description": "The stock ticker symbol, e.g. AAPL for Apple Inc." + } + }, + "required": ["ticker"] + } + } + ] + ``` + + And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this: + + ```json + [ + { + "type": "tool_use", + "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "name": "get_stock_price", + "input": { "ticker": "^GSPC" } + } + ] + ``` + + You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message: + + ```json + [ + { + "type": "tool_result", + "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "content": "259.75 USD" + } + ] + ``` + + Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output. + + See our [guide](https://docs.claude.com/en/docs/tool-use) for more details. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_message_tokens_count: object { context_management, input_tokens }` + + - `context_management: object { original_input_tokens }` + + Information about context management applied to the message. + + - `original_input_tokens: number` + + The original token count before context management was applied + + - `input_tokens: number` + + The total number of tokens across the provided list of messages, system prompt, and tools. + +### Example + +```cli +ant beta:messages count-tokens \ + --api-key my-anthropic-api-key \ + --message '{content: [{text: x, type: text}], role: user}' \ + --model claude-mythos-preview +``` diff --git a/content/en/api/cli/beta/messages/create.md b/content/en/api/cli/beta/messages/create.md index 2ec4bced0..5476cbeef 100644 --- a/content/en/api/cli/beta/messages/create.md +++ b/content/en/api/cli/beta/messages/create.md @@ -1 +1,1338 @@ -Not Found - Claude API Docs
                                    \ No newline at end of file +## Create + +`$ ant beta:messages create` + +**post** `/v1/messages` + +Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation. + +The Messages API can be used for either single queries or stateless multi-turn conversations. + +Learn more about the Messages API in our [user guide](https://docs.claude.com/en/docs/initial-setup) + +### Parameters + +- `--max-tokens: number` + + Body param: The maximum number of tokens to generate before stopping. + + Note that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate. + + Different models have different maximum values for this parameter. See [models](https://docs.claude.com/en/docs/models-overview) for details. + +- `--message: array of BetaMessageParam` + + Body param: Input messages. + + Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn. + + Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages. + + If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response. + + Example with a single `user` message: + + ```json + [{"role": "user", "content": "Hello, Claude"}] + ``` + + Example with multiple conversational turns: + + ```json + [ + {"role": "user", "content": "Hello there."}, + {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"}, + {"role": "user", "content": "Can you explain LLMs in plain English?"}, + ] + ``` + + Example with a partially-filled response from Claude: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("}, + ] + ``` + + Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent: + + ```json + {"role": "user", "content": "Hello, Claude"} + ``` + + ```json + {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]} + ``` + + See [input examples](https://docs.claude.com/en/api/messages-examples). + + Note that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. + + There is a limit of 100,000 messages in a single request. + +- `--model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + Body param: The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + +- `--cache-control: optional object { type, ttl }` + + Body param: Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request. + +- `--container: optional BetaContainerParams or string` + + Body param: Container identifier for reuse across requests. + +- `--context-management: optional object { edits }` + + Body param: Context management configuration. + + This allows you to control how Claude manages context across multiple requests, such as whether to clear function results or not. + +- `--inference-geo: optional string` + + Body param: Specifies the geographic region for inference processing. If not specified, the workspace's `default_inference_geo` is used. + +- `--mcp-server: optional array of BetaRequestMCPServerURLDefinition` + + Body param: MCP servers to be utilized in this request + +- `--metadata: optional object { user_id }` + + Body param: An object describing metadata about the request. + +- `--output-config: optional object { effort, format }` + + Body param: Configuration options for the model's output, such as the output format. + +- `--output-format: optional object { schema, type }` + + Body param: Deprecated: Use `output_config.format` instead. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) + + A schema to specify Claude's output format in responses. This parameter will be removed in a future release. + +- `--service-tier: optional "auto" or "standard_only"` + + Body param: Determines whether to use priority capacity (if available) or standard capacity for this request. + + Anthropic offers different levels of service for your API requests. See [service-tiers](https://docs.claude.com/en/api/service-tiers) for details. + +- `--speed: optional "standard" or "fast"` + + Body param: The inference speed mode for this request. `"fast"` enables high output-tokens-per-second inference. + +- `--stop-sequence: optional array of string` + + Body param: Custom text sequences that will cause the model to stop generating. + + Our models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `"end_turn"`. + + If you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `"stop_sequence"` and the response `stop_sequence` value will contain the matched stop sequence. + +- `--system: optional string or array of BetaTextBlockParam` + + Body param: System prompt. + + A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts). + +- `--temperature: optional number` + + Body param: Amount of randomness injected into the response. + + Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks. + + Note that even with `temperature` of `0.0`, the results will not be fully deterministic. + +- `--thinking: optional BetaThinkingConfigEnabled or BetaThinkingConfigDisabled or BetaThinkingConfigAdaptive` + + Body param: Configuration for enabling Claude's extended thinking. + + When enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit. + + See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details. + +- `--tool-choice: optional BetaToolChoiceAuto or BetaToolChoiceAny or BetaToolChoiceTool or BetaToolChoiceNone` + + Body param: How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all. + +- `--tool: optional array of BetaToolUnion` + + Body param: Definitions of tools that the model may use. + + If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks. + + There are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)). + + Each tool definition includes: + + * `name`: Name of the tool. + * `description`: Optional, but strongly-recommended description of the tool. + * `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks. + + For example, if you defined `tools` as: + + ```json + [ + { + "name": "get_stock_price", + "description": "Get the current stock price for a given ticker symbol.", + "input_schema": { + "type": "object", + "properties": { + "ticker": { + "type": "string", + "description": "The stock ticker symbol, e.g. AAPL for Apple Inc." + } + }, + "required": ["ticker"] + } + } + ] + ``` + + And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this: + + ```json + [ + { + "type": "tool_use", + "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "name": "get_stock_price", + "input": { "ticker": "^GSPC" } + } + ] + ``` + + You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message: + + ```json + [ + { + "type": "tool_result", + "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "content": "259.75 USD" + } + ] + ``` + + Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output. + + See our [guide](https://docs.claude.com/en/docs/tool-use) for more details. + +- `--top-k: optional number` + + Body param: Only sample from the top K options for each subsequent token. + + Used to remove "long tail" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277). + + Recommended for advanced use cases only. You usually only need to use `temperature`. + +- `--top-p: optional number` + + Body param: Use nucleus sampling. + + In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both. + + Recommended for advanced use cases only. You usually only need to use `temperature`. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_message: object { id, container, content, 8 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at, skills }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `skills: array of BetaSkill` + + Skills loaded in the container + + - `skill_id: string` + + Skill ID + + - `type: "anthropic" or "custom"` + + Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + + - `"anthropic"` + + - `"custom"` + + - `version: string` + + Skill version or 'latest' for most recent version + + - `content: array of BetaContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `beta_text_block: object { citations, text, type }` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `beta_thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `beta_redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `beta_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_server_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_search_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebSearchToolResultError or array of BetaWebSearchResultBlock` + + - `beta_web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of BetaWebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_web_fetch_tool_result_block: object { content, tool_use_id, type, caller }` + + - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock` + + - `beta_web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `beta_web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: BetaBase64PDFSource or BetaPlainTextSource` + + - `beta_base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `beta_plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120` + + Tool invocation directly from the model. + + - `beta_direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `beta_server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `beta_server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `beta_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaCodeExecutionToolResultError or BetaCodeExecutionResultBlock or BetaEncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `beta_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `beta_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `beta_encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of BetaCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `beta_bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock` + + - `beta_bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `beta_bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BetaBashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `beta_text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock` + + - `beta_text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `beta_text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `beta_text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `beta_text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `beta_tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock` + + - `beta_tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `beta_tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of BetaToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `beta_mcp_tool_use_block: object { id, input, name, 2 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + The name of the MCP tool + + - `server_name: string` + + The name of the MCP server + + - `type: "mcp_tool_use"` + + - `beta_mcp_tool_result_block: object { content, is_error, tool_use_id, type }` + + - `content: string or array of BetaTextBlock` + + - `union_member_0: string` + + - `beta_mcp_tool_result_block_content: array of BetaTextBlock` + + - `citations: array of BetaTextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `beta_citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `beta_citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `beta_citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `beta_citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `beta_citation_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `is_error: boolean` + + - `tool_use_id: string` + + - `type: "mcp_tool_result"` + + - `beta_container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `beta_compaction_block: object { content, type }` + + A compaction block returned when autocompact is triggered. + + When content is None, it indicates the compaction failed to produce a valid + summary (e.g., malformed output from the model). Clients may round-trip + compaction blocks with null content; the server treats them as no-ops. + + - `content: string` + + Summary of compacted content, or null if compaction failed + + - `type: "compaction"` + + - `context_management: object { applied_edits }` + + Context management response. + + Information about context management strategies applied during the request. + + - `applied_edits: array of BetaClearToolUses20250919EditResponse or BetaClearThinking20251015EditResponse` + + List of context management edits that were applied. + + - `beta_clear_tool_uses_20250919_edit_response: object { cleared_input_tokens, cleared_tool_uses, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_tool_uses: number` + + Number of tool uses that were cleared. + + - `type: "clear_tool_uses_20250919"` + + The type of context management edit applied. + + - `beta_clear_thinking_20251015_edit_response: object { cleared_input_tokens, cleared_thinking_turns, type }` + + - `cleared_input_tokens: number` + + Number of input tokens cleared by this edit. + + - `cleared_thinking_turns: number` + + Number of thinking turns that were cleared. + + - `type: "clear_thinking_20251015"` + + The type of context management edit applied. + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 5 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"compaction"` + + - `"refusal"` + + - `"model_context_window_exceeded"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 7 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `iterations: array of BetaMessageIterationUsage or BetaCompactionIterationUsage` + + Per-iteration token usage breakdown. + + Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: + + - Determine which iterations exceeded long context thresholds (>=200k tokens) + - Calculate the true context window size from the last iteration + - Understand token accumulation across server-side tool use loops + + - `beta_message_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a sampling iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "message"` + + Usage for a sampling iteration + + - `beta_compaction_iteration_usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }` + + Token usage for a compaction iteration. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `type: "compaction"` + + Usage for a compaction iteration + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `speed: "standard" or "fast"` + + The inference speed mode used for this request. + + - `"standard"` + + - `"fast"` + +### Example + +```cli +ant beta:messages create \ + --api-key my-anthropic-api-key \ + --max-tokens 1024 \ + --message '{content: [{text: x, type: text}], role: user}' \ + --model claude-opus-4-6 +``` diff --git a/content/en/api/cli/beta/models.md b/content/en/api/cli/beta/models.md index b49b133e5..9a2649b75 100644 --- a/content/en/api/cli/beta/models.md +++ b/content/en/api/cli/beta/models.md @@ -1 +1,920 @@ -Not Found - Claude API Docs
                                      \ No newline at end of file +# Models + +## List + +`$ ant beta:models list` + +**get** `/v1/models` + +List available models. + +The Models API response can be used to determine which models are available for use in the API. More recently released models are listed first. + +### Parameters + +- `--after-id: optional string` + + Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object. + +- `--before-id: optional string` + + Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object. + +- `--limit: optional number` + + Query param: Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaListResponse_ModelInfo_: object { data, first_id, has_more, last_id }` + + - `data: array of BetaModelInfo` + + - `id: string` + + Unique model identifier. + + - `capabilities: object { batch, citations, code_execution, 6 more }` + + Model capability information. + + - `batch: object { supported }` + + Whether the model supports the Batch API. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `citations: object { supported }` + + Whether the model supports citation generation. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `code_execution: object { supported }` + + Whether the model supports code execution tools. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `context_management: object { clear_thinking_20251015, clear_tool_uses_20250919, compact_20260112, supported }` + + Context management support and available strategies. + + - `clear_thinking_20251015: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `clear_tool_uses_20250919: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `compact_20260112: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `effort: object { high, low, max, 2 more }` + + Effort (reasoning_effort) support and available levels. + + - `high: object { supported }` + + Whether the model supports high effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `low: object { supported }` + + Whether the model supports low effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `max: object { supported }` + + Whether the model supports max effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `medium: object { supported }` + + Whether the model supports medium effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `image_input: object { supported }` + + Whether the model accepts image content blocks. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `pdf_input: object { supported }` + + Whether the model accepts PDF content blocks. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `structured_outputs: object { supported }` + + Whether the model supports structured output / JSON mode / strict tool schemas. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `thinking: object { supported, types }` + + Thinking capability and supported type configurations. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `types: object { adaptive, enabled }` + + Supported thinking type configurations. + + - `adaptive: object { supported }` + + Whether the model supports thinking with type 'adaptive' (auto). + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `enabled: object { supported }` + + Whether the model supports thinking with type 'enabled'. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown. + + - `display_name: string` + + A human-readable name for the model. + + - `max_input_tokens: number` + + Maximum input context window size in tokens for this model. + + - `max_tokens: number` + + Maximum value for the `max_tokens` parameter when using this model. + + - `type: "model"` + + Object type. + + For Models, this is always `"model"`. + + - `first_id: string` + + First ID in the `data` list. Can be used as the `before_id` for the previous page. + + - `has_more: boolean` + + Indicates if there are more results in the requested page direction. + + - `last_id: string` + + Last ID in the `data` list. Can be used as the `after_id` for the next page. + +### Example + +```cli +ant beta:models list \ + --api-key my-anthropic-api-key +``` + +## Retrieve + +`$ ant beta:models retrieve` + +**get** `/v1/models/{model_id}` + +Get a specific model. + +The Models API response can be used to determine information about a specific model or resolve a model alias to a model ID. + +### Parameters + +- `--model-id: string` + + Model identifier or alias. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_model_info: object { id, capabilities, created_at, 4 more }` + + - `id: string` + + Unique model identifier. + + - `capabilities: object { batch, citations, code_execution, 6 more }` + + Model capability information. + + - `batch: object { supported }` + + Whether the model supports the Batch API. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `citations: object { supported }` + + Whether the model supports citation generation. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `code_execution: object { supported }` + + Whether the model supports code execution tools. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `context_management: object { clear_thinking_20251015, clear_tool_uses_20250919, compact_20260112, supported }` + + Context management support and available strategies. + + - `clear_thinking_20251015: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `clear_tool_uses_20250919: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `compact_20260112: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `effort: object { high, low, max, 2 more }` + + Effort (reasoning_effort) support and available levels. + + - `high: object { supported }` + + Whether the model supports high effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `low: object { supported }` + + Whether the model supports low effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `max: object { supported }` + + Whether the model supports max effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `medium: object { supported }` + + Whether the model supports medium effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `image_input: object { supported }` + + Whether the model accepts image content blocks. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `pdf_input: object { supported }` + + Whether the model accepts PDF content blocks. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `structured_outputs: object { supported }` + + Whether the model supports structured output / JSON mode / strict tool schemas. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `thinking: object { supported, types }` + + Thinking capability and supported type configurations. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `types: object { adaptive, enabled }` + + Supported thinking type configurations. + + - `adaptive: object { supported }` + + Whether the model supports thinking with type 'adaptive' (auto). + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `enabled: object { supported }` + + Whether the model supports thinking with type 'enabled'. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown. + + - `display_name: string` + + A human-readable name for the model. + + - `max_input_tokens: number` + + Maximum input context window size in tokens for this model. + + - `max_tokens: number` + + Maximum value for the `max_tokens` parameter when using this model. + + - `type: "model"` + + Object type. + + For Models, this is always `"model"`. + +### Example + +```cli +ant beta:models retrieve \ + --api-key my-anthropic-api-key \ + --model-id model_id +``` + +## Domain Types + +### Beta Capability Support + +- `beta_capability_support: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + +### Beta Context Management Capability + +- `beta_context_management_capability: object { clear_thinking_20251015, clear_tool_uses_20250919, compact_20260112, supported }` + + Context management capability details. + + - `clear_thinking_20251015: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `clear_tool_uses_20250919: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `compact_20260112: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + +### Beta Effort Capability + +- `beta_effort_capability: object { high, low, max, 2 more }` + + Effort (reasoning_effort) capability details. + + - `high: object { supported }` + + Whether the model supports high effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `low: object { supported }` + + Whether the model supports low effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `max: object { supported }` + + Whether the model supports max effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `medium: object { supported }` + + Whether the model supports medium effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + +### Beta Model Capabilities + +- `beta_model_capabilities: object { batch, citations, code_execution, 6 more }` + + Model capability information. + + - `batch: object { supported }` + + Whether the model supports the Batch API. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `citations: object { supported }` + + Whether the model supports citation generation. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `code_execution: object { supported }` + + Whether the model supports code execution tools. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `context_management: object { clear_thinking_20251015, clear_tool_uses_20250919, compact_20260112, supported }` + + Context management support and available strategies. + + - `clear_thinking_20251015: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `clear_tool_uses_20250919: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `compact_20260112: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `effort: object { high, low, max, 2 more }` + + Effort (reasoning_effort) support and available levels. + + - `high: object { supported }` + + Whether the model supports high effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `low: object { supported }` + + Whether the model supports low effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `max: object { supported }` + + Whether the model supports max effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `medium: object { supported }` + + Whether the model supports medium effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `image_input: object { supported }` + + Whether the model accepts image content blocks. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `pdf_input: object { supported }` + + Whether the model accepts PDF content blocks. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `structured_outputs: object { supported }` + + Whether the model supports structured output / JSON mode / strict tool schemas. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `thinking: object { supported, types }` + + Thinking capability and supported type configurations. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `types: object { adaptive, enabled }` + + Supported thinking type configurations. + + - `adaptive: object { supported }` + + Whether the model supports thinking with type 'adaptive' (auto). + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `enabled: object { supported }` + + Whether the model supports thinking with type 'enabled'. + + - `supported: boolean` + + Whether this capability is supported by the model. + +### Beta Model Info + +- `beta_model_info: object { id, capabilities, created_at, 4 more }` + + - `id: string` + + Unique model identifier. + + - `capabilities: object { batch, citations, code_execution, 6 more }` + + Model capability information. + + - `batch: object { supported }` + + Whether the model supports the Batch API. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `citations: object { supported }` + + Whether the model supports citation generation. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `code_execution: object { supported }` + + Whether the model supports code execution tools. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `context_management: object { clear_thinking_20251015, clear_tool_uses_20250919, compact_20260112, supported }` + + Context management support and available strategies. + + - `clear_thinking_20251015: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `clear_tool_uses_20250919: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `compact_20260112: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `effort: object { high, low, max, 2 more }` + + Effort (reasoning_effort) support and available levels. + + - `high: object { supported }` + + Whether the model supports high effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `low: object { supported }` + + Whether the model supports low effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `max: object { supported }` + + Whether the model supports max effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `medium: object { supported }` + + Whether the model supports medium effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `image_input: object { supported }` + + Whether the model accepts image content blocks. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `pdf_input: object { supported }` + + Whether the model accepts PDF content blocks. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `structured_outputs: object { supported }` + + Whether the model supports structured output / JSON mode / strict tool schemas. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `thinking: object { supported, types }` + + Thinking capability and supported type configurations. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `types: object { adaptive, enabled }` + + Supported thinking type configurations. + + - `adaptive: object { supported }` + + Whether the model supports thinking with type 'adaptive' (auto). + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `enabled: object { supported }` + + Whether the model supports thinking with type 'enabled'. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown. + + - `display_name: string` + + A human-readable name for the model. + + - `max_input_tokens: number` + + Maximum input context window size in tokens for this model. + + - `max_tokens: number` + + Maximum value for the `max_tokens` parameter when using this model. + + - `type: "model"` + + Object type. + + For Models, this is always `"model"`. + +### Beta Thinking Capability + +- `beta_thinking_capability: object { supported, types }` + + Thinking capability details. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `types: object { adaptive, enabled }` + + Supported thinking type configurations. + + - `adaptive: object { supported }` + + Whether the model supports thinking with type 'adaptive' (auto). + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `enabled: object { supported }` + + Whether the model supports thinking with type 'enabled'. + + - `supported: boolean` + + Whether this capability is supported by the model. + +### Beta Thinking Types + +- `beta_thinking_types: object { adaptive, enabled }` + + Supported thinking type configurations. + + - `adaptive: object { supported }` + + Whether the model supports thinking with type 'adaptive' (auto). + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `enabled: object { supported }` + + Whether the model supports thinking with type 'enabled'. + + - `supported: boolean` + + Whether this capability is supported by the model. diff --git a/content/en/api/cli/beta/models/list.md b/content/en/api/cli/beta/models/list.md index d4238aa95..dd6086bb1 100644 --- a/content/en/api/cli/beta/models/list.md +++ b/content/en/api/cli/beta/models/list.md @@ -1 +1,232 @@ -Not Found - Claude API Docs
                                        \ No newline at end of file +## List + +`$ ant beta:models list` + +**get** `/v1/models` + +List available models. + +The Models API response can be used to determine which models are available for use in the API. More recently released models are listed first. + +### Parameters + +- `--after-id: optional string` + + Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object. + +- `--before-id: optional string` + + Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object. + +- `--limit: optional number` + + Query param: Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaListResponse_ModelInfo_: object { data, first_id, has_more, last_id }` + + - `data: array of BetaModelInfo` + + - `id: string` + + Unique model identifier. + + - `capabilities: object { batch, citations, code_execution, 6 more }` + + Model capability information. + + - `batch: object { supported }` + + Whether the model supports the Batch API. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `citations: object { supported }` + + Whether the model supports citation generation. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `code_execution: object { supported }` + + Whether the model supports code execution tools. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `context_management: object { clear_thinking_20251015, clear_tool_uses_20250919, compact_20260112, supported }` + + Context management support and available strategies. + + - `clear_thinking_20251015: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `clear_tool_uses_20250919: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `compact_20260112: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `effort: object { high, low, max, 2 more }` + + Effort (reasoning_effort) support and available levels. + + - `high: object { supported }` + + Whether the model supports high effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `low: object { supported }` + + Whether the model supports low effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `max: object { supported }` + + Whether the model supports max effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `medium: object { supported }` + + Whether the model supports medium effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `image_input: object { supported }` + + Whether the model accepts image content blocks. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `pdf_input: object { supported }` + + Whether the model accepts PDF content blocks. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `structured_outputs: object { supported }` + + Whether the model supports structured output / JSON mode / strict tool schemas. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `thinking: object { supported, types }` + + Thinking capability and supported type configurations. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `types: object { adaptive, enabled }` + + Supported thinking type configurations. + + - `adaptive: object { supported }` + + Whether the model supports thinking with type 'adaptive' (auto). + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `enabled: object { supported }` + + Whether the model supports thinking with type 'enabled'. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown. + + - `display_name: string` + + A human-readable name for the model. + + - `max_input_tokens: number` + + Maximum input context window size in tokens for this model. + + - `max_tokens: number` + + Maximum value for the `max_tokens` parameter when using this model. + + - `type: "model"` + + Object type. + + For Models, this is always `"model"`. + + - `first_id: string` + + First ID in the `data` list. Can be used as the `before_id` for the previous page. + + - `has_more: boolean` + + Indicates if there are more results in the requested page direction. + + - `last_id: string` + + Last ID in the `data` list. Can be used as the `after_id` for the next page. + +### Example + +```cli +ant beta:models list \ + --api-key my-anthropic-api-key +``` diff --git a/content/en/api/cli/beta/models/retrieve.md b/content/en/api/cli/beta/models/retrieve.md index 73e3324ff..480fd3578 100644 --- a/content/en/api/cli/beta/models/retrieve.md +++ b/content/en/api/cli/beta/models/retrieve.md @@ -1 +1,209 @@ -Not Found - Claude API Docs
                                          \ No newline at end of file +## Retrieve + +`$ ant beta:models retrieve` + +**get** `/v1/models/{model_id}` + +Get a specific model. + +The Models API response can be used to determine information about a specific model or resolve a model alias to a model ID. + +### Parameters + +- `--model-id: string` + + Model identifier or alias. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_model_info: object { id, capabilities, created_at, 4 more }` + + - `id: string` + + Unique model identifier. + + - `capabilities: object { batch, citations, code_execution, 6 more }` + + Model capability information. + + - `batch: object { supported }` + + Whether the model supports the Batch API. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `citations: object { supported }` + + Whether the model supports citation generation. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `code_execution: object { supported }` + + Whether the model supports code execution tools. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `context_management: object { clear_thinking_20251015, clear_tool_uses_20250919, compact_20260112, supported }` + + Context management support and available strategies. + + - `clear_thinking_20251015: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `clear_tool_uses_20250919: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `compact_20260112: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `effort: object { high, low, max, 2 more }` + + Effort (reasoning_effort) support and available levels. + + - `high: object { supported }` + + Whether the model supports high effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `low: object { supported }` + + Whether the model supports low effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `max: object { supported }` + + Whether the model supports max effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `medium: object { supported }` + + Whether the model supports medium effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `image_input: object { supported }` + + Whether the model accepts image content blocks. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `pdf_input: object { supported }` + + Whether the model accepts PDF content blocks. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `structured_outputs: object { supported }` + + Whether the model supports structured output / JSON mode / strict tool schemas. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `thinking: object { supported, types }` + + Thinking capability and supported type configurations. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `types: object { adaptive, enabled }` + + Supported thinking type configurations. + + - `adaptive: object { supported }` + + Whether the model supports thinking with type 'adaptive' (auto). + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `enabled: object { supported }` + + Whether the model supports thinking with type 'enabled'. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown. + + - `display_name: string` + + A human-readable name for the model. + + - `max_input_tokens: number` + + Maximum input context window size in tokens for this model. + + - `max_tokens: number` + + Maximum value for the `max_tokens` parameter when using this model. + + - `type: "model"` + + Object type. + + For Models, this is always `"model"`. + +### Example + +```cli +ant beta:models retrieve \ + --api-key my-anthropic-api-key \ + --model-id model_id +``` diff --git a/content/en/api/cli/beta/sessions.md b/content/en/api/cli/beta/sessions.md new file mode 100644 index 000000000..c72f94a90 --- /dev/null +++ b/content/en/api/cli/beta/sessions.md @@ -0,0 +1,12932 @@ +# Sessions + +## Create + +`$ ant beta:sessions create` + +**post** `/v1/sessions` + +Create Session + +### Parameters + +- `--agent: string or BetaManagedAgentsAgentParams` + + Body param: Agent identifier. Accepts the `agent` ID string, which pins the latest version for the session, or an `agent` object with both id and version specified. + +- `--environment-id: string` + + Body param: ID of the `environment` defining the container configuration for this session. + +- `--metadata: optional map[string]` + + Body param: Arbitrary key-value metadata attached to the session. + +- `--resource: optional array of BetaManagedAgentsGitHubRepositoryResourceParams or BetaManagedAgentsFileResourceParams` + + Body param: Resources (e.g. repositories, files) to mount into the session's container. + +- `--title: optional string` + + Body param: Human-readable session title. + +- `--vault-id: optional array of string` + + Body param: Vault IDs for stored credentials the agent can use during the session. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_session: object { id, agent, archived_at, 11 more }` + + A Managed Agents `session`. + + - `id: string` + + - `agent: object { id, description, mcp_servers, 7 more }` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: object { active_seconds, duration_seconds }` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: object { cache_creation, cache_read_input_tokens, input_tokens, output_tokens }` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```cli +ant beta:sessions create \ + --api-key my-anthropic-api-key \ + --agent agent_011CZkYpogX7uDKUyvBTophP \ + --environment-id env_011CZkZ9X2dpNyB7HsEFoRfW +``` + +## List + +`$ ant beta:sessions list` + +**get** `/v1/sessions` + +List Sessions + +### Parameters + +- `--agent-id: optional string` + + Query param: Filter sessions created with this agent ID. + +- `--agent-version: optional number` + + Query param: Filter by agent version. Only applies when agent_id is also set. + +- `--created-at-gt: optional string` + + Query param: Return sessions created after this time (exclusive). + +- `--created-at-gte: optional string` + + Query param: Return sessions created at or after this time (inclusive). + +- `--created-at-lt: optional string` + + Query param: Return sessions created before this time (exclusive). + +- `--created-at-lte: optional string` + + Query param: Return sessions created at or before this time (inclusive). + +- `--include-archived: optional boolean` + + Query param: When true, includes archived sessions. Default: false (exclude archived). + +- `--limit: optional number` + + Query param: Maximum number of results to return. + +- `--order: optional "asc" or "desc"` + + Query param: Sort direction for results, ordered by created_at. Defaults to desc (newest first). + +- `--page: optional string` + + Query param: Opaque pagination cursor from a previous response's next_page. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaManagedAgentsListSessions: object { data, next_page }` + + Paginated list of sessions. + + - `data: optional array of BetaManagedAgentsSession` + + List of sessions. + + - `id: string` + + - `agent: object { id, description, mcp_servers, 7 more }` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: object { active_seconds, duration_seconds }` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: object { cache_creation, cache_read_input_tokens, input_tokens, output_tokens }` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + + - `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```cli +ant beta:sessions list \ + --api-key my-anthropic-api-key +``` + +## Retrieve + +`$ ant beta:sessions retrieve` + +**get** `/v1/sessions/{session_id}` + +Get Session + +### Parameters + +- `--session-id: string` + + Path parameter session_id + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_session: object { id, agent, archived_at, 11 more }` + + A Managed Agents `session`. + + - `id: string` + + - `agent: object { id, description, mcp_servers, 7 more }` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: object { active_seconds, duration_seconds }` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: object { cache_creation, cache_read_input_tokens, input_tokens, output_tokens }` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```cli +ant beta:sessions retrieve \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 +``` + +## Update + +`$ ant beta:sessions update` + +**post** `/v1/sessions/{session_id}` + +Update Session + +### Parameters + +- `--session-id: string` + + Path param: Path parameter session_id + +- `--metadata: optional map[string]` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. + +- `--title: optional string` + + Body param: Human-readable session title. + +- `--vault-id: optional array of string` + + Body param: Vault IDs (`vlt_*`) to attach to the session. Not yet supported; requests setting this field are rejected. Reserved for future use. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_session: object { id, agent, archived_at, 11 more }` + + A Managed Agents `session`. + + - `id: string` + + - `agent: object { id, description, mcp_servers, 7 more }` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: object { active_seconds, duration_seconds }` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: object { cache_creation, cache_read_input_tokens, input_tokens, output_tokens }` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```cli +ant beta:sessions update \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 +``` + +## Delete + +`$ ant beta:sessions delete` + +**delete** `/v1/sessions/{session_id}` + +Delete Session + +### Parameters + +- `--session-id: string` + + Path parameter session_id + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_deleted_session: object { id, type }` + + Confirmation that a `session` has been permanently deleted. + + - `id: string` + + - `type: "session_deleted"` + + - `"session_deleted"` + +### Example + +```cli +ant beta:sessions delete \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 +``` + +## Archive + +`$ ant beta:sessions archive` + +**post** `/v1/sessions/{session_id}/archive` + +Archive Session + +### Parameters + +- `--session-id: string` + + Path parameter session_id + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_session: object { id, agent, archived_at, 11 more }` + + A Managed Agents `session`. + + - `id: string` + + - `agent: object { id, description, mcp_servers, 7 more }` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: object { active_seconds, duration_seconds }` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: object { cache_creation, cache_read_input_tokens, input_tokens, output_tokens }` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```cli +ant beta:sessions archive \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 +``` + +## Domain Types + +### Beta Managed Agents Agent Params + +- `beta_managed_agents_agent_params: object { id, type, version }` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `id: string` + + The `agent` ID. + + - `type: "agent"` + + - `"agent"` + + - `version: optional number` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + +### Beta Managed Agents Branch Checkout + +- `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + +### Beta Managed Agents Cache Creation Usage + +- `beta_managed_agents_cache_creation_usage: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + +### Beta Managed Agents Commit Checkout + +- `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + +### Beta Managed Agents Deleted Session + +- `beta_managed_agents_deleted_session: object { id, type }` + + Confirmation that a `session` has been permanently deleted. + + - `id: string` + + - `type: "session_deleted"` + + - `"session_deleted"` + +### Beta Managed Agents File Resource Params + +- `beta_managed_agents_file_resource_params: object { file_id, type, mount_path }` + + Mount a file uploaded via the Files API into the session. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `mount_path: optional string` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +### Beta Managed Agents GitHub Repository Resource Params + +- `beta_managed_agents_github_repository_resource_params: object { authorization_token, type, url, 2 more }` + + Mount a GitHub repository into the session's container. + + - `authorization_token: string` + + GitHub authorization token used to clone the repository. + + - `type: "github_repository"` + + - `"github_repository"` + + - `url: string` + + Github URL of the repository + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `mount_path: optional string` + + Mount path in the container. Defaults to `/workspace/`. + +### Beta Managed Agents Session + +- `beta_managed_agents_session: object { id, agent, archived_at, 11 more }` + + A Managed Agents `session`. + + - `id: string` + + - `agent: object { id, description, mcp_servers, 7 more }` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: object { active_seconds, duration_seconds }` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: object { cache_creation, cache_read_input_tokens, input_tokens, output_tokens }` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Beta Managed Agents Session Agent + +- `beta_managed_agents_session_agent: object { id, description, mcp_servers, 7 more }` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + +### Beta Managed Agents Session Stats + +- `beta_managed_agents_session_stats: object { active_seconds, duration_seconds }` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + +### Beta Managed Agents Session Usage + +- `beta_managed_agents_session_usage: object { cache_creation, cache_read_input_tokens, input_tokens, output_tokens }` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + +# Events + +## List + +`$ ant beta:sessions:events list` + +**get** `/v1/sessions/{session_id}/events` + +List Events + +### Parameters + +- `--session-id: string` + + Path param: Path parameter session_id + +- `--limit: optional number` + + Query param: Query parameter for limit + +- `--order: optional "asc" or "desc"` + + Query param: Sort direction for results, ordered by created_at. Defaults to asc (chronological). + +- `--page: optional string` + + Query param: Opaque pagination cursor from a previous response's next_page. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaManagedAgentsListSessionEvents: object { data, next_page }` + + Paginated list of events for a `session`. + + - `data: optional array of BetaManagedAgentsSessionEvent` + + Events for the session, ordered by `created_at`. + + - `beta_managed_agents_user_message_event: object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_interrupt_event: object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_tool_confirmation_event: object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_custom_tool_result_event: object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_agent_custom_tool_use_event: object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `beta_managed_agents_agent_message_event: object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `beta_managed_agents_agent_thinking_event: object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `beta_managed_agents_agent_mcp_tool_use_event: object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `beta_managed_agents_agent_mcp_tool_result_event: object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `beta_managed_agents_agent_tool_use_event: object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `beta_managed_agents_agent_tool_result_event: object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `beta_managed_agents_agent_thread_context_compacted_event: object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `beta_managed_agents_session_error_event: object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `beta_managed_agents_unknown_error: object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `beta_managed_agents_model_overloaded_error: object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `beta_managed_agents_model_rate_limited_error: object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `beta_managed_agents_model_request_failed_error: object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `beta_managed_agents_mcp_connection_failed_error: object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `beta_managed_agents_mcp_authentication_failed_error: object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `beta_managed_agents_billing_error: object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `beta_managed_agents_session_status_rescheduled_event: object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `beta_managed_agents_session_status_running_event: object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `beta_managed_agents_session_status_idle_event: object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `beta_managed_agents_session_end_turn: object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `beta_managed_agents_session_requires_action: object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `beta_managed_agents_session_retries_exhausted: object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `beta_managed_agents_session_status_terminated_event: object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `beta_managed_agents_span_model_request_start_event: object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `beta_managed_agents_span_model_request_end_event: object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: object { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 2 more }` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `beta_managed_agents_session_deleted_event: object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + + - `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```cli +ant beta:sessions:events list \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 +``` + +## Send + +`$ ant beta:sessions:events send` + +**post** `/v1/sessions/{session_id}/events` + +Send Events + +### Parameters + +- `--session-id: string` + + Path param: Path parameter session_id + +- `--event: array of BetaManagedAgentsEventParams` + + Body param: Events to send to the `session`. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_send_session_events: object { data }` + + Events that were successfully sent to the session. + + - `data: optional array of BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or BetaManagedAgentsUserCustomToolResultEvent` + + Sent events + + - `beta_managed_agents_user_message_event: object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_interrupt_event: object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_tool_confirmation_event: object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_custom_tool_result_event: object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Example + +```cli +ant beta:sessions:events send \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 \ + --event "{content: [{text: 'Where is my order #1234?', type: text}], type: user.message}" +``` + +## Stream + +`$ ant beta:sessions:events stream` + +**get** `/v1/sessions/{session_id}/events/stream` + +Stream Events + +### Parameters + +- `--session-id: string` + + Path parameter session_id + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_stream_session_events: BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or 17 more` + + Server-sent event in the session stream. + + - `beta_managed_agents_user_message_event: object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_interrupt_event: object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_tool_confirmation_event: object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_custom_tool_result_event: object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_agent_custom_tool_use_event: object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `beta_managed_agents_agent_message_event: object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `beta_managed_agents_agent_thinking_event: object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `beta_managed_agents_agent_mcp_tool_use_event: object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `beta_managed_agents_agent_mcp_tool_result_event: object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `beta_managed_agents_agent_tool_use_event: object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `beta_managed_agents_agent_tool_result_event: object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `beta_managed_agents_agent_thread_context_compacted_event: object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `beta_managed_agents_session_error_event: object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `beta_managed_agents_unknown_error: object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `beta_managed_agents_model_overloaded_error: object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `beta_managed_agents_model_rate_limited_error: object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `beta_managed_agents_model_request_failed_error: object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `beta_managed_agents_mcp_connection_failed_error: object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `beta_managed_agents_mcp_authentication_failed_error: object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `beta_managed_agents_billing_error: object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `beta_managed_agents_session_status_rescheduled_event: object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `beta_managed_agents_session_status_running_event: object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `beta_managed_agents_session_status_idle_event: object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `beta_managed_agents_session_end_turn: object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `beta_managed_agents_session_requires_action: object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `beta_managed_agents_session_retries_exhausted: object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `beta_managed_agents_session_status_terminated_event: object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `beta_managed_agents_span_model_request_start_event: object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `beta_managed_agents_span_model_request_end_event: object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: object { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 2 more }` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `beta_managed_agents_session_deleted_event: object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Example + +```cli +ant beta:sessions:events stream \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 +``` + +## Domain Types + +### Beta Managed Agents Agent Custom Tool Use Event + +- `beta_managed_agents_agent_custom_tool_use_event: object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + +### Beta Managed Agents Agent MCP Tool Result Event + +- `beta_managed_agents_agent_mcp_tool_result_event: object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent MCP Tool Use Event + +- `beta_managed_agents_agent_mcp_tool_use_event: object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + +### Beta Managed Agents Agent Message Event + +- `beta_managed_agents_agent_message_event: object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + +### Beta Managed Agents Agent Thinking Event + +- `beta_managed_agents_agent_thinking_event: object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + +### Beta Managed Agents Agent Thread Context Compacted Event + +- `beta_managed_agents_agent_thread_context_compacted_event: object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + +### Beta Managed Agents Agent Tool Result Event + +- `beta_managed_agents_agent_tool_result_event: object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent Tool Use Event + +- `beta_managed_agents_agent_tool_use_event: object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + +### Beta Managed Agents Base64 Document Source + +- `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + +### Beta Managed Agents Base64 Image Source + +- `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + +### Beta Managed Agents Billing Error + +- `beta_managed_agents_billing_error: object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + +### Beta Managed Agents Document Block + +- `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + +### Beta Managed Agents Event Params + +- `beta_managed_agents_event_params: BetaManagedAgentsUserMessageEventParams or BetaManagedAgentsUserInterruptEventParams or BetaManagedAgentsUserToolConfirmationEventParams or BetaManagedAgentsUserCustomToolResultEventParams` + + Union type for event parameters that can be sent to a session. + + - `beta_managed_agents_user_message_event_params: object { content, type }` + + Parameters for sending a user message to the session. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks for the user message. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `beta_managed_agents_user_interrupt_event_params: object { type }` + + Parameters for sending an interrupt to pause the agent. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `beta_managed_agents_user_tool_confirmation_event_params: object { result, tool_use_id, type, deny_message }` + + Parameters for confirming or denying a tool execution request. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `beta_managed_agents_user_custom_tool_result_event_params: object { custom_tool_use_id, type, content, is_error }` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents File Document Source + +- `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + +### Beta Managed Agents File Image Source + +- `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + +### Beta Managed Agents Image Block + +- `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + +### Beta Managed Agents MCP Authentication Failed Error + +- `beta_managed_agents_mcp_authentication_failed_error: object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + +### Beta Managed Agents MCP Connection Failed Error + +- `beta_managed_agents_mcp_connection_failed_error: object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + +### Beta Managed Agents Model Overloaded Error + +- `beta_managed_agents_model_overloaded_error: object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + +### Beta Managed Agents Model Rate Limited Error + +- `beta_managed_agents_model_rate_limited_error: object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + +### Beta Managed Agents Model Request Failed Error + +- `beta_managed_agents_model_request_failed_error: object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + +### Beta Managed Agents Plain Text Document Source + +- `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + +### Beta Managed Agents Retry Status Exhausted + +- `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + +### Beta Managed Agents Retry Status Retrying + +- `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + +### Beta Managed Agents Retry Status Terminal + +- `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + +### Beta Managed Agents Send Session Events + +- `beta_managed_agents_send_session_events: object { data }` + + Events that were successfully sent to the session. + + - `data: optional array of BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or BetaManagedAgentsUserCustomToolResultEvent` + + Sent events + + - `beta_managed_agents_user_message_event: object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_interrupt_event: object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_tool_confirmation_event: object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_custom_tool_result_event: object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents Session Deleted Event + +- `beta_managed_agents_session_deleted_event: object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Beta Managed Agents Session End Turn + +- `beta_managed_agents_session_end_turn: object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + +### Beta Managed Agents Session Error Event + +- `beta_managed_agents_session_error_event: object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `beta_managed_agents_unknown_error: object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `beta_managed_agents_model_overloaded_error: object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `beta_managed_agents_model_rate_limited_error: object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `beta_managed_agents_model_request_failed_error: object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `beta_managed_agents_mcp_connection_failed_error: object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `beta_managed_agents_mcp_authentication_failed_error: object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `beta_managed_agents_billing_error: object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + +### Beta Managed Agents Session Event + +- `beta_managed_agents_session_event: BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or 17 more` + + Union type for all event types in a session. + + - `beta_managed_agents_user_message_event: object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_interrupt_event: object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_tool_confirmation_event: object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_custom_tool_result_event: object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_agent_custom_tool_use_event: object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `beta_managed_agents_agent_message_event: object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `beta_managed_agents_agent_thinking_event: object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `beta_managed_agents_agent_mcp_tool_use_event: object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `beta_managed_agents_agent_mcp_tool_result_event: object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `beta_managed_agents_agent_tool_use_event: object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `beta_managed_agents_agent_tool_result_event: object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `beta_managed_agents_agent_thread_context_compacted_event: object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `beta_managed_agents_session_error_event: object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `beta_managed_agents_unknown_error: object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `beta_managed_agents_model_overloaded_error: object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `beta_managed_agents_model_rate_limited_error: object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `beta_managed_agents_model_request_failed_error: object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `beta_managed_agents_mcp_connection_failed_error: object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `beta_managed_agents_mcp_authentication_failed_error: object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `beta_managed_agents_billing_error: object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `beta_managed_agents_session_status_rescheduled_event: object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `beta_managed_agents_session_status_running_event: object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `beta_managed_agents_session_status_idle_event: object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `beta_managed_agents_session_end_turn: object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `beta_managed_agents_session_requires_action: object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `beta_managed_agents_session_retries_exhausted: object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `beta_managed_agents_session_status_terminated_event: object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `beta_managed_agents_span_model_request_start_event: object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `beta_managed_agents_span_model_request_end_event: object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: object { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 2 more }` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `beta_managed_agents_session_deleted_event: object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Beta Managed Agents Session Requires Action + +- `beta_managed_agents_session_requires_action: object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + +### Beta Managed Agents Session Retries Exhausted + +- `beta_managed_agents_session_retries_exhausted: object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + +### Beta Managed Agents Session Status Idle Event + +- `beta_managed_agents_session_status_idle_event: object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `beta_managed_agents_session_end_turn: object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `beta_managed_agents_session_requires_action: object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `beta_managed_agents_session_retries_exhausted: object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + +### Beta Managed Agents Session Status Rescheduled Event + +- `beta_managed_agents_session_status_rescheduled_event: object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + +### Beta Managed Agents Session Status Running Event + +- `beta_managed_agents_session_status_running_event: object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + +### Beta Managed Agents Session Status Terminated Event + +- `beta_managed_agents_session_status_terminated_event: object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + +### Beta Managed Agents Span Model Request End Event + +- `beta_managed_agents_span_model_request_end_event: object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: object { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 2 more }` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + +### Beta Managed Agents Span Model Request Start Event + +- `beta_managed_agents_span_model_request_start_event: object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + +### Beta Managed Agents Span Model Usage + +- `beta_managed_agents_span_model_usage: object { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 2 more }` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +### Beta Managed Agents Stream Session Events + +- `beta_managed_agents_stream_session_events: BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or 17 more` + + Server-sent event in the session stream. + + - `beta_managed_agents_user_message_event: object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_interrupt_event: object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_tool_confirmation_event: object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_custom_tool_result_event: object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_agent_custom_tool_use_event: object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `beta_managed_agents_agent_message_event: object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `beta_managed_agents_agent_thinking_event: object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `beta_managed_agents_agent_mcp_tool_use_event: object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `beta_managed_agents_agent_mcp_tool_result_event: object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `beta_managed_agents_agent_tool_use_event: object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `beta_managed_agents_agent_tool_result_event: object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `beta_managed_agents_agent_thread_context_compacted_event: object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `beta_managed_agents_session_error_event: object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `beta_managed_agents_unknown_error: object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `beta_managed_agents_model_overloaded_error: object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `beta_managed_agents_model_rate_limited_error: object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `beta_managed_agents_model_request_failed_error: object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `beta_managed_agents_mcp_connection_failed_error: object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `beta_managed_agents_mcp_authentication_failed_error: object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `beta_managed_agents_billing_error: object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `beta_managed_agents_session_status_rescheduled_event: object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `beta_managed_agents_session_status_running_event: object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `beta_managed_agents_session_status_idle_event: object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `beta_managed_agents_session_end_turn: object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `beta_managed_agents_session_requires_action: object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `beta_managed_agents_session_retries_exhausted: object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `beta_managed_agents_session_status_terminated_event: object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `beta_managed_agents_span_model_request_start_event: object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `beta_managed_agents_span_model_request_end_event: object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: object { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 2 more }` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `beta_managed_agents_session_deleted_event: object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Beta Managed Agents Text Block + +- `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + +### Beta Managed Agents Unknown Error + +- `beta_managed_agents_unknown_error: object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + +### Beta Managed Agents URL Document Source + +- `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + +### Beta Managed Agents URL Image Source + +- `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + +### Beta Managed Agents User Custom Tool Result Event + +- `beta_managed_agents_user_custom_tool_result_event: object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Custom Tool Result Event Params + +- `beta_managed_agents_user_custom_tool_result_event_params: object { custom_tool_use_id, type, content, is_error }` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents User Interrupt Event + +- `beta_managed_agents_user_interrupt_event: object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Interrupt Event Params + +- `beta_managed_agents_user_interrupt_event_params: object { type }` + + Parameters for sending an interrupt to pause the agent. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + +### Beta Managed Agents User Message Event + +- `beta_managed_agents_user_message_event: object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Message Event Params + +- `beta_managed_agents_user_message_event_params: object { content, type }` + + Parameters for sending a user message to the session. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks for the user message. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + +### Beta Managed Agents User Tool Confirmation Event + +- `beta_managed_agents_user_tool_confirmation_event: object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Tool Confirmation Event Params + +- `beta_managed_agents_user_tool_confirmation_event_params: object { result, tool_use_id, type, deny_message }` + + Parameters for confirming or denying a tool execution request. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + +# Resources + +## Add + +`$ ant beta:sessions:resources add` + +**post** `/v1/sessions/{session_id}/resources` + +Add Session Resource + +### Parameters + +- `--session-id: string` + + Path param: Path parameter session_id + +- `--file-id: string` + + Body param: ID of a previously uploaded file. + +- `--type: "file"` + + Body param + +- `--mount-path: optional string` + + Body param: Mount path in the container. Defaults to `/mnt/session/uploads/`. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```cli +ant beta:sessions:resources add \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 \ + --file-id file_011CNha8iCJcU1wXNR6q4V8w \ + --type file +``` + +## List + +`$ ant beta:sessions:resources list` + +**get** `/v1/sessions/{session_id}/resources` + +List Session Resources + +### Parameters + +- `--session-id: string` + + Path param: Path parameter session_id + +- `--limit: optional number` + + Query param: Maximum number of resources to return per page (max 1000). If omitted, returns all resources. + +- `--page: optional string` + + Query param: Opaque cursor from a previous response's next_page field. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaManagedAgentsListSessionResources: object { data, next_page }` + + Paginated list of resources attached to a session. + + - `data: array of BetaManagedAgentsSessionResource` + + Resources for the session, ordered by `created_at`. + + - `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```cli +ant beta:sessions:resources list \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 +``` + +## Retrieve + +`$ ant beta:sessions:resources retrieve` + +**get** `/v1/sessions/{session_id}/resources/{resource_id}` + +Get Session Resource + +### Parameters + +- `--session-id: string` + + Path param: Path parameter session_id + +- `--resource-id: string` + + Path param: Path parameter resource_id + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaSessionResourceGetResponse: BetaManagedAgentsGitHubRepositoryResource or BetaManagedAgentsFileResource` + + The requested session resource. + + - `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```cli +ant beta:sessions:resources retrieve \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 \ + --resource-id sesrsc_011CZkZBJq5dWxk9fVLNcPht +``` + +## Update + +`$ ant beta:sessions:resources update` + +**post** `/v1/sessions/{session_id}/resources/{resource_id}` + +Update Session Resource + +### Parameters + +- `--session-id: string` + + Path param: Path parameter session_id + +- `--resource-id: string` + + Path param: Path parameter resource_id + +- `--authorization-token: string` + + Body param: New authorization token for the resource. Currently only `github_repository` resources support token rotation. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaSessionResourceUpdateResponse: BetaManagedAgentsGitHubRepositoryResource or BetaManagedAgentsFileResource` + + The updated session resource. + + - `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```cli +ant beta:sessions:resources update \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 \ + --resource-id sesrsc_011CZkZBJq5dWxk9fVLNcPht \ + --authorization-token ghp_exampletoken +``` + +## Delete + +`$ ant beta:sessions:resources delete` + +**delete** `/v1/sessions/{session_id}/resources/{resource_id}` + +Delete Session Resource + +### Parameters + +- `--session-id: string` + + Path param: Path parameter session_id + +- `--resource-id: string` + + Path param: Path parameter resource_id + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_delete_session_resource: object { id, type }` + + Confirmation of resource deletion. + + - `id: string` + + - `type: "session_resource_deleted"` + + - `"session_resource_deleted"` + +### Example + +```cli +ant beta:sessions:resources delete \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 \ + --resource-id sesrsc_011CZkZBJq5dWxk9fVLNcPht +``` + +## Domain Types + +### Beta Managed Agents Delete Session Resource + +- `beta_managed_agents_delete_session_resource: object { id, type }` + + Confirmation of resource deletion. + + - `id: string` + + - `type: "session_resource_deleted"` + + - `"session_resource_deleted"` + +### Beta Managed Agents File Resource + +- `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents GitHub Repository Resource + +- `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + +### Beta Managed Agents Session Resource + +- `beta_managed_agents_session_resource: BetaManagedAgentsGitHubRepositoryResource or BetaManagedAgentsFileResource` + + - `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format diff --git a/content/en/api/cli/beta/sessions/archive.md b/content/en/api/cli/beta/sessions/archive.md new file mode 100644 index 000000000..32d02d78f --- /dev/null +++ b/content/en/api/cli/beta/sessions/archive.md @@ -0,0 +1,447 @@ +## Archive + +`$ ant beta:sessions archive` + +**post** `/v1/sessions/{session_id}/archive` + +Archive Session + +### Parameters + +- `--session-id: string` + + Path parameter session_id + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_session: object { id, agent, archived_at, 11 more }` + + A Managed Agents `session`. + + - `id: string` + + - `agent: object { id, description, mcp_servers, 7 more }` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: object { active_seconds, duration_seconds }` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: object { cache_creation, cache_read_input_tokens, input_tokens, output_tokens }` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```cli +ant beta:sessions archive \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 +``` diff --git a/content/en/api/cli/beta/sessions/create.md b/content/en/api/cli/beta/sessions/create.md new file mode 100644 index 000000000..be08c2d34 --- /dev/null +++ b/content/en/api/cli/beta/sessions/create.md @@ -0,0 +1,468 @@ +## Create + +`$ ant beta:sessions create` + +**post** `/v1/sessions` + +Create Session + +### Parameters + +- `--agent: string or BetaManagedAgentsAgentParams` + + Body param: Agent identifier. Accepts the `agent` ID string, which pins the latest version for the session, or an `agent` object with both id and version specified. + +- `--environment-id: string` + + Body param: ID of the `environment` defining the container configuration for this session. + +- `--metadata: optional map[string]` + + Body param: Arbitrary key-value metadata attached to the session. + +- `--resource: optional array of BetaManagedAgentsGitHubRepositoryResourceParams or BetaManagedAgentsFileResourceParams` + + Body param: Resources (e.g. repositories, files) to mount into the session's container. + +- `--title: optional string` + + Body param: Human-readable session title. + +- `--vault-id: optional array of string` + + Body param: Vault IDs for stored credentials the agent can use during the session. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_session: object { id, agent, archived_at, 11 more }` + + A Managed Agents `session`. + + - `id: string` + + - `agent: object { id, description, mcp_servers, 7 more }` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: object { active_seconds, duration_seconds }` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: object { cache_creation, cache_read_input_tokens, input_tokens, output_tokens }` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```cli +ant beta:sessions create \ + --api-key my-anthropic-api-key \ + --agent agent_011CZkYpogX7uDKUyvBTophP \ + --environment-id env_011CZkZ9X2dpNyB7HsEFoRfW +``` diff --git a/content/en/api/cli/beta/sessions/delete.md b/content/en/api/cli/beta/sessions/delete.md new file mode 100644 index 000000000..b08d5960d --- /dev/null +++ b/content/en/api/cli/beta/sessions/delete.md @@ -0,0 +1,37 @@ +## Delete + +`$ ant beta:sessions delete` + +**delete** `/v1/sessions/{session_id}` + +Delete Session + +### Parameters + +- `--session-id: string` + + Path parameter session_id + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_deleted_session: object { id, type }` + + Confirmation that a `session` has been permanently deleted. + + - `id: string` + + - `type: "session_deleted"` + + - `"session_deleted"` + +### Example + +```cli +ant beta:sessions delete \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 +``` diff --git a/content/en/api/cli/beta/sessions/events.md b/content/en/api/cli/beta/sessions/events.md new file mode 100644 index 000000000..6de98f456 --- /dev/null +++ b/content/en/api/cli/beta/sessions/events.md @@ -0,0 +1,9136 @@ +# Events + +## List + +`$ ant beta:sessions:events list` + +**get** `/v1/sessions/{session_id}/events` + +List Events + +### Parameters + +- `--session-id: string` + + Path param: Path parameter session_id + +- `--limit: optional number` + + Query param: Query parameter for limit + +- `--order: optional "asc" or "desc"` + + Query param: Sort direction for results, ordered by created_at. Defaults to asc (chronological). + +- `--page: optional string` + + Query param: Opaque pagination cursor from a previous response's next_page. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaManagedAgentsListSessionEvents: object { data, next_page }` + + Paginated list of events for a `session`. + + - `data: optional array of BetaManagedAgentsSessionEvent` + + Events for the session, ordered by `created_at`. + + - `beta_managed_agents_user_message_event: object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_interrupt_event: object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_tool_confirmation_event: object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_custom_tool_result_event: object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_agent_custom_tool_use_event: object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `beta_managed_agents_agent_message_event: object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `beta_managed_agents_agent_thinking_event: object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `beta_managed_agents_agent_mcp_tool_use_event: object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `beta_managed_agents_agent_mcp_tool_result_event: object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `beta_managed_agents_agent_tool_use_event: object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `beta_managed_agents_agent_tool_result_event: object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `beta_managed_agents_agent_thread_context_compacted_event: object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `beta_managed_agents_session_error_event: object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `beta_managed_agents_unknown_error: object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `beta_managed_agents_model_overloaded_error: object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `beta_managed_agents_model_rate_limited_error: object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `beta_managed_agents_model_request_failed_error: object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `beta_managed_agents_mcp_connection_failed_error: object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `beta_managed_agents_mcp_authentication_failed_error: object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `beta_managed_agents_billing_error: object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `beta_managed_agents_session_status_rescheduled_event: object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `beta_managed_agents_session_status_running_event: object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `beta_managed_agents_session_status_idle_event: object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `beta_managed_agents_session_end_turn: object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `beta_managed_agents_session_requires_action: object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `beta_managed_agents_session_retries_exhausted: object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `beta_managed_agents_session_status_terminated_event: object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `beta_managed_agents_span_model_request_start_event: object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `beta_managed_agents_span_model_request_end_event: object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: object { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 2 more }` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `beta_managed_agents_session_deleted_event: object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + + - `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```cli +ant beta:sessions:events list \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 +``` + +## Send + +`$ ant beta:sessions:events send` + +**post** `/v1/sessions/{session_id}/events` + +Send Events + +### Parameters + +- `--session-id: string` + + Path param: Path parameter session_id + +- `--event: array of BetaManagedAgentsEventParams` + + Body param: Events to send to the `session`. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_send_session_events: object { data }` + + Events that were successfully sent to the session. + + - `data: optional array of BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or BetaManagedAgentsUserCustomToolResultEvent` + + Sent events + + - `beta_managed_agents_user_message_event: object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_interrupt_event: object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_tool_confirmation_event: object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_custom_tool_result_event: object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Example + +```cli +ant beta:sessions:events send \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 \ + --event "{content: [{text: 'Where is my order #1234?', type: text}], type: user.message}" +``` + +## Stream + +`$ ant beta:sessions:events stream` + +**get** `/v1/sessions/{session_id}/events/stream` + +Stream Events + +### Parameters + +- `--session-id: string` + + Path parameter session_id + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_stream_session_events: BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or 17 more` + + Server-sent event in the session stream. + + - `beta_managed_agents_user_message_event: object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_interrupt_event: object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_tool_confirmation_event: object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_custom_tool_result_event: object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_agent_custom_tool_use_event: object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `beta_managed_agents_agent_message_event: object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `beta_managed_agents_agent_thinking_event: object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `beta_managed_agents_agent_mcp_tool_use_event: object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `beta_managed_agents_agent_mcp_tool_result_event: object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `beta_managed_agents_agent_tool_use_event: object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `beta_managed_agents_agent_tool_result_event: object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `beta_managed_agents_agent_thread_context_compacted_event: object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `beta_managed_agents_session_error_event: object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `beta_managed_agents_unknown_error: object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `beta_managed_agents_model_overloaded_error: object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `beta_managed_agents_model_rate_limited_error: object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `beta_managed_agents_model_request_failed_error: object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `beta_managed_agents_mcp_connection_failed_error: object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `beta_managed_agents_mcp_authentication_failed_error: object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `beta_managed_agents_billing_error: object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `beta_managed_agents_session_status_rescheduled_event: object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `beta_managed_agents_session_status_running_event: object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `beta_managed_agents_session_status_idle_event: object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `beta_managed_agents_session_end_turn: object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `beta_managed_agents_session_requires_action: object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `beta_managed_agents_session_retries_exhausted: object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `beta_managed_agents_session_status_terminated_event: object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `beta_managed_agents_span_model_request_start_event: object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `beta_managed_agents_span_model_request_end_event: object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: object { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 2 more }` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `beta_managed_agents_session_deleted_event: object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Example + +```cli +ant beta:sessions:events stream \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 +``` + +## Domain Types + +### Beta Managed Agents Agent Custom Tool Use Event + +- `beta_managed_agents_agent_custom_tool_use_event: object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + +### Beta Managed Agents Agent MCP Tool Result Event + +- `beta_managed_agents_agent_mcp_tool_result_event: object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent MCP Tool Use Event + +- `beta_managed_agents_agent_mcp_tool_use_event: object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + +### Beta Managed Agents Agent Message Event + +- `beta_managed_agents_agent_message_event: object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + +### Beta Managed Agents Agent Thinking Event + +- `beta_managed_agents_agent_thinking_event: object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + +### Beta Managed Agents Agent Thread Context Compacted Event + +- `beta_managed_agents_agent_thread_context_compacted_event: object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + +### Beta Managed Agents Agent Tool Result Event + +- `beta_managed_agents_agent_tool_result_event: object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent Tool Use Event + +- `beta_managed_agents_agent_tool_use_event: object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + +### Beta Managed Agents Base64 Document Source + +- `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + +### Beta Managed Agents Base64 Image Source + +- `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + +### Beta Managed Agents Billing Error + +- `beta_managed_agents_billing_error: object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + +### Beta Managed Agents Document Block + +- `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + +### Beta Managed Agents Event Params + +- `beta_managed_agents_event_params: BetaManagedAgentsUserMessageEventParams or BetaManagedAgentsUserInterruptEventParams or BetaManagedAgentsUserToolConfirmationEventParams or BetaManagedAgentsUserCustomToolResultEventParams` + + Union type for event parameters that can be sent to a session. + + - `beta_managed_agents_user_message_event_params: object { content, type }` + + Parameters for sending a user message to the session. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks for the user message. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `beta_managed_agents_user_interrupt_event_params: object { type }` + + Parameters for sending an interrupt to pause the agent. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `beta_managed_agents_user_tool_confirmation_event_params: object { result, tool_use_id, type, deny_message }` + + Parameters for confirming or denying a tool execution request. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `beta_managed_agents_user_custom_tool_result_event_params: object { custom_tool_use_id, type, content, is_error }` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents File Document Source + +- `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + +### Beta Managed Agents File Image Source + +- `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + +### Beta Managed Agents Image Block + +- `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + +### Beta Managed Agents MCP Authentication Failed Error + +- `beta_managed_agents_mcp_authentication_failed_error: object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + +### Beta Managed Agents MCP Connection Failed Error + +- `beta_managed_agents_mcp_connection_failed_error: object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + +### Beta Managed Agents Model Overloaded Error + +- `beta_managed_agents_model_overloaded_error: object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + +### Beta Managed Agents Model Rate Limited Error + +- `beta_managed_agents_model_rate_limited_error: object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + +### Beta Managed Agents Model Request Failed Error + +- `beta_managed_agents_model_request_failed_error: object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + +### Beta Managed Agents Plain Text Document Source + +- `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + +### Beta Managed Agents Retry Status Exhausted + +- `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + +### Beta Managed Agents Retry Status Retrying + +- `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + +### Beta Managed Agents Retry Status Terminal + +- `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + +### Beta Managed Agents Send Session Events + +- `beta_managed_agents_send_session_events: object { data }` + + Events that were successfully sent to the session. + + - `data: optional array of BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or BetaManagedAgentsUserCustomToolResultEvent` + + Sent events + + - `beta_managed_agents_user_message_event: object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_interrupt_event: object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_tool_confirmation_event: object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_custom_tool_result_event: object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents Session Deleted Event + +- `beta_managed_agents_session_deleted_event: object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Beta Managed Agents Session End Turn + +- `beta_managed_agents_session_end_turn: object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + +### Beta Managed Agents Session Error Event + +- `beta_managed_agents_session_error_event: object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `beta_managed_agents_unknown_error: object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `beta_managed_agents_model_overloaded_error: object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `beta_managed_agents_model_rate_limited_error: object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `beta_managed_agents_model_request_failed_error: object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `beta_managed_agents_mcp_connection_failed_error: object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `beta_managed_agents_mcp_authentication_failed_error: object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `beta_managed_agents_billing_error: object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + +### Beta Managed Agents Session Event + +- `beta_managed_agents_session_event: BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or 17 more` + + Union type for all event types in a session. + + - `beta_managed_agents_user_message_event: object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_interrupt_event: object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_tool_confirmation_event: object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_custom_tool_result_event: object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_agent_custom_tool_use_event: object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `beta_managed_agents_agent_message_event: object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `beta_managed_agents_agent_thinking_event: object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `beta_managed_agents_agent_mcp_tool_use_event: object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `beta_managed_agents_agent_mcp_tool_result_event: object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `beta_managed_agents_agent_tool_use_event: object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `beta_managed_agents_agent_tool_result_event: object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `beta_managed_agents_agent_thread_context_compacted_event: object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `beta_managed_agents_session_error_event: object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `beta_managed_agents_unknown_error: object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `beta_managed_agents_model_overloaded_error: object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `beta_managed_agents_model_rate_limited_error: object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `beta_managed_agents_model_request_failed_error: object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `beta_managed_agents_mcp_connection_failed_error: object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `beta_managed_agents_mcp_authentication_failed_error: object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `beta_managed_agents_billing_error: object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `beta_managed_agents_session_status_rescheduled_event: object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `beta_managed_agents_session_status_running_event: object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `beta_managed_agents_session_status_idle_event: object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `beta_managed_agents_session_end_turn: object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `beta_managed_agents_session_requires_action: object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `beta_managed_agents_session_retries_exhausted: object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `beta_managed_agents_session_status_terminated_event: object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `beta_managed_agents_span_model_request_start_event: object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `beta_managed_agents_span_model_request_end_event: object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: object { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 2 more }` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `beta_managed_agents_session_deleted_event: object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Beta Managed Agents Session Requires Action + +- `beta_managed_agents_session_requires_action: object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + +### Beta Managed Agents Session Retries Exhausted + +- `beta_managed_agents_session_retries_exhausted: object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + +### Beta Managed Agents Session Status Idle Event + +- `beta_managed_agents_session_status_idle_event: object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `beta_managed_agents_session_end_turn: object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `beta_managed_agents_session_requires_action: object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `beta_managed_agents_session_retries_exhausted: object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + +### Beta Managed Agents Session Status Rescheduled Event + +- `beta_managed_agents_session_status_rescheduled_event: object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + +### Beta Managed Agents Session Status Running Event + +- `beta_managed_agents_session_status_running_event: object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + +### Beta Managed Agents Session Status Terminated Event + +- `beta_managed_agents_session_status_terminated_event: object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + +### Beta Managed Agents Span Model Request End Event + +- `beta_managed_agents_span_model_request_end_event: object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: object { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 2 more }` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + +### Beta Managed Agents Span Model Request Start Event + +- `beta_managed_agents_span_model_request_start_event: object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + +### Beta Managed Agents Span Model Usage + +- `beta_managed_agents_span_model_usage: object { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 2 more }` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +### Beta Managed Agents Stream Session Events + +- `beta_managed_agents_stream_session_events: BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or 17 more` + + Server-sent event in the session stream. + + - `beta_managed_agents_user_message_event: object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_interrupt_event: object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_tool_confirmation_event: object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_custom_tool_result_event: object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_agent_custom_tool_use_event: object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `beta_managed_agents_agent_message_event: object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `beta_managed_agents_agent_thinking_event: object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `beta_managed_agents_agent_mcp_tool_use_event: object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `beta_managed_agents_agent_mcp_tool_result_event: object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `beta_managed_agents_agent_tool_use_event: object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `beta_managed_agents_agent_tool_result_event: object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `beta_managed_agents_agent_thread_context_compacted_event: object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `beta_managed_agents_session_error_event: object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `beta_managed_agents_unknown_error: object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `beta_managed_agents_model_overloaded_error: object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `beta_managed_agents_model_rate_limited_error: object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `beta_managed_agents_model_request_failed_error: object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `beta_managed_agents_mcp_connection_failed_error: object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `beta_managed_agents_mcp_authentication_failed_error: object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `beta_managed_agents_billing_error: object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `beta_managed_agents_session_status_rescheduled_event: object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `beta_managed_agents_session_status_running_event: object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `beta_managed_agents_session_status_idle_event: object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `beta_managed_agents_session_end_turn: object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `beta_managed_agents_session_requires_action: object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `beta_managed_agents_session_retries_exhausted: object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `beta_managed_agents_session_status_terminated_event: object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `beta_managed_agents_span_model_request_start_event: object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `beta_managed_agents_span_model_request_end_event: object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: object { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 2 more }` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `beta_managed_agents_session_deleted_event: object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Beta Managed Agents Text Block + +- `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + +### Beta Managed Agents Unknown Error + +- `beta_managed_agents_unknown_error: object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + +### Beta Managed Agents URL Document Source + +- `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + +### Beta Managed Agents URL Image Source + +- `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + +### Beta Managed Agents User Custom Tool Result Event + +- `beta_managed_agents_user_custom_tool_result_event: object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Custom Tool Result Event Params + +- `beta_managed_agents_user_custom_tool_result_event_params: object { custom_tool_use_id, type, content, is_error }` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents User Interrupt Event + +- `beta_managed_agents_user_interrupt_event: object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Interrupt Event Params + +- `beta_managed_agents_user_interrupt_event_params: object { type }` + + Parameters for sending an interrupt to pause the agent. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + +### Beta Managed Agents User Message Event + +- `beta_managed_agents_user_message_event: object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Message Event Params + +- `beta_managed_agents_user_message_event_params: object { content, type }` + + Parameters for sending a user message to the session. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks for the user message. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + +### Beta Managed Agents User Tool Confirmation Event + +- `beta_managed_agents_user_tool_confirmation_event: object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Tool Confirmation Event Params + +- `beta_managed_agents_user_tool_confirmation_event_params: object { result, tool_use_id, type, deny_message }` + + Parameters for confirming or denying a tool execution request. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. diff --git a/content/en/api/cli/beta/sessions/events/list.md b/content/en/api/cli/beta/sessions/events/list.md new file mode 100644 index 000000000..707e40ae1 --- /dev/null +++ b/content/en/api/cli/beta/sessions/events/list.md @@ -0,0 +1,1415 @@ +## List + +`$ ant beta:sessions:events list` + +**get** `/v1/sessions/{session_id}/events` + +List Events + +### Parameters + +- `--session-id: string` + + Path param: Path parameter session_id + +- `--limit: optional number` + + Query param: Query parameter for limit + +- `--order: optional "asc" or "desc"` + + Query param: Sort direction for results, ordered by created_at. Defaults to asc (chronological). + +- `--page: optional string` + + Query param: Opaque pagination cursor from a previous response's next_page. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaManagedAgentsListSessionEvents: object { data, next_page }` + + Paginated list of events for a `session`. + + - `data: optional array of BetaManagedAgentsSessionEvent` + + Events for the session, ordered by `created_at`. + + - `beta_managed_agents_user_message_event: object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_interrupt_event: object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_tool_confirmation_event: object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_custom_tool_result_event: object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_agent_custom_tool_use_event: object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `beta_managed_agents_agent_message_event: object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `beta_managed_agents_agent_thinking_event: object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `beta_managed_agents_agent_mcp_tool_use_event: object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `beta_managed_agents_agent_mcp_tool_result_event: object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `beta_managed_agents_agent_tool_use_event: object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `beta_managed_agents_agent_tool_result_event: object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `beta_managed_agents_agent_thread_context_compacted_event: object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `beta_managed_agents_session_error_event: object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `beta_managed_agents_unknown_error: object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `beta_managed_agents_model_overloaded_error: object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `beta_managed_agents_model_rate_limited_error: object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `beta_managed_agents_model_request_failed_error: object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `beta_managed_agents_mcp_connection_failed_error: object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `beta_managed_agents_mcp_authentication_failed_error: object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `beta_managed_agents_billing_error: object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `beta_managed_agents_session_status_rescheduled_event: object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `beta_managed_agents_session_status_running_event: object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `beta_managed_agents_session_status_idle_event: object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `beta_managed_agents_session_end_turn: object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `beta_managed_agents_session_requires_action: object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `beta_managed_agents_session_retries_exhausted: object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `beta_managed_agents_session_status_terminated_event: object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `beta_managed_agents_span_model_request_start_event: object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `beta_managed_agents_span_model_request_end_event: object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: object { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 2 more }` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `beta_managed_agents_session_deleted_event: object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + + - `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```cli +ant beta:sessions:events list \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 +``` diff --git a/content/en/api/cli/beta/sessions/events/send.md b/content/en/api/cli/beta/sessions/events/send.md new file mode 100644 index 000000000..0d29b585e --- /dev/null +++ b/content/en/api/cli/beta/sessions/events/send.md @@ -0,0 +1,420 @@ +## Send + +`$ ant beta:sessions:events send` + +**post** `/v1/sessions/{session_id}/events` + +Send Events + +### Parameters + +- `--session-id: string` + + Path param: Path parameter session_id + +- `--event: array of BetaManagedAgentsEventParams` + + Body param: Events to send to the `session`. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_send_session_events: object { data }` + + Events that were successfully sent to the session. + + - `data: optional array of BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or BetaManagedAgentsUserCustomToolResultEvent` + + Sent events + + - `beta_managed_agents_user_message_event: object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_interrupt_event: object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_tool_confirmation_event: object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_custom_tool_result_event: object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + +### Example + +```cli +ant beta:sessions:events send \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 \ + --event "{content: [{text: 'Where is my order #1234?', type: text}], type: user.message}" +``` diff --git a/content/en/api/cli/beta/sessions/events/stream.md b/content/en/api/cli/beta/sessions/events/stream.md new file mode 100644 index 000000000..69f1ab35a --- /dev/null +++ b/content/en/api/cli/beta/sessions/events/stream.md @@ -0,0 +1,1395 @@ +## Stream + +`$ ant beta:sessions:events stream` + +**get** `/v1/sessions/{session_id}/events/stream` + +Stream Events + +### Parameters + +- `--session-id: string` + + Path parameter session_id + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_stream_session_events: BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or 17 more` + + Server-sent event in the session stream. + + - `beta_managed_agents_user_message_event: object { id, content, type, processed_at }` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + Array of content blocks comprising the user message. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_interrupt_event: object { id, type, processed_at }` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_tool_confirmation_event: object { id, result, tool_use_id, 3 more }` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" or "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message: optional string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_user_custom_tool_result_event: object { id, custom_tool_use_id, type, 3 more }` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `processed_at: optional string` + + A timestamp in RFC 3339 format + + - `beta_managed_agents_agent_custom_tool_use_event: object { id, input, name, 2 more }` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `beta_managed_agents_agent_message_event: object { id, content, processed_at, type }` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: array of BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `beta_managed_agents_agent_thinking_event: object { id, processed_at, type }` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `beta_managed_agents_agent_mcp_tool_use_event: object { id, input, mcp_server_name, 4 more }` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `beta_managed_agents_agent_mcp_tool_result_event: object { id, mcp_tool_use_id, processed_at, 3 more }` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `beta_managed_agents_agent_tool_use_event: object { id, input, name, 3 more }` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: map[unknown]` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission: optional "allow" or "ask" or "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `beta_managed_agents_agent_tool_result_event: object { id, processed_at, tool_use_id, 3 more }` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock` + + The result content returned by the tool. + + - `beta_managed_agents_text_block: object { text, type }` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_image_block: object { source, type }` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `beta_managed_agents_base64_image_source: object { data, media_type, type }` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_url_image_source: object { type, url }` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `beta_managed_agents_file_image_source: object { file_id, type }` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `beta_managed_agents_document_block: object { source, type, context, title }` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `beta_managed_agents_base64_document_source: object { data, media_type, type }` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `beta_managed_agents_plain_text_document_source: object { data, media_type, type }` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `beta_managed_agents_url_document_source: object { type, url }` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `beta_managed_agents_file_document_source: object { file_id, type }` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context: optional string` + + Additional context about the document for the model. + + - `title: optional string` + + The title of the document. + + - `is_error: optional boolean` + + Whether the tool execution resulted in an error. + + - `beta_managed_agents_agent_thread_context_compacted_event: object { id, processed_at, type }` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `beta_managed_agents_session_error_event: object { id, error, processed_at, type }` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `beta_managed_agents_unknown_error: object { message, retry_status, type }` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `beta_managed_agents_model_overloaded_error: object { message, retry_status, type }` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `beta_managed_agents_model_rate_limited_error: object { message, retry_status, type }` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `beta_managed_agents_model_request_failed_error: object { message, retry_status, type }` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `beta_managed_agents_mcp_connection_failed_error: object { mcp_server_name, message, retry_status, type }` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `beta_managed_agents_mcp_authentication_failed_error: object { mcp_server_name, message, retry_status, type }` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `beta_managed_agents_billing_error: object { message, retry_status, type }` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `beta_managed_agents_retry_status_retrying: object { type }` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `beta_managed_agents_retry_status_exhausted: object { type }` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `beta_managed_agents_retry_status_terminal: object { type }` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `beta_managed_agents_session_status_rescheduled_event: object { id, processed_at, type }` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `beta_managed_agents_session_status_running_event: object { id, processed_at, type }` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `beta_managed_agents_session_status_idle_event: object { id, processed_at, stop_reason, type }` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `beta_managed_agents_session_end_turn: object { type }` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `beta_managed_agents_session_requires_action: object { event_ids, type }` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: array of string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `beta_managed_agents_session_retries_exhausted: object { type }` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `beta_managed_agents_session_status_terminated_event: object { id, processed_at, type }` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `beta_managed_agents_span_model_request_start_event: object { id, processed_at, type }` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `beta_managed_agents_span_model_request_end_event: object { id, is_error, model_request_start_id, 3 more }` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: object { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 2 more }` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `beta_managed_agents_session_deleted_event: object { id, processed_at, type }` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Example + +```cli +ant beta:sessions:events stream \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 +``` diff --git a/content/en/api/cli/beta/sessions/list.md b/content/en/api/cli/beta/sessions/list.md new file mode 100644 index 000000000..af60cb225 --- /dev/null +++ b/content/en/api/cli/beta/sessions/list.md @@ -0,0 +1,490 @@ +## List + +`$ ant beta:sessions list` + +**get** `/v1/sessions` + +List Sessions + +### Parameters + +- `--agent-id: optional string` + + Query param: Filter sessions created with this agent ID. + +- `--agent-version: optional number` + + Query param: Filter by agent version. Only applies when agent_id is also set. + +- `--created-at-gt: optional string` + + Query param: Return sessions created after this time (exclusive). + +- `--created-at-gte: optional string` + + Query param: Return sessions created at or after this time (inclusive). + +- `--created-at-lt: optional string` + + Query param: Return sessions created before this time (exclusive). + +- `--created-at-lte: optional string` + + Query param: Return sessions created at or before this time (inclusive). + +- `--include-archived: optional boolean` + + Query param: When true, includes archived sessions. Default: false (exclude archived). + +- `--limit: optional number` + + Query param: Maximum number of results to return. + +- `--order: optional "asc" or "desc"` + + Query param: Sort direction for results, ordered by created_at. Defaults to desc (newest first). + +- `--page: optional string` + + Query param: Opaque pagination cursor from a previous response's next_page. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaManagedAgentsListSessions: object { data, next_page }` + + Paginated list of sessions. + + - `data: optional array of BetaManagedAgentsSession` + + List of sessions. + + - `id: string` + + - `agent: object { id, description, mcp_servers, 7 more }` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: object { active_seconds, duration_seconds }` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: object { cache_creation, cache_read_input_tokens, input_tokens, output_tokens }` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + + - `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```cli +ant beta:sessions list \ + --api-key my-anthropic-api-key +``` diff --git a/content/en/api/cli/beta/sessions/resources.md b/content/en/api/cli/beta/sessions/resources.md new file mode 100644 index 000000000..327a55b92 --- /dev/null +++ b/content/en/api/cli/beta/sessions/resources.md @@ -0,0 +1,565 @@ +# Resources + +## Add + +`$ ant beta:sessions:resources add` + +**post** `/v1/sessions/{session_id}/resources` + +Add Session Resource + +### Parameters + +- `--session-id: string` + + Path param: Path parameter session_id + +- `--file-id: string` + + Body param: ID of a previously uploaded file. + +- `--type: "file"` + + Body param + +- `--mount-path: optional string` + + Body param: Mount path in the container. Defaults to `/mnt/session/uploads/`. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```cli +ant beta:sessions:resources add \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 \ + --file-id file_011CNha8iCJcU1wXNR6q4V8w \ + --type file +``` + +## List + +`$ ant beta:sessions:resources list` + +**get** `/v1/sessions/{session_id}/resources` + +List Session Resources + +### Parameters + +- `--session-id: string` + + Path param: Path parameter session_id + +- `--limit: optional number` + + Query param: Maximum number of resources to return per page (max 1000). If omitted, returns all resources. + +- `--page: optional string` + + Query param: Opaque cursor from a previous response's next_page field. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaManagedAgentsListSessionResources: object { data, next_page }` + + Paginated list of resources attached to a session. + + - `data: array of BetaManagedAgentsSessionResource` + + Resources for the session, ordered by `created_at`. + + - `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```cli +ant beta:sessions:resources list \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 +``` + +## Retrieve + +`$ ant beta:sessions:resources retrieve` + +**get** `/v1/sessions/{session_id}/resources/{resource_id}` + +Get Session Resource + +### Parameters + +- `--session-id: string` + + Path param: Path parameter session_id + +- `--resource-id: string` + + Path param: Path parameter resource_id + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaSessionResourceGetResponse: BetaManagedAgentsGitHubRepositoryResource or BetaManagedAgentsFileResource` + + The requested session resource. + + - `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```cli +ant beta:sessions:resources retrieve \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 \ + --resource-id sesrsc_011CZkZBJq5dWxk9fVLNcPht +``` + +## Update + +`$ ant beta:sessions:resources update` + +**post** `/v1/sessions/{session_id}/resources/{resource_id}` + +Update Session Resource + +### Parameters + +- `--session-id: string` + + Path param: Path parameter session_id + +- `--resource-id: string` + + Path param: Path parameter resource_id + +- `--authorization-token: string` + + Body param: New authorization token for the resource. Currently only `github_repository` resources support token rotation. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaSessionResourceUpdateResponse: BetaManagedAgentsGitHubRepositoryResource or BetaManagedAgentsFileResource` + + The updated session resource. + + - `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```cli +ant beta:sessions:resources update \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 \ + --resource-id sesrsc_011CZkZBJq5dWxk9fVLNcPht \ + --authorization-token ghp_exampletoken +``` + +## Delete + +`$ ant beta:sessions:resources delete` + +**delete** `/v1/sessions/{session_id}/resources/{resource_id}` + +Delete Session Resource + +### Parameters + +- `--session-id: string` + + Path param: Path parameter session_id + +- `--resource-id: string` + + Path param: Path parameter resource_id + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_delete_session_resource: object { id, type }` + + Confirmation of resource deletion. + + - `id: string` + + - `type: "session_resource_deleted"` + + - `"session_resource_deleted"` + +### Example + +```cli +ant beta:sessions:resources delete \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 \ + --resource-id sesrsc_011CZkZBJq5dWxk9fVLNcPht +``` + +## Domain Types + +### Beta Managed Agents Delete Session Resource + +- `beta_managed_agents_delete_session_resource: object { id, type }` + + Confirmation of resource deletion. + + - `id: string` + + - `type: "session_resource_deleted"` + + - `"session_resource_deleted"` + +### Beta Managed Agents File Resource + +- `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents GitHub Repository Resource + +- `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + +### Beta Managed Agents Session Resource + +- `beta_managed_agents_session_resource: BetaManagedAgentsGitHubRepositoryResource or BetaManagedAgentsFileResource` + + - `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format diff --git a/content/en/api/cli/beta/sessions/resources/add.md b/content/en/api/cli/beta/sessions/resources/add.md new file mode 100644 index 000000000..b336a49cc --- /dev/null +++ b/content/en/api/cli/beta/sessions/resources/add.md @@ -0,0 +1,61 @@ +## Add + +`$ ant beta:sessions:resources add` + +**post** `/v1/sessions/{session_id}/resources` + +Add Session Resource + +### Parameters + +- `--session-id: string` + + Path param: Path parameter session_id + +- `--file-id: string` + + Body param: ID of a previously uploaded file. + +- `--type: "file"` + + Body param + +- `--mount-path: optional string` + + Body param: Mount path in the container. Defaults to `/mnt/session/uploads/`. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```cli +ant beta:sessions:resources add \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 \ + --file-id file_011CNha8iCJcU1wXNR6q4V8w \ + --type file +``` diff --git a/content/en/api/cli/beta/sessions/resources/delete.md b/content/en/api/cli/beta/sessions/resources/delete.md new file mode 100644 index 000000000..573243bef --- /dev/null +++ b/content/en/api/cli/beta/sessions/resources/delete.md @@ -0,0 +1,42 @@ +## Delete + +`$ ant beta:sessions:resources delete` + +**delete** `/v1/sessions/{session_id}/resources/{resource_id}` + +Delete Session Resource + +### Parameters + +- `--session-id: string` + + Path param: Path parameter session_id + +- `--resource-id: string` + + Path param: Path parameter resource_id + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_delete_session_resource: object { id, type }` + + Confirmation of resource deletion. + + - `id: string` + + - `type: "session_resource_deleted"` + + - `"session_resource_deleted"` + +### Example + +```cli +ant beta:sessions:resources delete \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 \ + --resource-id sesrsc_011CZkZBJq5dWxk9fVLNcPht +``` diff --git a/content/en/api/cli/beta/sessions/resources/list.md b/content/en/api/cli/beta/sessions/resources/list.md new file mode 100644 index 000000000..5fa79caf2 --- /dev/null +++ b/content/en/api/cli/beta/sessions/resources/list.md @@ -0,0 +1,109 @@ +## List + +`$ ant beta:sessions:resources list` + +**get** `/v1/sessions/{session_id}/resources` + +List Session Resources + +### Parameters + +- `--session-id: string` + + Path param: Path parameter session_id + +- `--limit: optional number` + + Query param: Maximum number of resources to return per page (max 1000). If omitted, returns all resources. + +- `--page: optional string` + + Query param: Opaque cursor from a previous response's next_page field. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaManagedAgentsListSessionResources: object { data, next_page }` + + Paginated list of resources attached to a session. + + - `data: array of BetaManagedAgentsSessionResource` + + Resources for the session, ordered by `created_at`. + + - `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `next_page: optional string` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```cli +ant beta:sessions:resources list \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 +``` diff --git a/content/en/api/cli/beta/sessions/resources/retrieve.md b/content/en/api/cli/beta/sessions/resources/retrieve.md new file mode 100644 index 000000000..f92a7736b --- /dev/null +++ b/content/en/api/cli/beta/sessions/resources/retrieve.md @@ -0,0 +1,98 @@ +## Retrieve + +`$ ant beta:sessions:resources retrieve` + +**get** `/v1/sessions/{session_id}/resources/{resource_id}` + +Get Session Resource + +### Parameters + +- `--session-id: string` + + Path param: Path parameter session_id + +- `--resource-id: string` + + Path param: Path parameter resource_id + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaSessionResourceGetResponse: BetaManagedAgentsGitHubRepositoryResource or BetaManagedAgentsFileResource` + + The requested session resource. + + - `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```cli +ant beta:sessions:resources retrieve \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 \ + --resource-id sesrsc_011CZkZBJq5dWxk9fVLNcPht +``` diff --git a/content/en/api/cli/beta/sessions/resources/update.md b/content/en/api/cli/beta/sessions/resources/update.md new file mode 100644 index 000000000..cc0d4f6bb --- /dev/null +++ b/content/en/api/cli/beta/sessions/resources/update.md @@ -0,0 +1,103 @@ +## Update + +`$ ant beta:sessions:resources update` + +**post** `/v1/sessions/{session_id}/resources/{resource_id}` + +Update Session Resource + +### Parameters + +- `--session-id: string` + + Path param: Path parameter session_id + +- `--resource-id: string` + + Path param: Path parameter resource_id + +- `--authorization-token: string` + + Body param: New authorization token for the resource. Currently only `github_repository` resources support token rotation. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaSessionResourceUpdateResponse: BetaManagedAgentsGitHubRepositoryResource or BetaManagedAgentsFileResource` + + The updated session resource. + + - `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```cli +ant beta:sessions:resources update \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 \ + --resource-id sesrsc_011CZkZBJq5dWxk9fVLNcPht \ + --authorization-token ghp_exampletoken +``` diff --git a/content/en/api/cli/beta/sessions/retrieve.md b/content/en/api/cli/beta/sessions/retrieve.md new file mode 100644 index 000000000..ebe655d94 --- /dev/null +++ b/content/en/api/cli/beta/sessions/retrieve.md @@ -0,0 +1,447 @@ +## Retrieve + +`$ ant beta:sessions retrieve` + +**get** `/v1/sessions/{session_id}` + +Get Session + +### Parameters + +- `--session-id: string` + + Path parameter session_id + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_session: object { id, agent, archived_at, 11 more }` + + A Managed Agents `session`. + + - `id: string` + + - `agent: object { id, description, mcp_servers, 7 more }` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: object { active_seconds, duration_seconds }` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: object { cache_creation, cache_read_input_tokens, input_tokens, output_tokens }` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```cli +ant beta:sessions retrieve \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 +``` diff --git a/content/en/api/cli/beta/sessions/update.md b/content/en/api/cli/beta/sessions/update.md new file mode 100644 index 000000000..f4f35e99a --- /dev/null +++ b/content/en/api/cli/beta/sessions/update.md @@ -0,0 +1,459 @@ +## Update + +`$ ant beta:sessions update` + +**post** `/v1/sessions/{session_id}` + +Update Session + +### Parameters + +- `--session-id: string` + + Path param: Path parameter session_id + +- `--metadata: optional map[string]` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. + +- `--title: optional string` + + Body param: Human-readable session title. + +- `--vault-id: optional array of string` + + Body param: Vault IDs (`vlt_*`) to attach to the session. Not yet supported; requests setting this field are rejected. Reserved for future use. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_session: object { id, agent, archived_at, 11 more }` + + A Managed Agents `session`. + + - `id: string` + + - `agent: object { id, description, mcp_servers, 7 more }` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string` + + - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: object { id, speed }` + + Model identifier and configuration. + + - `id: "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 5 more or string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `speed: optional "standard" or "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill` + + - `beta_managed_agents_anthropic_skill: object { skill_id, type, version }` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `beta_managed_agents_custom_skill: object { skill_id, type, version }` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string` + + - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool` + + - `beta_managed_agents_agent_toolset20260401: object { configs, default_config, type }` + + - `configs: array of BetaManagedAgentsAgentToolConfig` + + - `enabled: boolean` + + - `name: "bash" or "edit" or "read" or 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `beta_managed_agents_mcp_toolset: object { configs, default_config, mcp_server_name, type }` + + - `configs: array of BetaManagedAgentsMCPToolConfig` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: object { enabled, permission_policy }` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `beta_managed_agents_always_allow_policy: object { type }` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `beta_managed_agents_always_ask_policy: object { type }` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `beta_managed_agents_custom_tool: object { description, input_schema, name, type }` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: object { properties, required, type }` + + JSON Schema for custom tool input parameters. + + - `properties: optional map[unknown]` + + JSON Schema properties defining the tool's input parameters. + + - `required: optional array of string` + + List of required property names. + + - `type: optional "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: map[string]` + + - `resources: array of BetaManagedAgentsSessionResource` + + - `beta_managed_agents_github_repository_resource: object { id, created_at, mount_path, 4 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout` + + - `beta_managed_agents_branch_checkout: object { name, type }` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `beta_managed_agents_commit_checkout: object { sha, type }` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `beta_managed_agents_file_resource: object { id, created_at, file_id, 3 more }` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: object { active_seconds, duration_seconds }` + + Timing statistics for a session. + + - `active_seconds: optional number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: optional number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" or "running" or "idle" or "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: object { cache_creation, cache_read_input_tokens, input_tokens, output_tokens }` + + Cumulative token usage for a session across all turns. + + - `cache_creation: optional object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: optional number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: optional number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: optional number` + + Total tokens read from prompt cache. + + - `input_tokens: optional number` + + Total input tokens consumed across all turns. + + - `output_tokens: optional number` + + Total output tokens generated across all turns. + + - `vault_ids: array of string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```cli +ant beta:sessions update \ + --api-key my-anthropic-api-key \ + --session-id sesn_011CZkZAtmR3yMPDzynEDxu7 +``` diff --git a/content/en/api/cli/beta/skills.md b/content/en/api/cli/beta/skills.md index 491f467a9..bcc2f883d 100644 --- a/content/en/api/cli/beta/skills.md +++ b/content/en/api/cli/beta/skills.md @@ -1 +1,615 @@ -Not Found - Claude API Docs
                                            \ No newline at end of file +# Skills + +## Create + +`$ ant beta:skills create` + +**post** `/v1/skills` + +Create Skill + +### Parameters + +- `--display-title: optional string` + + Body param: Display title for the skill. + + This is a human-readable label that is not included in the prompt sent to the model. + +- `--file: optional array of string` + + Body param: Files to upload for the skill. + + All files must be in the same top-level directory and must include a SKILL.md file at the root of that directory. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaSkillNewResponse: object { id, created_at, display_title, 4 more }` + + - `id: string` + + Unique identifier for the skill. + + The format and length of IDs may change over time. + + - `created_at: string` + + ISO 8601 timestamp of when the skill was created. + + - `display_title: string` + + Display title for the skill. + + This is a human-readable label that is not included in the prompt sent to the model. + + - `latest_version: string` + + The latest version identifier for the skill. + + This represents the most recent version of the skill that has been created. + + - `source: string` + + Source of the skill. + + This may be one of the following values: + + * `"custom"`: the skill was created by a user + * `"anthropic"`: the skill was created by Anthropic + + - `type: string` + + Object type. + + For Skills, this is always `"skill"`. + + - `updated_at: string` + + ISO 8601 timestamp of when the skill was last updated. + +### Example + +```cli +ant beta:skills create \ + --api-key my-anthropic-api-key +``` + +## List + +`$ ant beta:skills list` + +**get** `/v1/skills` + +List Skills + +### Parameters + +- `--limit: optional number` + + Query param: Number of results to return per page. + + Maximum value is 100. Defaults to 20. + +- `--page: optional string` + + Query param: Pagination token for fetching a specific page of results. + + Pass the value from a previous response's `next_page` field to get the next page of results. + +- `--source: optional string` + + Query param: Filter skills by source. + + If provided, only skills from the specified source will be returned: + + * `"custom"`: only return user-created skills + * `"anthropic"`: only return Anthropic-created skills + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaListSkillsResponse: object { data, has_more, next_page }` + + - `data: array of object { id, created_at, display_title, 4 more }` + + List of skills. + + - `id: string` + + Unique identifier for the skill. + + The format and length of IDs may change over time. + + - `created_at: string` + + ISO 8601 timestamp of when the skill was created. + + - `display_title: string` + + Display title for the skill. + + This is a human-readable label that is not included in the prompt sent to the model. + + - `latest_version: string` + + The latest version identifier for the skill. + + This represents the most recent version of the skill that has been created. + + - `source: string` + + Source of the skill. + + This may be one of the following values: + + * `"custom"`: the skill was created by a user + * `"anthropic"`: the skill was created by Anthropic + + - `type: string` + + Object type. + + For Skills, this is always `"skill"`. + + - `updated_at: string` + + ISO 8601 timestamp of when the skill was last updated. + + - `has_more: boolean` + + Whether there are more results available. + + If `true`, there are additional results that can be fetched using the `next_page` token. + + - `next_page: string` + + Token for fetching the next page of results. + + If `null`, there are no more results available. Pass this value to the `page_token` parameter in the next request to get the next page. + +### Example + +```cli +ant beta:skills list \ + --api-key my-anthropic-api-key +``` + +## Retrieve + +`$ ant beta:skills retrieve` + +**get** `/v1/skills/{skill_id}` + +Get Skill + +### Parameters + +- `--skill-id: string` + + Unique identifier for the skill. + + The format and length of IDs may change over time. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaSkillGetResponse: object { id, created_at, display_title, 4 more }` + + - `id: string` + + Unique identifier for the skill. + + The format and length of IDs may change over time. + + - `created_at: string` + + ISO 8601 timestamp of when the skill was created. + + - `display_title: string` + + Display title for the skill. + + This is a human-readable label that is not included in the prompt sent to the model. + + - `latest_version: string` + + The latest version identifier for the skill. + + This represents the most recent version of the skill that has been created. + + - `source: string` + + Source of the skill. + + This may be one of the following values: + + * `"custom"`: the skill was created by a user + * `"anthropic"`: the skill was created by Anthropic + + - `type: string` + + Object type. + + For Skills, this is always `"skill"`. + + - `updated_at: string` + + ISO 8601 timestamp of when the skill was last updated. + +### Example + +```cli +ant beta:skills retrieve \ + --api-key my-anthropic-api-key \ + --skill-id skill_id +``` + +## Delete + +`$ ant beta:skills delete` + +**delete** `/v1/skills/{skill_id}` + +Delete Skill + +### Parameters + +- `--skill-id: string` + + Unique identifier for the skill. + + The format and length of IDs may change over time. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaSkillDeleteResponse: object { id, type }` + + - `id: string` + + Unique identifier for the skill. + + The format and length of IDs may change over time. + + - `type: string` + + Deleted object type. + + For Skills, this is always `"skill_deleted"`. + +### Example + +```cli +ant beta:skills delete \ + --api-key my-anthropic-api-key \ + --skill-id skill_id +``` + +# Versions + +## Create + +`$ ant beta:skills:versions create` + +**post** `/v1/skills/{skill_id}/versions` + +Create Skill Version + +### Parameters + +- `--skill-id: string` + + Path param: Unique identifier for the skill. + + The format and length of IDs may change over time. + +- `--file: optional array of string` + + Body param: Files to upload for the skill. + + All files must be in the same top-level directory and must include a SKILL.md file at the root of that directory. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaSkillVersionNewResponse: object { id, created_at, description, 5 more }` + + - `id: string` + + Unique identifier for the skill version. + + The format and length of IDs may change over time. + + - `created_at: string` + + ISO 8601 timestamp of when the skill version was created. + + - `description: string` + + Description of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + + - `directory: string` + + Directory name of the skill version. + + This is the top-level directory name that was extracted from the uploaded files. + + - `name: string` + + Human-readable name of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + + - `skill_id: string` + + Identifier for the skill that this version belongs to. + + - `type: string` + + Object type. + + For Skill Versions, this is always `"skill_version"`. + + - `version: string` + + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + +### Example + +```cli +ant beta:skills:versions create \ + --api-key my-anthropic-api-key \ + --skill-id skill_id +``` + +## List + +`$ ant beta:skills:versions list` + +**get** `/v1/skills/{skill_id}/versions` + +List Skill Versions + +### Parameters + +- `--skill-id: string` + + Path param: Unique identifier for the skill. + + The format and length of IDs may change over time. + +- `--limit: optional number` + + Query param: Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + +- `--page: optional string` + + Query param: Optionally set to the `next_page` token from the previous response. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaListSkillVersionsResponse: object { data, has_more, next_page }` + + - `data: array of object { id, created_at, description, 5 more }` + + List of skill versions. + + - `id: string` + + Unique identifier for the skill version. + + The format and length of IDs may change over time. + + - `created_at: string` + + ISO 8601 timestamp of when the skill version was created. + + - `description: string` + + Description of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + + - `directory: string` + + Directory name of the skill version. + + This is the top-level directory name that was extracted from the uploaded files. + + - `name: string` + + Human-readable name of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + + - `skill_id: string` + + Identifier for the skill that this version belongs to. + + - `type: string` + + Object type. + + For Skill Versions, this is always `"skill_version"`. + + - `version: string` + + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + + - `has_more: boolean` + + Indicates if there are more results in the requested page direction. + + - `next_page: string` + + Token to provide in as `page` in the subsequent request to retrieve the next page of data. + +### Example + +```cli +ant beta:skills:versions list \ + --api-key my-anthropic-api-key \ + --skill-id skill_id +``` + +## Retrieve + +`$ ant beta:skills:versions retrieve` + +**get** `/v1/skills/{skill_id}/versions/{version}` + +Get Skill Version + +### Parameters + +- `--skill-id: string` + + Path param: Unique identifier for the skill. + + The format and length of IDs may change over time. + +- `--version: string` + + Path param: Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaSkillVersionGetResponse: object { id, created_at, description, 5 more }` + + - `id: string` + + Unique identifier for the skill version. + + The format and length of IDs may change over time. + + - `created_at: string` + + ISO 8601 timestamp of when the skill version was created. + + - `description: string` + + Description of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + + - `directory: string` + + Directory name of the skill version. + + This is the top-level directory name that was extracted from the uploaded files. + + - `name: string` + + Human-readable name of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + + - `skill_id: string` + + Identifier for the skill that this version belongs to. + + - `type: string` + + Object type. + + For Skill Versions, this is always `"skill_version"`. + + - `version: string` + + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + +### Example + +```cli +ant beta:skills:versions retrieve \ + --api-key my-anthropic-api-key \ + --skill-id skill_id \ + --version version +``` + +## Delete + +`$ ant beta:skills:versions delete` + +**delete** `/v1/skills/{skill_id}/versions/{version}` + +Delete Skill Version + +### Parameters + +- `--skill-id: string` + + Path param: Unique identifier for the skill. + + The format and length of IDs may change over time. + +- `--version: string` + + Path param: Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaSkillVersionDeleteResponse: object { id, type }` + + - `id: string` + + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + + - `type: string` + + Deleted object type. + + For Skill Versions, this is always `"skill_version_deleted"`. + +### Example + +```cli +ant beta:skills:versions delete \ + --api-key my-anthropic-api-key \ + --skill-id skill_id \ + --version version +``` diff --git a/content/en/api/cli/beta/skills/create.md b/content/en/api/cli/beta/skills/create.md index 8f399abd2..2b99864c8 100644 --- a/content/en/api/cli/beta/skills/create.md +++ b/content/en/api/cli/beta/skills/create.md @@ -1 +1,77 @@ -Not Found - Claude API Docs
                                              \ No newline at end of file +## Create + +`$ ant beta:skills create` + +**post** `/v1/skills` + +Create Skill + +### Parameters + +- `--display-title: optional string` + + Body param: Display title for the skill. + + This is a human-readable label that is not included in the prompt sent to the model. + +- `--file: optional array of string` + + Body param: Files to upload for the skill. + + All files must be in the same top-level directory and must include a SKILL.md file at the root of that directory. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaSkillNewResponse: object { id, created_at, display_title, 4 more }` + + - `id: string` + + Unique identifier for the skill. + + The format and length of IDs may change over time. + + - `created_at: string` + + ISO 8601 timestamp of when the skill was created. + + - `display_title: string` + + Display title for the skill. + + This is a human-readable label that is not included in the prompt sent to the model. + + - `latest_version: string` + + The latest version identifier for the skill. + + This represents the most recent version of the skill that has been created. + + - `source: string` + + Source of the skill. + + This may be one of the following values: + + * `"custom"`: the skill was created by a user + * `"anthropic"`: the skill was created by Anthropic + + - `type: string` + + Object type. + + For Skills, this is always `"skill"`. + + - `updated_at: string` + + ISO 8601 timestamp of when the skill was last updated. + +### Example + +```cli +ant beta:skills create \ + --api-key my-anthropic-api-key +``` diff --git a/content/en/api/cli/beta/skills/delete.md b/content/en/api/cli/beta/skills/delete.md index 9327077a9..29ebac763 100644 --- a/content/en/api/cli/beta/skills/delete.md +++ b/content/en/api/cli/beta/skills/delete.md @@ -1 +1,43 @@ -Not Found - Claude API Docs
                                                \ No newline at end of file +## Delete + +`$ ant beta:skills delete` + +**delete** `/v1/skills/{skill_id}` + +Delete Skill + +### Parameters + +- `--skill-id: string` + + Unique identifier for the skill. + + The format and length of IDs may change over time. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaSkillDeleteResponse: object { id, type }` + + - `id: string` + + Unique identifier for the skill. + + The format and length of IDs may change over time. + + - `type: string` + + Deleted object type. + + For Skills, this is always `"skill_deleted"`. + +### Example + +```cli +ant beta:skills delete \ + --api-key my-anthropic-api-key \ + --skill-id skill_id +``` diff --git a/content/en/api/cli/beta/skills/list.md b/content/en/api/cli/beta/skills/list.md index 88c4e9be4..2e59ace31 100644 --- a/content/en/api/cli/beta/skills/list.md +++ b/content/en/api/cli/beta/skills/list.md @@ -1 +1,102 @@ -Not Found - Claude API Docs
                                                  \ No newline at end of file +## List + +`$ ant beta:skills list` + +**get** `/v1/skills` + +List Skills + +### Parameters + +- `--limit: optional number` + + Query param: Number of results to return per page. + + Maximum value is 100. Defaults to 20. + +- `--page: optional string` + + Query param: Pagination token for fetching a specific page of results. + + Pass the value from a previous response's `next_page` field to get the next page of results. + +- `--source: optional string` + + Query param: Filter skills by source. + + If provided, only skills from the specified source will be returned: + + * `"custom"`: only return user-created skills + * `"anthropic"`: only return Anthropic-created skills + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaListSkillsResponse: object { data, has_more, next_page }` + + - `data: array of object { id, created_at, display_title, 4 more }` + + List of skills. + + - `id: string` + + Unique identifier for the skill. + + The format and length of IDs may change over time. + + - `created_at: string` + + ISO 8601 timestamp of when the skill was created. + + - `display_title: string` + + Display title for the skill. + + This is a human-readable label that is not included in the prompt sent to the model. + + - `latest_version: string` + + The latest version identifier for the skill. + + This represents the most recent version of the skill that has been created. + + - `source: string` + + Source of the skill. + + This may be one of the following values: + + * `"custom"`: the skill was created by a user + * `"anthropic"`: the skill was created by Anthropic + + - `type: string` + + Object type. + + For Skills, this is always `"skill"`. + + - `updated_at: string` + + ISO 8601 timestamp of when the skill was last updated. + + - `has_more: boolean` + + Whether there are more results available. + + If `true`, there are additional results that can be fetched using the `next_page` token. + + - `next_page: string` + + Token for fetching the next page of results. + + If `null`, there are no more results available. Pass this value to the `page_token` parameter in the next request to get the next page. + +### Example + +```cli +ant beta:skills list \ + --api-key my-anthropic-api-key +``` diff --git a/content/en/api/cli/beta/skills/retrieve.md b/content/en/api/cli/beta/skills/retrieve.md index c74c3e785..bc965afd1 100644 --- a/content/en/api/cli/beta/skills/retrieve.md +++ b/content/en/api/cli/beta/skills/retrieve.md @@ -1 +1,72 @@ -Not Found - Claude API Docs
                                                    \ No newline at end of file +## Retrieve + +`$ ant beta:skills retrieve` + +**get** `/v1/skills/{skill_id}` + +Get Skill + +### Parameters + +- `--skill-id: string` + + Unique identifier for the skill. + + The format and length of IDs may change over time. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaSkillGetResponse: object { id, created_at, display_title, 4 more }` + + - `id: string` + + Unique identifier for the skill. + + The format and length of IDs may change over time. + + - `created_at: string` + + ISO 8601 timestamp of when the skill was created. + + - `display_title: string` + + Display title for the skill. + + This is a human-readable label that is not included in the prompt sent to the model. + + - `latest_version: string` + + The latest version identifier for the skill. + + This represents the most recent version of the skill that has been created. + + - `source: string` + + Source of the skill. + + This may be one of the following values: + + * `"custom"`: the skill was created by a user + * `"anthropic"`: the skill was created by Anthropic + + - `type: string` + + Object type. + + For Skills, this is always `"skill"`. + + - `updated_at: string` + + ISO 8601 timestamp of when the skill was last updated. + +### Example + +```cli +ant beta:skills retrieve \ + --api-key my-anthropic-api-key \ + --skill-id skill_id +``` diff --git a/content/en/api/cli/beta/skills/versions.md b/content/en/api/cli/beta/skills/versions.md index 816fde711..847ca95c1 100644 --- a/content/en/api/cli/beta/skills/versions.md +++ b/content/en/api/cli/beta/skills/versions.md @@ -1 +1,315 @@ -Not Found - Claude API Docs
                                                      \ No newline at end of file +# Versions + +## Create + +`$ ant beta:skills:versions create` + +**post** `/v1/skills/{skill_id}/versions` + +Create Skill Version + +### Parameters + +- `--skill-id: string` + + Path param: Unique identifier for the skill. + + The format and length of IDs may change over time. + +- `--file: optional array of string` + + Body param: Files to upload for the skill. + + All files must be in the same top-level directory and must include a SKILL.md file at the root of that directory. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaSkillVersionNewResponse: object { id, created_at, description, 5 more }` + + - `id: string` + + Unique identifier for the skill version. + + The format and length of IDs may change over time. + + - `created_at: string` + + ISO 8601 timestamp of when the skill version was created. + + - `description: string` + + Description of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + + - `directory: string` + + Directory name of the skill version. + + This is the top-level directory name that was extracted from the uploaded files. + + - `name: string` + + Human-readable name of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + + - `skill_id: string` + + Identifier for the skill that this version belongs to. + + - `type: string` + + Object type. + + For Skill Versions, this is always `"skill_version"`. + + - `version: string` + + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + +### Example + +```cli +ant beta:skills:versions create \ + --api-key my-anthropic-api-key \ + --skill-id skill_id +``` + +## List + +`$ ant beta:skills:versions list` + +**get** `/v1/skills/{skill_id}/versions` + +List Skill Versions + +### Parameters + +- `--skill-id: string` + + Path param: Unique identifier for the skill. + + The format and length of IDs may change over time. + +- `--limit: optional number` + + Query param: Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + +- `--page: optional string` + + Query param: Optionally set to the `next_page` token from the previous response. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaListSkillVersionsResponse: object { data, has_more, next_page }` + + - `data: array of object { id, created_at, description, 5 more }` + + List of skill versions. + + - `id: string` + + Unique identifier for the skill version. + + The format and length of IDs may change over time. + + - `created_at: string` + + ISO 8601 timestamp of when the skill version was created. + + - `description: string` + + Description of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + + - `directory: string` + + Directory name of the skill version. + + This is the top-level directory name that was extracted from the uploaded files. + + - `name: string` + + Human-readable name of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + + - `skill_id: string` + + Identifier for the skill that this version belongs to. + + - `type: string` + + Object type. + + For Skill Versions, this is always `"skill_version"`. + + - `version: string` + + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + + - `has_more: boolean` + + Indicates if there are more results in the requested page direction. + + - `next_page: string` + + Token to provide in as `page` in the subsequent request to retrieve the next page of data. + +### Example + +```cli +ant beta:skills:versions list \ + --api-key my-anthropic-api-key \ + --skill-id skill_id +``` + +## Retrieve + +`$ ant beta:skills:versions retrieve` + +**get** `/v1/skills/{skill_id}/versions/{version}` + +Get Skill Version + +### Parameters + +- `--skill-id: string` + + Path param: Unique identifier for the skill. + + The format and length of IDs may change over time. + +- `--version: string` + + Path param: Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaSkillVersionGetResponse: object { id, created_at, description, 5 more }` + + - `id: string` + + Unique identifier for the skill version. + + The format and length of IDs may change over time. + + - `created_at: string` + + ISO 8601 timestamp of when the skill version was created. + + - `description: string` + + Description of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + + - `directory: string` + + Directory name of the skill version. + + This is the top-level directory name that was extracted from the uploaded files. + + - `name: string` + + Human-readable name of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + + - `skill_id: string` + + Identifier for the skill that this version belongs to. + + - `type: string` + + Object type. + + For Skill Versions, this is always `"skill_version"`. + + - `version: string` + + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + +### Example + +```cli +ant beta:skills:versions retrieve \ + --api-key my-anthropic-api-key \ + --skill-id skill_id \ + --version version +``` + +## Delete + +`$ ant beta:skills:versions delete` + +**delete** `/v1/skills/{skill_id}/versions/{version}` + +Delete Skill Version + +### Parameters + +- `--skill-id: string` + + Path param: Unique identifier for the skill. + + The format and length of IDs may change over time. + +- `--version: string` + + Path param: Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaSkillVersionDeleteResponse: object { id, type }` + + - `id: string` + + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + + - `type: string` + + Deleted object type. + + For Skill Versions, this is always `"skill_version_deleted"`. + +### Example + +```cli +ant beta:skills:versions delete \ + --api-key my-anthropic-api-key \ + --skill-id skill_id \ + --version version +``` diff --git a/content/en/api/cli/beta/skills/versions/create.md b/content/en/api/cli/beta/skills/versions/create.md index 6c7c84078..ff6e0d825 100644 --- a/content/en/api/cli/beta/skills/versions/create.md +++ b/content/en/api/cli/beta/skills/versions/create.md @@ -1 +1,81 @@ -Not Found - Claude API Docs
                                                        \ No newline at end of file +## Create + +`$ ant beta:skills:versions create` + +**post** `/v1/skills/{skill_id}/versions` + +Create Skill Version + +### Parameters + +- `--skill-id: string` + + Path param: Unique identifier for the skill. + + The format and length of IDs may change over time. + +- `--file: optional array of string` + + Body param: Files to upload for the skill. + + All files must be in the same top-level directory and must include a SKILL.md file at the root of that directory. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaSkillVersionNewResponse: object { id, created_at, description, 5 more }` + + - `id: string` + + Unique identifier for the skill version. + + The format and length of IDs may change over time. + + - `created_at: string` + + ISO 8601 timestamp of when the skill version was created. + + - `description: string` + + Description of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + + - `directory: string` + + Directory name of the skill version. + + This is the top-level directory name that was extracted from the uploaded files. + + - `name: string` + + Human-readable name of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + + - `skill_id: string` + + Identifier for the skill that this version belongs to. + + - `type: string` + + Object type. + + For Skill Versions, this is always `"skill_version"`. + + - `version: string` + + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + +### Example + +```cli +ant beta:skills:versions create \ + --api-key my-anthropic-api-key \ + --skill-id skill_id +``` diff --git a/content/en/api/cli/beta/skills/versions/delete.md b/content/en/api/cli/beta/skills/versions/delete.md index 1026c1b06..44eca6ac9 100644 --- a/content/en/api/cli/beta/skills/versions/delete.md +++ b/content/en/api/cli/beta/skills/versions/delete.md @@ -1 +1,50 @@ -Not Found - Claude API Docs
                                                          \ No newline at end of file +## Delete + +`$ ant beta:skills:versions delete` + +**delete** `/v1/skills/{skill_id}/versions/{version}` + +Delete Skill Version + +### Parameters + +- `--skill-id: string` + + Path param: Unique identifier for the skill. + + The format and length of IDs may change over time. + +- `--version: string` + + Path param: Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaSkillVersionDeleteResponse: object { id, type }` + + - `id: string` + + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + + - `type: string` + + Deleted object type. + + For Skill Versions, this is always `"skill_version_deleted"`. + +### Example + +```cli +ant beta:skills:versions delete \ + --api-key my-anthropic-api-key \ + --skill-id skill_id \ + --version version +``` diff --git a/content/en/api/cli/beta/skills/versions/list.md b/content/en/api/cli/beta/skills/versions/list.md index 1ddd29677..0a3f78020 100644 --- a/content/en/api/cli/beta/skills/versions/list.md +++ b/content/en/api/cli/beta/skills/versions/list.md @@ -1 +1,97 @@ -Not Found - Claude API Docs
                                                            \ No newline at end of file +## List + +`$ ant beta:skills:versions list` + +**get** `/v1/skills/{skill_id}/versions` + +List Skill Versions + +### Parameters + +- `--skill-id: string` + + Path param: Unique identifier for the skill. + + The format and length of IDs may change over time. + +- `--limit: optional number` + + Query param: Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + +- `--page: optional string` + + Query param: Optionally set to the `next_page` token from the previous response. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaListSkillVersionsResponse: object { data, has_more, next_page }` + + - `data: array of object { id, created_at, description, 5 more }` + + List of skill versions. + + - `id: string` + + Unique identifier for the skill version. + + The format and length of IDs may change over time. + + - `created_at: string` + + ISO 8601 timestamp of when the skill version was created. + + - `description: string` + + Description of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + + - `directory: string` + + Directory name of the skill version. + + This is the top-level directory name that was extracted from the uploaded files. + + - `name: string` + + Human-readable name of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + + - `skill_id: string` + + Identifier for the skill that this version belongs to. + + - `type: string` + + Object type. + + For Skill Versions, this is always `"skill_version"`. + + - `version: string` + + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + + - `has_more: boolean` + + Indicates if there are more results in the requested page direction. + + - `next_page: string` + + Token to provide in as `page` in the subsequent request to retrieve the next page of data. + +### Example + +```cli +ant beta:skills:versions list \ + --api-key my-anthropic-api-key \ + --skill-id skill_id +``` diff --git a/content/en/api/cli/beta/skills/versions/retrieve.md b/content/en/api/cli/beta/skills/versions/retrieve.md index 17cfea617..e1b5fd434 100644 --- a/content/en/api/cli/beta/skills/versions/retrieve.md +++ b/content/en/api/cli/beta/skills/versions/retrieve.md @@ -1 +1,82 @@ -Not Found - Claude API Docs
                                                              \ No newline at end of file +## Retrieve + +`$ ant beta:skills:versions retrieve` + +**get** `/v1/skills/{skill_id}/versions/{version}` + +Get Skill Version + +### Parameters + +- `--skill-id: string` + + Path param: Unique identifier for the skill. + + The format and length of IDs may change over time. + +- `--version: string` + + Path param: Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaSkillVersionGetResponse: object { id, created_at, description, 5 more }` + + - `id: string` + + Unique identifier for the skill version. + + The format and length of IDs may change over time. + + - `created_at: string` + + ISO 8601 timestamp of when the skill version was created. + + - `description: string` + + Description of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + + - `directory: string` + + Directory name of the skill version. + + This is the top-level directory name that was extracted from the uploaded files. + + - `name: string` + + Human-readable name of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + + - `skill_id: string` + + Identifier for the skill that this version belongs to. + + - `type: string` + + Object type. + + For Skill Versions, this is always `"skill_version"`. + + - `version: string` + + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + +### Example + +```cli +ant beta:skills:versions retrieve \ + --api-key my-anthropic-api-key \ + --skill-id skill_id \ + --version version +``` diff --git a/content/en/api/cli/beta/vaults.md b/content/en/api/cli/beta/vaults.md new file mode 100644 index 000000000..c82e18caa --- /dev/null +++ b/content/en/api/cli/beta/vaults.md @@ -0,0 +1,1881 @@ +# Vaults + +## Create + +`$ ant beta:vaults create` + +**post** `/v1/vaults` + +Create Vault + +### Parameters + +- `--display-name: string` + + Body param: Human-readable name for the vault. 1-255 characters. + +- `--metadata: optional map[string]` + + Body param: Arbitrary key-value metadata to attach to the vault. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_vault: object { id, archived_at, created_at, 4 more }` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```cli +ant beta:vaults create \ + --api-key my-anthropic-api-key \ + --display-name 'Example vault' +``` + +## List + +`$ ant beta:vaults list` + +**get** `/v1/vaults` + +List Vaults + +### Parameters + +- `--include-archived: optional boolean` + + Query param: Whether to include archived vaults in the results. + +- `--limit: optional number` + + Query param: Maximum number of vaults to return per page. Defaults to 20, maximum 100. + +- `--page: optional string` + + Query param: Opaque pagination token from a previous `list_vaults` response. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaManagedAgentsListVaultsResponse: object { data, next_page }` + + Response containing a paginated list of vaults. + + - `data: optional array of BetaManagedAgentsVault` + + List of vaults. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `next_page: optional string` + + Pagination token for the next page, or null if no more results. + +### Example + +```cli +ant beta:vaults list \ + --api-key my-anthropic-api-key +``` + +## Retrieve + +`$ ant beta:vaults retrieve` + +**get** `/v1/vaults/{vault_id}` + +Get Vault + +### Parameters + +- `--vault-id: string` + + Path parameter vault_id + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_vault: object { id, archived_at, created_at, 4 more }` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```cli +ant beta:vaults retrieve \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv +``` + +## Update + +`$ ant beta:vaults update` + +**post** `/v1/vaults/{vault_id}` + +Update Vault + +### Parameters + +- `--vault-id: string` + + Path param: Path parameter vault_id + +- `--display-name: optional string` + + Body param: Updated human-readable name for the vault. 1-255 characters. + +- `--metadata: optional map[string]` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_vault: object { id, archived_at, created_at, 4 more }` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```cli +ant beta:vaults update \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv +``` + +## Delete + +`$ ant beta:vaults delete` + +**delete** `/v1/vaults/{vault_id}` + +Delete Vault + +### Parameters + +- `--vault-id: string` + + Path parameter vault_id + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_deleted_vault: object { id, type }` + + Confirmation of a deleted vault. + + - `id: string` + + Unique identifier of the deleted vault. + + - `type: "vault_deleted"` + + - `"vault_deleted"` + +### Example + +```cli +ant beta:vaults delete \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv +``` + +## Archive + +`$ ant beta:vaults archive` + +**post** `/v1/vaults/{vault_id}/archive` + +Archive Vault + +### Parameters + +- `--vault-id: string` + + Path parameter vault_id + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_vault: object { id, archived_at, created_at, 4 more }` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```cli +ant beta:vaults archive \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv +``` + +## Domain Types + +### Beta Managed Agents Deleted Vault + +- `beta_managed_agents_deleted_vault: object { id, type }` + + Confirmation of a deleted vault. + + - `id: string` + + Unique identifier of the deleted vault. + + - `type: "vault_deleted"` + + - `"vault_deleted"` + +### Beta Managed Agents Vault + +- `beta_managed_agents_vault: object { id, archived_at, created_at, 4 more }` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +# Credentials + +## Create + +`$ ant beta:vaults:credentials create` + +**post** `/v1/vaults/{vault_id}/credentials` + +Create Credential + +### Parameters + +- `--vault-id: string` + + Path param: Path parameter vault_id + +- `--auth: BetaManagedAgentsMCPOAuthCreateParams or BetaManagedAgentsStaticBearerCreateParams` + + Body param: Authentication details for creating a credential. + +- `--display-name: optional string` + + Body param: Human-readable name for the credential. Up to 255 characters. + +- `--metadata: optional map[string]` + + Body param: Arbitrary key-value metadata to attach to the credential. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_credential: object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `beta_managed_agents_mcp_oauth_auth_response: object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional object { client_id, token_endpoint, token_endpoint_auth, 2 more }` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_response: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_response: object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_response: object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `beta_managed_agents_static_bearer_auth_response: object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Example + +```cli +ant beta:vaults:credentials create \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv \ + --auth '{token: bearer_exampletoken, mcp_server_url: https://example-server.modelcontextprotocol.io/sse, type: static_bearer}' +``` + +## List + +`$ ant beta:vaults:credentials list` + +**get** `/v1/vaults/{vault_id}/credentials` + +List Credentials + +### Parameters + +- `--vault-id: string` + + Path param: Path parameter vault_id + +- `--include-archived: optional boolean` + + Query param: Whether to include archived credentials in the results. + +- `--limit: optional number` + + Query param: Maximum number of credentials to return per page. Defaults to 20, maximum 100. + +- `--page: optional string` + + Query param: Opaque pagination token from a previous `list_credentials` response. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaManagedAgentsListCredentialsResponse: object { data, next_page }` + + Response containing a paginated list of credentials. + + - `data: optional array of BetaManagedAgentsCredential` + + List of credentials. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `beta_managed_agents_mcp_oauth_auth_response: object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional object { client_id, token_endpoint, token_endpoint_auth, 2 more }` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_response: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_response: object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_response: object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `beta_managed_agents_static_bearer_auth_response: object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + + - `next_page: optional string` + + Pagination token for the next page, or null if no more results. + +### Example + +```cli +ant beta:vaults:credentials list \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv +``` + +## Retrieve + +`$ ant beta:vaults:credentials retrieve` + +**get** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Get Credential + +### Parameters + +- `--vault-id: string` + + Path param: Path parameter vault_id + +- `--credential-id: string` + + Path param: Path parameter credential_id + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_credential: object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `beta_managed_agents_mcp_oauth_auth_response: object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional object { client_id, token_endpoint, token_endpoint_auth, 2 more }` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_response: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_response: object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_response: object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `beta_managed_agents_static_bearer_auth_response: object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Example + +```cli +ant beta:vaults:credentials retrieve \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv \ + --credential-id vcrd_011CZkZEMt8gZan2iYOQfSkw +``` + +## Update + +`$ ant beta:vaults:credentials update` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Update Credential + +### Parameters + +- `--vault-id: string` + + Path param: Path parameter vault_id + +- `--credential-id: string` + + Path param: Path parameter credential_id + +- `--auth: optional BetaManagedAgentsMCPOAuthUpdateParams or BetaManagedAgentsStaticBearerUpdateParams` + + Body param: Updated authentication details for a credential. + +- `--display-name: optional string` + + Body param: Updated human-readable name for the credential. 1-255 characters. + +- `--metadata: optional map[string]` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_credential: object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `beta_managed_agents_mcp_oauth_auth_response: object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional object { client_id, token_endpoint, token_endpoint_auth, 2 more }` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_response: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_response: object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_response: object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `beta_managed_agents_static_bearer_auth_response: object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Example + +```cli +ant beta:vaults:credentials update \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv \ + --credential-id vcrd_011CZkZEMt8gZan2iYOQfSkw +``` + +## Delete + +`$ ant beta:vaults:credentials delete` + +**delete** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Delete Credential + +### Parameters + +- `--vault-id: string` + + Path param: Path parameter vault_id + +- `--credential-id: string` + + Path param: Path parameter credential_id + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_deleted_credential: object { id, type }` + + Confirmation of a deleted credential. + + - `id: string` + + Unique identifier of the deleted credential. + + - `type: "vault_credential_deleted"` + + - `"vault_credential_deleted"` + +### Example + +```cli +ant beta:vaults:credentials delete \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv \ + --credential-id vcrd_011CZkZEMt8gZan2iYOQfSkw +``` + +## Archive + +`$ ant beta:vaults:credentials archive` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}/archive` + +Archive Credential + +### Parameters + +- `--vault-id: string` + + Path param: Path parameter vault_id + +- `--credential-id: string` + + Path param: Path parameter credential_id + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_credential: object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `beta_managed_agents_mcp_oauth_auth_response: object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional object { client_id, token_endpoint, token_endpoint_auth, 2 more }` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_response: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_response: object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_response: object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `beta_managed_agents_static_bearer_auth_response: object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Example + +```cli +ant beta:vaults:credentials archive \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv \ + --credential-id vcrd_011CZkZEMt8gZan2iYOQfSkw +``` + +## Domain Types + +### Beta Managed Agents Credential + +- `beta_managed_agents_credential: object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `beta_managed_agents_mcp_oauth_auth_response: object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional object { client_id, token_endpoint, token_endpoint_auth, 2 more }` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_response: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_response: object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_response: object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `beta_managed_agents_static_bearer_auth_response: object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Beta Managed Agents Deleted Credential + +- `beta_managed_agents_deleted_credential: object { id, type }` + + Confirmation of a deleted credential. + + - `id: string` + + Unique identifier of the deleted credential. + + - `type: "vault_credential_deleted"` + + - `"vault_credential_deleted"` + +### Beta Managed Agents MCP OAuth Auth Response + +- `beta_managed_agents_mcp_oauth_auth_response: object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional object { client_id, token_endpoint, token_endpoint_auth, 2 more }` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_response: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_response: object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_response: object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Create Params + +- `beta_managed_agents_mcp_oauth_create_params: object { access_token, mcp_server_url, type, 2 more }` + + Parameters for creating an MCP OAuth credential. + + - `access_token: string` + + OAuth access token. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional object { client_id, refresh_token, token_endpoint, 3 more }` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: string` + + OAuth client ID. + + - `refresh_token: string` + + OAuth refresh token. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam or BetaManagedAgentsTokenEndpointAuthBasicParam or BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_param: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_param: object { client_secret, type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_param: object { client_secret, type }` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Params + +- `beta_managed_agents_mcp_oauth_refresh_params: object { client_id, refresh_token, token_endpoint, 3 more }` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: string` + + OAuth client ID. + + - `refresh_token: string` + + OAuth refresh token. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam or BetaManagedAgentsTokenEndpointAuthBasicParam or BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_param: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_param: object { client_secret, type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_param: object { client_secret, type }` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Response + +- `beta_managed_agents_mcp_oauth_refresh_response: object { client_id, token_endpoint, token_endpoint_auth, 2 more }` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_response: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_response: object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_response: object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Update Params + +- `beta_managed_agents_mcp_oauth_refresh_update_params: object { refresh_token, scope, token_endpoint_auth }` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: optional string` + + Updated OAuth refresh token. + + - `scope: optional string` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: optional BetaManagedAgentsTokenEndpointAuthBasicUpdateParam or BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `beta_managed_agents_token_endpoint_auth_basic_update_param: object { type, client_secret }` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret: optional string` + + Updated OAuth client secret. + + - `beta_managed_agents_token_endpoint_auth_post_update_param: object { type, client_secret }` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret: optional string` + + Updated OAuth client secret. + +### Beta Managed Agents MCP OAuth Update Params + +- `beta_managed_agents_mcp_oauth_update_params: object { type, access_token, expires_at, refresh }` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `access_token: optional string` + + Updated OAuth access token. + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional object { refresh_token, scope, token_endpoint_auth }` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: optional string` + + Updated OAuth refresh token. + + - `scope: optional string` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: optional BetaManagedAgentsTokenEndpointAuthBasicUpdateParam or BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `beta_managed_agents_token_endpoint_auth_basic_update_param: object { type, client_secret }` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret: optional string` + + Updated OAuth client secret. + + - `beta_managed_agents_token_endpoint_auth_post_update_param: object { type, client_secret }` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret: optional string` + + Updated OAuth client secret. + +### Beta Managed Agents Static Bearer Auth Response + +- `beta_managed_agents_static_bearer_auth_response: object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + +### Beta Managed Agents Static Bearer Create Params + +- `beta_managed_agents_static_bearer_create_params: object { token, mcp_server_url, type }` + + Parameters for creating a static bearer token credential. + + - `token: string` + + Static bearer token value. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + +### Beta Managed Agents Static Bearer Update Params + +- `beta_managed_agents_static_bearer_update_params: object { type, token }` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `token: optional string` + + Updated static bearer token value. + +### Beta Managed Agents Token Endpoint Auth Basic Param + +- `beta_managed_agents_token_endpoint_auth_basic_param: object { client_secret, type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + +### Beta Managed Agents Token Endpoint Auth Basic Response + +- `beta_managed_agents_token_endpoint_auth_basic_response: object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + +### Beta Managed Agents Token Endpoint Auth Basic Update Param + +- `beta_managed_agents_token_endpoint_auth_basic_update_param: object { type, client_secret }` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret: optional string` + + Updated OAuth client secret. + +### Beta Managed Agents Token Endpoint Auth None Param + +- `beta_managed_agents_token_endpoint_auth_none_param: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + +### Beta Managed Agents Token Endpoint Auth None Response + +- `beta_managed_agents_token_endpoint_auth_none_response: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + +### Beta Managed Agents Token Endpoint Auth Post Param + +- `beta_managed_agents_token_endpoint_auth_post_param: object { client_secret, type }` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + +### Beta Managed Agents Token Endpoint Auth Post Response + +- `beta_managed_agents_token_endpoint_auth_post_response: object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + +### Beta Managed Agents Token Endpoint Auth Post Update Param + +- `beta_managed_agents_token_endpoint_auth_post_update_param: object { type, client_secret }` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret: optional string` + + Updated OAuth client secret. diff --git a/content/en/api/cli/beta/vaults/archive.md b/content/en/api/cli/beta/vaults/archive.md new file mode 100644 index 000000000..daf03c8dd --- /dev/null +++ b/content/en/api/cli/beta/vaults/archive.md @@ -0,0 +1,59 @@ +## Archive + +`$ ant beta:vaults archive` + +**post** `/v1/vaults/{vault_id}/archive` + +Archive Vault + +### Parameters + +- `--vault-id: string` + + Path parameter vault_id + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_vault: object { id, archived_at, created_at, 4 more }` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```cli +ant beta:vaults archive \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv +``` diff --git a/content/en/api/cli/beta/vaults/create.md b/content/en/api/cli/beta/vaults/create.md new file mode 100644 index 000000000..0ee8653ee --- /dev/null +++ b/content/en/api/cli/beta/vaults/create.md @@ -0,0 +1,63 @@ +## Create + +`$ ant beta:vaults create` + +**post** `/v1/vaults` + +Create Vault + +### Parameters + +- `--display-name: string` + + Body param: Human-readable name for the vault. 1-255 characters. + +- `--metadata: optional map[string]` + + Body param: Arbitrary key-value metadata to attach to the vault. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_vault: object { id, archived_at, created_at, 4 more }` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```cli +ant beta:vaults create \ + --api-key my-anthropic-api-key \ + --display-name 'Example vault' +``` diff --git a/content/en/api/cli/beta/vaults/credentials.md b/content/en/api/cli/beta/vaults/credentials.md new file mode 100644 index 000000000..50fe62a80 --- /dev/null +++ b/content/en/api/cli/beta/vaults/credentials.md @@ -0,0 +1,1462 @@ +# Credentials + +## Create + +`$ ant beta:vaults:credentials create` + +**post** `/v1/vaults/{vault_id}/credentials` + +Create Credential + +### Parameters + +- `--vault-id: string` + + Path param: Path parameter vault_id + +- `--auth: BetaManagedAgentsMCPOAuthCreateParams or BetaManagedAgentsStaticBearerCreateParams` + + Body param: Authentication details for creating a credential. + +- `--display-name: optional string` + + Body param: Human-readable name for the credential. Up to 255 characters. + +- `--metadata: optional map[string]` + + Body param: Arbitrary key-value metadata to attach to the credential. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_credential: object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `beta_managed_agents_mcp_oauth_auth_response: object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional object { client_id, token_endpoint, token_endpoint_auth, 2 more }` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_response: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_response: object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_response: object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `beta_managed_agents_static_bearer_auth_response: object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Example + +```cli +ant beta:vaults:credentials create \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv \ + --auth '{token: bearer_exampletoken, mcp_server_url: https://example-server.modelcontextprotocol.io/sse, type: static_bearer}' +``` + +## List + +`$ ant beta:vaults:credentials list` + +**get** `/v1/vaults/{vault_id}/credentials` + +List Credentials + +### Parameters + +- `--vault-id: string` + + Path param: Path parameter vault_id + +- `--include-archived: optional boolean` + + Query param: Whether to include archived credentials in the results. + +- `--limit: optional number` + + Query param: Maximum number of credentials to return per page. Defaults to 20, maximum 100. + +- `--page: optional string` + + Query param: Opaque pagination token from a previous `list_credentials` response. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaManagedAgentsListCredentialsResponse: object { data, next_page }` + + Response containing a paginated list of credentials. + + - `data: optional array of BetaManagedAgentsCredential` + + List of credentials. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `beta_managed_agents_mcp_oauth_auth_response: object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional object { client_id, token_endpoint, token_endpoint_auth, 2 more }` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_response: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_response: object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_response: object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `beta_managed_agents_static_bearer_auth_response: object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + + - `next_page: optional string` + + Pagination token for the next page, or null if no more results. + +### Example + +```cli +ant beta:vaults:credentials list \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv +``` + +## Retrieve + +`$ ant beta:vaults:credentials retrieve` + +**get** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Get Credential + +### Parameters + +- `--vault-id: string` + + Path param: Path parameter vault_id + +- `--credential-id: string` + + Path param: Path parameter credential_id + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_credential: object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `beta_managed_agents_mcp_oauth_auth_response: object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional object { client_id, token_endpoint, token_endpoint_auth, 2 more }` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_response: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_response: object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_response: object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `beta_managed_agents_static_bearer_auth_response: object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Example + +```cli +ant beta:vaults:credentials retrieve \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv \ + --credential-id vcrd_011CZkZEMt8gZan2iYOQfSkw +``` + +## Update + +`$ ant beta:vaults:credentials update` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Update Credential + +### Parameters + +- `--vault-id: string` + + Path param: Path parameter vault_id + +- `--credential-id: string` + + Path param: Path parameter credential_id + +- `--auth: optional BetaManagedAgentsMCPOAuthUpdateParams or BetaManagedAgentsStaticBearerUpdateParams` + + Body param: Updated authentication details for a credential. + +- `--display-name: optional string` + + Body param: Updated human-readable name for the credential. 1-255 characters. + +- `--metadata: optional map[string]` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_credential: object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `beta_managed_agents_mcp_oauth_auth_response: object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional object { client_id, token_endpoint, token_endpoint_auth, 2 more }` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_response: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_response: object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_response: object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `beta_managed_agents_static_bearer_auth_response: object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Example + +```cli +ant beta:vaults:credentials update \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv \ + --credential-id vcrd_011CZkZEMt8gZan2iYOQfSkw +``` + +## Delete + +`$ ant beta:vaults:credentials delete` + +**delete** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Delete Credential + +### Parameters + +- `--vault-id: string` + + Path param: Path parameter vault_id + +- `--credential-id: string` + + Path param: Path parameter credential_id + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_deleted_credential: object { id, type }` + + Confirmation of a deleted credential. + + - `id: string` + + Unique identifier of the deleted credential. + + - `type: "vault_credential_deleted"` + + - `"vault_credential_deleted"` + +### Example + +```cli +ant beta:vaults:credentials delete \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv \ + --credential-id vcrd_011CZkZEMt8gZan2iYOQfSkw +``` + +## Archive + +`$ ant beta:vaults:credentials archive` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}/archive` + +Archive Credential + +### Parameters + +- `--vault-id: string` + + Path param: Path parameter vault_id + +- `--credential-id: string` + + Path param: Path parameter credential_id + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_credential: object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `beta_managed_agents_mcp_oauth_auth_response: object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional object { client_id, token_endpoint, token_endpoint_auth, 2 more }` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_response: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_response: object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_response: object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `beta_managed_agents_static_bearer_auth_response: object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Example + +```cli +ant beta:vaults:credentials archive \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv \ + --credential-id vcrd_011CZkZEMt8gZan2iYOQfSkw +``` + +## Domain Types + +### Beta Managed Agents Credential + +- `beta_managed_agents_credential: object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `beta_managed_agents_mcp_oauth_auth_response: object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional object { client_id, token_endpoint, token_endpoint_auth, 2 more }` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_response: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_response: object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_response: object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `beta_managed_agents_static_bearer_auth_response: object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Beta Managed Agents Deleted Credential + +- `beta_managed_agents_deleted_credential: object { id, type }` + + Confirmation of a deleted credential. + + - `id: string` + + Unique identifier of the deleted credential. + + - `type: "vault_credential_deleted"` + + - `"vault_credential_deleted"` + +### Beta Managed Agents MCP OAuth Auth Response + +- `beta_managed_agents_mcp_oauth_auth_response: object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional object { client_id, token_endpoint, token_endpoint_auth, 2 more }` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_response: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_response: object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_response: object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Create Params + +- `beta_managed_agents_mcp_oauth_create_params: object { access_token, mcp_server_url, type, 2 more }` + + Parameters for creating an MCP OAuth credential. + + - `access_token: string` + + OAuth access token. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional object { client_id, refresh_token, token_endpoint, 3 more }` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: string` + + OAuth client ID. + + - `refresh_token: string` + + OAuth refresh token. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam or BetaManagedAgentsTokenEndpointAuthBasicParam or BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_param: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_param: object { client_secret, type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_param: object { client_secret, type }` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Params + +- `beta_managed_agents_mcp_oauth_refresh_params: object { client_id, refresh_token, token_endpoint, 3 more }` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: string` + + OAuth client ID. + + - `refresh_token: string` + + OAuth refresh token. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam or BetaManagedAgentsTokenEndpointAuthBasicParam or BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_param: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_param: object { client_secret, type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_param: object { client_secret, type }` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Response + +- `beta_managed_agents_mcp_oauth_refresh_response: object { client_id, token_endpoint, token_endpoint_auth, 2 more }` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_response: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_response: object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_response: object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Update Params + +- `beta_managed_agents_mcp_oauth_refresh_update_params: object { refresh_token, scope, token_endpoint_auth }` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: optional string` + + Updated OAuth refresh token. + + - `scope: optional string` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: optional BetaManagedAgentsTokenEndpointAuthBasicUpdateParam or BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `beta_managed_agents_token_endpoint_auth_basic_update_param: object { type, client_secret }` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret: optional string` + + Updated OAuth client secret. + + - `beta_managed_agents_token_endpoint_auth_post_update_param: object { type, client_secret }` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret: optional string` + + Updated OAuth client secret. + +### Beta Managed Agents MCP OAuth Update Params + +- `beta_managed_agents_mcp_oauth_update_params: object { type, access_token, expires_at, refresh }` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `access_token: optional string` + + Updated OAuth access token. + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional object { refresh_token, scope, token_endpoint_auth }` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: optional string` + + Updated OAuth refresh token. + + - `scope: optional string` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: optional BetaManagedAgentsTokenEndpointAuthBasicUpdateParam or BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `beta_managed_agents_token_endpoint_auth_basic_update_param: object { type, client_secret }` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret: optional string` + + Updated OAuth client secret. + + - `beta_managed_agents_token_endpoint_auth_post_update_param: object { type, client_secret }` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret: optional string` + + Updated OAuth client secret. + +### Beta Managed Agents Static Bearer Auth Response + +- `beta_managed_agents_static_bearer_auth_response: object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + +### Beta Managed Agents Static Bearer Create Params + +- `beta_managed_agents_static_bearer_create_params: object { token, mcp_server_url, type }` + + Parameters for creating a static bearer token credential. + + - `token: string` + + Static bearer token value. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + +### Beta Managed Agents Static Bearer Update Params + +- `beta_managed_agents_static_bearer_update_params: object { type, token }` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `token: optional string` + + Updated static bearer token value. + +### Beta Managed Agents Token Endpoint Auth Basic Param + +- `beta_managed_agents_token_endpoint_auth_basic_param: object { client_secret, type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + +### Beta Managed Agents Token Endpoint Auth Basic Response + +- `beta_managed_agents_token_endpoint_auth_basic_response: object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + +### Beta Managed Agents Token Endpoint Auth Basic Update Param + +- `beta_managed_agents_token_endpoint_auth_basic_update_param: object { type, client_secret }` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret: optional string` + + Updated OAuth client secret. + +### Beta Managed Agents Token Endpoint Auth None Param + +- `beta_managed_agents_token_endpoint_auth_none_param: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + +### Beta Managed Agents Token Endpoint Auth None Response + +- `beta_managed_agents_token_endpoint_auth_none_response: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + +### Beta Managed Agents Token Endpoint Auth Post Param + +- `beta_managed_agents_token_endpoint_auth_post_param: object { client_secret, type }` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + +### Beta Managed Agents Token Endpoint Auth Post Response + +- `beta_managed_agents_token_endpoint_auth_post_response: object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + +### Beta Managed Agents Token Endpoint Auth Post Update Param + +- `beta_managed_agents_token_endpoint_auth_post_update_param: object { type, client_secret }` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret: optional string` + + Updated OAuth client secret. diff --git a/content/en/api/cli/beta/vaults/credentials/archive.md b/content/en/api/cli/beta/vaults/credentials/archive.md new file mode 100644 index 000000000..11bde71ac --- /dev/null +++ b/content/en/api/cli/beta/vaults/credentials/archive.md @@ -0,0 +1,148 @@ +## Archive + +`$ ant beta:vaults:credentials archive` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}/archive` + +Archive Credential + +### Parameters + +- `--vault-id: string` + + Path param: Path parameter vault_id + +- `--credential-id: string` + + Path param: Path parameter credential_id + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_credential: object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `beta_managed_agents_mcp_oauth_auth_response: object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional object { client_id, token_endpoint, token_endpoint_auth, 2 more }` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_response: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_response: object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_response: object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `beta_managed_agents_static_bearer_auth_response: object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Example + +```cli +ant beta:vaults:credentials archive \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv \ + --credential-id vcrd_011CZkZEMt8gZan2iYOQfSkw +``` diff --git a/content/en/api/cli/beta/vaults/credentials/create.md b/content/en/api/cli/beta/vaults/credentials/create.md new file mode 100644 index 000000000..b292b4577 --- /dev/null +++ b/content/en/api/cli/beta/vaults/credentials/create.md @@ -0,0 +1,156 @@ +## Create + +`$ ant beta:vaults:credentials create` + +**post** `/v1/vaults/{vault_id}/credentials` + +Create Credential + +### Parameters + +- `--vault-id: string` + + Path param: Path parameter vault_id + +- `--auth: BetaManagedAgentsMCPOAuthCreateParams or BetaManagedAgentsStaticBearerCreateParams` + + Body param: Authentication details for creating a credential. + +- `--display-name: optional string` + + Body param: Human-readable name for the credential. Up to 255 characters. + +- `--metadata: optional map[string]` + + Body param: Arbitrary key-value metadata to attach to the credential. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_credential: object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `beta_managed_agents_mcp_oauth_auth_response: object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional object { client_id, token_endpoint, token_endpoint_auth, 2 more }` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_response: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_response: object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_response: object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `beta_managed_agents_static_bearer_auth_response: object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Example + +```cli +ant beta:vaults:credentials create \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv \ + --auth '{token: bearer_exampletoken, mcp_server_url: https://example-server.modelcontextprotocol.io/sse, type: static_bearer}' +``` diff --git a/content/en/api/cli/beta/vaults/credentials/delete.md b/content/en/api/cli/beta/vaults/credentials/delete.md new file mode 100644 index 000000000..f98f8bb0b --- /dev/null +++ b/content/en/api/cli/beta/vaults/credentials/delete.md @@ -0,0 +1,44 @@ +## Delete + +`$ ant beta:vaults:credentials delete` + +**delete** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Delete Credential + +### Parameters + +- `--vault-id: string` + + Path param: Path parameter vault_id + +- `--credential-id: string` + + Path param: Path parameter credential_id + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_deleted_credential: object { id, type }` + + Confirmation of a deleted credential. + + - `id: string` + + Unique identifier of the deleted credential. + + - `type: "vault_credential_deleted"` + + - `"vault_credential_deleted"` + +### Example + +```cli +ant beta:vaults:credentials delete \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv \ + --credential-id vcrd_011CZkZEMt8gZan2iYOQfSkw +``` diff --git a/content/en/api/cli/beta/vaults/credentials/list.md b/content/en/api/cli/beta/vaults/credentials/list.md new file mode 100644 index 000000000..b7b10167e --- /dev/null +++ b/content/en/api/cli/beta/vaults/credentials/list.md @@ -0,0 +1,163 @@ +## List + +`$ ant beta:vaults:credentials list` + +**get** `/v1/vaults/{vault_id}/credentials` + +List Credentials + +### Parameters + +- `--vault-id: string` + + Path param: Path parameter vault_id + +- `--include-archived: optional boolean` + + Query param: Whether to include archived credentials in the results. + +- `--limit: optional number` + + Query param: Maximum number of credentials to return per page. Defaults to 20, maximum 100. + +- `--page: optional string` + + Query param: Opaque pagination token from a previous `list_credentials` response. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaManagedAgentsListCredentialsResponse: object { data, next_page }` + + Response containing a paginated list of credentials. + + - `data: optional array of BetaManagedAgentsCredential` + + List of credentials. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `beta_managed_agents_mcp_oauth_auth_response: object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional object { client_id, token_endpoint, token_endpoint_auth, 2 more }` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_response: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_response: object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_response: object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `beta_managed_agents_static_bearer_auth_response: object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + + - `next_page: optional string` + + Pagination token for the next page, or null if no more results. + +### Example + +```cli +ant beta:vaults:credentials list \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv +``` diff --git a/content/en/api/cli/beta/vaults/credentials/retrieve.md b/content/en/api/cli/beta/vaults/credentials/retrieve.md new file mode 100644 index 000000000..f28ca9bc6 --- /dev/null +++ b/content/en/api/cli/beta/vaults/credentials/retrieve.md @@ -0,0 +1,148 @@ +## Retrieve + +`$ ant beta:vaults:credentials retrieve` + +**get** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Get Credential + +### Parameters + +- `--vault-id: string` + + Path param: Path parameter vault_id + +- `--credential-id: string` + + Path param: Path parameter credential_id + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_credential: object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `beta_managed_agents_mcp_oauth_auth_response: object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional object { client_id, token_endpoint, token_endpoint_auth, 2 more }` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_response: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_response: object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_response: object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `beta_managed_agents_static_bearer_auth_response: object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Example + +```cli +ant beta:vaults:credentials retrieve \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv \ + --credential-id vcrd_011CZkZEMt8gZan2iYOQfSkw +``` diff --git a/content/en/api/cli/beta/vaults/credentials/update.md b/content/en/api/cli/beta/vaults/credentials/update.md new file mode 100644 index 000000000..2e22a76dd --- /dev/null +++ b/content/en/api/cli/beta/vaults/credentials/update.md @@ -0,0 +1,160 @@ +## Update + +`$ ant beta:vaults:credentials update` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Update Credential + +### Parameters + +- `--vault-id: string` + + Path param: Path parameter vault_id + +- `--credential-id: string` + + Path param: Path parameter credential_id + +- `--auth: optional BetaManagedAgentsMCPOAuthUpdateParams or BetaManagedAgentsStaticBearerUpdateParams` + + Body param: Updated authentication details for a credential. + +- `--display-name: optional string` + + Body param: Updated human-readable name for the credential. 1-255 characters. + +- `--metadata: optional map[string]` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_credential: object { id, archived_at, auth, 6 more }` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `beta_managed_agents_mcp_oauth_auth_response: object { mcp_server_url, type, expires_at, refresh }` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at: optional string` + + A timestamp in RFC 3339 format + + - `refresh: optional object { client_id, token_endpoint, token_endpoint_auth, 2 more }` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse or BetaManagedAgentsTokenEndpointAuthBasicResponse or BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `beta_managed_agents_token_endpoint_auth_none_response: object { type }` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `beta_managed_agents_token_endpoint_auth_basic_response: object { type }` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `beta_managed_agents_token_endpoint_auth_post_response: object { type }` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource: optional string` + + OAuth resource indicator. + + - `scope: optional string` + + OAuth scope for the refresh request. + + - `beta_managed_agents_static_bearer_auth_response: object { mcp_server_url, type }` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name: optional string` + + Human-readable name for the credential. + +### Example + +```cli +ant beta:vaults:credentials update \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv \ + --credential-id vcrd_011CZkZEMt8gZan2iYOQfSkw +``` diff --git a/content/en/api/cli/beta/vaults/delete.md b/content/en/api/cli/beta/vaults/delete.md new file mode 100644 index 000000000..3ccc04b4a --- /dev/null +++ b/content/en/api/cli/beta/vaults/delete.md @@ -0,0 +1,39 @@ +## Delete + +`$ ant beta:vaults delete` + +**delete** `/v1/vaults/{vault_id}` + +Delete Vault + +### Parameters + +- `--vault-id: string` + + Path parameter vault_id + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_deleted_vault: object { id, type }` + + Confirmation of a deleted vault. + + - `id: string` + + Unique identifier of the deleted vault. + + - `type: "vault_deleted"` + + - `"vault_deleted"` + +### Example + +```cli +ant beta:vaults delete \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv +``` diff --git a/content/en/api/cli/beta/vaults/list.md b/content/en/api/cli/beta/vaults/list.md new file mode 100644 index 000000000..2792e12fb --- /dev/null +++ b/content/en/api/cli/beta/vaults/list.md @@ -0,0 +1,74 @@ +## List + +`$ ant beta:vaults list` + +**get** `/v1/vaults` + +List Vaults + +### Parameters + +- `--include-archived: optional boolean` + + Query param: Whether to include archived vaults in the results. + +- `--limit: optional number` + + Query param: Maximum number of vaults to return per page. Defaults to 20, maximum 100. + +- `--page: optional string` + + Query param: Opaque pagination token from a previous `list_vaults` response. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `BetaManagedAgentsListVaultsResponse: object { data, next_page }` + + Response containing a paginated list of vaults. + + - `data: optional array of BetaManagedAgentsVault` + + List of vaults. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `next_page: optional string` + + Pagination token for the next page, or null if no more results. + +### Example + +```cli +ant beta:vaults list \ + --api-key my-anthropic-api-key +``` diff --git a/content/en/api/cli/beta/vaults/retrieve.md b/content/en/api/cli/beta/vaults/retrieve.md new file mode 100644 index 000000000..e2251a13d --- /dev/null +++ b/content/en/api/cli/beta/vaults/retrieve.md @@ -0,0 +1,59 @@ +## Retrieve + +`$ ant beta:vaults retrieve` + +**get** `/v1/vaults/{vault_id}` + +Get Vault + +### Parameters + +- `--vault-id: string` + + Path parameter vault_id + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_vault: object { id, archived_at, created_at, 4 more }` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```cli +ant beta:vaults retrieve \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv +``` diff --git a/content/en/api/cli/beta/vaults/update.md b/content/en/api/cli/beta/vaults/update.md new file mode 100644 index 000000000..07c37540d --- /dev/null +++ b/content/en/api/cli/beta/vaults/update.md @@ -0,0 +1,67 @@ +## Update + +`$ ant beta:vaults update` + +**post** `/v1/vaults/{vault_id}` + +Update Vault + +### Parameters + +- `--vault-id: string` + + Path param: Path parameter vault_id + +- `--display-name: optional string` + + Body param: Updated human-readable name for the vault. 1-255 characters. + +- `--metadata: optional map[string]` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `beta_managed_agents_vault: object { id, archived_at, created_at, 4 more }` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: map[string]` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```cli +ant beta:vaults update \ + --api-key my-anthropic-api-key \ + --vault-id vlt_011CZkZDLs7fYzm1hXNPeRjv +``` diff --git a/content/en/api/cli/completions.md b/content/en/api/cli/completions.md index 98235cd3c..e2d7563a2 100644 --- a/content/en/api/cli/completions.md +++ b/content/en/api/cli/completions.md @@ -1 +1,301 @@ -Not Found - Claude API Docs
                                                                \ No newline at end of file +# Completions + +## Create + +`$ ant completions create` + +**post** `/v1/complete` + +[Legacy] Create a Text Completion. + +The Text Completions API is a legacy API. We recommend using the [Messages API](https://docs.claude.com/en/api/messages) going forward. + +Future models and features will not be compatible with Text Completions. See our [migration guide](https://docs.claude.com/en/api/migrating-from-text-completions-to-messages) for guidance in migrating from Text Completions to Messages. + +### Parameters + +- `--max-tokens-to-sample: number` + + Body param: The maximum number of tokens to generate before stopping. + + Note that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate. + +- `--model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + Body param: The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + +- `--prompt: string` + + Body param: The prompt that you want Claude to complete. + + For proper response generation you will need to format your prompt using alternating ` + + Human:`and` + + Assistant:` conversational turns. For example: + + ``` + " + + Human: {userQuestion} + + Assistant:" + ``` + + See [prompt validation](https://docs.claude.com/en/api/prompt-validation) and our guide to [prompt design](https://docs.claude.com/en/docs/intro-to-prompting) for more details. + +- `--metadata: optional object { user_id }` + + Body param: An object describing metadata about the request. + +- `--stop-sequence: optional array of string` + + Body param: Sequences that will cause the model to stop generating. + + Our models stop on `" + + Human:"`, and may include additional built-in stop sequences in the future. By providing the stop_sequences parameter, you may include additional strings that will cause the model to stop generating. + +- `--temperature: optional number` + + Body param: Amount of randomness injected into the response. + + Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks. + + Note that even with `temperature` of `0.0`, the results will not be fully deterministic. + +- `--top-k: optional number` + + Body param: Only sample from the top K options for each subsequent token. + + Used to remove "long tail" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277). + + Recommended for advanced use cases only. You usually only need to use `temperature`. + +- `--top-p: optional number` + + Body param: Use nucleus sampling. + + In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both. + + Recommended for advanced use cases only. You usually only need to use `temperature`. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `completion: object { id, completion, model, 2 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `completion: string` + + The resulting completion up to and excluding the stop sequences. + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `stop_reason: string` + + The reason that we stopped. + + This may be one the following values: + + * `"stop_sequence"`: we reached a stop sequence — either provided by you via the `stop_sequences` parameter, or a stop sequence built into the model + * `"max_tokens"`: we exceeded `max_tokens_to_sample` or the model's maximum + + - `type: "completion"` + + Object type. + + For Text Completions, this is always `"completion"`. + +### Example + +```cli +ant completions create \ + --api-key my-anthropic-api-key \ + --max-tokens-to-sample 256 \ + --model claude-mythos-preview \ + --prompt ' + +Human: Hello, world! + +Assistant:' +``` + +## Domain Types + +### Completion + +- `completion: object { id, completion, model, 2 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `completion: string` + + The resulting completion up to and excluding the stop sequences. + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `stop_reason: string` + + The reason that we stopped. + + This may be one the following values: + + * `"stop_sequence"`: we reached a stop sequence — either provided by you via the `stop_sequences` parameter, or a stop sequence built into the model + * `"max_tokens"`: we exceeded `max_tokens_to_sample` or the model's maximum + + - `type: "completion"` + + Object type. + + For Text Completions, this is always `"completion"`. diff --git a/content/en/api/cli/completions/create.md b/content/en/api/cli/completions/create.md index eb0377b2c..85134903b 100644 --- a/content/en/api/cli/completions/create.md +++ b/content/en/api/cli/completions/create.md @@ -1 +1,198 @@ -Not Found - Claude API Docs
                                                                  \ No newline at end of file +## Create + +`$ ant completions create` + +**post** `/v1/complete` + +[Legacy] Create a Text Completion. + +The Text Completions API is a legacy API. We recommend using the [Messages API](https://docs.claude.com/en/api/messages) going forward. + +Future models and features will not be compatible with Text Completions. See our [migration guide](https://docs.claude.com/en/api/migrating-from-text-completions-to-messages) for guidance in migrating from Text Completions to Messages. + +### Parameters + +- `--max-tokens-to-sample: number` + + Body param: The maximum number of tokens to generate before stopping. + + Note that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate. + +- `--model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + Body param: The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + +- `--prompt: string` + + Body param: The prompt that you want Claude to complete. + + For proper response generation you will need to format your prompt using alternating ` + + Human:`and` + + Assistant:` conversational turns. For example: + + ``` + " + + Human: {userQuestion} + + Assistant:" + ``` + + See [prompt validation](https://docs.claude.com/en/api/prompt-validation) and our guide to [prompt design](https://docs.claude.com/en/docs/intro-to-prompting) for more details. + +- `--metadata: optional object { user_id }` + + Body param: An object describing metadata about the request. + +- `--stop-sequence: optional array of string` + + Body param: Sequences that will cause the model to stop generating. + + Our models stop on `" + + Human:"`, and may include additional built-in stop sequences in the future. By providing the stop_sequences parameter, you may include additional strings that will cause the model to stop generating. + +- `--temperature: optional number` + + Body param: Amount of randomness injected into the response. + + Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks. + + Note that even with `temperature` of `0.0`, the results will not be fully deterministic. + +- `--top-k: optional number` + + Body param: Only sample from the top K options for each subsequent token. + + Used to remove "long tail" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277). + + Recommended for advanced use cases only. You usually only need to use `temperature`. + +- `--top-p: optional number` + + Body param: Use nucleus sampling. + + In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both. + + Recommended for advanced use cases only. You usually only need to use `temperature`. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `completion: object { id, completion, model, 2 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `completion: string` + + The resulting completion up to and excluding the stop sequences. + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `stop_reason: string` + + The reason that we stopped. + + This may be one the following values: + + * `"stop_sequence"`: we reached a stop sequence — either provided by you via the `stop_sequences` parameter, or a stop sequence built into the model + * `"max_tokens"`: we exceeded `max_tokens_to_sample` or the model's maximum + + - `type: "completion"` + + Object type. + + For Text Completions, this is always `"completion"`. + +### Example + +```cli +ant completions create \ + --api-key my-anthropic-api-key \ + --max-tokens-to-sample 256 \ + --model claude-mythos-preview \ + --prompt ' + +Human: Hello, world! + +Assistant:' +``` diff --git a/content/en/api/cli/messages.md b/content/en/api/cli/messages.md index ee46967ae..4509829b4 100644 --- a/content/en/api/cli/messages.md +++ b/content/en/api/cli/messages.md @@ -1 +1,21779 @@ -Not Found - Claude API Docs
                                                                    \ No newline at end of file +# Messages + +## Create + +`$ ant messages create` + +**post** `/v1/messages` + +Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation. + +The Messages API can be used for either single queries or stateless multi-turn conversations. + +Learn more about the Messages API in our [user guide](https://docs.claude.com/en/docs/initial-setup) + +### Parameters + +- `--max-tokens: number` + + The maximum number of tokens to generate before stopping. + + Note that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate. + + Different models have different maximum values for this parameter. See [models](https://docs.claude.com/en/docs/models-overview) for details. + +- `--message: array of MessageParam` + + Input messages. + + Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn. + + Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages. + + If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response. + + Example with a single `user` message: + + ```json + [{"role": "user", "content": "Hello, Claude"}] + ``` + + Example with multiple conversational turns: + + ```json + [ + {"role": "user", "content": "Hello there."}, + {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"}, + {"role": "user", "content": "Can you explain LLMs in plain English?"}, + ] + ``` + + Example with a partially-filled response from Claude: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("}, + ] + ``` + + Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent: + + ```json + {"role": "user", "content": "Hello, Claude"} + ``` + + ```json + {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]} + ``` + + See [input examples](https://docs.claude.com/en/api/messages-examples). + + Note that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. + + There is a limit of 100,000 messages in a single request. + +- `--model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + +- `--cache-control: optional object { type, ttl }` + + Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request. + +- `--container: optional string` + + Container identifier for reuse across requests. + +- `--inference-geo: optional string` + + Specifies the geographic region for inference processing. If not specified, the workspace's `default_inference_geo` is used. + +- `--metadata: optional object { user_id }` + + An object describing metadata about the request. + +- `--output-config: optional object { effort, format }` + + Configuration options for the model's output, such as the output format. + +- `--service-tier: optional "auto" or "standard_only"` + + Determines whether to use priority capacity (if available) or standard capacity for this request. + + Anthropic offers different levels of service for your API requests. See [service-tiers](https://docs.claude.com/en/api/service-tiers) for details. + +- `--stop-sequence: optional array of string` + + Custom text sequences that will cause the model to stop generating. + + Our models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `"end_turn"`. + + If you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `"stop_sequence"` and the response `stop_sequence` value will contain the matched stop sequence. + +- `--system: optional string or array of TextBlockParam` + + System prompt. + + A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts). + +- `--temperature: optional number` + + Amount of randomness injected into the response. + + Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks. + + Note that even with `temperature` of `0.0`, the results will not be fully deterministic. + +- `--thinking: optional ThinkingConfigEnabled or ThinkingConfigDisabled or ThinkingConfigAdaptive` + + Configuration for enabling Claude's extended thinking. + + When enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit. + + See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details. + +- `--tool-choice: optional ToolChoiceAuto or ToolChoiceAny or ToolChoiceTool or ToolChoiceNone` + + How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all. + +- `--tool: optional array of ToolUnion` + + Definitions of tools that the model may use. + + If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks. + + There are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)). + + Each tool definition includes: + + * `name`: Name of the tool. + * `description`: Optional, but strongly-recommended description of the tool. + * `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks. + + For example, if you defined `tools` as: + + ```json + [ + { + "name": "get_stock_price", + "description": "Get the current stock price for a given ticker symbol.", + "input_schema": { + "type": "object", + "properties": { + "ticker": { + "type": "string", + "description": "The stock ticker symbol, e.g. AAPL for Apple Inc." + } + }, + "required": ["ticker"] + } + } + ] + ``` + + And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this: + + ```json + [ + { + "type": "tool_use", + "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "name": "get_stock_price", + "input": { "ticker": "^GSPC" } + } + ] + ``` + + You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message: + + ```json + [ + { + "type": "tool_result", + "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "content": "259.75 USD" + } + ] + ``` + + Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output. + + See our [guide](https://docs.claude.com/en/docs/tool-use) for more details. + +- `--top-k: optional number` + + Only sample from the top K options for each subsequent token. + + Used to remove "long tail" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277). + + Recommended for advanced use cases only. You usually only need to use `temperature`. + +- `--top-p: optional number` + + Use nucleus sampling. + + In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both. + + Recommended for advanced use cases only. You usually only need to use `temperature`. + +### Returns + +- `message: object { id, container, content, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `content: array of ContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `text_block: object { citations, text, type }` + + - `citations: array of TextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citations_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `server_tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `web_search_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebSearchToolResultError or array of WebSearchResultBlock` + + - `web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of WebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `web_fetch_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebFetchToolResultErrorBlock or WebFetchBlock` + + - `web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: Base64PDFSource or PlainTextSource` + + - `base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: CodeExecutionToolResultError or CodeExecutionResultBlock or EncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BashCodeExecutionToolResultError or BashCodeExecutionResultBlock` + + - `bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: TextEditorCodeExecutionToolResultError or TextEditorCodeExecutionViewResultBlock or TextEditorCodeExecutionCreateResultBlock or TextEditorCodeExecutionStrReplaceResultBlock` + + - `text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: ToolSearchToolResultError or ToolSearchToolSearchResultBlock` + + - `tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of ToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 3 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"refusal"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 5 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + +### Example + +```cli +ant messages create \ + --api-key my-anthropic-api-key \ + --max-tokens 1024 \ + --message '{content: [{text: x, type: text}], role: user}' \ + --model claude-opus-4-6 +``` + +## Count Tokens + +`$ ant messages count-tokens` + +**post** `/v1/messages/count_tokens` + +Count the number of tokens in a Message. + +The Token Count API can be used to count the number of tokens in a Message, including tools, images, and documents, without creating it. + +Learn more about token counting in our [user guide](https://docs.claude.com/en/docs/build-with-claude/token-counting) + +### Parameters + +- `--message: array of MessageParam` + + Input messages. + + Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn. + + Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages. + + If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response. + + Example with a single `user` message: + + ```json + [{"role": "user", "content": "Hello, Claude"}] + ``` + + Example with multiple conversational turns: + + ```json + [ + {"role": "user", "content": "Hello there."}, + {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"}, + {"role": "user", "content": "Can you explain LLMs in plain English?"}, + ] + ``` + + Example with a partially-filled response from Claude: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("}, + ] + ``` + + Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent: + + ```json + {"role": "user", "content": "Hello, Claude"} + ``` + + ```json + {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]} + ``` + + See [input examples](https://docs.claude.com/en/api/messages-examples). + + Note that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. + + There is a limit of 100,000 messages in a single request. + +- `--model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + +- `--cache-control: optional object { type, ttl }` + + Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request. + +- `--output-config: optional object { effort, format }` + + Configuration options for the model's output, such as the output format. + +- `--system: optional string or array of TextBlockParam` + + System prompt. + + A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts). + +- `--thinking: optional ThinkingConfigEnabled or ThinkingConfigDisabled or ThinkingConfigAdaptive` + + Configuration for enabling Claude's extended thinking. + + When enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit. + + See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details. + +- `--tool-choice: optional ToolChoiceAuto or ToolChoiceAny or ToolChoiceTool or ToolChoiceNone` + + How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all. + +- `--tool: optional array of MessageCountTokensTool` + + Definitions of tools that the model may use. + + If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks. + + There are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)). + + Each tool definition includes: + + * `name`: Name of the tool. + * `description`: Optional, but strongly-recommended description of the tool. + * `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks. + + For example, if you defined `tools` as: + + ```json + [ + { + "name": "get_stock_price", + "description": "Get the current stock price for a given ticker symbol.", + "input_schema": { + "type": "object", + "properties": { + "ticker": { + "type": "string", + "description": "The stock ticker symbol, e.g. AAPL for Apple Inc." + } + }, + "required": ["ticker"] + } + } + ] + ``` + + And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this: + + ```json + [ + { + "type": "tool_use", + "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "name": "get_stock_price", + "input": { "ticker": "^GSPC" } + } + ] + ``` + + You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message: + + ```json + [ + { + "type": "tool_result", + "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "content": "259.75 USD" + } + ] + ``` + + Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output. + + See our [guide](https://docs.claude.com/en/docs/tool-use) for more details. + +### Returns + +- `message_tokens_count: object { input_tokens }` + + - `input_tokens: number` + + The total number of tokens across the provided list of messages, system prompt, and tools. + +### Example + +```cli +ant messages count-tokens \ + --api-key my-anthropic-api-key \ + --message '{content: [{text: x, type: text}], role: user}' \ + --model claude-mythos-preview +``` + +## Domain Types + +### Base64 Image Source + +- `base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + +### Base64 PDF Source + +- `base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + +### Bash Code Execution Output Block + +- `bash_code_execution_output_block: object { file_id, type }` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + +### Bash Code Execution Output Block Param + +- `bash_code_execution_output_block_param: object { file_id, type }` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + +### Bash Code Execution Result Block + +- `bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + +### Bash Code Execution Result Block Param + +- `bash_code_execution_result_block_param: object { content, return_code, stderr, 2 more }` + + - `content: array of BashCodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + +### Bash Code Execution Tool Result Block + +- `bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BashCodeExecutionToolResultError or BashCodeExecutionResultBlock` + + - `bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + +### Bash Code Execution Tool Result Block Param + +- `bash_code_execution_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: BashCodeExecutionToolResultErrorParam or BashCodeExecutionResultBlockParam` + + - `bash_code_execution_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `bash_code_execution_result_block_param: object { content, return_code, stderr, 2 more }` + + - `content: array of BashCodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Bash Code Execution Tool Result Error + +- `bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + +### Bash Code Execution Tool Result Error Code + +- `bash_code_execution_tool_result_error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + +### Bash Code Execution Tool Result Error Param + +- `bash_code_execution_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + +### Cache Control Ephemeral + +- `cache_control_ephemeral: object { type, ttl }` + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Cache Creation + +- `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + +### Citation Char Location + +- `citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + +### Citation Char Location Param + +- `citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + +### Citation Content Block Location + +- `citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + +### Citation Content Block Location Param + +- `citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + +### Citation Page Location + +- `citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + +### Citation Page Location Param + +- `citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + +### Citation Search Result Location Param + +- `citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + +### Citation Web Search Result Location Param + +- `citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + +### Citations Config + +- `citations_config: object { enabled }` + + - `enabled: boolean` + +### Citations Config Param + +- `citations_config_param: object { enabled }` + + - `enabled: optional boolean` + +### Citations Delta + +- `citations_delta: object { citation, type }` + + - `citation: CitationCharLocation or CitationPageLocation or CitationContentBlockLocation or 2 more` + + - `citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citations_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `type: "citations_delta"` + +### Citations Search Result Location + +- `citations_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + +### Citations Web Search Result Location + +- `citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + +### Code Execution Output Block + +- `code_execution_output_block: object { file_id, type }` + + - `file_id: string` + + - `type: "code_execution_output"` + +### Code Execution Output Block Param + +- `code_execution_output_block_param: object { file_id, type }` + + - `file_id: string` + + - `type: "code_execution_output"` + +### Code Execution Result Block + +- `code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + +### Code Execution Result Block Param + +- `code_execution_result_block_param: object { content, return_code, stderr, 2 more }` + + - `content: array of CodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + +### Code Execution Tool 20250522 + +- `code_execution_tool_20250522: object { name, type, allowed_callers, 3 more }` + + - `name: "code_execution"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "code_execution_20250522"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Code Execution Tool 20250825 + +- `code_execution_tool_20250825: object { name, type, allowed_callers, 3 more }` + + - `name: "code_execution"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "code_execution_20250825"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Code Execution Tool 20260120 + +- `code_execution_tool_20260120: object { name, type, allowed_callers, 3 more }` + + Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint). + + - `name: "code_execution"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "code_execution_20260120"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Code Execution Tool Result Block + +- `code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: CodeExecutionToolResultError or CodeExecutionResultBlock or EncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + +### Code Execution Tool Result Block Content + +- `code_execution_tool_result_block_content: CodeExecutionToolResultError or CodeExecutionResultBlock or EncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + +### Code Execution Tool Result Block Param + +- `code_execution_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: CodeExecutionToolResultErrorParam or CodeExecutionResultBlockParam or EncryptedCodeExecutionResultBlockParam` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `code_execution_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `code_execution_result_block_param: object { content, return_code, stderr, 2 more }` + + - `content: array of CodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `encrypted_code_execution_result_block_param: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of CodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Code Execution Tool Result Block Param Content + +- `code_execution_tool_result_block_param_content: CodeExecutionToolResultErrorParam or CodeExecutionResultBlockParam or EncryptedCodeExecutionResultBlockParam` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `code_execution_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `code_execution_result_block_param: object { content, return_code, stderr, 2 more }` + + - `content: array of CodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `encrypted_code_execution_result_block_param: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of CodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + +### Code Execution Tool Result Error + +- `code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + +### Code Execution Tool Result Error Code + +- `code_execution_tool_result_error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + +### Code Execution Tool Result Error Param + +- `code_execution_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + +### Container + +- `container: object { id, expires_at }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + +### Container Upload Block + +- `container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + +### Container Upload Block Param + +- `container_upload_block_param: object { file_id, type, cache_control }` + + A content block that represents a file to be uploaded to the container + Files uploaded via this block will be available in the container's input directory. + + - `file_id: string` + + - `type: "container_upload"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Content Block + +- `content_block: TextBlock or ThinkingBlock or RedactedThinkingBlock or 9 more` + + Response model for a file uploaded to the container. + + - `text_block: object { citations, text, type }` + + - `citations: array of TextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citations_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `server_tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `web_search_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebSearchToolResultError or array of WebSearchResultBlock` + + - `web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of WebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `web_fetch_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebFetchToolResultErrorBlock or WebFetchBlock` + + - `web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: Base64PDFSource or PlainTextSource` + + - `base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: CodeExecutionToolResultError or CodeExecutionResultBlock or EncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BashCodeExecutionToolResultError or BashCodeExecutionResultBlock` + + - `bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: TextEditorCodeExecutionToolResultError or TextEditorCodeExecutionViewResultBlock or TextEditorCodeExecutionCreateResultBlock or TextEditorCodeExecutionStrReplaceResultBlock` + + - `text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: ToolSearchToolResultError or ToolSearchToolSearchResultBlock` + + - `tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of ToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + +### Content Block Param + +- `content_block_param: TextBlockParam or ImageBlockParam or DocumentBlockParam or 13 more` + + Regular text content. + + - `text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of TextCitationParam` + + - `citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `image_block_param: object { source, type, cache_control }` + + - `source: Base64ImageSource or URLImageSource` + + - `base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `document_block_param: object { source, type, cache_control, 3 more }` + + - `source: Base64PDFSource or PlainTextSource or ContentBlockSource or URLPDFSource` + + - `base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `content_block_source: object { content, type }` + + - `content: string or array of ContentBlockSourceContent` + + - `union_member_0: string` + + - `content_block_source_content: array of ContentBlockSourceContent` + + - `text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of TextCitationParam` + + - `citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `image_block_param: object { source, type, cache_control }` + + - `source: Base64ImageSource or URLImageSource` + + - `base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "content"` + + - `url_pdf_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `type: "document"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `context: optional string` + + - `title: optional string` + + - `search_result_block_param: object { content, source, title, 3 more }` + + - `content: array of TextBlockParam` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of TextCitationParam` + + - `citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `source: string` + + - `title: string` + + - `type: "search_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `thinking_block_param: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `redacted_thinking_block_param: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `tool_use_block_param: object { id, input, name, 3 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `tool_result_block_param: object { tool_use_id, type, cache_control, 2 more }` + + - `tool_use_id: string` + + - `type: "tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `content: optional array of TextBlockParam or ImageBlockParam or SearchResultBlockParam or 2 more` + + - `text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of TextCitationParam` + + - `citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `image_block_param: object { source, type, cache_control }` + + - `source: Base64ImageSource or URLImageSource` + + - `base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `search_result_block_param: object { content, source, title, 3 more }` + + - `content: array of TextBlockParam` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of TextCitationParam` + + - `citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `source: string` + + - `title: string` + + - `type: "search_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `document_block_param: object { source, type, cache_control, 3 more }` + + - `source: Base64PDFSource or PlainTextSource or ContentBlockSource or URLPDFSource` + + - `base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `content_block_source: object { content, type }` + + - `content: string or array of ContentBlockSourceContent` + + - `union_member_0: string` + + - `content_block_source_content: array of ContentBlockSourceContent` + + - `text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of TextCitationParam` + + - `citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `image_block_param: object { source, type, cache_control }` + + - `source: Base64ImageSource or URLImageSource` + + - `base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "content"` + + - `url_pdf_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `type: "document"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `context: optional string` + + - `title: optional string` + + - `tool_reference_block_param: object { tool_name, type, cache_control }` + + Tool reference block that can be included in tool_result content. + + - `tool_name: string` + + - `type: "tool_reference"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `is_error: optional boolean` + + - `server_tool_use_block_param: object { id, input, name, 3 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `web_search_tool_result_block_param: object { content, tool_use_id, type, 2 more }` + + - `content: array of WebSearchResultBlockParam or WebSearchToolRequestError` + + - `web_search_tool_result_block_item: array of WebSearchResultBlockParam` + + - `encrypted_content: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `page_age: optional string` + + - `web_search_tool_request_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `web_fetch_tool_result_block_param: object { content, tool_use_id, type, 2 more }` + + - `content: WebFetchToolResultErrorBlockParam or WebFetchBlockParam` + + - `web_fetch_tool_result_error_block_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `web_fetch_block_param: object { content, type, url, retrieved_at }` + + - `content: object { source, type, cache_control, 3 more }` + + - `source: Base64PDFSource or PlainTextSource or ContentBlockSource or URLPDFSource` + + - `base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `content_block_source: object { content, type }` + + - `content: string or array of ContentBlockSourceContent` + + - `union_member_0: string` + + - `content_block_source_content: array of ContentBlockSourceContent` + + - `text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of TextCitationParam` + + - `citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `image_block_param: object { source, type, cache_control }` + + - `source: Base64ImageSource or URLImageSource` + + - `base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "content"` + + - `url_pdf_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `type: "document"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `context: optional string` + + - `title: optional string` + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `retrieved_at: optional string` + + ISO 8601 timestamp when the content was retrieved + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `code_execution_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: CodeExecutionToolResultErrorParam or CodeExecutionResultBlockParam or EncryptedCodeExecutionResultBlockParam` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `code_execution_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `code_execution_result_block_param: object { content, return_code, stderr, 2 more }` + + - `content: array of CodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `encrypted_code_execution_result_block_param: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of CodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `bash_code_execution_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: BashCodeExecutionToolResultErrorParam or BashCodeExecutionResultBlockParam` + + - `bash_code_execution_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `bash_code_execution_result_block_param: object { content, return_code, stderr, 2 more }` + + - `content: array of BashCodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `text_editor_code_execution_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: TextEditorCodeExecutionToolResultErrorParam or TextEditorCodeExecutionViewResultBlockParam or TextEditorCodeExecutionCreateResultBlockParam or TextEditorCodeExecutionStrReplaceResultBlockParam` + + - `text_editor_code_execution_tool_result_error_param: object { error_code, type, error_message }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `error_message: optional string` + + - `text_editor_code_execution_view_result_block_param: object { content, file_type, type, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `type: "text_editor_code_execution_view_result"` + + - `num_lines: optional number` + + - `start_line: optional number` + + - `total_lines: optional number` + + - `text_editor_code_execution_create_result_block_param: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `text_editor_code_execution_str_replace_result_block_param: object { type, lines, new_lines, 3 more }` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `lines: optional array of string` + + - `new_lines: optional number` + + - `new_start: optional number` + + - `old_lines: optional number` + + - `old_start: optional number` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `tool_search_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: ToolSearchToolResultErrorParam or ToolSearchToolSearchResultBlockParam` + + - `tool_search_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "tool_search_tool_result_error"` + + - `tool_search_tool_search_result_block_param: object { tool_references, type }` + + - `tool_references: array of ToolReferenceBlockParam` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `container_upload_block_param: object { file_id, type, cache_control }` + + A content block that represents a file to be uploaded to the container + Files uploaded via this block will be available in the container's input directory. + + - `file_id: string` + + - `type: "container_upload"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Content Block Source + +- `content_block_source: object { content, type }` + + - `content: string or array of ContentBlockSourceContent` + + - `union_member_0: string` + + - `content_block_source_content: array of ContentBlockSourceContent` + + - `text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of TextCitationParam` + + - `citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `image_block_param: object { source, type, cache_control }` + + - `source: Base64ImageSource or URLImageSource` + + - `base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "content"` + +### Content Block Source Content + +- `content_block_source_content: TextBlockParam or ImageBlockParam` + + - `text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of TextCitationParam` + + - `citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `image_block_param: object { source, type, cache_control }` + + - `source: Base64ImageSource or URLImageSource` + + - `base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Direct Caller + +- `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + +### Document Block + +- `document_block: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: Base64PDFSource or PlainTextSource` + + - `base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + +### Document Block Param + +- `document_block_param: object { source, type, cache_control, 3 more }` + + - `source: Base64PDFSource or PlainTextSource or ContentBlockSource or URLPDFSource` + + - `base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `content_block_source: object { content, type }` + + - `content: string or array of ContentBlockSourceContent` + + - `union_member_0: string` + + - `content_block_source_content: array of ContentBlockSourceContent` + + - `text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of TextCitationParam` + + - `citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `image_block_param: object { source, type, cache_control }` + + - `source: Base64ImageSource or URLImageSource` + + - `base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "content"` + + - `url_pdf_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `type: "document"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `context: optional string` + + - `title: optional string` + +### Encrypted Code Execution Result Block + +- `encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + +### Encrypted Code Execution Result Block Param + +- `encrypted_code_execution_result_block_param: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of CodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + +### Image Block Param + +- `image_block_param: object { source, type, cache_control }` + + - `source: Base64ImageSource or URLImageSource` + + - `base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Input JSON Delta + +- `input_json_delta: object { partial_json, type }` + + - `partial_json: string` + + - `type: "input_json_delta"` + +### JSON Output Format + +- `json_output_format: object { schema, type }` + + - `schema: map[unknown]` + + The JSON schema of the format + + - `type: "json_schema"` + +### Memory Tool 20250818 + +- `memory_tool_20250818: object { name, type, allowed_callers, 4 more }` + + - `name: "memory"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "memory_20250818"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Message + +- `message: object { id, container, content, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `content: array of ContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `text_block: object { citations, text, type }` + + - `citations: array of TextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citations_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `server_tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `web_search_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebSearchToolResultError or array of WebSearchResultBlock` + + - `web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of WebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `web_fetch_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebFetchToolResultErrorBlock or WebFetchBlock` + + - `web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: Base64PDFSource or PlainTextSource` + + - `base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: CodeExecutionToolResultError or CodeExecutionResultBlock or EncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BashCodeExecutionToolResultError or BashCodeExecutionResultBlock` + + - `bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: TextEditorCodeExecutionToolResultError or TextEditorCodeExecutionViewResultBlock or TextEditorCodeExecutionCreateResultBlock or TextEditorCodeExecutionStrReplaceResultBlock` + + - `text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: ToolSearchToolResultError or ToolSearchToolSearchResultBlock` + + - `tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of ToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 3 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"refusal"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 5 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + +### Message Count Tokens Tool + +- `message_count_tokens_tool: Tool or ToolBash20250124 or CodeExecutionTool20250522 or 13 more` + + Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint). + + - `tool: object { input_schema, name, allowed_callers, 7 more }` + + - `input_schema: object { type, properties, required }` + + [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input. + + This defines the shape of the `input` that your tool accepts and that the model will produce. + + - `type: "object"` + + - `properties: optional map[unknown]` + + - `required: optional array of string` + + - `name: string` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `description: optional string` + + Description of what this tool does. + + Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema. + + - `eager_input_streaming: optional boolean` + + Enable eager input streaming for this tool. When true, tool input parameters will be streamed incrementally as they are generated, and types will be inferred on-the-fly rather than buffering the full JSON output. When false, streaming is disabled for this tool even if the fine-grained-tool-streaming beta is active. When null (default), uses the default behavior based on beta headers. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `type: optional "custom"` + + - `"custom"` + + - `tool_bash_20250124: object { name, type, allowed_callers, 4 more }` + + - `name: "bash"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "bash_20250124"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `code_execution_tool_20250522: object { name, type, allowed_callers, 3 more }` + + - `name: "code_execution"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "code_execution_20250522"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `code_execution_tool_20250825: object { name, type, allowed_callers, 3 more }` + + - `name: "code_execution"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "code_execution_20250825"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `code_execution_tool_20260120: object { name, type, allowed_callers, 3 more }` + + Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint). + + - `name: "code_execution"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "code_execution_20260120"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `memory_tool_20250818: object { name, type, allowed_callers, 4 more }` + + - `name: "memory"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "memory_20250818"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `tool_text_editor_20250124: object { name, type, allowed_callers, 4 more }` + + - `name: "str_replace_editor"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "text_editor_20250124"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `tool_text_editor_20250429: object { name, type, allowed_callers, 4 more }` + + - `name: "str_replace_based_edit_tool"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "text_editor_20250429"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `tool_text_editor_20250728: object { name, type, allowed_callers, 5 more }` + + - `name: "str_replace_based_edit_tool"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "text_editor_20250728"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `max_characters: optional number` + + Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `web_search_tool_20250305: object { name, type, allowed_callers, 7 more }` + + - `name: "web_search"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_search_20250305"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`. + + - `blocked_domains: optional array of string` + + If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`. + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `user_location: optional object { type, city, country, 2 more }` + + Parameters for the user's location. Used to provide more relevant search results. + + - `type: "approximate"` + + - `city: optional string` + + The city of the user. + + - `country: optional string` + + The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user. + + - `region: optional string` + + The region of the user. + + - `timezone: optional string` + + The [IANA timezone](https://nodatime.org/TimeZones) of the user. + + - `web_fetch_tool_20250910: object { name, type, allowed_callers, 8 more }` + + - `name: "web_fetch"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_fetch_20250910"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + List of domains to allow fetching from + + - `blocked_domains: optional array of string` + + List of domains to block fetching from + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + Citations configuration for fetched documents. Citations are disabled by default. + + - `enabled: optional boolean` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_content_tokens: optional number` + + Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `web_search_tool_20260209: object { name, type, allowed_callers, 7 more }` + + - `name: "web_search"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_search_20260209"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`. + + - `blocked_domains: optional array of string` + + If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`. + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `user_location: optional object { type, city, country, 2 more }` + + Parameters for the user's location. Used to provide more relevant search results. + + - `type: "approximate"` + + - `city: optional string` + + The city of the user. + + - `country: optional string` + + The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user. + + - `region: optional string` + + The region of the user. + + - `timezone: optional string` + + The [IANA timezone](https://nodatime.org/TimeZones) of the user. + + - `web_fetch_tool_20260209: object { name, type, allowed_callers, 8 more }` + + - `name: "web_fetch"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_fetch_20260209"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + List of domains to allow fetching from + + - `blocked_domains: optional array of string` + + List of domains to block fetching from + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + Citations configuration for fetched documents. Citations are disabled by default. + + - `enabled: optional boolean` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_content_tokens: optional number` + + Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `web_fetch_tool_20260309: object { name, type, allowed_callers, 9 more }` + + Web fetch tool with use_cache parameter for bypassing cached content. + + - `name: "web_fetch"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_fetch_20260309"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + List of domains to allow fetching from + + - `blocked_domains: optional array of string` + + List of domains to block fetching from + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + Citations configuration for fetched documents. Citations are disabled by default. + + - `enabled: optional boolean` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_content_tokens: optional number` + + Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `use_cache: optional boolean` + + Whether to use cached content. Set to false to bypass the cache and fetch fresh content. Only set to false when the user explicitly requests fresh content or when fetching rapidly-changing sources. + + - `tool_search_tool_bm25_20251119: object { name, type, allowed_callers, 3 more }` + + - `name: "tool_search_tool_bm25"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "tool_search_tool_bm25_20251119" or "tool_search_tool_bm25"` + + - `"tool_search_tool_bm25_20251119"` + + - `"tool_search_tool_bm25"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `tool_search_tool_regex_20251119: object { name, type, allowed_callers, 3 more }` + + - `name: "tool_search_tool_regex"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "tool_search_tool_regex_20251119" or "tool_search_tool_regex"` + + - `"tool_search_tool_regex_20251119"` + + - `"tool_search_tool_regex"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Message Delta Usage + +- `message_delta_usage: object { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 2 more }` + + - `cache_creation_input_tokens: number` + + The cumulative number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The cumulative number of input tokens read from the cache. + + - `input_tokens: number` + + The cumulative number of input tokens which were used. + + - `output_tokens: number` + + The cumulative number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + +### Message Param + +- `message_param: object { content, role }` + + - `content: array of ContentBlockParam` + + - `text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of TextCitationParam` + + - `citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `image_block_param: object { source, type, cache_control }` + + - `source: Base64ImageSource or URLImageSource` + + - `base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `document_block_param: object { source, type, cache_control, 3 more }` + + - `source: Base64PDFSource or PlainTextSource or ContentBlockSource or URLPDFSource` + + - `base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `content_block_source: object { content, type }` + + - `content: string or array of ContentBlockSourceContent` + + - `union_member_0: string` + + - `content_block_source_content: array of ContentBlockSourceContent` + + - `text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of TextCitationParam` + + - `citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `image_block_param: object { source, type, cache_control }` + + - `source: Base64ImageSource or URLImageSource` + + - `base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "content"` + + - `url_pdf_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `type: "document"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `context: optional string` + + - `title: optional string` + + - `search_result_block_param: object { content, source, title, 3 more }` + + - `content: array of TextBlockParam` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of TextCitationParam` + + - `citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `source: string` + + - `title: string` + + - `type: "search_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `thinking_block_param: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `redacted_thinking_block_param: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `tool_use_block_param: object { id, input, name, 3 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `tool_result_block_param: object { tool_use_id, type, cache_control, 2 more }` + + - `tool_use_id: string` + + - `type: "tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `content: optional array of TextBlockParam or ImageBlockParam or SearchResultBlockParam or 2 more` + + - `text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of TextCitationParam` + + - `citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `image_block_param: object { source, type, cache_control }` + + - `source: Base64ImageSource or URLImageSource` + + - `base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `search_result_block_param: object { content, source, title, 3 more }` + + - `content: array of TextBlockParam` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of TextCitationParam` + + - `citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `source: string` + + - `title: string` + + - `type: "search_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `document_block_param: object { source, type, cache_control, 3 more }` + + - `source: Base64PDFSource or PlainTextSource or ContentBlockSource or URLPDFSource` + + - `base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `content_block_source: object { content, type }` + + - `content: string or array of ContentBlockSourceContent` + + - `union_member_0: string` + + - `content_block_source_content: array of ContentBlockSourceContent` + + - `text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of TextCitationParam` + + - `citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `image_block_param: object { source, type, cache_control }` + + - `source: Base64ImageSource or URLImageSource` + + - `base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "content"` + + - `url_pdf_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `type: "document"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `context: optional string` + + - `title: optional string` + + - `tool_reference_block_param: object { tool_name, type, cache_control }` + + Tool reference block that can be included in tool_result content. + + - `tool_name: string` + + - `type: "tool_reference"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `is_error: optional boolean` + + - `server_tool_use_block_param: object { id, input, name, 3 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `web_search_tool_result_block_param: object { content, tool_use_id, type, 2 more }` + + - `content: array of WebSearchResultBlockParam or WebSearchToolRequestError` + + - `web_search_tool_result_block_item: array of WebSearchResultBlockParam` + + - `encrypted_content: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `page_age: optional string` + + - `web_search_tool_request_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `web_fetch_tool_result_block_param: object { content, tool_use_id, type, 2 more }` + + - `content: WebFetchToolResultErrorBlockParam or WebFetchBlockParam` + + - `web_fetch_tool_result_error_block_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `web_fetch_block_param: object { content, type, url, retrieved_at }` + + - `content: object { source, type, cache_control, 3 more }` + + - `source: Base64PDFSource or PlainTextSource or ContentBlockSource or URLPDFSource` + + - `base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `content_block_source: object { content, type }` + + - `content: string or array of ContentBlockSourceContent` + + - `union_member_0: string` + + - `content_block_source_content: array of ContentBlockSourceContent` + + - `text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of TextCitationParam` + + - `citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `image_block_param: object { source, type, cache_control }` + + - `source: Base64ImageSource or URLImageSource` + + - `base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "content"` + + - `url_pdf_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `type: "document"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `context: optional string` + + - `title: optional string` + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `retrieved_at: optional string` + + ISO 8601 timestamp when the content was retrieved + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `code_execution_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: CodeExecutionToolResultErrorParam or CodeExecutionResultBlockParam or EncryptedCodeExecutionResultBlockParam` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `code_execution_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `code_execution_result_block_param: object { content, return_code, stderr, 2 more }` + + - `content: array of CodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `encrypted_code_execution_result_block_param: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of CodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `bash_code_execution_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: BashCodeExecutionToolResultErrorParam or BashCodeExecutionResultBlockParam` + + - `bash_code_execution_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `bash_code_execution_result_block_param: object { content, return_code, stderr, 2 more }` + + - `content: array of BashCodeExecutionOutputBlockParam` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `text_editor_code_execution_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: TextEditorCodeExecutionToolResultErrorParam or TextEditorCodeExecutionViewResultBlockParam or TextEditorCodeExecutionCreateResultBlockParam or TextEditorCodeExecutionStrReplaceResultBlockParam` + + - `text_editor_code_execution_tool_result_error_param: object { error_code, type, error_message }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `error_message: optional string` + + - `text_editor_code_execution_view_result_block_param: object { content, file_type, type, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `type: "text_editor_code_execution_view_result"` + + - `num_lines: optional number` + + - `start_line: optional number` + + - `total_lines: optional number` + + - `text_editor_code_execution_create_result_block_param: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `text_editor_code_execution_str_replace_result_block_param: object { type, lines, new_lines, 3 more }` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `lines: optional array of string` + + - `new_lines: optional number` + + - `new_start: optional number` + + - `old_lines: optional number` + + - `old_start: optional number` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `tool_search_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: ToolSearchToolResultErrorParam or ToolSearchToolSearchResultBlockParam` + + - `tool_search_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "tool_search_tool_result_error"` + + - `tool_search_tool_search_result_block_param: object { tool_references, type }` + + - `tool_references: array of ToolReferenceBlockParam` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `container_upload_block_param: object { file_id, type, cache_control }` + + A content block that represents a file to be uploaded to the container + Files uploaded via this block will be available in the container's input directory. + + - `file_id: string` + + - `type: "container_upload"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `role: "user" or "assistant"` + + - `"user"` + + - `"assistant"` + +### Message Tokens Count + +- `message_tokens_count: object { input_tokens }` + + - `input_tokens: number` + + The total number of tokens across the provided list of messages, system prompt, and tools. + +### Metadata + +- `metadata: object { user_id }` + + - `user_id: optional string` + + An external identifier for the user who is associated with the request. + + This should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number. + +### Output Config + +- `output_config: object { effort, format }` + + - `effort: optional "low" or "medium" or "high" or "max"` + + All possible effort levels. + + - `"low"` + + - `"medium"` + + - `"high"` + + - `"max"` + + - `format: optional object { schema, type }` + + A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) + + - `schema: map[unknown]` + + The JSON schema of the format + + - `type: "json_schema"` + +### Plain Text Source + +- `plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + +### Raw Content Block Delta + +- `raw_content_block_delta: TextDelta or InputJSONDelta or CitationsDelta or 2 more` + + - `text_delta: object { text, type }` + + - `text: string` + + - `type: "text_delta"` + + - `input_json_delta: object { partial_json, type }` + + - `partial_json: string` + + - `type: "input_json_delta"` + + - `citations_delta: object { citation, type }` + + - `citation: CitationCharLocation or CitationPageLocation or CitationContentBlockLocation or 2 more` + + - `citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citations_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `type: "citations_delta"` + + - `thinking_delta: object { thinking, type }` + + - `thinking: string` + + - `type: "thinking_delta"` + + - `signature_delta: object { signature, type }` + + - `signature: string` + + - `type: "signature_delta"` + +### Raw Content Block Delta Event + +- `raw_content_block_delta_event: object { delta, index, type }` + + - `delta: TextDelta or InputJSONDelta or CitationsDelta or 2 more` + + - `text_delta: object { text, type }` + + - `text: string` + + - `type: "text_delta"` + + - `input_json_delta: object { partial_json, type }` + + - `partial_json: string` + + - `type: "input_json_delta"` + + - `citations_delta: object { citation, type }` + + - `citation: CitationCharLocation or CitationPageLocation or CitationContentBlockLocation or 2 more` + + - `citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citations_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `type: "citations_delta"` + + - `thinking_delta: object { thinking, type }` + + - `thinking: string` + + - `type: "thinking_delta"` + + - `signature_delta: object { signature, type }` + + - `signature: string` + + - `type: "signature_delta"` + + - `index: number` + + - `type: "content_block_delta"` + +### Raw Content Block Start Event + +- `raw_content_block_start_event: object { content_block, index, type }` + + - `content_block: TextBlock or ThinkingBlock or RedactedThinkingBlock or 9 more` + + Response model for a file uploaded to the container. + + - `text_block: object { citations, text, type }` + + - `citations: array of TextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citations_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `server_tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `web_search_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebSearchToolResultError or array of WebSearchResultBlock` + + - `web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of WebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `web_fetch_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebFetchToolResultErrorBlock or WebFetchBlock` + + - `web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: Base64PDFSource or PlainTextSource` + + - `base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: CodeExecutionToolResultError or CodeExecutionResultBlock or EncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BashCodeExecutionToolResultError or BashCodeExecutionResultBlock` + + - `bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: TextEditorCodeExecutionToolResultError or TextEditorCodeExecutionViewResultBlock or TextEditorCodeExecutionCreateResultBlock or TextEditorCodeExecutionStrReplaceResultBlock` + + - `text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: ToolSearchToolResultError or ToolSearchToolSearchResultBlock` + + - `tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of ToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `index: number` + + - `type: "content_block_start"` + +### Raw Content Block Stop Event + +- `raw_content_block_stop_event: object { index, type }` + + - `index: number` + + - `type: "content_block_stop"` + +### Raw Message Delta Event + +- `raw_message_delta_event: object { delta, type, usage }` + + - `delta: object { container, stop_details, stop_reason, stop_sequence }` + + - `container: object { id, expires_at }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 3 more` + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"refusal"` + + - `stop_sequence: string` + + - `type: "message_delta"` + + - `usage: object { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 2 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation_input_tokens: number` + + The cumulative number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The cumulative number of input tokens read from the cache. + + - `input_tokens: number` + + The cumulative number of input tokens which were used. + + - `output_tokens: number` + + The cumulative number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + +### Raw Message Start Event + +- `raw_message_start_event: object { message, type }` + + - `message: object { id, container, content, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `content: array of ContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `text_block: object { citations, text, type }` + + - `citations: array of TextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citations_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `server_tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `web_search_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebSearchToolResultError or array of WebSearchResultBlock` + + - `web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of WebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `web_fetch_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebFetchToolResultErrorBlock or WebFetchBlock` + + - `web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: Base64PDFSource or PlainTextSource` + + - `base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: CodeExecutionToolResultError or CodeExecutionResultBlock or EncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BashCodeExecutionToolResultError or BashCodeExecutionResultBlock` + + - `bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: TextEditorCodeExecutionToolResultError or TextEditorCodeExecutionViewResultBlock or TextEditorCodeExecutionCreateResultBlock or TextEditorCodeExecutionStrReplaceResultBlock` + + - `text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: ToolSearchToolResultError or ToolSearchToolSearchResultBlock` + + - `tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of ToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 3 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"refusal"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 5 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `type: "message_start"` + +### Raw Message Stop Event + +- `raw_message_stop_event: object { type }` + + - `type: "message_stop"` + +### Raw Message Stream Event + +- `raw_message_stream_event: RawMessageStartEvent or RawMessageDeltaEvent or RawMessageStopEvent or 3 more` + + - `raw_message_start_event: object { message, type }` + + - `message: object { id, container, content, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `content: array of ContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `text_block: object { citations, text, type }` + + - `citations: array of TextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citations_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `server_tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `web_search_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebSearchToolResultError or array of WebSearchResultBlock` + + - `web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of WebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `web_fetch_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebFetchToolResultErrorBlock or WebFetchBlock` + + - `web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: Base64PDFSource or PlainTextSource` + + - `base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: CodeExecutionToolResultError or CodeExecutionResultBlock or EncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BashCodeExecutionToolResultError or BashCodeExecutionResultBlock` + + - `bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: TextEditorCodeExecutionToolResultError or TextEditorCodeExecutionViewResultBlock or TextEditorCodeExecutionCreateResultBlock or TextEditorCodeExecutionStrReplaceResultBlock` + + - `text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: ToolSearchToolResultError or ToolSearchToolSearchResultBlock` + + - `tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of ToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 3 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"refusal"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 5 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `type: "message_start"` + + - `raw_message_delta_event: object { delta, type, usage }` + + - `delta: object { container, stop_details, stop_reason, stop_sequence }` + + - `container: object { id, expires_at }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 3 more` + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"refusal"` + + - `stop_sequence: string` + + - `type: "message_delta"` + + - `usage: object { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 2 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation_input_tokens: number` + + The cumulative number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The cumulative number of input tokens read from the cache. + + - `input_tokens: number` + + The cumulative number of input tokens which were used. + + - `output_tokens: number` + + The cumulative number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `raw_message_stop_event: object { type }` + + - `type: "message_stop"` + + - `raw_content_block_start_event: object { content_block, index, type }` + + - `content_block: TextBlock or ThinkingBlock or RedactedThinkingBlock or 9 more` + + Response model for a file uploaded to the container. + + - `text_block: object { citations, text, type }` + + - `citations: array of TextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citations_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `server_tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `web_search_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebSearchToolResultError or array of WebSearchResultBlock` + + - `web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of WebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `web_fetch_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebFetchToolResultErrorBlock or WebFetchBlock` + + - `web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: Base64PDFSource or PlainTextSource` + + - `base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: CodeExecutionToolResultError or CodeExecutionResultBlock or EncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BashCodeExecutionToolResultError or BashCodeExecutionResultBlock` + + - `bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: TextEditorCodeExecutionToolResultError or TextEditorCodeExecutionViewResultBlock or TextEditorCodeExecutionCreateResultBlock or TextEditorCodeExecutionStrReplaceResultBlock` + + - `text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: ToolSearchToolResultError or ToolSearchToolSearchResultBlock` + + - `tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of ToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `index: number` + + - `type: "content_block_start"` + + - `raw_content_block_delta_event: object { delta, index, type }` + + - `delta: TextDelta or InputJSONDelta or CitationsDelta or 2 more` + + - `text_delta: object { text, type }` + + - `text: string` + + - `type: "text_delta"` + + - `input_json_delta: object { partial_json, type }` + + - `partial_json: string` + + - `type: "input_json_delta"` + + - `citations_delta: object { citation, type }` + + - `citation: CitationCharLocation or CitationPageLocation or CitationContentBlockLocation or 2 more` + + - `citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citations_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `type: "citations_delta"` + + - `thinking_delta: object { thinking, type }` + + - `thinking: string` + + - `type: "thinking_delta"` + + - `signature_delta: object { signature, type }` + + - `signature: string` + + - `type: "signature_delta"` + + - `index: number` + + - `type: "content_block_delta"` + + - `raw_content_block_stop_event: object { index, type }` + + - `index: number` + + - `type: "content_block_stop"` + +### Redacted Thinking Block + +- `redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + +### Redacted Thinking Block Param + +- `redacted_thinking_block_param: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + +### Refusal Stop Details + +- `refusal_stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + +### Search Result Block Param + +- `search_result_block_param: object { content, source, title, 3 more }` + + - `content: array of TextBlockParam` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of TextCitationParam` + + - `citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `source: string` + + - `title: string` + + - `type: "search_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + +### Server Tool Caller + +- `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + +### Server Tool Caller 20260120 + +- `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + +### Server Tool Usage + +- `server_tool_usage: object { web_fetch_requests, web_search_requests }` + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + +### Server Tool Use Block + +- `server_tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + +### Server Tool Use Block Param + +- `server_tool_use_block_param: object { id, input, name, 3 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + +### Signature Delta + +- `signature_delta: object { signature, type }` + + - `signature: string` + + - `type: "signature_delta"` + +### Stop Reason + +- `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 3 more` + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"refusal"` + +### Text Block + +- `text_block: object { citations, text, type }` + + - `citations: array of TextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citations_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + +### Text Block Param + +- `text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of TextCitationParam` + + - `citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + +### Text Citation + +- `text_citation: CitationCharLocation or CitationPageLocation or CitationContentBlockLocation or 2 more` + + - `citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citations_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + +### Text Citation Param + +- `text_citation_param: CitationCharLocationParam or CitationPageLocationParam or CitationContentBlockLocationParam or 2 more` + + - `citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + +### Text Delta + +- `text_delta: object { text, type }` + + - `text: string` + + - `type: "text_delta"` + +### Text Editor Code Execution Create Result Block + +- `text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + +### Text Editor Code Execution Create Result Block Param + +- `text_editor_code_execution_create_result_block_param: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + +### Text Editor Code Execution Str Replace Result Block + +- `text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + +### Text Editor Code Execution Str Replace Result Block Param + +- `text_editor_code_execution_str_replace_result_block_param: object { type, lines, new_lines, 3 more }` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `lines: optional array of string` + + - `new_lines: optional number` + + - `new_start: optional number` + + - `old_lines: optional number` + + - `old_start: optional number` + +### Text Editor Code Execution Tool Result Block + +- `text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: TextEditorCodeExecutionToolResultError or TextEditorCodeExecutionViewResultBlock or TextEditorCodeExecutionCreateResultBlock or TextEditorCodeExecutionStrReplaceResultBlock` + + - `text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + +### Text Editor Code Execution Tool Result Block Param + +- `text_editor_code_execution_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: TextEditorCodeExecutionToolResultErrorParam or TextEditorCodeExecutionViewResultBlockParam or TextEditorCodeExecutionCreateResultBlockParam or TextEditorCodeExecutionStrReplaceResultBlockParam` + + - `text_editor_code_execution_tool_result_error_param: object { error_code, type, error_message }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `error_message: optional string` + + - `text_editor_code_execution_view_result_block_param: object { content, file_type, type, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `type: "text_editor_code_execution_view_result"` + + - `num_lines: optional number` + + - `start_line: optional number` + + - `total_lines: optional number` + + - `text_editor_code_execution_create_result_block_param: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `text_editor_code_execution_str_replace_result_block_param: object { type, lines, new_lines, 3 more }` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `lines: optional array of string` + + - `new_lines: optional number` + + - `new_start: optional number` + + - `old_lines: optional number` + + - `old_start: optional number` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Text Editor Code Execution Tool Result Error + +- `text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + +### Text Editor Code Execution Tool Result Error Code + +- `text_editor_code_execution_tool_result_error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + +### Text Editor Code Execution Tool Result Error Param + +- `text_editor_code_execution_tool_result_error_param: object { error_code, type, error_message }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `error_message: optional string` + +### Text Editor Code Execution View Result Block + +- `text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + +### Text Editor Code Execution View Result Block Param + +- `text_editor_code_execution_view_result_block_param: object { content, file_type, type, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `type: "text_editor_code_execution_view_result"` + + - `num_lines: optional number` + + - `start_line: optional number` + + - `total_lines: optional number` + +### Thinking Block + +- `thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + +### Thinking Block Param + +- `thinking_block_param: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + +### Thinking Config Adaptive + +- `thinking_config_adaptive: object { type, display }` + + - `type: "adaptive"` + + - `display: optional "summarized" or "omitted"` + + Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`. + + - `"summarized"` + + - `"omitted"` + +### Thinking Config Disabled + +- `thinking_config_disabled: object { type }` + + - `type: "disabled"` + +### Thinking Config Enabled + +- `thinking_config_enabled: object { budget_tokens, type, display }` + + - `budget_tokens: number` + + Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality. + + Must be ≥1024 and less than `max_tokens`. + + See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details. + + - `type: "enabled"` + + - `display: optional "summarized" or "omitted"` + + Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`. + + - `"summarized"` + + - `"omitted"` + +### Thinking Config Param + +- `thinking_config_param: ThinkingConfigEnabled or ThinkingConfigDisabled or ThinkingConfigAdaptive` + + Configuration for enabling Claude's extended thinking. + + When enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit. + + See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details. + + - `thinking_config_enabled: object { budget_tokens, type, display }` + + - `budget_tokens: number` + + Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality. + + Must be ≥1024 and less than `max_tokens`. + + See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details. + + - `type: "enabled"` + + - `display: optional "summarized" or "omitted"` + + Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`. + + - `"summarized"` + + - `"omitted"` + + - `thinking_config_disabled: object { type }` + + - `type: "disabled"` + + - `thinking_config_adaptive: object { type, display }` + + - `type: "adaptive"` + + - `display: optional "summarized" or "omitted"` + + Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`. + + - `"summarized"` + + - `"omitted"` + +### Thinking Delta + +- `thinking_delta: object { thinking, type }` + + - `thinking: string` + + - `type: "thinking_delta"` + +### Tool + +- `tool: object { input_schema, name, allowed_callers, 7 more }` + + - `input_schema: object { type, properties, required }` + + [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input. + + This defines the shape of the `input` that your tool accepts and that the model will produce. + + - `type: "object"` + + - `properties: optional map[unknown]` + + - `required: optional array of string` + + - `name: string` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `description: optional string` + + Description of what this tool does. + + Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema. + + - `eager_input_streaming: optional boolean` + + Enable eager input streaming for this tool. When true, tool input parameters will be streamed incrementally as they are generated, and types will be inferred on-the-fly rather than buffering the full JSON output. When false, streaming is disabled for this tool even if the fine-grained-tool-streaming beta is active. When null (default), uses the default behavior based on beta headers. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `type: optional "custom"` + + - `"custom"` + +### Tool Bash 20250124 + +- `tool_bash_20250124: object { name, type, allowed_callers, 4 more }` + + - `name: "bash"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "bash_20250124"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Tool Choice + +- `tool_choice: ToolChoiceAuto or ToolChoiceAny or ToolChoiceTool or ToolChoiceNone` + + How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all. + + - `tool_choice_auto: object { type, disable_parallel_tool_use }` + + The model will automatically decide whether to use tools. + + - `type: "auto"` + + - `disable_parallel_tool_use: optional boolean` + + Whether to disable parallel tool use. + + Defaults to `false`. If set to `true`, the model will output at most one tool use. + + - `tool_choice_any: object { type, disable_parallel_tool_use }` + + The model will use any available tools. + + - `type: "any"` + + - `disable_parallel_tool_use: optional boolean` + + Whether to disable parallel tool use. + + Defaults to `false`. If set to `true`, the model will output exactly one tool use. + + - `tool_choice_tool: object { name, type, disable_parallel_tool_use }` + + The model will use the specified tool with `tool_choice.name`. + + - `name: string` + + The name of the tool to use. + + - `type: "tool"` + + - `disable_parallel_tool_use: optional boolean` + + Whether to disable parallel tool use. + + Defaults to `false`. If set to `true`, the model will output exactly one tool use. + + - `tool_choice_none: object { type }` + + The model will not be allowed to use tools. + + - `type: "none"` + +### Tool Choice Any + +- `tool_choice_any: object { type, disable_parallel_tool_use }` + + The model will use any available tools. + + - `type: "any"` + + - `disable_parallel_tool_use: optional boolean` + + Whether to disable parallel tool use. + + Defaults to `false`. If set to `true`, the model will output exactly one tool use. + +### Tool Choice Auto + +- `tool_choice_auto: object { type, disable_parallel_tool_use }` + + The model will automatically decide whether to use tools. + + - `type: "auto"` + + - `disable_parallel_tool_use: optional boolean` + + Whether to disable parallel tool use. + + Defaults to `false`. If set to `true`, the model will output at most one tool use. + +### Tool Choice None + +- `tool_choice_none: object { type }` + + The model will not be allowed to use tools. + + - `type: "none"` + +### Tool Choice Tool + +- `tool_choice_tool: object { name, type, disable_parallel_tool_use }` + + The model will use the specified tool with `tool_choice.name`. + + - `name: string` + + The name of the tool to use. + + - `type: "tool"` + + - `disable_parallel_tool_use: optional boolean` + + Whether to disable parallel tool use. + + Defaults to `false`. If set to `true`, the model will output exactly one tool use. + +### Tool Reference Block + +- `tool_reference_block: object { tool_name, type }` + + - `tool_name: string` + + - `type: "tool_reference"` + +### Tool Reference Block Param + +- `tool_reference_block_param: object { tool_name, type, cache_control }` + + Tool reference block that can be included in tool_result content. + + - `tool_name: string` + + - `type: "tool_reference"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Tool Result Block Param + +- `tool_result_block_param: object { tool_use_id, type, cache_control, 2 more }` + + - `tool_use_id: string` + + - `type: "tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `content: optional array of TextBlockParam or ImageBlockParam or SearchResultBlockParam or 2 more` + + - `text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of TextCitationParam` + + - `citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `image_block_param: object { source, type, cache_control }` + + - `source: Base64ImageSource or URLImageSource` + + - `base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `search_result_block_param: object { content, source, title, 3 more }` + + - `content: array of TextBlockParam` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of TextCitationParam` + + - `citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `source: string` + + - `title: string` + + - `type: "search_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `document_block_param: object { source, type, cache_control, 3 more }` + + - `source: Base64PDFSource or PlainTextSource or ContentBlockSource or URLPDFSource` + + - `base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `content_block_source: object { content, type }` + + - `content: string or array of ContentBlockSourceContent` + + - `union_member_0: string` + + - `content_block_source_content: array of ContentBlockSourceContent` + + - `text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of TextCitationParam` + + - `citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `image_block_param: object { source, type, cache_control }` + + - `source: Base64ImageSource or URLImageSource` + + - `base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "content"` + + - `url_pdf_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `type: "document"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `context: optional string` + + - `title: optional string` + + - `tool_reference_block_param: object { tool_name, type, cache_control }` + + Tool reference block that can be included in tool_result content. + + - `tool_name: string` + + - `type: "tool_reference"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `is_error: optional boolean` + +### Tool Search Tool Bm25 20251119 + +- `tool_search_tool_bm25_20251119: object { name, type, allowed_callers, 3 more }` + + - `name: "tool_search_tool_bm25"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "tool_search_tool_bm25_20251119" or "tool_search_tool_bm25"` + + - `"tool_search_tool_bm25_20251119"` + + - `"tool_search_tool_bm25"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Tool Search Tool Regex 20251119 + +- `tool_search_tool_regex_20251119: object { name, type, allowed_callers, 3 more }` + + - `name: "tool_search_tool_regex"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "tool_search_tool_regex_20251119" or "tool_search_tool_regex"` + + - `"tool_search_tool_regex_20251119"` + + - `"tool_search_tool_regex"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Tool Search Tool Result Block + +- `tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: ToolSearchToolResultError or ToolSearchToolSearchResultBlock` + + - `tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of ToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + +### Tool Search Tool Result Block Param + +- `tool_search_tool_result_block_param: object { content, tool_use_id, type, cache_control }` + + - `content: ToolSearchToolResultErrorParam or ToolSearchToolSearchResultBlockParam` + + - `tool_search_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "tool_search_tool_result_error"` + + - `tool_search_tool_search_result_block_param: object { tool_references, type }` + + - `tool_references: array of ToolReferenceBlockParam` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + +### Tool Search Tool Result Error + +- `tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + +### Tool Search Tool Result Error Code + +- `tool_search_tool_result_error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + +### Tool Search Tool Result Error Param + +- `tool_search_tool_result_error_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "tool_search_tool_result_error"` + +### Tool Search Tool Search Result Block + +- `tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of ToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + +### Tool Search Tool Search Result Block Param + +- `tool_search_tool_search_result_block_param: object { tool_references, type }` + + - `tool_references: array of ToolReferenceBlockParam` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "tool_search_tool_search_result"` + +### Tool Text Editor 20250124 + +- `tool_text_editor_20250124: object { name, type, allowed_callers, 4 more }` + + - `name: "str_replace_editor"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "text_editor_20250124"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Tool Text Editor 20250429 + +- `tool_text_editor_20250429: object { name, type, allowed_callers, 4 more }` + + - `name: "str_replace_based_edit_tool"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "text_editor_20250429"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Tool Text Editor 20250728 + +- `tool_text_editor_20250728: object { name, type, allowed_callers, 5 more }` + + - `name: "str_replace_based_edit_tool"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "text_editor_20250728"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `max_characters: optional number` + + Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Tool Union + +- `tool_union: Tool or ToolBash20250124 or CodeExecutionTool20250522 or 13 more` + + Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint). + + - `tool: object { input_schema, name, allowed_callers, 7 more }` + + - `input_schema: object { type, properties, required }` + + [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input. + + This defines the shape of the `input` that your tool accepts and that the model will produce. + + - `type: "object"` + + - `properties: optional map[unknown]` + + - `required: optional array of string` + + - `name: string` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `description: optional string` + + Description of what this tool does. + + Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema. + + - `eager_input_streaming: optional boolean` + + Enable eager input streaming for this tool. When true, tool input parameters will be streamed incrementally as they are generated, and types will be inferred on-the-fly rather than buffering the full JSON output. When false, streaming is disabled for this tool even if the fine-grained-tool-streaming beta is active. When null (default), uses the default behavior based on beta headers. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `type: optional "custom"` + + - `"custom"` + + - `tool_bash_20250124: object { name, type, allowed_callers, 4 more }` + + - `name: "bash"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "bash_20250124"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `code_execution_tool_20250522: object { name, type, allowed_callers, 3 more }` + + - `name: "code_execution"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "code_execution_20250522"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `code_execution_tool_20250825: object { name, type, allowed_callers, 3 more }` + + - `name: "code_execution"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "code_execution_20250825"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `code_execution_tool_20260120: object { name, type, allowed_callers, 3 more }` + + Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint). + + - `name: "code_execution"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "code_execution_20260120"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `memory_tool_20250818: object { name, type, allowed_callers, 4 more }` + + - `name: "memory"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "memory_20250818"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `tool_text_editor_20250124: object { name, type, allowed_callers, 4 more }` + + - `name: "str_replace_editor"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "text_editor_20250124"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `tool_text_editor_20250429: object { name, type, allowed_callers, 4 more }` + + - `name: "str_replace_based_edit_tool"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "text_editor_20250429"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `tool_text_editor_20250728: object { name, type, allowed_callers, 5 more }` + + - `name: "str_replace_based_edit_tool"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "text_editor_20250728"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `input_examples: optional array of map[unknown]` + + - `max_characters: optional number` + + Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `web_search_tool_20250305: object { name, type, allowed_callers, 7 more }` + + - `name: "web_search"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_search_20250305"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`. + + - `blocked_domains: optional array of string` + + If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`. + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `user_location: optional object { type, city, country, 2 more }` + + Parameters for the user's location. Used to provide more relevant search results. + + - `type: "approximate"` + + - `city: optional string` + + The city of the user. + + - `country: optional string` + + The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user. + + - `region: optional string` + + The region of the user. + + - `timezone: optional string` + + The [IANA timezone](https://nodatime.org/TimeZones) of the user. + + - `web_fetch_tool_20250910: object { name, type, allowed_callers, 8 more }` + + - `name: "web_fetch"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_fetch_20250910"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + List of domains to allow fetching from + + - `blocked_domains: optional array of string` + + List of domains to block fetching from + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + Citations configuration for fetched documents. Citations are disabled by default. + + - `enabled: optional boolean` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_content_tokens: optional number` + + Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `web_search_tool_20260209: object { name, type, allowed_callers, 7 more }` + + - `name: "web_search"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_search_20260209"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`. + + - `blocked_domains: optional array of string` + + If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`. + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `user_location: optional object { type, city, country, 2 more }` + + Parameters for the user's location. Used to provide more relevant search results. + + - `type: "approximate"` + + - `city: optional string` + + The city of the user. + + - `country: optional string` + + The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user. + + - `region: optional string` + + The region of the user. + + - `timezone: optional string` + + The [IANA timezone](https://nodatime.org/TimeZones) of the user. + + - `web_fetch_tool_20260209: object { name, type, allowed_callers, 8 more }` + + - `name: "web_fetch"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_fetch_20260209"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + List of domains to allow fetching from + + - `blocked_domains: optional array of string` + + List of domains to block fetching from + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + Citations configuration for fetched documents. Citations are disabled by default. + + - `enabled: optional boolean` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_content_tokens: optional number` + + Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `web_fetch_tool_20260309: object { name, type, allowed_callers, 9 more }` + + Web fetch tool with use_cache parameter for bypassing cached content. + + - `name: "web_fetch"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_fetch_20260309"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + List of domains to allow fetching from + + - `blocked_domains: optional array of string` + + List of domains to block fetching from + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + Citations configuration for fetched documents. Citations are disabled by default. + + - `enabled: optional boolean` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_content_tokens: optional number` + + Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `use_cache: optional boolean` + + Whether to use cached content. Set to false to bypass the cache and fetch fresh content. Only set to false when the user explicitly requests fresh content or when fetching rapidly-changing sources. + + - `tool_search_tool_bm25_20251119: object { name, type, allowed_callers, 3 more }` + + - `name: "tool_search_tool_bm25"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "tool_search_tool_bm25_20251119" or "tool_search_tool_bm25"` + + - `"tool_search_tool_bm25_20251119"` + + - `"tool_search_tool_bm25"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `tool_search_tool_regex_20251119: object { name, type, allowed_callers, 3 more }` + + - `name: "tool_search_tool_regex"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "tool_search_tool_regex_20251119" or "tool_search_tool_regex"` + + - `"tool_search_tool_regex_20251119"` + + - `"tool_search_tool_regex"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Tool Use Block + +- `tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + +### Tool Use Block Param + +- `tool_use_block_param: object { id, input, name, 3 more }` + + - `id: string` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + +### URL Image Source + +- `url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + +### URL PDF Source + +- `url_pdf_source: object { type, url }` + + - `type: "url"` + + - `url: string` + +### Usage + +- `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 5 more }` + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + +### User Location + +- `user_location: object { type, city, country, 2 more }` + + - `type: "approximate"` + + - `city: optional string` + + The city of the user. + + - `country: optional string` + + The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user. + + - `region: optional string` + + The region of the user. + + - `timezone: optional string` + + The [IANA timezone](https://nodatime.org/TimeZones) of the user. + +### Web Fetch Block + +- `web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: Base64PDFSource or PlainTextSource` + + - `base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + +### Web Fetch Block Param + +- `web_fetch_block_param: object { content, type, url, retrieved_at }` + + - `content: object { source, type, cache_control, 3 more }` + + - `source: Base64PDFSource or PlainTextSource or ContentBlockSource or URLPDFSource` + + - `base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `content_block_source: object { content, type }` + + - `content: string or array of ContentBlockSourceContent` + + - `union_member_0: string` + + - `content_block_source_content: array of ContentBlockSourceContent` + + - `text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of TextCitationParam` + + - `citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `image_block_param: object { source, type, cache_control }` + + - `source: Base64ImageSource or URLImageSource` + + - `base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "content"` + + - `url_pdf_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `type: "document"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `context: optional string` + + - `title: optional string` + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `retrieved_at: optional string` + + ISO 8601 timestamp when the content was retrieved + +### Web Fetch Tool 20250910 + +- `web_fetch_tool_20250910: object { name, type, allowed_callers, 8 more }` + + - `name: "web_fetch"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_fetch_20250910"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + List of domains to allow fetching from + + - `blocked_domains: optional array of string` + + List of domains to block fetching from + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + Citations configuration for fetched documents. Citations are disabled by default. + + - `enabled: optional boolean` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_content_tokens: optional number` + + Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Web Fetch Tool 20260209 + +- `web_fetch_tool_20260209: object { name, type, allowed_callers, 8 more }` + + - `name: "web_fetch"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_fetch_20260209"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + List of domains to allow fetching from + + - `blocked_domains: optional array of string` + + List of domains to block fetching from + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + Citations configuration for fetched documents. Citations are disabled by default. + + - `enabled: optional boolean` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_content_tokens: optional number` + + Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + +### Web Fetch Tool 20260309 + +- `web_fetch_tool_20260309: object { name, type, allowed_callers, 9 more }` + + Web fetch tool with use_cache parameter for bypassing cached content. + + - `name: "web_fetch"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_fetch_20260309"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + List of domains to allow fetching from + + - `blocked_domains: optional array of string` + + List of domains to block fetching from + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + Citations configuration for fetched documents. Citations are disabled by default. + + - `enabled: optional boolean` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_content_tokens: optional number` + + Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `use_cache: optional boolean` + + Whether to use cached content. Set to false to bypass the cache and fetch fresh content. Only set to false when the user explicitly requests fresh content or when fetching rapidly-changing sources. + +### Web Fetch Tool Result Block + +- `web_fetch_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebFetchToolResultErrorBlock or WebFetchBlock` + + - `web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: Base64PDFSource or PlainTextSource` + + - `base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + +### Web Fetch Tool Result Block Param + +- `web_fetch_tool_result_block_param: object { content, tool_use_id, type, 2 more }` + + - `content: WebFetchToolResultErrorBlockParam or WebFetchBlockParam` + + - `web_fetch_tool_result_error_block_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `web_fetch_block_param: object { content, type, url, retrieved_at }` + + - `content: object { source, type, cache_control, 3 more }` + + - `source: Base64PDFSource or PlainTextSource or ContentBlockSource or URLPDFSource` + + - `base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `content_block_source: object { content, type }` + + - `content: string or array of ContentBlockSourceContent` + + - `union_member_0: string` + + - `content_block_source_content: array of ContentBlockSourceContent` + + - `text_block_param: object { text, type, cache_control, citations }` + + - `text: string` + + - `type: "text"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional array of TextCitationParam` + + - `citation_char_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location_param: object { cited_text, document_index, document_title, 3 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citation_web_search_result_location_param: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citation_search_result_location_param: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `image_block_param: object { source, type, cache_control }` + + - `source: Base64ImageSource or URLImageSource` + + - `base64_image_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"` + + - `"image/jpeg"` + + - `"image/png"` + + - `"image/gif"` + + - `"image/webp"` + + - `type: "base64"` + + - `url_image_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `type: "image"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `type: "content"` + + - `url_pdf_source: object { type, url }` + + - `type: "url"` + + - `url: string` + + - `type: "document"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `citations: optional object { enabled }` + + - `enabled: optional boolean` + + - `context: optional string` + + - `title: optional string` + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `retrieved_at: optional string` + + ISO 8601 timestamp when the content was retrieved + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + +### Web Fetch Tool Result Error Block + +- `web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + +### Web Fetch Tool Result Error Block Param + +- `web_fetch_tool_result_error_block_param: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + +### Web Fetch Tool Result Error Code + +- `web_fetch_tool_result_error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + +### Web Search Result Block + +- `web_search_result_block: object { encrypted_content, page_age, title, 2 more }` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + +### Web Search Result Block Param + +- `web_search_result_block_param: object { encrypted_content, title, type, 2 more }` + + - `encrypted_content: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `page_age: optional string` + +### Web Search Tool 20250305 + +- `web_search_tool_20250305: object { name, type, allowed_callers, 7 more }` + + - `name: "web_search"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_search_20250305"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`. + + - `blocked_domains: optional array of string` + + If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`. + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `user_location: optional object { type, city, country, 2 more }` + + Parameters for the user's location. Used to provide more relevant search results. + + - `type: "approximate"` + + - `city: optional string` + + The city of the user. + + - `country: optional string` + + The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user. + + - `region: optional string` + + The region of the user. + + - `timezone: optional string` + + The [IANA timezone](https://nodatime.org/TimeZones) of the user. + +### Web Search Tool 20260209 + +- `web_search_tool_20260209: object { name, type, allowed_callers, 7 more }` + + - `name: "web_search"` + + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + + - `type: "web_search_20260209"` + + - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"` + + - `"direct"` + + - `"code_execution_20250825"` + + - `"code_execution_20260120"` + + - `allowed_domains: optional array of string` + + If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`. + + - `blocked_domains: optional array of string` + + If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`. + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `defer_loading: optional boolean` + + If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. + + - `max_uses: optional number` + + Maximum number of times the tool can be used in the API request. + + - `strict: optional boolean` + + When true, guarantees schema validation on tool names and inputs + + - `user_location: optional object { type, city, country, 2 more }` + + Parameters for the user's location. Used to provide more relevant search results. + + - `type: "approximate"` + + - `city: optional string` + + The city of the user. + + - `country: optional string` + + The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user. + + - `region: optional string` + + The region of the user. + + - `timezone: optional string` + + The [IANA timezone](https://nodatime.org/TimeZones) of the user. + +### Web Search Tool Request Error + +- `web_search_tool_request_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + +### Web Search Tool Result Block + +- `web_search_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebSearchToolResultError or array of WebSearchResultBlock` + + - `web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of WebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + +### Web Search Tool Result Block Content + +- `web_search_tool_result_block_content: WebSearchToolResultError or array of WebSearchResultBlock` + + - `web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of WebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + +### Web Search Tool Result Block Param + +- `web_search_tool_result_block_param: object { content, tool_use_id, type, 2 more }` + + - `content: array of WebSearchResultBlockParam or WebSearchToolRequestError` + + - `web_search_tool_result_block_item: array of WebSearchResultBlockParam` + + - `encrypted_content: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `page_age: optional string` + + - `web_search_tool_request_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `cache_control: optional object { type, ttl }` + + Create a cache control breakpoint at this content block. + + - `type: "ephemeral"` + + - `ttl: optional "5m" or "1h"` + + The time-to-live for the cache control breakpoint. + + This may be one the following values: + + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + + - `"5m"` + + - `"1h"` + + - `caller: optional DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + +### Web Search Tool Result Block Param Content + +- `web_search_tool_result_block_param_content: array of WebSearchResultBlockParam or WebSearchToolRequestError` + + - `web_search_tool_result_block_item: array of WebSearchResultBlockParam` + + - `encrypted_content: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `page_age: optional string` + + - `web_search_tool_request_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + +### Web Search Tool Result Error + +- `web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + +### Web Search Tool Result Error Code + +- `web_search_tool_result_error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + +# Batches + +## Create + +`$ ant messages:batches create` + +**post** `/v1/messages/batches` + +Send a batch of Message creation requests. + +The Message Batches API can be used to process multiple Messages API requests at once. Once a Message Batch is created, it begins processing immediately. Batches can take up to 24 hours to complete. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--request: array of object { custom_id, params }` + + List of requests for prompt completion. Each is an individual request to create a Message. + +### Returns + +- `message_batch: object { id, archived_at, cancel_initiated_at, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: object { canceled, errored, expired, 2 more }` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + +### Example + +```cli +ant messages:batches create \ + --api-key my-anthropic-api-key \ + --request '{custom_id: my-custom-id-1, params: {max_tokens: 1024, messages: [{content: [{text: x, type: text}], role: user}], model: claude-opus-4-6}}' +``` + +## Retrieve + +`$ ant messages:batches retrieve` + +**get** `/v1/messages/batches/{message_batch_id}` + +This endpoint is idempotent and can be used to poll for Message Batch completion. To access the results of a Message Batch, make a request to the `results_url` field in the response. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--message-batch-id: string` + + ID of the Message Batch. + +### Returns + +- `message_batch: object { id, archived_at, cancel_initiated_at, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: object { canceled, errored, expired, 2 more }` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + +### Example + +```cli +ant messages:batches retrieve \ + --api-key my-anthropic-api-key \ + --message-batch-id message_batch_id +``` + +## List + +`$ ant messages:batches list` + +**get** `/v1/messages/batches` + +List all Message Batches within a Workspace. Most recently created batches are returned first. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--after-id: optional string` + + ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object. + +- `--before-id: optional string` + + ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object. + +- `--limit: optional number` + + Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + +### Returns + +- `ListResponse_MessageBatch_: object { data, first_id, has_more, last_id }` + + - `data: array of MessageBatch` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: object { canceled, errored, expired, 2 more }` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + + - `first_id: string` + + First ID in the `data` list. Can be used as the `before_id` for the previous page. + + - `has_more: boolean` + + Indicates if there are more results in the requested page direction. + + - `last_id: string` + + Last ID in the `data` list. Can be used as the `after_id` for the next page. + +### Example + +```cli +ant messages:batches list \ + --api-key my-anthropic-api-key +``` + +## Cancel + +`$ ant messages:batches cancel` + +**post** `/v1/messages/batches/{message_batch_id}/cancel` + +Batches may be canceled any time before processing ends. Once cancellation is initiated, the batch enters a `canceling` state, at which time the system may complete any in-progress, non-interruptible requests before finalizing cancellation. + +The number of canceled requests is specified in `request_counts`. To determine which requests were canceled, check the individual results within the batch. Note that cancellation may not result in any canceled requests if they were non-interruptible. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--message-batch-id: string` + + ID of the Message Batch. + +### Returns + +- `message_batch: object { id, archived_at, cancel_initiated_at, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: object { canceled, errored, expired, 2 more }` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + +### Example + +```cli +ant messages:batches cancel \ + --api-key my-anthropic-api-key \ + --message-batch-id message_batch_id +``` + +## Delete + +`$ ant messages:batches delete` + +**delete** `/v1/messages/batches/{message_batch_id}` + +Delete a Message Batch. + +Message Batches can only be deleted once they've finished processing. If you'd like to delete an in-progress batch, you must first cancel it. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--message-batch-id: string` + + ID of the Message Batch. + +### Returns + +- `deleted_message_batch: object { id, type }` + + - `id: string` + + ID of the Message Batch. + + - `type: "message_batch_deleted"` + + Deleted object type. + + For Message Batches, this is always `"message_batch_deleted"`. + +### Example + +```cli +ant messages:batches delete \ + --api-key my-anthropic-api-key \ + --message-batch-id message_batch_id +``` + +## Results + +`$ ant messages:batches results` + +**get** `/v1/messages/batches/{message_batch_id}/results` + +Streams the results of a Message Batch as a `.jsonl` file. + +Each line in the file is a JSON object containing the result of a single request in the Message Batch. Results are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--message-batch-id: string` + + ID of the Message Batch. + +### Returns + +- `message_batch_individual_response: object { custom_id, result }` + + This is a single line in the response `.jsonl` file and does not represent the response as a whole. + + - `custom_id: string` + + Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order. + + Must be unique for each request within the Message Batch. + + - `result: MessageBatchSucceededResult or MessageBatchErroredResult or MessageBatchCanceledResult or MessageBatchExpiredResult` + + Processing result for this request. + + Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration. + + - `message_batch_succeeded_result: object { message, type }` + + - `message: object { id, container, content, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `content: array of ContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `text_block: object { citations, text, type }` + + - `citations: array of TextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citations_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `server_tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `web_search_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebSearchToolResultError or array of WebSearchResultBlock` + + - `web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of WebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `web_fetch_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebFetchToolResultErrorBlock or WebFetchBlock` + + - `web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: Base64PDFSource or PlainTextSource` + + - `base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: CodeExecutionToolResultError or CodeExecutionResultBlock or EncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BashCodeExecutionToolResultError or BashCodeExecutionResultBlock` + + - `bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: TextEditorCodeExecutionToolResultError or TextEditorCodeExecutionViewResultBlock or TextEditorCodeExecutionCreateResultBlock or TextEditorCodeExecutionStrReplaceResultBlock` + + - `text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: ToolSearchToolResultError or ToolSearchToolSearchResultBlock` + + - `tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of ToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 3 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"refusal"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 5 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `type: "succeeded"` + + - `message_batch_errored_result: object { error, type }` + + - `error: object { error, request_id, type }` + + - `error: InvalidRequestError or AuthenticationError or BillingError or 6 more` + + - `invalid_request_error: object { message, type }` + + - `message: string` + + - `type: "invalid_request_error"` + + - `authentication_error: object { message, type }` + + - `message: string` + + - `type: "authentication_error"` + + - `billing_error: object { message, type }` + + - `message: string` + + - `type: "billing_error"` + + - `permission_error: object { message, type }` + + - `message: string` + + - `type: "permission_error"` + + - `not_found_error: object { message, type }` + + - `message: string` + + - `type: "not_found_error"` + + - `rate_limit_error: object { message, type }` + + - `message: string` + + - `type: "rate_limit_error"` + + - `gateway_timeout_error: object { message, type }` + + - `message: string` + + - `type: "timeout_error"` + + - `api_error_object: object { message, type }` + + - `message: string` + + - `type: "api_error"` + + - `overloaded_error: object { message, type }` + + - `message: string` + + - `type: "overloaded_error"` + + - `request_id: string` + + - `type: "error"` + + - `type: "errored"` + + - `message_batch_canceled_result: object { type }` + + - `type: "canceled"` + + - `message_batch_expired_result: object { type }` + + - `type: "expired"` + +### Example + +```cli +ant messages:batches results \ + --api-key my-anthropic-api-key \ + --message-batch-id message_batch_id +``` + +## Domain Types + +### Deleted Message Batch + +- `deleted_message_batch: object { id, type }` + + - `id: string` + + ID of the Message Batch. + + - `type: "message_batch_deleted"` + + Deleted object type. + + For Message Batches, this is always `"message_batch_deleted"`. + +### Message Batch + +- `message_batch: object { id, archived_at, cancel_initiated_at, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: object { canceled, errored, expired, 2 more }` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + +### Message Batch Canceled Result + +- `message_batch_canceled_result: object { type }` + + - `type: "canceled"` + +### Message Batch Errored Result + +- `message_batch_errored_result: object { error, type }` + + - `error: object { error, request_id, type }` + + - `error: InvalidRequestError or AuthenticationError or BillingError or 6 more` + + - `invalid_request_error: object { message, type }` + + - `message: string` + + - `type: "invalid_request_error"` + + - `authentication_error: object { message, type }` + + - `message: string` + + - `type: "authentication_error"` + + - `billing_error: object { message, type }` + + - `message: string` + + - `type: "billing_error"` + + - `permission_error: object { message, type }` + + - `message: string` + + - `type: "permission_error"` + + - `not_found_error: object { message, type }` + + - `message: string` + + - `type: "not_found_error"` + + - `rate_limit_error: object { message, type }` + + - `message: string` + + - `type: "rate_limit_error"` + + - `gateway_timeout_error: object { message, type }` + + - `message: string` + + - `type: "timeout_error"` + + - `api_error_object: object { message, type }` + + - `message: string` + + - `type: "api_error"` + + - `overloaded_error: object { message, type }` + + - `message: string` + + - `type: "overloaded_error"` + + - `request_id: string` + + - `type: "error"` + + - `type: "errored"` + +### Message Batch Expired Result + +- `message_batch_expired_result: object { type }` + + - `type: "expired"` + +### Message Batch Individual Response + +- `message_batch_individual_response: object { custom_id, result }` + + This is a single line in the response `.jsonl` file and does not represent the response as a whole. + + - `custom_id: string` + + Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order. + + Must be unique for each request within the Message Batch. + + - `result: MessageBatchSucceededResult or MessageBatchErroredResult or MessageBatchCanceledResult or MessageBatchExpiredResult` + + Processing result for this request. + + Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration. + + - `message_batch_succeeded_result: object { message, type }` + + - `message: object { id, container, content, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `content: array of ContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `text_block: object { citations, text, type }` + + - `citations: array of TextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citations_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `server_tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `web_search_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebSearchToolResultError or array of WebSearchResultBlock` + + - `web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of WebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `web_fetch_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebFetchToolResultErrorBlock or WebFetchBlock` + + - `web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: Base64PDFSource or PlainTextSource` + + - `base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: CodeExecutionToolResultError or CodeExecutionResultBlock or EncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BashCodeExecutionToolResultError or BashCodeExecutionResultBlock` + + - `bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: TextEditorCodeExecutionToolResultError or TextEditorCodeExecutionViewResultBlock or TextEditorCodeExecutionCreateResultBlock or TextEditorCodeExecutionStrReplaceResultBlock` + + - `text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: ToolSearchToolResultError or ToolSearchToolSearchResultBlock` + + - `tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of ToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 3 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"refusal"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 5 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `type: "succeeded"` + + - `message_batch_errored_result: object { error, type }` + + - `error: object { error, request_id, type }` + + - `error: InvalidRequestError or AuthenticationError or BillingError or 6 more` + + - `invalid_request_error: object { message, type }` + + - `message: string` + + - `type: "invalid_request_error"` + + - `authentication_error: object { message, type }` + + - `message: string` + + - `type: "authentication_error"` + + - `billing_error: object { message, type }` + + - `message: string` + + - `type: "billing_error"` + + - `permission_error: object { message, type }` + + - `message: string` + + - `type: "permission_error"` + + - `not_found_error: object { message, type }` + + - `message: string` + + - `type: "not_found_error"` + + - `rate_limit_error: object { message, type }` + + - `message: string` + + - `type: "rate_limit_error"` + + - `gateway_timeout_error: object { message, type }` + + - `message: string` + + - `type: "timeout_error"` + + - `api_error_object: object { message, type }` + + - `message: string` + + - `type: "api_error"` + + - `overloaded_error: object { message, type }` + + - `message: string` + + - `type: "overloaded_error"` + + - `request_id: string` + + - `type: "error"` + + - `type: "errored"` + + - `message_batch_canceled_result: object { type }` + + - `type: "canceled"` + + - `message_batch_expired_result: object { type }` + + - `type: "expired"` + +### Message Batch Request Counts + +- `message_batch_request_counts: object { canceled, errored, expired, 2 more }` + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + +### Message Batch Result + +- `message_batch_result: MessageBatchSucceededResult or MessageBatchErroredResult or MessageBatchCanceledResult or MessageBatchExpiredResult` + + Processing result for this request. + + Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration. + + - `message_batch_succeeded_result: object { message, type }` + + - `message: object { id, container, content, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `content: array of ContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `text_block: object { citations, text, type }` + + - `citations: array of TextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citations_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `server_tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `web_search_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebSearchToolResultError or array of WebSearchResultBlock` + + - `web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of WebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `web_fetch_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebFetchToolResultErrorBlock or WebFetchBlock` + + - `web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: Base64PDFSource or PlainTextSource` + + - `base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: CodeExecutionToolResultError or CodeExecutionResultBlock or EncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BashCodeExecutionToolResultError or BashCodeExecutionResultBlock` + + - `bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: TextEditorCodeExecutionToolResultError or TextEditorCodeExecutionViewResultBlock or TextEditorCodeExecutionCreateResultBlock or TextEditorCodeExecutionStrReplaceResultBlock` + + - `text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: ToolSearchToolResultError or ToolSearchToolSearchResultBlock` + + - `tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of ToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 3 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"refusal"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 5 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `type: "succeeded"` + + - `message_batch_errored_result: object { error, type }` + + - `error: object { error, request_id, type }` + + - `error: InvalidRequestError or AuthenticationError or BillingError or 6 more` + + - `invalid_request_error: object { message, type }` + + - `message: string` + + - `type: "invalid_request_error"` + + - `authentication_error: object { message, type }` + + - `message: string` + + - `type: "authentication_error"` + + - `billing_error: object { message, type }` + + - `message: string` + + - `type: "billing_error"` + + - `permission_error: object { message, type }` + + - `message: string` + + - `type: "permission_error"` + + - `not_found_error: object { message, type }` + + - `message: string` + + - `type: "not_found_error"` + + - `rate_limit_error: object { message, type }` + + - `message: string` + + - `type: "rate_limit_error"` + + - `gateway_timeout_error: object { message, type }` + + - `message: string` + + - `type: "timeout_error"` + + - `api_error_object: object { message, type }` + + - `message: string` + + - `type: "api_error"` + + - `overloaded_error: object { message, type }` + + - `message: string` + + - `type: "overloaded_error"` + + - `request_id: string` + + - `type: "error"` + + - `type: "errored"` + + - `message_batch_canceled_result: object { type }` + + - `type: "canceled"` + + - `message_batch_expired_result: object { type }` + + - `type: "expired"` + +### Message Batch Succeeded Result + +- `message_batch_succeeded_result: object { message, type }` + + - `message: object { id, container, content, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `content: array of ContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `text_block: object { citations, text, type }` + + - `citations: array of TextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citations_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `server_tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `web_search_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebSearchToolResultError or array of WebSearchResultBlock` + + - `web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of WebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `web_fetch_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebFetchToolResultErrorBlock or WebFetchBlock` + + - `web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: Base64PDFSource or PlainTextSource` + + - `base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: CodeExecutionToolResultError or CodeExecutionResultBlock or EncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BashCodeExecutionToolResultError or BashCodeExecutionResultBlock` + + - `bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: TextEditorCodeExecutionToolResultError or TextEditorCodeExecutionViewResultBlock or TextEditorCodeExecutionCreateResultBlock or TextEditorCodeExecutionStrReplaceResultBlock` + + - `text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: ToolSearchToolResultError or ToolSearchToolSearchResultBlock` + + - `tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of ToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 3 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"refusal"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 5 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `type: "succeeded"` diff --git a/content/en/api/cli/messages/batches.md b/content/en/api/cli/messages/batches.md index 5d627650b..b17075cf4 100644 --- a/content/en/api/cli/messages/batches.md +++ b/content/en/api/cli/messages/batches.md @@ -1 +1,4250 @@ -Not Found - Claude API Docs
                                                                      \ No newline at end of file +# Batches + +## Create + +`$ ant messages:batches create` + +**post** `/v1/messages/batches` + +Send a batch of Message creation requests. + +The Message Batches API can be used to process multiple Messages API requests at once. Once a Message Batch is created, it begins processing immediately. Batches can take up to 24 hours to complete. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--request: array of object { custom_id, params }` + + List of requests for prompt completion. Each is an individual request to create a Message. + +### Returns + +- `message_batch: object { id, archived_at, cancel_initiated_at, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: object { canceled, errored, expired, 2 more }` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + +### Example + +```cli +ant messages:batches create \ + --api-key my-anthropic-api-key \ + --request '{custom_id: my-custom-id-1, params: {max_tokens: 1024, messages: [{content: [{text: x, type: text}], role: user}], model: claude-opus-4-6}}' +``` + +## Retrieve + +`$ ant messages:batches retrieve` + +**get** `/v1/messages/batches/{message_batch_id}` + +This endpoint is idempotent and can be used to poll for Message Batch completion. To access the results of a Message Batch, make a request to the `results_url` field in the response. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--message-batch-id: string` + + ID of the Message Batch. + +### Returns + +- `message_batch: object { id, archived_at, cancel_initiated_at, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: object { canceled, errored, expired, 2 more }` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + +### Example + +```cli +ant messages:batches retrieve \ + --api-key my-anthropic-api-key \ + --message-batch-id message_batch_id +``` + +## List + +`$ ant messages:batches list` + +**get** `/v1/messages/batches` + +List all Message Batches within a Workspace. Most recently created batches are returned first. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--after-id: optional string` + + ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object. + +- `--before-id: optional string` + + ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object. + +- `--limit: optional number` + + Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + +### Returns + +- `ListResponse_MessageBatch_: object { data, first_id, has_more, last_id }` + + - `data: array of MessageBatch` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: object { canceled, errored, expired, 2 more }` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + + - `first_id: string` + + First ID in the `data` list. Can be used as the `before_id` for the previous page. + + - `has_more: boolean` + + Indicates if there are more results in the requested page direction. + + - `last_id: string` + + Last ID in the `data` list. Can be used as the `after_id` for the next page. + +### Example + +```cli +ant messages:batches list \ + --api-key my-anthropic-api-key +``` + +## Cancel + +`$ ant messages:batches cancel` + +**post** `/v1/messages/batches/{message_batch_id}/cancel` + +Batches may be canceled any time before processing ends. Once cancellation is initiated, the batch enters a `canceling` state, at which time the system may complete any in-progress, non-interruptible requests before finalizing cancellation. + +The number of canceled requests is specified in `request_counts`. To determine which requests were canceled, check the individual results within the batch. Note that cancellation may not result in any canceled requests if they were non-interruptible. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--message-batch-id: string` + + ID of the Message Batch. + +### Returns + +- `message_batch: object { id, archived_at, cancel_initiated_at, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: object { canceled, errored, expired, 2 more }` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + +### Example + +```cli +ant messages:batches cancel \ + --api-key my-anthropic-api-key \ + --message-batch-id message_batch_id +``` + +## Delete + +`$ ant messages:batches delete` + +**delete** `/v1/messages/batches/{message_batch_id}` + +Delete a Message Batch. + +Message Batches can only be deleted once they've finished processing. If you'd like to delete an in-progress batch, you must first cancel it. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--message-batch-id: string` + + ID of the Message Batch. + +### Returns + +- `deleted_message_batch: object { id, type }` + + - `id: string` + + ID of the Message Batch. + + - `type: "message_batch_deleted"` + + Deleted object type. + + For Message Batches, this is always `"message_batch_deleted"`. + +### Example + +```cli +ant messages:batches delete \ + --api-key my-anthropic-api-key \ + --message-batch-id message_batch_id +``` + +## Results + +`$ ant messages:batches results` + +**get** `/v1/messages/batches/{message_batch_id}/results` + +Streams the results of a Message Batch as a `.jsonl` file. + +Each line in the file is a JSON object containing the result of a single request in the Message Batch. Results are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--message-batch-id: string` + + ID of the Message Batch. + +### Returns + +- `message_batch_individual_response: object { custom_id, result }` + + This is a single line in the response `.jsonl` file and does not represent the response as a whole. + + - `custom_id: string` + + Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order. + + Must be unique for each request within the Message Batch. + + - `result: MessageBatchSucceededResult or MessageBatchErroredResult or MessageBatchCanceledResult or MessageBatchExpiredResult` + + Processing result for this request. + + Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration. + + - `message_batch_succeeded_result: object { message, type }` + + - `message: object { id, container, content, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `content: array of ContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `text_block: object { citations, text, type }` + + - `citations: array of TextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citations_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `server_tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `web_search_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebSearchToolResultError or array of WebSearchResultBlock` + + - `web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of WebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `web_fetch_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebFetchToolResultErrorBlock or WebFetchBlock` + + - `web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: Base64PDFSource or PlainTextSource` + + - `base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: CodeExecutionToolResultError or CodeExecutionResultBlock or EncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BashCodeExecutionToolResultError or BashCodeExecutionResultBlock` + + - `bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: TextEditorCodeExecutionToolResultError or TextEditorCodeExecutionViewResultBlock or TextEditorCodeExecutionCreateResultBlock or TextEditorCodeExecutionStrReplaceResultBlock` + + - `text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: ToolSearchToolResultError or ToolSearchToolSearchResultBlock` + + - `tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of ToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 3 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"refusal"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 5 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `type: "succeeded"` + + - `message_batch_errored_result: object { error, type }` + + - `error: object { error, request_id, type }` + + - `error: InvalidRequestError or AuthenticationError or BillingError or 6 more` + + - `invalid_request_error: object { message, type }` + + - `message: string` + + - `type: "invalid_request_error"` + + - `authentication_error: object { message, type }` + + - `message: string` + + - `type: "authentication_error"` + + - `billing_error: object { message, type }` + + - `message: string` + + - `type: "billing_error"` + + - `permission_error: object { message, type }` + + - `message: string` + + - `type: "permission_error"` + + - `not_found_error: object { message, type }` + + - `message: string` + + - `type: "not_found_error"` + + - `rate_limit_error: object { message, type }` + + - `message: string` + + - `type: "rate_limit_error"` + + - `gateway_timeout_error: object { message, type }` + + - `message: string` + + - `type: "timeout_error"` + + - `api_error_object: object { message, type }` + + - `message: string` + + - `type: "api_error"` + + - `overloaded_error: object { message, type }` + + - `message: string` + + - `type: "overloaded_error"` + + - `request_id: string` + + - `type: "error"` + + - `type: "errored"` + + - `message_batch_canceled_result: object { type }` + + - `type: "canceled"` + + - `message_batch_expired_result: object { type }` + + - `type: "expired"` + +### Example + +```cli +ant messages:batches results \ + --api-key my-anthropic-api-key \ + --message-batch-id message_batch_id +``` + +## Domain Types + +### Deleted Message Batch + +- `deleted_message_batch: object { id, type }` + + - `id: string` + + ID of the Message Batch. + + - `type: "message_batch_deleted"` + + Deleted object type. + + For Message Batches, this is always `"message_batch_deleted"`. + +### Message Batch + +- `message_batch: object { id, archived_at, cancel_initiated_at, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: object { canceled, errored, expired, 2 more }` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + +### Message Batch Canceled Result + +- `message_batch_canceled_result: object { type }` + + - `type: "canceled"` + +### Message Batch Errored Result + +- `message_batch_errored_result: object { error, type }` + + - `error: object { error, request_id, type }` + + - `error: InvalidRequestError or AuthenticationError or BillingError or 6 more` + + - `invalid_request_error: object { message, type }` + + - `message: string` + + - `type: "invalid_request_error"` + + - `authentication_error: object { message, type }` + + - `message: string` + + - `type: "authentication_error"` + + - `billing_error: object { message, type }` + + - `message: string` + + - `type: "billing_error"` + + - `permission_error: object { message, type }` + + - `message: string` + + - `type: "permission_error"` + + - `not_found_error: object { message, type }` + + - `message: string` + + - `type: "not_found_error"` + + - `rate_limit_error: object { message, type }` + + - `message: string` + + - `type: "rate_limit_error"` + + - `gateway_timeout_error: object { message, type }` + + - `message: string` + + - `type: "timeout_error"` + + - `api_error_object: object { message, type }` + + - `message: string` + + - `type: "api_error"` + + - `overloaded_error: object { message, type }` + + - `message: string` + + - `type: "overloaded_error"` + + - `request_id: string` + + - `type: "error"` + + - `type: "errored"` + +### Message Batch Expired Result + +- `message_batch_expired_result: object { type }` + + - `type: "expired"` + +### Message Batch Individual Response + +- `message_batch_individual_response: object { custom_id, result }` + + This is a single line in the response `.jsonl` file and does not represent the response as a whole. + + - `custom_id: string` + + Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order. + + Must be unique for each request within the Message Batch. + + - `result: MessageBatchSucceededResult or MessageBatchErroredResult or MessageBatchCanceledResult or MessageBatchExpiredResult` + + Processing result for this request. + + Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration. + + - `message_batch_succeeded_result: object { message, type }` + + - `message: object { id, container, content, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `content: array of ContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `text_block: object { citations, text, type }` + + - `citations: array of TextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citations_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `server_tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `web_search_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebSearchToolResultError or array of WebSearchResultBlock` + + - `web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of WebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `web_fetch_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebFetchToolResultErrorBlock or WebFetchBlock` + + - `web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: Base64PDFSource or PlainTextSource` + + - `base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: CodeExecutionToolResultError or CodeExecutionResultBlock or EncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BashCodeExecutionToolResultError or BashCodeExecutionResultBlock` + + - `bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: TextEditorCodeExecutionToolResultError or TextEditorCodeExecutionViewResultBlock or TextEditorCodeExecutionCreateResultBlock or TextEditorCodeExecutionStrReplaceResultBlock` + + - `text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: ToolSearchToolResultError or ToolSearchToolSearchResultBlock` + + - `tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of ToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 3 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"refusal"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 5 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `type: "succeeded"` + + - `message_batch_errored_result: object { error, type }` + + - `error: object { error, request_id, type }` + + - `error: InvalidRequestError or AuthenticationError or BillingError or 6 more` + + - `invalid_request_error: object { message, type }` + + - `message: string` + + - `type: "invalid_request_error"` + + - `authentication_error: object { message, type }` + + - `message: string` + + - `type: "authentication_error"` + + - `billing_error: object { message, type }` + + - `message: string` + + - `type: "billing_error"` + + - `permission_error: object { message, type }` + + - `message: string` + + - `type: "permission_error"` + + - `not_found_error: object { message, type }` + + - `message: string` + + - `type: "not_found_error"` + + - `rate_limit_error: object { message, type }` + + - `message: string` + + - `type: "rate_limit_error"` + + - `gateway_timeout_error: object { message, type }` + + - `message: string` + + - `type: "timeout_error"` + + - `api_error_object: object { message, type }` + + - `message: string` + + - `type: "api_error"` + + - `overloaded_error: object { message, type }` + + - `message: string` + + - `type: "overloaded_error"` + + - `request_id: string` + + - `type: "error"` + + - `type: "errored"` + + - `message_batch_canceled_result: object { type }` + + - `type: "canceled"` + + - `message_batch_expired_result: object { type }` + + - `type: "expired"` + +### Message Batch Request Counts + +- `message_batch_request_counts: object { canceled, errored, expired, 2 more }` + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + +### Message Batch Result + +- `message_batch_result: MessageBatchSucceededResult or MessageBatchErroredResult or MessageBatchCanceledResult or MessageBatchExpiredResult` + + Processing result for this request. + + Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration. + + - `message_batch_succeeded_result: object { message, type }` + + - `message: object { id, container, content, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `content: array of ContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `text_block: object { citations, text, type }` + + - `citations: array of TextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citations_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `server_tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `web_search_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebSearchToolResultError or array of WebSearchResultBlock` + + - `web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of WebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `web_fetch_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebFetchToolResultErrorBlock or WebFetchBlock` + + - `web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: Base64PDFSource or PlainTextSource` + + - `base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: CodeExecutionToolResultError or CodeExecutionResultBlock or EncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BashCodeExecutionToolResultError or BashCodeExecutionResultBlock` + + - `bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: TextEditorCodeExecutionToolResultError or TextEditorCodeExecutionViewResultBlock or TextEditorCodeExecutionCreateResultBlock or TextEditorCodeExecutionStrReplaceResultBlock` + + - `text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: ToolSearchToolResultError or ToolSearchToolSearchResultBlock` + + - `tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of ToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 3 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"refusal"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 5 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `type: "succeeded"` + + - `message_batch_errored_result: object { error, type }` + + - `error: object { error, request_id, type }` + + - `error: InvalidRequestError or AuthenticationError or BillingError or 6 more` + + - `invalid_request_error: object { message, type }` + + - `message: string` + + - `type: "invalid_request_error"` + + - `authentication_error: object { message, type }` + + - `message: string` + + - `type: "authentication_error"` + + - `billing_error: object { message, type }` + + - `message: string` + + - `type: "billing_error"` + + - `permission_error: object { message, type }` + + - `message: string` + + - `type: "permission_error"` + + - `not_found_error: object { message, type }` + + - `message: string` + + - `type: "not_found_error"` + + - `rate_limit_error: object { message, type }` + + - `message: string` + + - `type: "rate_limit_error"` + + - `gateway_timeout_error: object { message, type }` + + - `message: string` + + - `type: "timeout_error"` + + - `api_error_object: object { message, type }` + + - `message: string` + + - `type: "api_error"` + + - `overloaded_error: object { message, type }` + + - `message: string` + + - `type: "overloaded_error"` + + - `request_id: string` + + - `type: "error"` + + - `type: "errored"` + + - `message_batch_canceled_result: object { type }` + + - `type: "canceled"` + + - `message_batch_expired_result: object { type }` + + - `type: "expired"` + +### Message Batch Succeeded Result + +- `message_batch_succeeded_result: object { message, type }` + + - `message: object { id, container, content, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `content: array of ContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `text_block: object { citations, text, type }` + + - `citations: array of TextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citations_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `server_tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `web_search_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebSearchToolResultError or array of WebSearchResultBlock` + + - `web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of WebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `web_fetch_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebFetchToolResultErrorBlock or WebFetchBlock` + + - `web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: Base64PDFSource or PlainTextSource` + + - `base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: CodeExecutionToolResultError or CodeExecutionResultBlock or EncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BashCodeExecutionToolResultError or BashCodeExecutionResultBlock` + + - `bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: TextEditorCodeExecutionToolResultError or TextEditorCodeExecutionViewResultBlock or TextEditorCodeExecutionCreateResultBlock or TextEditorCodeExecutionStrReplaceResultBlock` + + - `text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: ToolSearchToolResultError or ToolSearchToolSearchResultBlock` + + - `tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of ToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 3 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"refusal"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 5 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `type: "succeeded"` diff --git a/content/en/api/cli/messages/batches/cancel.md b/content/en/api/cli/messages/batches/cancel.md index 81a0014ec..250cfedea 100644 --- a/content/en/api/cli/messages/batches/cancel.md +++ b/content/en/api/cli/messages/batches/cancel.md @@ -1 +1,113 @@ -Not Found - Claude API Docs
                                                                        \ No newline at end of file +## Cancel + +`$ ant messages:batches cancel` + +**post** `/v1/messages/batches/{message_batch_id}/cancel` + +Batches may be canceled any time before processing ends. Once cancellation is initiated, the batch enters a `canceling` state, at which time the system may complete any in-progress, non-interruptible requests before finalizing cancellation. + +The number of canceled requests is specified in `request_counts`. To determine which requests were canceled, check the individual results within the batch. Note that cancellation may not result in any canceled requests if they were non-interruptible. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--message-batch-id: string` + + ID of the Message Batch. + +### Returns + +- `message_batch: object { id, archived_at, cancel_initiated_at, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: object { canceled, errored, expired, 2 more }` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + +### Example + +```cli +ant messages:batches cancel \ + --api-key my-anthropic-api-key \ + --message-batch-id message_batch_id +``` diff --git a/content/en/api/cli/messages/batches/create.md b/content/en/api/cli/messages/batches/create.md index 9425d5356..34d8becb7 100644 --- a/content/en/api/cli/messages/batches/create.md +++ b/content/en/api/cli/messages/batches/create.md @@ -1 +1,113 @@ -Not Found - Claude API Docs
                                                                          \ No newline at end of file +## Create + +`$ ant messages:batches create` + +**post** `/v1/messages/batches` + +Send a batch of Message creation requests. + +The Message Batches API can be used to process multiple Messages API requests at once. Once a Message Batch is created, it begins processing immediately. Batches can take up to 24 hours to complete. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--request: array of object { custom_id, params }` + + List of requests for prompt completion. Each is an individual request to create a Message. + +### Returns + +- `message_batch: object { id, archived_at, cancel_initiated_at, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: object { canceled, errored, expired, 2 more }` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + +### Example + +```cli +ant messages:batches create \ + --api-key my-anthropic-api-key \ + --request '{custom_id: my-custom-id-1, params: {max_tokens: 1024, messages: [{content: [{text: x, type: text}], role: user}], model: claude-opus-4-6}}' +``` diff --git a/content/en/api/cli/messages/batches/delete.md b/content/en/api/cli/messages/batches/delete.md index 92909acc6..23d487a8e 100644 --- a/content/en/api/cli/messages/batches/delete.md +++ b/content/en/api/cli/messages/batches/delete.md @@ -1 +1,39 @@ -Not Found - Claude API Docs
                                                                            \ No newline at end of file +## Delete + +`$ ant messages:batches delete` + +**delete** `/v1/messages/batches/{message_batch_id}` + +Delete a Message Batch. + +Message Batches can only be deleted once they've finished processing. If you'd like to delete an in-progress batch, you must first cancel it. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--message-batch-id: string` + + ID of the Message Batch. + +### Returns + +- `deleted_message_batch: object { id, type }` + + - `id: string` + + ID of the Message Batch. + + - `type: "message_batch_deleted"` + + Deleted object type. + + For Message Batches, this is always `"message_batch_deleted"`. + +### Example + +```cli +ant messages:batches delete \ + --api-key my-anthropic-api-key \ + --message-batch-id message_batch_id +``` diff --git a/content/en/api/cli/messages/batches/list.md b/content/en/api/cli/messages/batches/list.md index f52ea9152..5b26ceb4b 100644 --- a/content/en/api/cli/messages/batches/list.md +++ b/content/en/api/cli/messages/batches/list.md @@ -1 +1,134 @@ -Not Found - Claude API Docs
                                                                              \ No newline at end of file +## List + +`$ ant messages:batches list` + +**get** `/v1/messages/batches` + +List all Message Batches within a Workspace. Most recently created batches are returned first. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--after-id: optional string` + + ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object. + +- `--before-id: optional string` + + ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object. + +- `--limit: optional number` + + Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + +### Returns + +- `ListResponse_MessageBatch_: object { data, first_id, has_more, last_id }` + + - `data: array of MessageBatch` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: object { canceled, errored, expired, 2 more }` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + + - `first_id: string` + + First ID in the `data` list. Can be used as the `before_id` for the previous page. + + - `has_more: boolean` + + Indicates if there are more results in the requested page direction. + + - `last_id: string` + + Last ID in the `data` list. Can be used as the `after_id` for the next page. + +### Example + +```cli +ant messages:batches list \ + --api-key my-anthropic-api-key +``` diff --git a/content/en/api/cli/messages/batches/results.md b/content/en/api/cli/messages/batches/results.md index d45d10752..7f1dde6c6 100644 --- a/content/en/api/cli/messages/batches/results.md +++ b/content/en/api/cli/messages/batches/results.md @@ -1 +1,923 @@ -Not Found - Claude API Docs
                                                                                \ No newline at end of file +## Results + +`$ ant messages:batches results` + +**get** `/v1/messages/batches/{message_batch_id}/results` + +Streams the results of a Message Batch as a `.jsonl` file. + +Each line in the file is a JSON object containing the result of a single request in the Message Batch. Results are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--message-batch-id: string` + + ID of the Message Batch. + +### Returns + +- `message_batch_individual_response: object { custom_id, result }` + + This is a single line in the response `.jsonl` file and does not represent the response as a whole. + + - `custom_id: string` + + Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order. + + Must be unique for each request within the Message Batch. + + - `result: MessageBatchSucceededResult or MessageBatchErroredResult or MessageBatchCanceledResult or MessageBatchExpiredResult` + + Processing result for this request. + + Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration. + + - `message_batch_succeeded_result: object { message, type }` + + - `message: object { id, container, content, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `content: array of ContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `text_block: object { citations, text, type }` + + - `citations: array of TextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citations_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `server_tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `web_search_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebSearchToolResultError or array of WebSearchResultBlock` + + - `web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of WebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `web_fetch_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebFetchToolResultErrorBlock or WebFetchBlock` + + - `web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: Base64PDFSource or PlainTextSource` + + - `base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: CodeExecutionToolResultError or CodeExecutionResultBlock or EncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BashCodeExecutionToolResultError or BashCodeExecutionResultBlock` + + - `bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: TextEditorCodeExecutionToolResultError or TextEditorCodeExecutionViewResultBlock or TextEditorCodeExecutionCreateResultBlock or TextEditorCodeExecutionStrReplaceResultBlock` + + - `text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: ToolSearchToolResultError or ToolSearchToolSearchResultBlock` + + - `tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of ToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 3 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"refusal"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 5 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + + - `type: "succeeded"` + + - `message_batch_errored_result: object { error, type }` + + - `error: object { error, request_id, type }` + + - `error: InvalidRequestError or AuthenticationError or BillingError or 6 more` + + - `invalid_request_error: object { message, type }` + + - `message: string` + + - `type: "invalid_request_error"` + + - `authentication_error: object { message, type }` + + - `message: string` + + - `type: "authentication_error"` + + - `billing_error: object { message, type }` + + - `message: string` + + - `type: "billing_error"` + + - `permission_error: object { message, type }` + + - `message: string` + + - `type: "permission_error"` + + - `not_found_error: object { message, type }` + + - `message: string` + + - `type: "not_found_error"` + + - `rate_limit_error: object { message, type }` + + - `message: string` + + - `type: "rate_limit_error"` + + - `gateway_timeout_error: object { message, type }` + + - `message: string` + + - `type: "timeout_error"` + + - `api_error_object: object { message, type }` + + - `message: string` + + - `type: "api_error"` + + - `overloaded_error: object { message, type }` + + - `message: string` + + - `type: "overloaded_error"` + + - `request_id: string` + + - `type: "error"` + + - `type: "errored"` + + - `message_batch_canceled_result: object { type }` + + - `type: "canceled"` + + - `message_batch_expired_result: object { type }` + + - `type: "expired"` + +### Example + +```cli +ant messages:batches results \ + --api-key my-anthropic-api-key \ + --message-batch-id message_batch_id +``` diff --git a/content/en/api/cli/messages/batches/retrieve.md b/content/en/api/cli/messages/batches/retrieve.md index 6fce047c0..70b060159 100644 --- a/content/en/api/cli/messages/batches/retrieve.md +++ b/content/en/api/cli/messages/batches/retrieve.md @@ -1 +1,111 @@ -Not Found - Claude API Docs
                                                                                  \ No newline at end of file +## Retrieve + +`$ ant messages:batches retrieve` + +**get** `/v1/messages/batches/{message_batch_id}` + +This endpoint is idempotent and can be used to poll for Message Batch completion. To access the results of a Message Batch, make a request to the `results_url` field in the response. + +Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + +### Parameters + +- `--message-batch-id: string` + + ID of the Message Batch. + +### Returns + +- `message_batch: object { id, archived_at, cancel_initiated_at, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `archived_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + + - `cancel_initiated_at: string` + + RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch was created. + + - `ended_at: string` + + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. + + - `expires_at: string` + + RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + + - `processing_status: "in_progress" or "canceling" or "ended"` + + Processing status of the Message Batch. + + - `"in_progress"` + + - `"canceling"` + + - `"ended"` + + - `request_counts: object { canceled, errored, expired, 2 more }` + + Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. + + - `canceled: number` + + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + + - `errored: number` + + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + + - `expired: number` + + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + + - `processing: number` + + Number of requests in the Message Batch that are processing. + + - `succeeded: number` + + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + + - `results_url: string` + + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + + - `type: "message_batch"` + + Object type. + + For Message Batches, this is always `"message_batch"`. + +### Example + +```cli +ant messages:batches retrieve \ + --api-key my-anthropic-api-key \ + --message-batch-id message_batch_id +``` diff --git a/content/en/api/cli/messages/count_tokens.md b/content/en/api/cli/messages/count_tokens.md index ba5e1ff0c..261ea3f8a 100644 --- a/content/en/api/cli/messages/count_tokens.md +++ b/content/en/api/cli/messages/count_tokens.md @@ -1 +1,177 @@ -Not Found - Claude API Docs
                                                                                    \ No newline at end of file +## Count Tokens + +`$ ant messages count-tokens` + +**post** `/v1/messages/count_tokens` + +Count the number of tokens in a Message. + +The Token Count API can be used to count the number of tokens in a Message, including tools, images, and documents, without creating it. + +Learn more about token counting in our [user guide](https://docs.claude.com/en/docs/build-with-claude/token-counting) + +### Parameters + +- `--message: array of MessageParam` + + Input messages. + + Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn. + + Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages. + + If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response. + + Example with a single `user` message: + + ```json + [{"role": "user", "content": "Hello, Claude"}] + ``` + + Example with multiple conversational turns: + + ```json + [ + {"role": "user", "content": "Hello there."}, + {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"}, + {"role": "user", "content": "Can you explain LLMs in plain English?"}, + ] + ``` + + Example with a partially-filled response from Claude: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("}, + ] + ``` + + Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent: + + ```json + {"role": "user", "content": "Hello, Claude"} + ``` + + ```json + {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]} + ``` + + See [input examples](https://docs.claude.com/en/api/messages-examples). + + Note that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. + + There is a limit of 100,000 messages in a single request. + +- `--model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + +- `--cache-control: optional object { type, ttl }` + + Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request. + +- `--output-config: optional object { effort, format }` + + Configuration options for the model's output, such as the output format. + +- `--system: optional string or array of TextBlockParam` + + System prompt. + + A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts). + +- `--thinking: optional ThinkingConfigEnabled or ThinkingConfigDisabled or ThinkingConfigAdaptive` + + Configuration for enabling Claude's extended thinking. + + When enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit. + + See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details. + +- `--tool-choice: optional ToolChoiceAuto or ToolChoiceAny or ToolChoiceTool or ToolChoiceNone` + + How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all. + +- `--tool: optional array of MessageCountTokensTool` + + Definitions of tools that the model may use. + + If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks. + + There are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)). + + Each tool definition includes: + + * `name`: Name of the tool. + * `description`: Optional, but strongly-recommended description of the tool. + * `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks. + + For example, if you defined `tools` as: + + ```json + [ + { + "name": "get_stock_price", + "description": "Get the current stock price for a given ticker symbol.", + "input_schema": { + "type": "object", + "properties": { + "ticker": { + "type": "string", + "description": "The stock ticker symbol, e.g. AAPL for Apple Inc." + } + }, + "required": ["ticker"] + } + } + ] + ``` + + And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this: + + ```json + [ + { + "type": "tool_use", + "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "name": "get_stock_price", + "input": { "ticker": "^GSPC" } + } + ] + ``` + + You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message: + + ```json + [ + { + "type": "tool_result", + "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "content": "259.75 USD" + } + ] + ``` + + Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output. + + See our [guide](https://docs.claude.com/en/docs/tool-use) for more details. + +### Returns + +- `message_tokens_count: object { input_tokens }` + + - `input_tokens: number` + + The total number of tokens across the provided list of messages, system prompt, and tools. + +### Example + +```cli +ant messages count-tokens \ + --api-key my-anthropic-api-key \ + --message '{content: [{text: x, type: text}], role: user}' \ + --model claude-mythos-preview +``` diff --git a/content/en/api/cli/messages/create.md b/content/en/api/cli/messages/create.md index 0bbbc48e2..251bc4a5e 100644 --- a/content/en/api/cli/messages/create.md +++ b/content/en/api/cli/messages/create.md @@ -1 +1,1032 @@ -Not Found - Claude API Docs
                                                                                      \ No newline at end of file +## Create + +`$ ant messages create` + +**post** `/v1/messages` + +Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation. + +The Messages API can be used for either single queries or stateless multi-turn conversations. + +Learn more about the Messages API in our [user guide](https://docs.claude.com/en/docs/initial-setup) + +### Parameters + +- `--max-tokens: number` + + The maximum number of tokens to generate before stopping. + + Note that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate. + + Different models have different maximum values for this parameter. See [models](https://docs.claude.com/en/docs/models-overview) for details. + +- `--message: array of MessageParam` + + Input messages. + + Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn. + + Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages. + + If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response. + + Example with a single `user` message: + + ```json + [{"role": "user", "content": "Hello, Claude"}] + ``` + + Example with multiple conversational turns: + + ```json + [ + {"role": "user", "content": "Hello there."}, + {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"}, + {"role": "user", "content": "Can you explain LLMs in plain English?"}, + ] + ``` + + Example with a partially-filled response from Claude: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("}, + ] + ``` + + Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent: + + ```json + {"role": "user", "content": "Hello, Claude"} + ``` + + ```json + {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]} + ``` + + See [input examples](https://docs.claude.com/en/api/messages-examples). + + Note that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. + + There is a limit of 100,000 messages in a single request. + +- `--model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + +- `--cache-control: optional object { type, ttl }` + + Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request. + +- `--container: optional string` + + Container identifier for reuse across requests. + +- `--inference-geo: optional string` + + Specifies the geographic region for inference processing. If not specified, the workspace's `default_inference_geo` is used. + +- `--metadata: optional object { user_id }` + + An object describing metadata about the request. + +- `--output-config: optional object { effort, format }` + + Configuration options for the model's output, such as the output format. + +- `--service-tier: optional "auto" or "standard_only"` + + Determines whether to use priority capacity (if available) or standard capacity for this request. + + Anthropic offers different levels of service for your API requests. See [service-tiers](https://docs.claude.com/en/api/service-tiers) for details. + +- `--stop-sequence: optional array of string` + + Custom text sequences that will cause the model to stop generating. + + Our models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `"end_turn"`. + + If you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `"stop_sequence"` and the response `stop_sequence` value will contain the matched stop sequence. + +- `--system: optional string or array of TextBlockParam` + + System prompt. + + A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts). + +- `--temperature: optional number` + + Amount of randomness injected into the response. + + Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks. + + Note that even with `temperature` of `0.0`, the results will not be fully deterministic. + +- `--thinking: optional ThinkingConfigEnabled or ThinkingConfigDisabled or ThinkingConfigAdaptive` + + Configuration for enabling Claude's extended thinking. + + When enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit. + + See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details. + +- `--tool-choice: optional ToolChoiceAuto or ToolChoiceAny or ToolChoiceTool or ToolChoiceNone` + + How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all. + +- `--tool: optional array of ToolUnion` + + Definitions of tools that the model may use. + + If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks. + + There are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)). + + Each tool definition includes: + + * `name`: Name of the tool. + * `description`: Optional, but strongly-recommended description of the tool. + * `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks. + + For example, if you defined `tools` as: + + ```json + [ + { + "name": "get_stock_price", + "description": "Get the current stock price for a given ticker symbol.", + "input_schema": { + "type": "object", + "properties": { + "ticker": { + "type": "string", + "description": "The stock ticker symbol, e.g. AAPL for Apple Inc." + } + }, + "required": ["ticker"] + } + } + ] + ``` + + And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this: + + ```json + [ + { + "type": "tool_use", + "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "name": "get_stock_price", + "input": { "ticker": "^GSPC" } + } + ] + ``` + + You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message: + + ```json + [ + { + "type": "tool_result", + "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "content": "259.75 USD" + } + ] + ``` + + Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output. + + See our [guide](https://docs.claude.com/en/docs/tool-use) for more details. + +- `--top-k: optional number` + + Only sample from the top K options for each subsequent token. + + Used to remove "long tail" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277). + + Recommended for advanced use cases only. You usually only need to use `temperature`. + +- `--top-p: optional number` + + Use nucleus sampling. + + In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both. + + Recommended for advanced use cases only. You usually only need to use `temperature`. + +### Returns + +- `message: object { id, container, content, 7 more }` + + - `id: string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `container: object { id, expires_at }` + + Information about the container used in the request (for the code execution tool) + + - `id: string` + + Identifier for the container used in this request + + - `expires_at: string` + + The time at which the container will expire. + + - `content: array of ContentBlock` + + Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines its shape. + + Example: + + ```json + [{"type": "text", "text": "Hi, I'm Claude."}] + ``` + + If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + ``` + + Then the response `content` might be: + + ```json + [{"type": "text", "text": "B)"}] + ``` + + - `text_block: object { citations, text, type }` + + - `citations: array of TextCitation` + + Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. + + - `citation_char_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_char_index: number` + + - `file_id: string` + + - `start_char_index: number` + + - `type: "char_location"` + + - `citation_page_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_page_number: number` + + - `file_id: string` + + - `start_page_number: number` + + - `type: "page_location"` + + - `citation_content_block_location: object { cited_text, document_index, document_title, 4 more }` + + - `cited_text: string` + + - `document_index: number` + + - `document_title: string` + + - `end_block_index: number` + + - `file_id: string` + + - `start_block_index: number` + + - `type: "content_block_location"` + + - `citations_web_search_result_location: object { cited_text, encrypted_index, title, 2 more }` + + - `cited_text: string` + + - `encrypted_index: string` + + - `title: string` + + - `type: "web_search_result_location"` + + - `url: string` + + - `citations_search_result_location: object { cited_text, end_block_index, search_result_index, 4 more }` + + - `cited_text: string` + + - `end_block_index: number` + + - `search_result_index: number` + + - `source: string` + + - `start_block_index: number` + + - `title: string` + + - `type: "search_result_location"` + + - `text: string` + + - `type: "text"` + + - `thinking_block: object { signature, thinking, type }` + + - `signature: string` + + - `thinking: string` + + - `type: "thinking"` + + - `redacted_thinking_block: object { data, type }` + + - `data: string` + + - `type: "redacted_thinking"` + + - `tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: string` + + - `type: "tool_use"` + + - `server_tool_use_block: object { id, caller, input, 2 more }` + + - `id: string` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `input: map[unknown]` + + - `name: "web_search" or "web_fetch" or "code_execution" or 4 more` + + - `"web_search"` + + - `"web_fetch"` + + - `"code_execution"` + + - `"bash_code_execution"` + + - `"text_editor_code_execution"` + + - `"tool_search_tool_regex"` + + - `"tool_search_tool_bm25"` + + - `type: "server_tool_use"` + + - `web_search_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebSearchToolResultError or array of WebSearchResultBlock` + + - `web_search_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "max_uses_exceeded" or 3 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"max_uses_exceeded"` + + - `"too_many_requests"` + + - `"query_too_long"` + + - `"request_too_large"` + + - `type: "web_search_tool_result_error"` + + - `union_member_1: array of WebSearchResultBlock` + + - `encrypted_content: string` + + - `page_age: string` + + - `title: string` + + - `type: "web_search_result"` + + - `url: string` + + - `tool_use_id: string` + + - `type: "web_search_tool_result"` + + - `web_fetch_tool_result_block: object { caller, content, tool_use_id, type }` + + - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120` + + Tool invocation directly from the model. + + - `direct_caller: object { type }` + + Tool invocation directly from the model. + + - `type: "direct"` + + - `server_tool_caller: object { tool_id, type }` + + Tool invocation generated by a server-side tool. + + - `tool_id: string` + + - `type: "code_execution_20250825"` + + - `server_tool_caller_20260120: object { tool_id, type }` + + - `tool_id: string` + + - `type: "code_execution_20260120"` + + - `content: WebFetchToolResultErrorBlock or WebFetchBlock` + + - `web_fetch_tool_result_error_block: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "url_too_long" or "url_not_allowed" or 5 more` + + - `"invalid_tool_input"` + + - `"url_too_long"` + + - `"url_not_allowed"` + + - `"url_not_accessible"` + + - `"unsupported_content_type"` + + - `"too_many_requests"` + + - `"max_uses_exceeded"` + + - `"unavailable"` + + - `type: "web_fetch_tool_result_error"` + + - `web_fetch_block: object { content, retrieved_at, type, url }` + + - `content: object { citations, source, title, type }` + + - `citations: object { enabled }` + + Citation configuration for the document + + - `enabled: boolean` + + - `source: Base64PDFSource or PlainTextSource` + + - `base64_pdf_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "application/pdf"` + + - `type: "base64"` + + - `plain_text_source: object { data, media_type, type }` + + - `data: string` + + - `media_type: "text/plain"` + + - `type: "text"` + + - `title: string` + + The title of the document + + - `type: "document"` + + - `retrieved_at: string` + + ISO 8601 timestamp when the content was retrieved + + - `type: "web_fetch_result"` + + - `url: string` + + Fetched content URL + + - `tool_use_id: string` + + - `type: "web_fetch_tool_result"` + + - `code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: CodeExecutionToolResultError or CodeExecutionResultBlock or EncryptedCodeExecutionResultBlock` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `type: "code_execution_tool_result_error"` + + - `code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "code_execution_result"` + + - `encrypted_code_execution_result_block: object { content, encrypted_stdout, return_code, 2 more }` + + Code execution result with encrypted stdout for PFC + web_search results. + + - `content: array of CodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "code_execution_output"` + + - `encrypted_stdout: string` + + - `return_code: number` + + - `stderr: string` + + - `type: "encrypted_code_execution_result"` + + - `tool_use_id: string` + + - `type: "code_execution_tool_result"` + + - `bash_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: BashCodeExecutionToolResultError or BashCodeExecutionResultBlock` + + - `bash_code_execution_tool_result_error: object { error_code, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"output_file_too_large"` + + - `type: "bash_code_execution_tool_result_error"` + + - `bash_code_execution_result_block: object { content, return_code, stderr, 2 more }` + + - `content: array of BashCodeExecutionOutputBlock` + + - `file_id: string` + + - `type: "bash_code_execution_output"` + + - `return_code: number` + + - `stderr: string` + + - `stdout: string` + + - `type: "bash_code_execution_result"` + + - `tool_use_id: string` + + - `type: "bash_code_execution_tool_result"` + + - `text_editor_code_execution_tool_result_block: object { content, tool_use_id, type }` + + - `content: TextEditorCodeExecutionToolResultError or TextEditorCodeExecutionViewResultBlock or TextEditorCodeExecutionCreateResultBlock or TextEditorCodeExecutionStrReplaceResultBlock` + + - `text_editor_code_execution_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `"file_not_found"` + + - `error_message: string` + + - `type: "text_editor_code_execution_tool_result_error"` + + - `text_editor_code_execution_view_result_block: object { content, file_type, num_lines, 3 more }` + + - `content: string` + + - `file_type: "text" or "image" or "pdf"` + + - `"text"` + + - `"image"` + + - `"pdf"` + + - `num_lines: number` + + - `start_line: number` + + - `total_lines: number` + + - `type: "text_editor_code_execution_view_result"` + + - `text_editor_code_execution_create_result_block: object { is_file_update, type }` + + - `is_file_update: boolean` + + - `type: "text_editor_code_execution_create_result"` + + - `text_editor_code_execution_str_replace_result_block: object { lines, new_lines, new_start, 3 more }` + + - `lines: array of string` + + - `new_lines: number` + + - `new_start: number` + + - `old_lines: number` + + - `old_start: number` + + - `type: "text_editor_code_execution_str_replace_result"` + + - `tool_use_id: string` + + - `type: "text_editor_code_execution_tool_result"` + + - `tool_search_tool_result_block: object { content, tool_use_id, type }` + + - `content: ToolSearchToolResultError or ToolSearchToolSearchResultBlock` + + - `tool_search_tool_result_error: object { error_code, error_message, type }` + + - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"` + + - `"invalid_tool_input"` + + - `"unavailable"` + + - `"too_many_requests"` + + - `"execution_time_exceeded"` + + - `error_message: string` + + - `type: "tool_search_tool_result_error"` + + - `tool_search_tool_search_result_block: object { tool_references, type }` + + - `tool_references: array of ToolReferenceBlock` + + - `tool_name: string` + + - `type: "tool_reference"` + + - `type: "tool_search_tool_search_result"` + + - `tool_use_id: string` + + - `type: "tool_search_tool_result"` + + - `container_upload_block: object { file_id, type }` + + Response model for a file uploaded to the container. + + - `file_id: string` + + - `type: "container_upload"` + + - `model: "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` + + The model that will complete your prompt. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + + - `"claude-opus-4-6"` + + Frontier intelligence for long-running agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `"claude-opus-4-1"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-1-20250805"` + + Exceptional model for specialized complex tasks + + - `"claude-opus-4-0"` + + Powerful model for complex tasks + + - `"claude-opus-4-20250514"` + + Powerful model for complex tasks + + - `"claude-sonnet-4-0"` + + High-performance model with extended thinking + + - `"claude-sonnet-4-20250514"` + + High-performance model with extended thinking + + - `"claude-3-haiku-20240307"` + + Fast and cost-effective model + + - `role: "assistant"` + + Conversational role of the generated message. + + This will always be `"assistant"`. + + - `stop_details: object { category, explanation, type }` + + Structured information about a refusal. + + - `category: "cyber" or "bio"` + + The policy category that triggered the refusal. + + `null` when the refusal doesn't map to a named category. + + - `"cyber"` + + - `"bio"` + + - `explanation: string` + + Human-readable explanation of the refusal. + + This text is not guaranteed to be stable. `null` when no explanation is available for the category. + + - `type: "refusal"` + + - `stop_reason: "end_turn" or "max_tokens" or "stop_sequence" or 3 more` + + The reason that we stopped. + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + * `"tool_use"`: the model invoked one or more tools + * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. + + - `"end_turn"` + + - `"max_tokens"` + + - `"stop_sequence"` + + - `"tool_use"` + + - `"pause_turn"` + + - `"refusal"` + + - `stop_sequence: string` + + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + + - `type: "message"` + + Object type. + + For Messages, this is always `"message"`. + + - `usage: object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 5 more }` + + Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. + + - `cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }` + + Breakdown of cached tokens by TTL + + - `ephemeral_1h_input_tokens: number` + + The number of input tokens used to create the 1 hour cache entry. + + - `ephemeral_5m_input_tokens: number` + + The number of input tokens used to create the 5 minute cache entry. + + - `cache_creation_input_tokens: number` + + The number of input tokens used to create the cache entry. + + - `cache_read_input_tokens: number` + + The number of input tokens read from the cache. + + - `inference_geo: string` + + The geographic region where inference was performed for this request. + + - `input_tokens: number` + + The number of input tokens which were used. + + - `output_tokens: number` + + The number of output tokens which were used. + + - `server_tool_use: object { web_fetch_requests, web_search_requests }` + + The number of server tool requests. + + - `web_fetch_requests: number` + + The number of web fetch tool requests. + + - `web_search_requests: number` + + The number of web search tool requests. + + - `service_tier: "standard" or "priority" or "batch"` + + If the request used the priority, standard, or batch tier. + + - `"standard"` + + - `"priority"` + + - `"batch"` + +### Example + +```cli +ant messages create \ + --api-key my-anthropic-api-key \ + --max-tokens 1024 \ + --message '{content: [{text: x, type: text}], role: user}' \ + --model claude-opus-4-6 +``` diff --git a/content/en/api/cli/models.md b/content/en/api/cli/models.md index 236260cd6..05eb18c53 100644 --- a/content/en/api/cli/models.md +++ b/content/en/api/cli/models.md @@ -1 +1,920 @@ -Not Found - Claude API Docs
                                                                                        \ No newline at end of file +# Models + +## List + +`$ ant models list` + +**get** `/v1/models` + +List available models. + +The Models API response can be used to determine which models are available for use in the API. More recently released models are listed first. + +### Parameters + +- `--after-id: optional string` + + Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object. + +- `--before-id: optional string` + + Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object. + +- `--limit: optional number` + + Query param: Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `ListResponse_ModelInfo_: object { data, first_id, has_more, last_id }` + + - `data: array of ModelInfo` + + - `id: string` + + Unique model identifier. + + - `capabilities: object { batch, citations, code_execution, 6 more }` + + Model capability information. + + - `batch: object { supported }` + + Whether the model supports the Batch API. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `citations: object { supported }` + + Whether the model supports citation generation. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `code_execution: object { supported }` + + Whether the model supports code execution tools. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `context_management: object { clear_thinking_20251015, clear_tool_uses_20250919, compact_20260112, supported }` + + Context management support and available strategies. + + - `clear_thinking_20251015: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `clear_tool_uses_20250919: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `compact_20260112: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `effort: object { high, low, max, 2 more }` + + Effort (reasoning_effort) support and available levels. + + - `high: object { supported }` + + Whether the model supports high effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `low: object { supported }` + + Whether the model supports low effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `max: object { supported }` + + Whether the model supports max effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `medium: object { supported }` + + Whether the model supports medium effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `image_input: object { supported }` + + Whether the model accepts image content blocks. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `pdf_input: object { supported }` + + Whether the model accepts PDF content blocks. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `structured_outputs: object { supported }` + + Whether the model supports structured output / JSON mode / strict tool schemas. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `thinking: object { supported, types }` + + Thinking capability and supported type configurations. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `types: object { adaptive, enabled }` + + Supported thinking type configurations. + + - `adaptive: object { supported }` + + Whether the model supports thinking with type 'adaptive' (auto). + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `enabled: object { supported }` + + Whether the model supports thinking with type 'enabled'. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown. + + - `display_name: string` + + A human-readable name for the model. + + - `max_input_tokens: number` + + Maximum input context window size in tokens for this model. + + - `max_tokens: number` + + Maximum value for the `max_tokens` parameter when using this model. + + - `type: "model"` + + Object type. + + For Models, this is always `"model"`. + + - `first_id: string` + + First ID in the `data` list. Can be used as the `before_id` for the previous page. + + - `has_more: boolean` + + Indicates if there are more results in the requested page direction. + + - `last_id: string` + + Last ID in the `data` list. Can be used as the `after_id` for the next page. + +### Example + +```cli +ant models list \ + --api-key my-anthropic-api-key +``` + +## Retrieve + +`$ ant models retrieve` + +**get** `/v1/models/{model_id}` + +Get a specific model. + +The Models API response can be used to determine information about a specific model or resolve a model alias to a model ID. + +### Parameters + +- `--model-id: string` + + Model identifier or alias. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `model_info: object { id, capabilities, created_at, 4 more }` + + - `id: string` + + Unique model identifier. + + - `capabilities: object { batch, citations, code_execution, 6 more }` + + Model capability information. + + - `batch: object { supported }` + + Whether the model supports the Batch API. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `citations: object { supported }` + + Whether the model supports citation generation. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `code_execution: object { supported }` + + Whether the model supports code execution tools. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `context_management: object { clear_thinking_20251015, clear_tool_uses_20250919, compact_20260112, supported }` + + Context management support and available strategies. + + - `clear_thinking_20251015: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `clear_tool_uses_20250919: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `compact_20260112: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `effort: object { high, low, max, 2 more }` + + Effort (reasoning_effort) support and available levels. + + - `high: object { supported }` + + Whether the model supports high effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `low: object { supported }` + + Whether the model supports low effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `max: object { supported }` + + Whether the model supports max effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `medium: object { supported }` + + Whether the model supports medium effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `image_input: object { supported }` + + Whether the model accepts image content blocks. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `pdf_input: object { supported }` + + Whether the model accepts PDF content blocks. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `structured_outputs: object { supported }` + + Whether the model supports structured output / JSON mode / strict tool schemas. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `thinking: object { supported, types }` + + Thinking capability and supported type configurations. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `types: object { adaptive, enabled }` + + Supported thinking type configurations. + + - `adaptive: object { supported }` + + Whether the model supports thinking with type 'adaptive' (auto). + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `enabled: object { supported }` + + Whether the model supports thinking with type 'enabled'. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown. + + - `display_name: string` + + A human-readable name for the model. + + - `max_input_tokens: number` + + Maximum input context window size in tokens for this model. + + - `max_tokens: number` + + Maximum value for the `max_tokens` parameter when using this model. + + - `type: "model"` + + Object type. + + For Models, this is always `"model"`. + +### Example + +```cli +ant models retrieve \ + --api-key my-anthropic-api-key \ + --model-id model_id +``` + +## Domain Types + +### Capability Support + +- `capability_support: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + +### Context Management Capability + +- `context_management_capability: object { clear_thinking_20251015, clear_tool_uses_20250919, compact_20260112, supported }` + + Context management capability details. + + - `clear_thinking_20251015: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `clear_tool_uses_20250919: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `compact_20260112: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + +### Effort Capability + +- `effort_capability: object { high, low, max, 2 more }` + + Effort (reasoning_effort) capability details. + + - `high: object { supported }` + + Whether the model supports high effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `low: object { supported }` + + Whether the model supports low effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `max: object { supported }` + + Whether the model supports max effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `medium: object { supported }` + + Whether the model supports medium effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + +### Model Capabilities + +- `model_capabilities: object { batch, citations, code_execution, 6 more }` + + Model capability information. + + - `batch: object { supported }` + + Whether the model supports the Batch API. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `citations: object { supported }` + + Whether the model supports citation generation. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `code_execution: object { supported }` + + Whether the model supports code execution tools. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `context_management: object { clear_thinking_20251015, clear_tool_uses_20250919, compact_20260112, supported }` + + Context management support and available strategies. + + - `clear_thinking_20251015: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `clear_tool_uses_20250919: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `compact_20260112: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `effort: object { high, low, max, 2 more }` + + Effort (reasoning_effort) support and available levels. + + - `high: object { supported }` + + Whether the model supports high effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `low: object { supported }` + + Whether the model supports low effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `max: object { supported }` + + Whether the model supports max effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `medium: object { supported }` + + Whether the model supports medium effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `image_input: object { supported }` + + Whether the model accepts image content blocks. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `pdf_input: object { supported }` + + Whether the model accepts PDF content blocks. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `structured_outputs: object { supported }` + + Whether the model supports structured output / JSON mode / strict tool schemas. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `thinking: object { supported, types }` + + Thinking capability and supported type configurations. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `types: object { adaptive, enabled }` + + Supported thinking type configurations. + + - `adaptive: object { supported }` + + Whether the model supports thinking with type 'adaptive' (auto). + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `enabled: object { supported }` + + Whether the model supports thinking with type 'enabled'. + + - `supported: boolean` + + Whether this capability is supported by the model. + +### Model Info + +- `model_info: object { id, capabilities, created_at, 4 more }` + + - `id: string` + + Unique model identifier. + + - `capabilities: object { batch, citations, code_execution, 6 more }` + + Model capability information. + + - `batch: object { supported }` + + Whether the model supports the Batch API. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `citations: object { supported }` + + Whether the model supports citation generation. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `code_execution: object { supported }` + + Whether the model supports code execution tools. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `context_management: object { clear_thinking_20251015, clear_tool_uses_20250919, compact_20260112, supported }` + + Context management support and available strategies. + + - `clear_thinking_20251015: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `clear_tool_uses_20250919: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `compact_20260112: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `effort: object { high, low, max, 2 more }` + + Effort (reasoning_effort) support and available levels. + + - `high: object { supported }` + + Whether the model supports high effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `low: object { supported }` + + Whether the model supports low effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `max: object { supported }` + + Whether the model supports max effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `medium: object { supported }` + + Whether the model supports medium effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `image_input: object { supported }` + + Whether the model accepts image content blocks. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `pdf_input: object { supported }` + + Whether the model accepts PDF content blocks. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `structured_outputs: object { supported }` + + Whether the model supports structured output / JSON mode / strict tool schemas. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `thinking: object { supported, types }` + + Thinking capability and supported type configurations. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `types: object { adaptive, enabled }` + + Supported thinking type configurations. + + - `adaptive: object { supported }` + + Whether the model supports thinking with type 'adaptive' (auto). + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `enabled: object { supported }` + + Whether the model supports thinking with type 'enabled'. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown. + + - `display_name: string` + + A human-readable name for the model. + + - `max_input_tokens: number` + + Maximum input context window size in tokens for this model. + + - `max_tokens: number` + + Maximum value for the `max_tokens` parameter when using this model. + + - `type: "model"` + + Object type. + + For Models, this is always `"model"`. + +### Thinking Capability + +- `thinking_capability: object { supported, types }` + + Thinking capability details. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `types: object { adaptive, enabled }` + + Supported thinking type configurations. + + - `adaptive: object { supported }` + + Whether the model supports thinking with type 'adaptive' (auto). + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `enabled: object { supported }` + + Whether the model supports thinking with type 'enabled'. + + - `supported: boolean` + + Whether this capability is supported by the model. + +### Thinking Types + +- `thinking_types: object { adaptive, enabled }` + + Supported thinking type configurations. + + - `adaptive: object { supported }` + + Whether the model supports thinking with type 'adaptive' (auto). + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `enabled: object { supported }` + + Whether the model supports thinking with type 'enabled'. + + - `supported: boolean` + + Whether this capability is supported by the model. diff --git a/content/en/api/cli/models/list.md b/content/en/api/cli/models/list.md index d906e3717..957f9ebe6 100644 --- a/content/en/api/cli/models/list.md +++ b/content/en/api/cli/models/list.md @@ -1 +1,232 @@ -Not Found - Claude API Docs
                                                                                          \ No newline at end of file +## List + +`$ ant models list` + +**get** `/v1/models` + +List available models. + +The Models API response can be used to determine which models are available for use in the API. More recently released models are listed first. + +### Parameters + +- `--after-id: optional string` + + Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object. + +- `--before-id: optional string` + + Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object. + +- `--limit: optional number` + + Query param: Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + +- `--beta: optional array of AnthropicBeta` + + Header param: Optional header to specify the beta version(s) you want to use. + +### Returns + +- `ListResponse_ModelInfo_: object { data, first_id, has_more, last_id }` + + - `data: array of ModelInfo` + + - `id: string` + + Unique model identifier. + + - `capabilities: object { batch, citations, code_execution, 6 more }` + + Model capability information. + + - `batch: object { supported }` + + Whether the model supports the Batch API. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `citations: object { supported }` + + Whether the model supports citation generation. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `code_execution: object { supported }` + + Whether the model supports code execution tools. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `context_management: object { clear_thinking_20251015, clear_tool_uses_20250919, compact_20260112, supported }` + + Context management support and available strategies. + + - `clear_thinking_20251015: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `clear_tool_uses_20250919: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `compact_20260112: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `effort: object { high, low, max, 2 more }` + + Effort (reasoning_effort) support and available levels. + + - `high: object { supported }` + + Whether the model supports high effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `low: object { supported }` + + Whether the model supports low effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `max: object { supported }` + + Whether the model supports max effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `medium: object { supported }` + + Whether the model supports medium effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `image_input: object { supported }` + + Whether the model accepts image content blocks. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `pdf_input: object { supported }` + + Whether the model accepts PDF content blocks. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `structured_outputs: object { supported }` + + Whether the model supports structured output / JSON mode / strict tool schemas. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `thinking: object { supported, types }` + + Thinking capability and supported type configurations. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `types: object { adaptive, enabled }` + + Supported thinking type configurations. + + - `adaptive: object { supported }` + + Whether the model supports thinking with type 'adaptive' (auto). + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `enabled: object { supported }` + + Whether the model supports thinking with type 'enabled'. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown. + + - `display_name: string` + + A human-readable name for the model. + + - `max_input_tokens: number` + + Maximum input context window size in tokens for this model. + + - `max_tokens: number` + + Maximum value for the `max_tokens` parameter when using this model. + + - `type: "model"` + + Object type. + + For Models, this is always `"model"`. + + - `first_id: string` + + First ID in the `data` list. Can be used as the `before_id` for the previous page. + + - `has_more: boolean` + + Indicates if there are more results in the requested page direction. + + - `last_id: string` + + Last ID in the `data` list. Can be used as the `after_id` for the next page. + +### Example + +```cli +ant models list \ + --api-key my-anthropic-api-key +``` diff --git a/content/en/api/cli/models/retrieve.md b/content/en/api/cli/models/retrieve.md index 4628c12f4..96fb501cd 100644 --- a/content/en/api/cli/models/retrieve.md +++ b/content/en/api/cli/models/retrieve.md @@ -1 +1,209 @@ -Not Found - Claude API Docs
                                                                                            \ No newline at end of file +## Retrieve + +`$ ant models retrieve` + +**get** `/v1/models/{model_id}` + +Get a specific model. + +The Models API response can be used to determine information about a specific model or resolve a model alias to a model ID. + +### Parameters + +- `--model-id: string` + + Model identifier or alias. + +- `--beta: optional array of AnthropicBeta` + + Optional header to specify the beta version(s) you want to use. + +### Returns + +- `model_info: object { id, capabilities, created_at, 4 more }` + + - `id: string` + + Unique model identifier. + + - `capabilities: object { batch, citations, code_execution, 6 more }` + + Model capability information. + + - `batch: object { supported }` + + Whether the model supports the Batch API. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `citations: object { supported }` + + Whether the model supports citation generation. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `code_execution: object { supported }` + + Whether the model supports code execution tools. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `context_management: object { clear_thinking_20251015, clear_tool_uses_20250919, compact_20260112, supported }` + + Context management support and available strategies. + + - `clear_thinking_20251015: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `clear_tool_uses_20250919: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `compact_20260112: object { supported }` + + Indicates whether a capability is supported. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `effort: object { high, low, max, 2 more }` + + Effort (reasoning_effort) support and available levels. + + - `high: object { supported }` + + Whether the model supports high effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `low: object { supported }` + + Whether the model supports low effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `max: object { supported }` + + Whether the model supports max effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `medium: object { supported }` + + Whether the model supports medium effort level. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `image_input: object { supported }` + + Whether the model accepts image content blocks. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `pdf_input: object { supported }` + + Whether the model accepts PDF content blocks. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `structured_outputs: object { supported }` + + Whether the model supports structured output / JSON mode / strict tool schemas. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `thinking: object { supported, types }` + + Thinking capability and supported type configurations. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `types: object { adaptive, enabled }` + + Supported thinking type configurations. + + - `adaptive: object { supported }` + + Whether the model supports thinking with type 'adaptive' (auto). + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `enabled: object { supported }` + + Whether the model supports thinking with type 'enabled'. + + - `supported: boolean` + + Whether this capability is supported by the model. + + - `created_at: string` + + RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown. + + - `display_name: string` + + A human-readable name for the model. + + - `max_input_tokens: number` + + Maximum input context window size in tokens for this model. + + - `max_tokens: number` + + Maximum value for the `max_tokens` parameter when using this model. + + - `type: "model"` + + Object type. + + For Models, this is always `"model"`. + +### Example + +```cli +ant models retrieve \ + --api-key my-anthropic-api-key \ + --model-id model_id +``` diff --git a/content/en/api/client-sdks.md b/content/en/api/client-sdks.md index feb822927..29d6c609f 100644 --- a/content/en/api/client-sdks.md +++ b/content/en/api/client-sdks.md @@ -1,12 +1,15 @@ # Client SDKs -Official SDKs for building with the Claude API in Python, TypeScript, Java, Go, Ruby, C#, and PHP. +Official SDKs for building with the Claude API in Python, TypeScript, Java, Go, Ruby, C#, PHP, and the command line. --- Anthropic provides official client SDKs in multiple languages to make it easier to work with the Claude API. Each SDK provides idiomatic interfaces, type safety, and built-in support for features like streaming, retries, and error handling. + + Shell scripting, typed flags, response transforms + Sync and async clients, Pydantic models @@ -33,6 +36,11 @@ Anthropic provides official client SDKs in multiple languages to make it easier ## Quick installation + +```bash +brew install anthropics/tap/ant +``` + ```bash pip install anthropic @@ -56,14 +64,14 @@ go get github.com/anthropics/anthropic-sdk-go ```groovy Gradle -implementation("com.anthropic:anthropic-java:2.18.0") +implementation("com.anthropic:anthropic-java:2.20.0") ``` ```xml Maven com.anthropic anthropic-java - 2.18.0 + 2.20.0 ``` @@ -83,6 +91,14 @@ bundler add anthropic ## Quick start +```bash CLI +ant messages create \ + --model claude-opus-4-6 \ + --max-tokens 1024 \ + --message '{role: user, content: "Hello, Claude"}' \ + --transform content +``` + ```python Python import anthropic @@ -224,6 +240,14 @@ Access beta features using the `beta` namespace in any SDK: +```bash CLI nocheck +ant beta:messages create \ + --model claude-opus-4-6 \ + --max-tokens 1024 \ + --message '{role: user, content: "Hello"}' \ + --beta feature-name +``` + ```python Python nocheck message = client.beta.messages.create( model="claude-opus-4-6", diff --git a/content/en/api/completions.md b/content/en/api/completions.md index 25d48f90b..e530f7c9b 100644 --- a/content/en/api/completions.md +++ b/content/en/api/completions.md @@ -18,7 +18,7 @@ Future models and features will not be compatible with Text Completions. See our - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -62,8 +62,6 @@ Future models and features will not be compatible with Text Completions. See our - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Body Parameters - `max_tokens_to_sample: number` @@ -78,15 +76,19 @@ Future models and features will not be compatible with Text Completions. See our See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -234,15 +236,19 @@ Future models and features will not be compatible with Text Completions. See our See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -329,7 +335,7 @@ curl https://api.anthropic.com/v1/complete \ --max-time 600 \ -d '{ "max_tokens_to_sample": 256, - "model": "claude-opus-4-6", + "model": "claude-mythos-preview", "prompt": "\\n\\nHuman: Hello, world!\\n\\nAssistant:" }' ``` @@ -356,15 +362,19 @@ curl https://api.anthropic.com/v1/complete \ See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` diff --git a/content/en/api/completions/create.md b/content/en/api/completions/create.md index deee11be4..24383a675 100644 --- a/content/en/api/completions/create.md +++ b/content/en/api/completions/create.md @@ -16,7 +16,7 @@ Future models and features will not be compatible with Text Completions. See our - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -60,8 +60,6 @@ Future models and features will not be compatible with Text Completions. See our - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Body Parameters - `max_tokens_to_sample: number` @@ -76,15 +74,19 @@ Future models and features will not be compatible with Text Completions. See our See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -232,15 +234,19 @@ Future models and features will not be compatible with Text Completions. See our See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -327,7 +333,7 @@ curl https://api.anthropic.com/v1/complete \ --max-time 600 \ -d '{ "max_tokens_to_sample": 256, - "model": "claude-opus-4-6", + "model": "claude-mythos-preview", "prompt": "\\n\\nHuman: Hello, world!\\n\\nAssistant:" }' ``` diff --git a/content/en/api/csharp/beta.md b/content/en/api/csharp/beta.md index 8836ef4da..0633e2e19 100644 --- a/content/en/api/csharp/beta.md +++ b/content/en/api/csharp/beta.md @@ -272,8 +272,6 @@ The Models API response can be used to determine which models are available for - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class ModelListPageResponse:` @@ -546,8 +544,6 @@ The Models API response can be used to determine information about a specific mo - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class BetaModelInfo:` @@ -5061,10 +5057,6 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en Recommended for advanced use cases only. You usually only need to use `temperature`. - - `string? userProfileID` - - Body param: The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `IReadOnlyList betas` Header param: Optional header to specify the beta version(s) you want to use. @@ -5111,8 +5103,6 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class BetaMessage:` @@ -5908,9 +5898,13 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -10014,8 +10008,6 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class BetaMessageTokensCount:` @@ -10045,7 +10037,7 @@ MessageCountTokensParams parameters = new() Role = Role.User, }, ], - Model = Model.ClaudeOpus4_6, + Model = Model.ClaudeMythosPreview, }; var betaMessageTokensCount = await client.Beta.Messages.CountTokens(parameters); @@ -16180,9 +16172,13 @@ Console.WriteLine(betaMessageTokensCount); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -20832,9 +20828,13 @@ Console.WriteLine(betaMessageTokensCount); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -21926,9 +21926,13 @@ Console.WriteLine(betaMessageTokensCount); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -31730,9 +31734,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -33613,10 +33621,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Recommended for advanced use cases only. You usually only need to use `temperature`. - - `string? UserProfileID` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `IReadOnlyList betas` Header param: Optional header to specify the beta version(s) you want to use. @@ -33663,8 +33667,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class BetaMessageBatch:` @@ -33921,7 +33923,6 @@ BatchCreateParams parameters = new() ], TopK = 5, TopP = 0.7, - UserProfileID = "user_profile_id", }, }, ], @@ -33996,8 +33997,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class BetaMessageBatch:` @@ -34170,8 +34169,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class BatchListPageResponse:` @@ -34352,8 +34349,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class BetaMessageBatch:` @@ -34518,8 +34513,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class BetaDeletedMessageBatch:` @@ -34610,8 +34603,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class BetaMessageBatchIndividualResponse:` @@ -35425,9 +35416,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -36796,9 +36791,13 @@ await foreach (var betaMessageBatchIndividualResponse in client.Beta.Messages.Ba See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -37994,9 +37993,13 @@ await foreach (var betaMessageBatchIndividualResponse in client.Beta.Messages.Ba See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -39154,9 +39157,13 @@ await foreach (var betaMessageBatchIndividualResponse in client.Beta.Messages.Ba See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -39443,23 +39450,373 @@ await foreach (var betaMessageBatchIndividualResponse in client.Beta.Messages.Ba - `JsonElement Type "succeeded"constant` -# Files +# Agents -## Upload +## Create -`FileMetadata Beta.Files.Upload(FileUploadParamsparameters, CancellationTokencancellationToken = default)` +`BetaManagedAgentsAgent Beta.Agents.Create(AgentCreateParamsparameters, CancellationTokencancellationToken = default)` -**post** `/v1/files` +**post** `/v1/agents` -Upload File +Create Agent ### Parameters -- `FileUploadParams parameters` +- `AgentCreateParams parameters` - - `required string file` + - `required Model model` - Body param: The file to upload + Body param: Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control + + - `enum BetaManagedAgentsModel:` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `class BetaManagedAgentsModelConfigParams:` + + An object that defines additional configuration control over model use + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed? Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string name` + + Body param: Human-readable name for the agent. 1-256 characters. + + - `string? description` + + Body param: Description of what the agent does. Up to 2048 characters. + + - `IReadOnlyList mcpServers` + + Body param: MCP servers this agent connects to. Maximum 20. Names must be unique within the array. + + - `required string Name` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + Endpoint URL for the MCP server. + + - `IReadOnlyDictionary metadata` + + Body param: Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars. + + - `IReadOnlyList skills` + + Body param: Skills available to the agent. Maximum 20. + + - `class BetaManagedAgentsAnthropicSkillParams:` + + An Anthropic-managed skill. + + - `required string SkillID` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `string? Version` + + Version to pin. Defaults to latest if omitted. + + - `class BetaManagedAgentsCustomSkillParams:` + + A user-created custom skill. + + - `required string SkillID` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `required Type Type` + + - `"custom"Custom` + + - `string? Version` + + Version to pin. Defaults to latest if omitted. + + - `string? system` + + Body param: System prompt for the agent. Up to 100,000 characters. + + - `IReadOnlyList tools` + + Body param: Tool configurations available to the agent. Maximum of 128 tools across all toolsets allowed. + + - `class BetaManagedAgentsAgentToolset20260401Params:` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `IReadOnlyList Configs` + + Per-tool configuration overrides. + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `Boolean? Enabled` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `BetaManagedAgentsAgentToolsetDefaultConfigParams? DefaultConfig` + + Default configuration for all tools in a toolset. + + - `Boolean? Enabled` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `class BetaManagedAgentsMcpToolsetParams:` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `required string McpServerName` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `IReadOnlyList Configs` + + Per-tool configuration overrides. + + - `required string Name` + + Name of the MCP tool to configure. 1-128 characters. + + - `Boolean? Enabled` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `BetaManagedAgentsMcpToolsetDefaultConfigParams? DefaultConfig` + + Default configuration for all tools from an MCP server. + + - `Boolean? Enabled` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `class BetaManagedAgentsCustomToolParams:` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `required string Description` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `required Type Type` + + - `"custom"Custom` - `IReadOnlyList betas` @@ -39507,7 +39864,22020 @@ Upload File - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` +### Returns + +- `class BetaManagedAgentsAgent:` + + A Managed Agents `agent`. + + - `required string ID` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required IReadOnlyDictionary Metadata` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required Int Version` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```csharp +AgentCreateParams parameters = new() +{ + Model = BetaManagedAgentsModel.ClaudeSonnet4_6, + Name = "My First Agent", +}; + +var betaManagedAgentsAgent = await client.Beta.Agents.Create(parameters); + +Console.WriteLine(betaManagedAgentsAgent); +``` + +## List + +`AgentListPageResponse Beta.Agents.List(AgentListParams?parameters, CancellationTokencancellationToken = default)` + +**get** `/v1/agents` + +List Agents + +### Parameters + +- `AgentListParams parameters` + + - `DateTimeOffset createdAtGte` + + Query param: Return agents created at or after this time (inclusive). + + - `DateTimeOffset createdAtLte` + + Query param: Return agents created at or before this time (inclusive). + + - `Boolean includeArchived` + + Query param: Include archived agents in results. Defaults to false. + + - `Int limit` + + Query param: Maximum results per page. Default 20, maximum 100. + + - `string page` + + Query param: Opaque pagination cursor from a previous response. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class AgentListPageResponse:` + + Paginated list of agents. + + - `IReadOnlyList Data` + + List of agents. + + - `required string ID` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required IReadOnlyDictionary Metadata` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required Int Version` + + The agent's current version. Starts at 1 and increments when the agent is modified. + + - `string? NextPage` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```csharp +AgentListParams parameters = new(); + +var page = await client.Beta.Agents.List(parameters); +await foreach (var item in page.Paginate()) +{ + Console.WriteLine(item); +} +``` + +## Retrieve + +`BetaManagedAgentsAgent Beta.Agents.Retrieve(AgentRetrieveParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/agents/{agent_id}` + +Get Agent + +### Parameters + +- `AgentRetrieveParams parameters` + + - `required string agentID` + + Path param: Path parameter agent_id + + - `Int version` + + Query param: Agent version. Omit for the most recent version. Must be at least 1 if specified. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsAgent:` + + A Managed Agents `agent`. + + - `required string ID` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required IReadOnlyDictionary Metadata` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required Int Version` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```csharp +AgentRetrieveParams parameters = new() +{ + AgentID = "agent_011CZkYpogX7uDKUyvBTophP" +}; + +var betaManagedAgentsAgent = await client.Beta.Agents.Retrieve(parameters); + +Console.WriteLine(betaManagedAgentsAgent); +``` + +## Update + +`BetaManagedAgentsAgent Beta.Agents.Update(AgentUpdateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/agents/{agent_id}` + +Update Agent + +### Parameters + +- `AgentUpdateParams parameters` + + - `required string agentID` + + Path param: Path parameter agent_id + + - `required Int version` + + Body param: The agent's current version, used to prevent concurrent overwrites. Obtain this value from a create or retrieve response. The request fails if this does not match the server's current version. + + - `string? description` + + Body param: Description. Up to 2048 characters. Omit to preserve; send empty string or null to clear. + + - `IReadOnlyList? mcpServers` + + Body param: MCP servers. Full replacement. Omit to preserve; send empty array or null to clear. Names must be unique. Maximum 20. + + - `required string Name` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + Endpoint URL for the MCP server. + + - `IReadOnlyDictionary? metadata` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. The stored bag is limited to 16 keys (up to 64 chars each) with values up to 512 chars. + + - `Model model` + + Body param: Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control. Omit to preserve. Cannot be cleared. + + - `enum BetaManagedAgentsModel:` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `class BetaManagedAgentsModelConfigParams:` + + An object that defines additional configuration control over model use + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed? Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `string name` + + Body param: Human-readable name. 1-256 characters. Omit to preserve. Cannot be cleared. + + - `IReadOnlyList? skills` + + Body param: Skills. Full replacement. Omit to preserve; send empty array or null to clear. Maximum 20. + + - `class BetaManagedAgentsAnthropicSkillParams:` + + An Anthropic-managed skill. + + - `required string SkillID` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `string? Version` + + Version to pin. Defaults to latest if omitted. + + - `class BetaManagedAgentsCustomSkillParams:` + + A user-created custom skill. + + - `required string SkillID` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `required Type Type` + + - `"custom"Custom` + + - `string? Version` + + Version to pin. Defaults to latest if omitted. + + - `string? system` + + Body param: System prompt. Up to 100,000 characters. Omit to preserve; send empty string or null to clear. + + - `IReadOnlyList? tools` + + Body param: Tool configurations available to the agent. Full replacement. Omit to preserve; send empty array or null to clear. Maximum of 128 tools across all toolsets allowed. + + - `class BetaManagedAgentsAgentToolset20260401Params:` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `IReadOnlyList Configs` + + Per-tool configuration overrides. + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `Boolean? Enabled` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `BetaManagedAgentsAgentToolsetDefaultConfigParams? DefaultConfig` + + Default configuration for all tools in a toolset. + + - `Boolean? Enabled` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `class BetaManagedAgentsMcpToolsetParams:` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `required string McpServerName` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `IReadOnlyList Configs` + + Per-tool configuration overrides. + + - `required string Name` + + Name of the MCP tool to configure. 1-128 characters. + + - `Boolean? Enabled` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `BetaManagedAgentsMcpToolsetDefaultConfigParams? DefaultConfig` + + Default configuration for all tools from an MCP server. + + - `Boolean? Enabled` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `class BetaManagedAgentsCustomToolParams:` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `required string Description` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `required Type Type` + + - `"custom"Custom` + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsAgent:` + + A Managed Agents `agent`. + + - `required string ID` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required IReadOnlyDictionary Metadata` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required Int Version` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```csharp +AgentUpdateParams parameters = new() +{ + AgentID = "agent_011CZkYpogX7uDKUyvBTophP", + Version = 1, +}; + +var betaManagedAgentsAgent = await client.Beta.Agents.Update(parameters); + +Console.WriteLine(betaManagedAgentsAgent); +``` + +## Archive + +`BetaManagedAgentsAgent Beta.Agents.Archive(AgentArchiveParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/agents/{agent_id}/archive` + +Archive Agent + +### Parameters + +- `AgentArchiveParams parameters` + + - `required string agentID` + + Path parameter agent_id + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsAgent:` + + A Managed Agents `agent`. + + - `required string ID` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required IReadOnlyDictionary Metadata` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required Int Version` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```csharp +AgentArchiveParams parameters = new() +{ + AgentID = "agent_011CZkYpogX7uDKUyvBTophP" +}; + +var betaManagedAgentsAgent = await client.Beta.Agents.Archive(parameters); + +Console.WriteLine(betaManagedAgentsAgent); +``` + +## Domain Types + +### Beta Managed Agents Agent + +- `class BetaManagedAgentsAgent:` + + A Managed Agents `agent`. + + - `required string ID` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required IReadOnlyDictionary Metadata` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required Int Version` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Beta Managed Agents Agent Tool Config + +- `class BetaManagedAgentsAgentToolConfig:` + + Configuration for a specific agent tool. + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + +### Beta Managed Agents Agent Tool Config Params + +- `class BetaManagedAgentsAgentToolConfigParams:` + + Configuration override for a specific tool within a toolset. + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `Boolean? Enabled` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + +### Beta Managed Agents Agent Toolset Default Config + +- `class BetaManagedAgentsAgentToolsetDefaultConfig:` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + +### Beta Managed Agents Agent Toolset Default Config Params + +- `class BetaManagedAgentsAgentToolsetDefaultConfigParams:` + + Default configuration for all tools in a toolset. + + - `Boolean? Enabled` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + +### Beta Managed Agents Agent Toolset20260401 + +- `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + +### Beta Managed Agents Agent Toolset20260401 Params + +- `class BetaManagedAgentsAgentToolset20260401Params:` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `IReadOnlyList Configs` + + Per-tool configuration overrides. + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `Boolean? Enabled` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `BetaManagedAgentsAgentToolsetDefaultConfigParams? DefaultConfig` + + Default configuration for all tools in a toolset. + + - `Boolean? Enabled` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + +### Beta Managed Agents Always Allow Policy + +- `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + +### Beta Managed Agents Always Ask Policy + +- `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + +### Beta Managed Agents Anthropic Skill + +- `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + +### Beta Managed Agents Anthropic Skill Params + +- `class BetaManagedAgentsAnthropicSkillParams:` + + An Anthropic-managed skill. + + - `required string SkillID` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `string? Version` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents Custom Skill + +- `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + +### Beta Managed Agents Custom Skill Params + +- `class BetaManagedAgentsCustomSkillParams:` + + A user-created custom skill. + + - `required string SkillID` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `required Type Type` + + - `"custom"Custom` + + - `string? Version` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents Custom Tool + +- `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + +### Beta Managed Agents Custom Tool Input Schema + +- `class BetaManagedAgentsCustomToolInputSchema:` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + +### Beta Managed Agents Custom Tool Params + +- `class BetaManagedAgentsCustomToolParams:` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `required string Description` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `required Type Type` + + - `"custom"Custom` + +### Beta Managed Agents MCP Server URL Definition + +- `class BetaManagedAgentsMcpServerUrlDefinition:` + + URL-based MCP server connection as returned in API responses. + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + +### Beta Managed Agents MCP Tool Config + +- `class BetaManagedAgentsMcpToolConfig:` + + Resolved configuration for a specific MCP tool. + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + +### Beta Managed Agents MCP Tool Config Params + +- `class BetaManagedAgentsMcpToolConfigParams:` + + Configuration override for a specific MCP tool. + + - `required string Name` + + Name of the MCP tool to configure. 1-128 characters. + + - `Boolean? Enabled` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + +### Beta Managed Agents MCP Toolset + +- `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + +### Beta Managed Agents MCP Toolset Default Config + +- `class BetaManagedAgentsMcpToolsetDefaultConfig:` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + +### Beta Managed Agents MCP Toolset Default Config Params + +- `class BetaManagedAgentsMcpToolsetDefaultConfigParams:` + + Default configuration for all tools from an MCP server. + + - `Boolean? Enabled` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + +### Beta Managed Agents MCP Toolset Params + +- `class BetaManagedAgentsMcpToolsetParams:` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `required string McpServerName` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `IReadOnlyList Configs` + + Per-tool configuration overrides. + + - `required string Name` + + Name of the MCP tool to configure. 1-128 characters. + + - `Boolean? Enabled` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `BetaManagedAgentsMcpToolsetDefaultConfigParams? DefaultConfig` + + Default configuration for all tools from an MCP server. + + - `Boolean? Enabled` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + +### Beta Managed Agents Model Config + +- `class BetaManagedAgentsModelConfig:` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + +### Beta Managed Agents Model Config Params + +- `class BetaManagedAgentsModelConfigParams:` + + An object that defines additional configuration control over model use + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed? Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + +### Beta Managed Agents Skill Params + +- `class BetaManagedAgentsSkillParams: A class that can be one of several variants.union` + + Skill to load in the session container. + + - `class BetaManagedAgentsAnthropicSkillParams:` + + An Anthropic-managed skill. + + - `required string SkillID` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `string? Version` + + Version to pin. Defaults to latest if omitted. + + - `class BetaManagedAgentsCustomSkillParams:` + + A user-created custom skill. + + - `required string SkillID` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `required Type Type` + + - `"custom"Custom` + + - `string? Version` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents URL MCP Server Params + +- `class BetaManagedAgentsUrlMcpServerParams:` + + URL-based MCP server connection. + + - `required string Name` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + Endpoint URL for the MCP server. + +# Versions + +## List + +`VersionListPageResponse Beta.Agents.Versions.List(VersionListParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/agents/{agent_id}/versions` + +List Agent Versions + +### Parameters + +- `VersionListParams parameters` + + - `required string agentID` + + Path param: Path parameter agent_id + + - `Int limit` + + Query param: Maximum results per page. Default 20, maximum 100. + + - `string page` + + Query param: Opaque pagination cursor. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class VersionListPageResponse:` + + Paginated list of agent versions. + + - `IReadOnlyList Data` + + Agent versions. + + - `required string ID` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required IReadOnlyDictionary Metadata` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required Int Version` + + The agent's current version. Starts at 1 and increments when the agent is modified. + + - `string? NextPage` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```csharp +VersionListParams parameters = new() +{ + AgentID = "agent_011CZkYpogX7uDKUyvBTophP" +}; + +var page = await client.Beta.Agents.Versions.List(parameters); +await foreach (var item in page.Paginate()) +{ + Console.WriteLine(item); +} +``` + +# Environments + +## Create + +`BetaEnvironment Beta.Environments.Create(EnvironmentCreateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/environments` + +Create a new environment with the specified configuration. + +### Parameters + +- `EnvironmentCreateParams parameters` + + - `required string name` + + Body param: Human-readable name for the environment + + - `BetaCloudConfigParams? config` + + Body param: Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `string? description` + + Body param: Optional description of the environment + + - `IReadOnlyDictionary metadata` + + Body param: User-provided metadata key-value pairs + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaEnvironment:` + + Unified Environment resource for both cloud and BYOC environments. + + - `required string ID` + + Environment identifier (e.g., 'env_...') + + - `required string? ArchivedAt` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `required BetaCloudConfig Config` + + `cloud` environment configuration. + + - `required Networking Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonElement Type "unrestricted"constant` + + Network policy type + + - `class BetaLimitedNetwork:` + + Limited network access. + + - `required Boolean AllowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `required Boolean AllowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `required IReadOnlyList AllowedHosts` + + Specifies domains the container can reach. + + - `JsonElement Type "limited"constant` + + Network policy type + + - `required BetaPackages Packages` + + Package manager configuration. + + - `required IReadOnlyList Apt` + + Ubuntu/Debian packages to install + + - `required IReadOnlyList Cargo` + + Rust packages to install + + - `required IReadOnlyList Gem` + + Ruby packages to install + + - `required IReadOnlyList Go` + + Go packages to install + + - `required IReadOnlyList Npm` + + Node.js packages to install + + - `required IReadOnlyList Pip` + + Python packages to install + + - `Type Type` + + Package configuration type + + - `"packages"Packages` + + - `JsonElement Type "cloud"constant` + + Environment type + + - `required string CreatedAt` + + RFC 3339 timestamp when environment was created + + - `required string Description` + + User-provided description for the environment + + - `required IReadOnlyDictionary Metadata` + + User-provided metadata key-value pairs + + - `required string Name` + + Human-readable name for the environment + + - `JsonElement Type "environment"constant` + + The type of object (always 'environment') + + - `required string UpdatedAt` + + RFC 3339 timestamp when environment was last updated + +### Example + +```csharp +EnvironmentCreateParams parameters = new() { Name = "python-data-analysis" }; + +var betaEnvironment = await client.Beta.Environments.Create(parameters); + +Console.WriteLine(betaEnvironment); +``` + +## List + +`EnvironmentListPageResponse Beta.Environments.List(EnvironmentListParams?parameters, CancellationTokencancellationToken = default)` + +**get** `/v1/environments` + +List environments with pagination support. + +### Parameters + +- `EnvironmentListParams parameters` + + - `Boolean includeArchived` + + Query param: Include archived environments in the response + + - `Long limit` + + Query param: Maximum number of environments to return + + - `string? page` + + Query param: Opaque cursor from previous response for pagination. Pass the `next_page` value from the previous response. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class EnvironmentListPageResponse:` + + Response when listing environments. + + This response model uses opaque cursor-based pagination. Use the `page` + query parameter with the value from `next_page` to fetch the next page. + + - `required IReadOnlyList Data` + + List of environments. + + - `required string ID` + + Environment identifier (e.g., 'env_...') + + - `required string? ArchivedAt` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `required BetaCloudConfig Config` + + `cloud` environment configuration. + + - `required Networking Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonElement Type "unrestricted"constant` + + Network policy type + + - `class BetaLimitedNetwork:` + + Limited network access. + + - `required Boolean AllowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `required Boolean AllowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `required IReadOnlyList AllowedHosts` + + Specifies domains the container can reach. + + - `JsonElement Type "limited"constant` + + Network policy type + + - `required BetaPackages Packages` + + Package manager configuration. + + - `required IReadOnlyList Apt` + + Ubuntu/Debian packages to install + + - `required IReadOnlyList Cargo` + + Rust packages to install + + - `required IReadOnlyList Gem` + + Ruby packages to install + + - `required IReadOnlyList Go` + + Go packages to install + + - `required IReadOnlyList Npm` + + Node.js packages to install + + - `required IReadOnlyList Pip` + + Python packages to install + + - `Type Type` + + Package configuration type + + - `"packages"Packages` + + - `JsonElement Type "cloud"constant` + + Environment type + + - `required string CreatedAt` + + RFC 3339 timestamp when environment was created + + - `required string Description` + + User-provided description for the environment + + - `required IReadOnlyDictionary Metadata` + + User-provided metadata key-value pairs + + - `required string Name` + + Human-readable name for the environment + + - `JsonElement Type "environment"constant` + + The type of object (always 'environment') + + - `required string UpdatedAt` + + RFC 3339 timestamp when environment was last updated + + - `required string? NextPage` + + Token for fetching the next page of results. If `null`, there are no more results available. Pass this value to the `page` parameter in the next request. + +### Example + +```csharp +EnvironmentListParams parameters = new(); + +var page = await client.Beta.Environments.List(parameters); +await foreach (var item in page.Paginate()) +{ + Console.WriteLine(item); +} +``` + +## Retrieve + +`BetaEnvironment Beta.Environments.Retrieve(EnvironmentRetrieveParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/environments/{environment_id}` + +Retrieve a specific environment by ID. + +### Parameters + +- `EnvironmentRetrieveParams parameters` + + - `required string environmentID` + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaEnvironment:` + + Unified Environment resource for both cloud and BYOC environments. + + - `required string ID` + + Environment identifier (e.g., 'env_...') + + - `required string? ArchivedAt` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `required BetaCloudConfig Config` + + `cloud` environment configuration. + + - `required Networking Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonElement Type "unrestricted"constant` + + Network policy type + + - `class BetaLimitedNetwork:` + + Limited network access. + + - `required Boolean AllowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `required Boolean AllowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `required IReadOnlyList AllowedHosts` + + Specifies domains the container can reach. + + - `JsonElement Type "limited"constant` + + Network policy type + + - `required BetaPackages Packages` + + Package manager configuration. + + - `required IReadOnlyList Apt` + + Ubuntu/Debian packages to install + + - `required IReadOnlyList Cargo` + + Rust packages to install + + - `required IReadOnlyList Gem` + + Ruby packages to install + + - `required IReadOnlyList Go` + + Go packages to install + + - `required IReadOnlyList Npm` + + Node.js packages to install + + - `required IReadOnlyList Pip` + + Python packages to install + + - `Type Type` + + Package configuration type + + - `"packages"Packages` + + - `JsonElement Type "cloud"constant` + + Environment type + + - `required string CreatedAt` + + RFC 3339 timestamp when environment was created + + - `required string Description` + + User-provided description for the environment + + - `required IReadOnlyDictionary Metadata` + + User-provided metadata key-value pairs + + - `required string Name` + + Human-readable name for the environment + + - `JsonElement Type "environment"constant` + + The type of object (always 'environment') + + - `required string UpdatedAt` + + RFC 3339 timestamp when environment was last updated + +### Example + +```csharp +EnvironmentRetrieveParams parameters = new() +{ + EnvironmentID = "env_011CZkZ9X2dpNyB7HsEFoRfW" +}; + +var betaEnvironment = await client.Beta.Environments.Retrieve(parameters); + +Console.WriteLine(betaEnvironment); +``` + +## Update + +`BetaEnvironment Beta.Environments.Update(EnvironmentUpdateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/environments/{environment_id}` + +Update an existing environment's configuration. + +### Parameters + +- `EnvironmentUpdateParams parameters` + + - `required string environmentID` + + Path param + + - `BetaCloudConfigParams? config` + + Body param: Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `string? description` + + Body param: Updated description of the environment + + - `IReadOnlyDictionary metadata` + + Body param: User-provided metadata key-value pairs. Set a value to null or empty string to delete the key. + + - `string? name` + + Body param: Updated name for the environment + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaEnvironment:` + + Unified Environment resource for both cloud and BYOC environments. + + - `required string ID` + + Environment identifier (e.g., 'env_...') + + - `required string? ArchivedAt` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `required BetaCloudConfig Config` + + `cloud` environment configuration. + + - `required Networking Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonElement Type "unrestricted"constant` + + Network policy type + + - `class BetaLimitedNetwork:` + + Limited network access. + + - `required Boolean AllowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `required Boolean AllowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `required IReadOnlyList AllowedHosts` + + Specifies domains the container can reach. + + - `JsonElement Type "limited"constant` + + Network policy type + + - `required BetaPackages Packages` + + Package manager configuration. + + - `required IReadOnlyList Apt` + + Ubuntu/Debian packages to install + + - `required IReadOnlyList Cargo` + + Rust packages to install + + - `required IReadOnlyList Gem` + + Ruby packages to install + + - `required IReadOnlyList Go` + + Go packages to install + + - `required IReadOnlyList Npm` + + Node.js packages to install + + - `required IReadOnlyList Pip` + + Python packages to install + + - `Type Type` + + Package configuration type + + - `"packages"Packages` + + - `JsonElement Type "cloud"constant` + + Environment type + + - `required string CreatedAt` + + RFC 3339 timestamp when environment was created + + - `required string Description` + + User-provided description for the environment + + - `required IReadOnlyDictionary Metadata` + + User-provided metadata key-value pairs + + - `required string Name` + + Human-readable name for the environment + + - `JsonElement Type "environment"constant` + + The type of object (always 'environment') + + - `required string UpdatedAt` + + RFC 3339 timestamp when environment was last updated + +### Example + +```csharp +EnvironmentUpdateParams parameters = new() +{ + EnvironmentID = "env_011CZkZ9X2dpNyB7HsEFoRfW" +}; + +var betaEnvironment = await client.Beta.Environments.Update(parameters); + +Console.WriteLine(betaEnvironment); +``` + +## Delete + +`BetaEnvironmentDeleteResponse Beta.Environments.Delete(EnvironmentDeleteParamsparameters, CancellationTokencancellationToken = default)` + +**delete** `/v1/environments/{environment_id}` + +Delete an environment by ID. Returns a confirmation of the deletion. + +### Parameters + +- `EnvironmentDeleteParams parameters` + + - `required string environmentID` + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaEnvironmentDeleteResponse:` + + Response after deleting an environment. + + - `required string ID` + + Environment identifier + + - `JsonElement Type "environment_deleted"constant` + + The type of response + +### Example + +```csharp +EnvironmentDeleteParams parameters = new() +{ + EnvironmentID = "env_011CZkZ9X2dpNyB7HsEFoRfW" +}; + +var betaEnvironmentDeleteResponse = await client.Beta.Environments.Delete(parameters); + +Console.WriteLine(betaEnvironmentDeleteResponse); +``` + +## Archive + +`BetaEnvironment Beta.Environments.Archive(EnvironmentArchiveParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/environments/{environment_id}/archive` + +Archive an environment by ID. Archived environments cannot be used to create new sessions. + +### Parameters + +- `EnvironmentArchiveParams parameters` + + - `required string environmentID` + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaEnvironment:` + + Unified Environment resource for both cloud and BYOC environments. + + - `required string ID` + + Environment identifier (e.g., 'env_...') + + - `required string? ArchivedAt` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `required BetaCloudConfig Config` + + `cloud` environment configuration. + + - `required Networking Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonElement Type "unrestricted"constant` + + Network policy type + + - `class BetaLimitedNetwork:` + + Limited network access. + + - `required Boolean AllowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `required Boolean AllowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `required IReadOnlyList AllowedHosts` + + Specifies domains the container can reach. + + - `JsonElement Type "limited"constant` + + Network policy type + + - `required BetaPackages Packages` + + Package manager configuration. + + - `required IReadOnlyList Apt` + + Ubuntu/Debian packages to install + + - `required IReadOnlyList Cargo` + + Rust packages to install + + - `required IReadOnlyList Gem` + + Ruby packages to install + + - `required IReadOnlyList Go` + + Go packages to install + + - `required IReadOnlyList Npm` + + Node.js packages to install + + - `required IReadOnlyList Pip` + + Python packages to install + + - `Type Type` + + Package configuration type + + - `"packages"Packages` + + - `JsonElement Type "cloud"constant` + + Environment type + + - `required string CreatedAt` + + RFC 3339 timestamp when environment was created + + - `required string Description` + + User-provided description for the environment + + - `required IReadOnlyDictionary Metadata` + + User-provided metadata key-value pairs + + - `required string Name` + + Human-readable name for the environment + + - `JsonElement Type "environment"constant` + + The type of object (always 'environment') + + - `required string UpdatedAt` + + RFC 3339 timestamp when environment was last updated + +### Example + +```csharp +EnvironmentArchiveParams parameters = new() +{ + EnvironmentID = "env_011CZkZ9X2dpNyB7HsEFoRfW" +}; + +var betaEnvironment = await client.Beta.Environments.Archive(parameters); + +Console.WriteLine(betaEnvironment); +``` + +## Domain Types + +### Beta Cloud Config + +- `class BetaCloudConfig:` + + `cloud` environment configuration. + + - `required Networking Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonElement Type "unrestricted"constant` + + Network policy type + + - `class BetaLimitedNetwork:` + + Limited network access. + + - `required Boolean AllowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `required Boolean AllowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `required IReadOnlyList AllowedHosts` + + Specifies domains the container can reach. + + - `JsonElement Type "limited"constant` + + Network policy type + + - `required BetaPackages Packages` + + Package manager configuration. + + - `required IReadOnlyList Apt` + + Ubuntu/Debian packages to install + + - `required IReadOnlyList Cargo` + + Rust packages to install + + - `required IReadOnlyList Gem` + + Ruby packages to install + + - `required IReadOnlyList Go` + + Go packages to install + + - `required IReadOnlyList Npm` + + Node.js packages to install + + - `required IReadOnlyList Pip` + + Python packages to install + + - `Type Type` + + Package configuration type + + - `"packages"Packages` + + - `JsonElement Type "cloud"constant` + + Environment type + +### Beta Cloud Config Params + +- `class BetaCloudConfigParams:` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `JsonElement Type "cloud"constant` + + Environment type + + - `Networking? Networking` + + Network configuration policy. Omit on update to preserve the existing value. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonElement Type "unrestricted"constant` + + Network policy type + + - `class BetaLimitedNetworkParams:` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `JsonElement Type "limited"constant` + + Network policy type + + - `Boolean? AllowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `Boolean? AllowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `IReadOnlyList? AllowedHosts` + + Specifies domains the container can reach. + + - `BetaPackagesParams? Packages` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `IReadOnlyList? Apt` + + Ubuntu/Debian packages to install + + - `IReadOnlyList? Cargo` + + Rust packages to install + + - `IReadOnlyList? Gem` + + Ruby packages to install + + - `IReadOnlyList? Go` + + Go packages to install + + - `IReadOnlyList? Npm` + + Node.js packages to install + + - `IReadOnlyList? Pip` + + Python packages to install + + - `Type Type` + + Package configuration type + + - `"packages"Packages` + +### Beta Environment + +- `class BetaEnvironment:` + + Unified Environment resource for both cloud and BYOC environments. + + - `required string ID` + + Environment identifier (e.g., 'env_...') + + - `required string? ArchivedAt` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `required BetaCloudConfig Config` + + `cloud` environment configuration. + + - `required Networking Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonElement Type "unrestricted"constant` + + Network policy type + + - `class BetaLimitedNetwork:` + + Limited network access. + + - `required Boolean AllowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `required Boolean AllowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `required IReadOnlyList AllowedHosts` + + Specifies domains the container can reach. + + - `JsonElement Type "limited"constant` + + Network policy type + + - `required BetaPackages Packages` + + Package manager configuration. + + - `required IReadOnlyList Apt` + + Ubuntu/Debian packages to install + + - `required IReadOnlyList Cargo` + + Rust packages to install + + - `required IReadOnlyList Gem` + + Ruby packages to install + + - `required IReadOnlyList Go` + + Go packages to install + + - `required IReadOnlyList Npm` + + Node.js packages to install + + - `required IReadOnlyList Pip` + + Python packages to install + + - `Type Type` + + Package configuration type + + - `"packages"Packages` + + - `JsonElement Type "cloud"constant` + + Environment type + + - `required string CreatedAt` + + RFC 3339 timestamp when environment was created + + - `required string Description` + + User-provided description for the environment + + - `required IReadOnlyDictionary Metadata` + + User-provided metadata key-value pairs + + - `required string Name` + + Human-readable name for the environment + + - `JsonElement Type "environment"constant` + + The type of object (always 'environment') + + - `required string UpdatedAt` + + RFC 3339 timestamp when environment was last updated + +### Beta Environment Delete Response + +- `class BetaEnvironmentDeleteResponse:` + + Response after deleting an environment. + + - `required string ID` + + Environment identifier + + - `JsonElement Type "environment_deleted"constant` + + The type of response + +### Beta Limited Network + +- `class BetaLimitedNetwork:` + + Limited network access. + + - `required Boolean AllowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `required Boolean AllowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `required IReadOnlyList AllowedHosts` + + Specifies domains the container can reach. + + - `JsonElement Type "limited"constant` + + Network policy type + +### Beta Limited Network Params + +- `class BetaLimitedNetworkParams:` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `JsonElement Type "limited"constant` + + Network policy type + + - `Boolean? AllowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `Boolean? AllowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `IReadOnlyList? AllowedHosts` + + Specifies domains the container can reach. + +### Beta Packages + +- `class BetaPackages:` + + Packages (and their versions) available in this environment. + + - `required IReadOnlyList Apt` + + Ubuntu/Debian packages to install + + - `required IReadOnlyList Cargo` + + Rust packages to install + + - `required IReadOnlyList Gem` + + Ruby packages to install + + - `required IReadOnlyList Go` + + Go packages to install + + - `required IReadOnlyList Npm` + + Node.js packages to install + + - `required IReadOnlyList Pip` + + Python packages to install + + - `Type Type` + + Package configuration type + + - `"packages"Packages` + +### Beta Packages Params + +- `class BetaPackagesParams:` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `IReadOnlyList? Apt` + + Ubuntu/Debian packages to install + + - `IReadOnlyList? Cargo` + + Rust packages to install + + - `IReadOnlyList? Gem` + + Ruby packages to install + + - `IReadOnlyList? Go` + + Go packages to install + + - `IReadOnlyList? Npm` + + Node.js packages to install + + - `IReadOnlyList? Pip` + + Python packages to install + + - `Type Type` + + Package configuration type + + - `"packages"Packages` + +### Beta Unrestricted Network + +- `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonElement Type "unrestricted"constant` + + Network policy type + +# Sessions + +## Create + +`BetaManagedAgentsSession Beta.Sessions.Create(SessionCreateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/sessions` + +Create Session + +### Parameters + +- `SessionCreateParams parameters` + + - `required Agent agent` + + Body param: Agent identifier. Accepts the `agent` ID string, which pins the latest version for the session, or an `agent` object with both id and version specified. + + - `string` + + - `class BetaManagedAgentsAgentParams:` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `required string ID` + + The `agent` ID. + + - `required Type Type` + + - `"agent"Agent` + + - `Int Version` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + + - `required string environmentID` + + Body param: ID of the `environment` defining the container configuration for this session. + + - `IReadOnlyDictionary metadata` + + Body param: Arbitrary key-value metadata attached to the session. + + - `IReadOnlyList resources` + + Body param: Resources (e.g. repositories, files) to mount into the session's container. + + - `class BetaManagedAgentsGitHubRepositoryResourceParams:` + + Mount a GitHub repository into the session's container. + + - `required string AuthorizationToken` + + GitHub authorization token used to clone the repository. + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required string Url` + + Github URL of the repository + + - `Checkout? Checkout` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `string? MountPath` + + Mount path in the container. Defaults to `/workspace/`. + + - `class BetaManagedAgentsFileResourceParams:` + + Mount a file uploaded via the Files API into the session. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `string? MountPath` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + + - `string? title` + + Body param: Human-readable session title. + + - `IReadOnlyList vaultIds` + + Body param: Vault IDs for stored credentials the agent can use during the session. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsSession:` + + A Managed Agents `session`. + + - `required string ID` + + - `required BetaManagedAgentsSessionAgent Agent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `required string ID` + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required Int Version` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string EnvironmentID` + + - `required IReadOnlyDictionary Metadata` + + - `required IReadOnlyList Resources` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionStats Stats` + + Timing statistics for a session. + + - `Double ActiveSeconds` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `Double DurationSeconds` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `required Status Status` + + SessionStatus enum + + - `"rescheduling"Rescheduling` + + - `"running"Running` + + - `"idle"Idle` + + - `"terminated"Terminated` + + - `required string? Title` + + - `required Type Type` + + - `"session"Session` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionUsage Usage` + + Cumulative token usage for a session across all turns. + + - `BetaManagedAgentsCacheCreationUsage CacheCreation` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Int Ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Int Ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + + - `Int CacheReadInputTokens` + + Total tokens read from prompt cache. + + - `Int InputTokens` + + Total input tokens consumed across all turns. + + - `Int OutputTokens` + + Total output tokens generated across all turns. + + - `required IReadOnlyList VaultIds` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```csharp +SessionCreateParams parameters = new() +{ + Agent = "agent_011CZkYpogX7uDKUyvBTophP", + EnvironmentID = "env_011CZkZ9X2dpNyB7HsEFoRfW", +}; + +var betaManagedAgentsSession = await client.Beta.Sessions.Create(parameters); + +Console.WriteLine(betaManagedAgentsSession); +``` + +## List + +`SessionListPageResponse Beta.Sessions.List(SessionListParams?parameters, CancellationTokencancellationToken = default)` + +**get** `/v1/sessions` + +List Sessions + +### Parameters + +- `SessionListParams parameters` + + - `string agentID` + + Query param: Filter sessions created with this agent ID. + + - `Int agentVersion` + + Query param: Filter by agent version. Only applies when agent_id is also set. + + - `DateTimeOffset createdAtGt` + + Query param: Return sessions created after this time (exclusive). + + - `DateTimeOffset createdAtGte` + + Query param: Return sessions created at or after this time (inclusive). + + - `DateTimeOffset createdAtLt` + + Query param: Return sessions created before this time (exclusive). + + - `DateTimeOffset createdAtLte` + + Query param: Return sessions created at or before this time (inclusive). + + - `Boolean includeArchived` + + Query param: When true, includes archived sessions. Default: false (exclude archived). + + - `Int limit` + + Query param: Maximum number of results to return. + + - `Order order` + + Query param: Sort direction for results, ordered by created_at. Defaults to desc (newest first). + + - `"asc"Asc` + + - `"desc"Desc` + + - `string page` + + Query param: Opaque pagination cursor from a previous response's next_page. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class SessionListPageResponse:` + + Paginated list of sessions. + + - `IReadOnlyList Data` + + List of sessions. + + - `required string ID` + + - `required BetaManagedAgentsSessionAgent Agent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `required string ID` + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required Int Version` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string EnvironmentID` + + - `required IReadOnlyDictionary Metadata` + + - `required IReadOnlyList Resources` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionStats Stats` + + Timing statistics for a session. + + - `Double ActiveSeconds` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `Double DurationSeconds` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `required Status Status` + + SessionStatus enum + + - `"rescheduling"Rescheduling` + + - `"running"Running` + + - `"idle"Idle` + + - `"terminated"Terminated` + + - `required string? Title` + + - `required Type Type` + + - `"session"Session` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionUsage Usage` + + Cumulative token usage for a session across all turns. + + - `BetaManagedAgentsCacheCreationUsage CacheCreation` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Int Ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Int Ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + + - `Int CacheReadInputTokens` + + Total tokens read from prompt cache. + + - `Int InputTokens` + + Total input tokens consumed across all turns. + + - `Int OutputTokens` + + Total output tokens generated across all turns. + + - `required IReadOnlyList VaultIds` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + + - `string? NextPage` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```csharp +SessionListParams parameters = new(); + +var page = await client.Beta.Sessions.List(parameters); +await foreach (var item in page.Paginate()) +{ + Console.WriteLine(item); +} +``` + +## Retrieve + +`BetaManagedAgentsSession Beta.Sessions.Retrieve(SessionRetrieveParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/sessions/{session_id}` + +Get Session + +### Parameters + +- `SessionRetrieveParams parameters` + + - `required string sessionID` + + Path parameter session_id + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsSession:` + + A Managed Agents `session`. + + - `required string ID` + + - `required BetaManagedAgentsSessionAgent Agent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `required string ID` + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required Int Version` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string EnvironmentID` + + - `required IReadOnlyDictionary Metadata` + + - `required IReadOnlyList Resources` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionStats Stats` + + Timing statistics for a session. + + - `Double ActiveSeconds` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `Double DurationSeconds` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `required Status Status` + + SessionStatus enum + + - `"rescheduling"Rescheduling` + + - `"running"Running` + + - `"idle"Idle` + + - `"terminated"Terminated` + + - `required string? Title` + + - `required Type Type` + + - `"session"Session` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionUsage Usage` + + Cumulative token usage for a session across all turns. + + - `BetaManagedAgentsCacheCreationUsage CacheCreation` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Int Ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Int Ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + + - `Int CacheReadInputTokens` + + Total tokens read from prompt cache. + + - `Int InputTokens` + + Total input tokens consumed across all turns. + + - `Int OutputTokens` + + Total output tokens generated across all turns. + + - `required IReadOnlyList VaultIds` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```csharp +SessionRetrieveParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7" +}; + +var betaManagedAgentsSession = await client.Beta.Sessions.Retrieve(parameters); + +Console.WriteLine(betaManagedAgentsSession); +``` + +## Update + +`BetaManagedAgentsSession Beta.Sessions.Update(SessionUpdateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/sessions/{session_id}` + +Update Session + +### Parameters + +- `SessionUpdateParams parameters` + + - `required string sessionID` + + Path param: Path parameter session_id + + - `IReadOnlyDictionary? metadata` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. + + - `string? title` + + Body param: Human-readable session title. + + - `IReadOnlyList vaultIds` + + Body param: Vault IDs (`vlt_*`) to attach to the session. Not yet supported; requests setting this field are rejected. Reserved for future use. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsSession:` + + A Managed Agents `session`. + + - `required string ID` + + - `required BetaManagedAgentsSessionAgent Agent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `required string ID` + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required Int Version` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string EnvironmentID` + + - `required IReadOnlyDictionary Metadata` + + - `required IReadOnlyList Resources` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionStats Stats` + + Timing statistics for a session. + + - `Double ActiveSeconds` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `Double DurationSeconds` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `required Status Status` + + SessionStatus enum + + - `"rescheduling"Rescheduling` + + - `"running"Running` + + - `"idle"Idle` + + - `"terminated"Terminated` + + - `required string? Title` + + - `required Type Type` + + - `"session"Session` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionUsage Usage` + + Cumulative token usage for a session across all turns. + + - `BetaManagedAgentsCacheCreationUsage CacheCreation` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Int Ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Int Ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + + - `Int CacheReadInputTokens` + + Total tokens read from prompt cache. + + - `Int InputTokens` + + Total input tokens consumed across all turns. + + - `Int OutputTokens` + + Total output tokens generated across all turns. + + - `required IReadOnlyList VaultIds` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```csharp +SessionUpdateParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7" +}; + +var betaManagedAgentsSession = await client.Beta.Sessions.Update(parameters); + +Console.WriteLine(betaManagedAgentsSession); +``` + +## Delete + +`BetaManagedAgentsDeletedSession Beta.Sessions.Delete(SessionDeleteParamsparameters, CancellationTokencancellationToken = default)` + +**delete** `/v1/sessions/{session_id}` + +Delete Session + +### Parameters + +- `SessionDeleteParams parameters` + + - `required string sessionID` + + Path parameter session_id + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsDeletedSession:` + + Confirmation that a `session` has been permanently deleted. + + - `required string ID` + + - `required Type Type` + + - `"session_deleted"SessionDeleted` + +### Example + +```csharp +SessionDeleteParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7" +}; + +var betaManagedAgentsDeletedSession = await client.Beta.Sessions.Delete(parameters); + +Console.WriteLine(betaManagedAgentsDeletedSession); +``` + +## Archive + +`BetaManagedAgentsSession Beta.Sessions.Archive(SessionArchiveParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/sessions/{session_id}/archive` + +Archive Session + +### Parameters + +- `SessionArchiveParams parameters` + + - `required string sessionID` + + Path parameter session_id + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsSession:` + + A Managed Agents `session`. + + - `required string ID` + + - `required BetaManagedAgentsSessionAgent Agent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `required string ID` + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required Int Version` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string EnvironmentID` + + - `required IReadOnlyDictionary Metadata` + + - `required IReadOnlyList Resources` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionStats Stats` + + Timing statistics for a session. + + - `Double ActiveSeconds` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `Double DurationSeconds` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `required Status Status` + + SessionStatus enum + + - `"rescheduling"Rescheduling` + + - `"running"Running` + + - `"idle"Idle` + + - `"terminated"Terminated` + + - `required string? Title` + + - `required Type Type` + + - `"session"Session` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionUsage Usage` + + Cumulative token usage for a session across all turns. + + - `BetaManagedAgentsCacheCreationUsage CacheCreation` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Int Ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Int Ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + + - `Int CacheReadInputTokens` + + Total tokens read from prompt cache. + + - `Int InputTokens` + + Total input tokens consumed across all turns. + + - `Int OutputTokens` + + Total output tokens generated across all turns. + + - `required IReadOnlyList VaultIds` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```csharp +SessionArchiveParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7" +}; + +var betaManagedAgentsSession = await client.Beta.Sessions.Archive(parameters); + +Console.WriteLine(betaManagedAgentsSession); +``` + +## Domain Types + +### Beta Managed Agents Agent Params + +- `class BetaManagedAgentsAgentParams:` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `required string ID` + + The `agent` ID. + + - `required Type Type` + + - `"agent"Agent` + + - `Int Version` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + +### Beta Managed Agents Branch Checkout + +- `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + +### Beta Managed Agents Cache Creation Usage + +- `class BetaManagedAgentsCacheCreationUsage:` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Int Ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Int Ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + +### Beta Managed Agents Commit Checkout + +- `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + +### Beta Managed Agents Deleted Session + +- `class BetaManagedAgentsDeletedSession:` + + Confirmation that a `session` has been permanently deleted. + + - `required string ID` + + - `required Type Type` + + - `"session_deleted"SessionDeleted` + +### Beta Managed Agents File Resource Params + +- `class BetaManagedAgentsFileResourceParams:` + + Mount a file uploaded via the Files API into the session. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `string? MountPath` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +### Beta Managed Agents GitHub Repository Resource Params + +- `class BetaManagedAgentsGitHubRepositoryResourceParams:` + + Mount a GitHub repository into the session's container. + + - `required string AuthorizationToken` + + GitHub authorization token used to clone the repository. + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required string Url` + + Github URL of the repository + + - `Checkout? Checkout` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `string? MountPath` + + Mount path in the container. Defaults to `/workspace/`. + +### Beta Managed Agents Session + +- `class BetaManagedAgentsSession:` + + A Managed Agents `session`. + + - `required string ID` + + - `required BetaManagedAgentsSessionAgent Agent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `required string ID` + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required Int Version` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string EnvironmentID` + + - `required IReadOnlyDictionary Metadata` + + - `required IReadOnlyList Resources` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionStats Stats` + + Timing statistics for a session. + + - `Double ActiveSeconds` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `Double DurationSeconds` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `required Status Status` + + SessionStatus enum + + - `"rescheduling"Rescheduling` + + - `"running"Running` + + - `"idle"Idle` + + - `"terminated"Terminated` + + - `required string? Title` + + - `required Type Type` + + - `"session"Session` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionUsage Usage` + + Cumulative token usage for a session across all turns. + + - `BetaManagedAgentsCacheCreationUsage CacheCreation` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Int Ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Int Ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + + - `Int CacheReadInputTokens` + + Total tokens read from prompt cache. + + - `Int InputTokens` + + Total input tokens consumed across all turns. + + - `Int OutputTokens` + + Total output tokens generated across all turns. + + - `required IReadOnlyList VaultIds` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Beta Managed Agents Session Agent + +- `class BetaManagedAgentsSessionAgent:` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `required string ID` + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required Int Version` + +### Beta Managed Agents Session Stats + +- `class BetaManagedAgentsSessionStats:` + + Timing statistics for a session. + + - `Double ActiveSeconds` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `Double DurationSeconds` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + +### Beta Managed Agents Session Usage + +- `class BetaManagedAgentsSessionUsage:` + + Cumulative token usage for a session across all turns. + + - `BetaManagedAgentsCacheCreationUsage CacheCreation` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Int Ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Int Ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + + - `Int CacheReadInputTokens` + + Total tokens read from prompt cache. + + - `Int InputTokens` + + Total input tokens consumed across all turns. + + - `Int OutputTokens` + + Total output tokens generated across all turns. + +# Events + +## List + +`EventListPageResponse Beta.Sessions.Events.List(EventListParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/sessions/{session_id}/events` + +List Events + +### Parameters + +- `EventListParams parameters` + + - `required string sessionID` + + Path param: Path parameter session_id + + - `Int limit` + + Query param: Query parameter for limit + + - `Order order` + + Query param: Sort direction for results, ordered by created_at. Defaults to asc (chronological). + + - `"asc"Asc` + + - `"desc"Desc` + + - `string page` + + Query param: Opaque pagination cursor from a previous response's next_page. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class EventListPageResponse:` + + Paginated list of events for a `session`. + + - `IReadOnlyList Data` + + Events for the session, ordered by `created_at`. + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `required string ID` + + Unique identifier for this event. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent:` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the custom tool being called. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.custom_tool_use"AgentCustomToolUse` + + - `class BetaManagedAgentsAgentMessageEvent:` + + An agent response event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of text blocks comprising the agent response. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.message"AgentMessage` + + - `class BetaManagedAgentsAgentThinkingEvent:` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thinking"AgentThinking` + + - `class BetaManagedAgentsAgentMcpToolUseEvent:` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string McpServerName` + + Name of the MCP server providing the tool. + + - `required string Name` + + Name of the MCP tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_use"AgentMcpToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + + - `class BetaManagedAgentsAgentMcpToolResultEvent:` + + Event representing the result of an MCP tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string McpToolUseID` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_result"AgentMcpToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent:` + + Event emitted when the agent invokes a built-in agent tool. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the agent tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.tool_use"AgentToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + + - `class BetaManagedAgentsAgentToolResultEvent:` + + Event representing the result of an agent tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required string ToolUseID` + + The id of the `agent.tool_use` event this result corresponds to. + + - `required Type Type` + + - `"agent.tool_result"AgentToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent:` + + Indicates that context compaction (summarization) occurred during the session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thread_context_compacted"AgentThreadContextCompacted` + + - `class BetaManagedAgentsSessionErrorEvent:` + + An error event indicating a problem occurred during session execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Error Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"unknown_error"UnknownError` + + - `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_overloaded_error"ModelOverloadedError` + + - `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_rate_limited_error"ModelRateLimitedError` + + - `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_request_failed_error"ModelRequestFailedError` + + - `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `required string McpServerName` + + Name of the MCP server that failed to connect. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_connection_failed_error"McpConnectionFailedError` + + - `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `required string McpServerName` + + Name of the MCP server that failed authentication. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_authentication_failed_error"McpAuthenticationFailedError` + + - `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"billing_error"BillingError` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.error"SessionError` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent:` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_rescheduled"SessionStatusRescheduled` + + - `class BetaManagedAgentsSessionStatusRunningEvent:` + + Indicates the session is actively running and the agent is working. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_running"SessionStatusRunning` + + - `class BetaManagedAgentsSessionStatusIdleEvent:` + + Indicates the agent has paused and is awaiting user input. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required StopReason StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `required Type Type` + + - `"end_turn"EndTurn` + + - `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `required IReadOnlyList EventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `required Type Type` + + - `"requires_action"RequiresAction` + + - `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `required Type Type` + + - `"retries_exhausted"RetriesExhausted` + + - `required Type Type` + + - `"session.status_idle"SessionStatusIdle` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent:` + + Indicates the session has terminated, either due to an error or completion. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_terminated"SessionStatusTerminated` + + - `class BetaManagedAgentsSpanModelRequestStartEvent:` + + Emitted when a model request is initiated by the agent. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_start"SpanModelRequestStart` + + - `class BetaManagedAgentsSpanModelRequestEndEvent:` + + Emitted when a model request completes. + + - `required string ID` + + Unique identifier for this event. + + - `required Boolean? IsError` + + Whether the model request resulted in an error. + + - `required string ModelRequestStartID` + + The id of the corresponding `span.model_request_start` event. + + - `required BetaManagedAgentsSpanModelUsage ModelUsage` + + Token usage for a single model request. + + - `required Int CacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `required Int CacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `required Int InputTokens` + + Input tokens consumed by this request. + + - `required Int OutputTokens` + + Output tokens generated by this request. + + - `Speed? Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_end"SpanModelRequestEnd` + + - `class BetaManagedAgentsSessionDeletedEvent:` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.deleted"SessionDeleted` + + - `string? NextPage` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```csharp +EventListParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7" +}; + +var page = await client.Beta.Sessions.Events.List(parameters); +await foreach (var item in page.Paginate()) +{ + Console.WriteLine(item); +} +``` + +## Send + +`BetaManagedAgentsSendSessionEvents Beta.Sessions.Events.Send(EventSendParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/sessions/{session_id}/events` + +Send Events + +### Parameters + +- `EventSendParams parameters` + + - `required string sessionID` + + Path param: Path parameter session_id + + - `required IReadOnlyList events` + + Body param: Events to send to the `session`. + + - `class BetaManagedAgentsUserMessageEventParams:` + + Parameters for sending a user message to the session. + + - `required IReadOnlyList Content` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + + - `class BetaManagedAgentsUserInterruptEventParams:` + + Parameters for sending an interrupt to pause the agent. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + + - `class BetaManagedAgentsUserToolConfirmationEventParams:` + + Parameters for confirming or denying a tool execution request. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `class BetaManagedAgentsUserCustomToolResultEventParams:` + + Parameters for providing the result of a custom tool execution. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsSendSessionEvents:` + + Events that were successfully sent to the session. + + - `IReadOnlyList Data` + + Sent events + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `required string ID` + + Unique identifier for this event. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + +### Example + +```csharp +EventSendParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7", + Events = + [ + new BetaManagedAgentsUserMessageEventParams() + { + Content = + [ + new BetaManagedAgentsTextBlock() + { + Text = "Where is my order #1234?", + Type = Type.Text, + }, + ], + Type = Type.UserMessage, + }, + ], +}; + +var betaManagedAgentsSendSessionEvents = await client.Beta.Sessions.Events.Send(parameters); + +Console.WriteLine(betaManagedAgentsSendSessionEvents); +``` + +## Stream + +`BetaManagedAgentsStreamSessionEvents Beta.Sessions.Events.StreamStreaming(EventStreamParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/sessions/{session_id}/events/stream` + +Stream Events + +### Parameters + +- `EventStreamParams parameters` + + - `required string sessionID` + + Path parameter session_id + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsStreamSessionEvents: A class that can be one of several variants.union` + + Server-sent event in the session stream. + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `required string ID` + + Unique identifier for this event. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent:` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the custom tool being called. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.custom_tool_use"AgentCustomToolUse` + + - `class BetaManagedAgentsAgentMessageEvent:` + + An agent response event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of text blocks comprising the agent response. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.message"AgentMessage` + + - `class BetaManagedAgentsAgentThinkingEvent:` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thinking"AgentThinking` + + - `class BetaManagedAgentsAgentMcpToolUseEvent:` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string McpServerName` + + Name of the MCP server providing the tool. + + - `required string Name` + + Name of the MCP tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_use"AgentMcpToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + + - `class BetaManagedAgentsAgentMcpToolResultEvent:` + + Event representing the result of an MCP tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string McpToolUseID` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_result"AgentMcpToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent:` + + Event emitted when the agent invokes a built-in agent tool. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the agent tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.tool_use"AgentToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + + - `class BetaManagedAgentsAgentToolResultEvent:` + + Event representing the result of an agent tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required string ToolUseID` + + The id of the `agent.tool_use` event this result corresponds to. + + - `required Type Type` + + - `"agent.tool_result"AgentToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent:` + + Indicates that context compaction (summarization) occurred during the session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thread_context_compacted"AgentThreadContextCompacted` + + - `class BetaManagedAgentsSessionErrorEvent:` + + An error event indicating a problem occurred during session execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Error Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"unknown_error"UnknownError` + + - `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_overloaded_error"ModelOverloadedError` + + - `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_rate_limited_error"ModelRateLimitedError` + + - `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_request_failed_error"ModelRequestFailedError` + + - `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `required string McpServerName` + + Name of the MCP server that failed to connect. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_connection_failed_error"McpConnectionFailedError` + + - `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `required string McpServerName` + + Name of the MCP server that failed authentication. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_authentication_failed_error"McpAuthenticationFailedError` + + - `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"billing_error"BillingError` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.error"SessionError` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent:` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_rescheduled"SessionStatusRescheduled` + + - `class BetaManagedAgentsSessionStatusRunningEvent:` + + Indicates the session is actively running and the agent is working. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_running"SessionStatusRunning` + + - `class BetaManagedAgentsSessionStatusIdleEvent:` + + Indicates the agent has paused and is awaiting user input. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required StopReason StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `required Type Type` + + - `"end_turn"EndTurn` + + - `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `required IReadOnlyList EventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `required Type Type` + + - `"requires_action"RequiresAction` + + - `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `required Type Type` + + - `"retries_exhausted"RetriesExhausted` + + - `required Type Type` + + - `"session.status_idle"SessionStatusIdle` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent:` + + Indicates the session has terminated, either due to an error or completion. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_terminated"SessionStatusTerminated` + + - `class BetaManagedAgentsSpanModelRequestStartEvent:` + + Emitted when a model request is initiated by the agent. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_start"SpanModelRequestStart` + + - `class BetaManagedAgentsSpanModelRequestEndEvent:` + + Emitted when a model request completes. + + - `required string ID` + + Unique identifier for this event. + + - `required Boolean? IsError` + + Whether the model request resulted in an error. + + - `required string ModelRequestStartID` + + The id of the corresponding `span.model_request_start` event. + + - `required BetaManagedAgentsSpanModelUsage ModelUsage` + + Token usage for a single model request. + + - `required Int CacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `required Int CacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `required Int InputTokens` + + Input tokens consumed by this request. + + - `required Int OutputTokens` + + Output tokens generated by this request. + + - `Speed? Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_end"SpanModelRequestEnd` + + - `class BetaManagedAgentsSessionDeletedEvent:` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.deleted"SessionDeleted` + +### Example + +```csharp +EventStreamParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7" +}; + +await foreach (var betaManagedAgentsStreamSessionEvents in client.Beta.Sessions.Events.StreamStreaming(parameters)) +{ + Console.WriteLine(betaManagedAgentsStreamSessionEvents); +} +``` + +## Domain Types + +### Beta Managed Agents Agent Custom Tool Use Event + +- `class BetaManagedAgentsAgentCustomToolUseEvent:` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the custom tool being called. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.custom_tool_use"AgentCustomToolUse` + +### Beta Managed Agents Agent MCP Tool Result Event + +- `class BetaManagedAgentsAgentMcpToolResultEvent:` + + Event representing the result of an MCP tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string McpToolUseID` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_result"AgentMcpToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent MCP Tool Use Event + +- `class BetaManagedAgentsAgentMcpToolUseEvent:` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string McpServerName` + + Name of the MCP server providing the tool. + + - `required string Name` + + Name of the MCP tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_use"AgentMcpToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + +### Beta Managed Agents Agent Message Event + +- `class BetaManagedAgentsAgentMessageEvent:` + + An agent response event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of text blocks comprising the agent response. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.message"AgentMessage` + +### Beta Managed Agents Agent Thinking Event + +- `class BetaManagedAgentsAgentThinkingEvent:` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thinking"AgentThinking` + +### Beta Managed Agents Agent Thread Context Compacted Event + +- `class BetaManagedAgentsAgentThreadContextCompactedEvent:` + + Indicates that context compaction (summarization) occurred during the session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thread_context_compacted"AgentThreadContextCompacted` + +### Beta Managed Agents Agent Tool Result Event + +- `class BetaManagedAgentsAgentToolResultEvent:` + + Event representing the result of an agent tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required string ToolUseID` + + The id of the `agent.tool_use` event this result corresponds to. + + - `required Type Type` + + - `"agent.tool_result"AgentToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent Tool Use Event + +- `class BetaManagedAgentsAgentToolUseEvent:` + + Event emitted when the agent invokes a built-in agent tool. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the agent tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.tool_use"AgentToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + +### Beta Managed Agents Base64 Document Source + +- `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + +### Beta Managed Agents Base64 Image Source + +- `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + +### Beta Managed Agents Billing Error + +- `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"billing_error"BillingError` + +### Beta Managed Agents Document Block + +- `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + +### Beta Managed Agents Event Params + +- `class BetaManagedAgentsEventParams: A class that can be one of several variants.union` + + Union type for event parameters that can be sent to a session. + + - `class BetaManagedAgentsUserMessageEventParams:` + + Parameters for sending a user message to the session. + + - `required IReadOnlyList Content` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + + - `class BetaManagedAgentsUserInterruptEventParams:` + + Parameters for sending an interrupt to pause the agent. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + + - `class BetaManagedAgentsUserToolConfirmationEventParams:` + + Parameters for confirming or denying a tool execution request. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `class BetaManagedAgentsUserCustomToolResultEventParams:` + + Parameters for providing the result of a custom tool execution. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents File Document Source + +- `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + +### Beta Managed Agents File Image Source + +- `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + +### Beta Managed Agents Image Block + +- `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + +### Beta Managed Agents MCP Authentication Failed Error + +- `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `required string McpServerName` + + Name of the MCP server that failed authentication. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_authentication_failed_error"McpAuthenticationFailedError` + +### Beta Managed Agents MCP Connection Failed Error + +- `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `required string McpServerName` + + Name of the MCP server that failed to connect. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_connection_failed_error"McpConnectionFailedError` + +### Beta Managed Agents Model Overloaded Error + +- `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_overloaded_error"ModelOverloadedError` + +### Beta Managed Agents Model Rate Limited Error + +- `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_rate_limited_error"ModelRateLimitedError` + +### Beta Managed Agents Model Request Failed Error + +- `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_request_failed_error"ModelRequestFailedError` + +### Beta Managed Agents Plain Text Document Source + +- `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + +### Beta Managed Agents Retry Status Exhausted + +- `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + +### Beta Managed Agents Retry Status Retrying + +- `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + +### Beta Managed Agents Retry Status Terminal + +- `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + +### Beta Managed Agents Send Session Events + +- `class BetaManagedAgentsSendSessionEvents:` + + Events that were successfully sent to the session. + + - `IReadOnlyList Data` + + Sent events + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `required string ID` + + Unique identifier for this event. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + +### Beta Managed Agents Session Deleted Event + +- `class BetaManagedAgentsSessionDeletedEvent:` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.deleted"SessionDeleted` + +### Beta Managed Agents Session End Turn + +- `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `required Type Type` + + - `"end_turn"EndTurn` + +### Beta Managed Agents Session Error Event + +- `class BetaManagedAgentsSessionErrorEvent:` + + An error event indicating a problem occurred during session execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Error Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"unknown_error"UnknownError` + + - `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_overloaded_error"ModelOverloadedError` + + - `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_rate_limited_error"ModelRateLimitedError` + + - `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_request_failed_error"ModelRequestFailedError` + + - `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `required string McpServerName` + + Name of the MCP server that failed to connect. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_connection_failed_error"McpConnectionFailedError` + + - `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `required string McpServerName` + + Name of the MCP server that failed authentication. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_authentication_failed_error"McpAuthenticationFailedError` + + - `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"billing_error"BillingError` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.error"SessionError` + +### Beta Managed Agents Session Event + +- `class BetaManagedAgentsSessionEvent: A class that can be one of several variants.union` + + Union type for all event types in a session. + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `required string ID` + + Unique identifier for this event. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent:` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the custom tool being called. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.custom_tool_use"AgentCustomToolUse` + + - `class BetaManagedAgentsAgentMessageEvent:` + + An agent response event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of text blocks comprising the agent response. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.message"AgentMessage` + + - `class BetaManagedAgentsAgentThinkingEvent:` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thinking"AgentThinking` + + - `class BetaManagedAgentsAgentMcpToolUseEvent:` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string McpServerName` + + Name of the MCP server providing the tool. + + - `required string Name` + + Name of the MCP tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_use"AgentMcpToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + + - `class BetaManagedAgentsAgentMcpToolResultEvent:` + + Event representing the result of an MCP tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string McpToolUseID` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_result"AgentMcpToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent:` + + Event emitted when the agent invokes a built-in agent tool. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the agent tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.tool_use"AgentToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + + - `class BetaManagedAgentsAgentToolResultEvent:` + + Event representing the result of an agent tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required string ToolUseID` + + The id of the `agent.tool_use` event this result corresponds to. + + - `required Type Type` + + - `"agent.tool_result"AgentToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent:` + + Indicates that context compaction (summarization) occurred during the session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thread_context_compacted"AgentThreadContextCompacted` + + - `class BetaManagedAgentsSessionErrorEvent:` + + An error event indicating a problem occurred during session execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Error Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"unknown_error"UnknownError` + + - `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_overloaded_error"ModelOverloadedError` + + - `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_rate_limited_error"ModelRateLimitedError` + + - `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_request_failed_error"ModelRequestFailedError` + + - `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `required string McpServerName` + + Name of the MCP server that failed to connect. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_connection_failed_error"McpConnectionFailedError` + + - `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `required string McpServerName` + + Name of the MCP server that failed authentication. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_authentication_failed_error"McpAuthenticationFailedError` + + - `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"billing_error"BillingError` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.error"SessionError` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent:` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_rescheduled"SessionStatusRescheduled` + + - `class BetaManagedAgentsSessionStatusRunningEvent:` + + Indicates the session is actively running and the agent is working. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_running"SessionStatusRunning` + + - `class BetaManagedAgentsSessionStatusIdleEvent:` + + Indicates the agent has paused and is awaiting user input. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required StopReason StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `required Type Type` + + - `"end_turn"EndTurn` + + - `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `required IReadOnlyList EventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `required Type Type` + + - `"requires_action"RequiresAction` + + - `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `required Type Type` + + - `"retries_exhausted"RetriesExhausted` + + - `required Type Type` + + - `"session.status_idle"SessionStatusIdle` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent:` + + Indicates the session has terminated, either due to an error or completion. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_terminated"SessionStatusTerminated` + + - `class BetaManagedAgentsSpanModelRequestStartEvent:` + + Emitted when a model request is initiated by the agent. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_start"SpanModelRequestStart` + + - `class BetaManagedAgentsSpanModelRequestEndEvent:` + + Emitted when a model request completes. + + - `required string ID` + + Unique identifier for this event. + + - `required Boolean? IsError` + + Whether the model request resulted in an error. + + - `required string ModelRequestStartID` + + The id of the corresponding `span.model_request_start` event. + + - `required BetaManagedAgentsSpanModelUsage ModelUsage` + + Token usage for a single model request. + + - `required Int CacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `required Int CacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `required Int InputTokens` + + Input tokens consumed by this request. + + - `required Int OutputTokens` + + Output tokens generated by this request. + + - `Speed? Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_end"SpanModelRequestEnd` + + - `class BetaManagedAgentsSessionDeletedEvent:` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.deleted"SessionDeleted` + +### Beta Managed Agents Session Requires Action + +- `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `required IReadOnlyList EventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `required Type Type` + + - `"requires_action"RequiresAction` + +### Beta Managed Agents Session Retries Exhausted + +- `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `required Type Type` + + - `"retries_exhausted"RetriesExhausted` + +### Beta Managed Agents Session Status Idle Event + +- `class BetaManagedAgentsSessionStatusIdleEvent:` + + Indicates the agent has paused and is awaiting user input. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required StopReason StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `required Type Type` + + - `"end_turn"EndTurn` + + - `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `required IReadOnlyList EventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `required Type Type` + + - `"requires_action"RequiresAction` + + - `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `required Type Type` + + - `"retries_exhausted"RetriesExhausted` + + - `required Type Type` + + - `"session.status_idle"SessionStatusIdle` + +### Beta Managed Agents Session Status Rescheduled Event + +- `class BetaManagedAgentsSessionStatusRescheduledEvent:` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_rescheduled"SessionStatusRescheduled` + +### Beta Managed Agents Session Status Running Event + +- `class BetaManagedAgentsSessionStatusRunningEvent:` + + Indicates the session is actively running and the agent is working. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_running"SessionStatusRunning` + +### Beta Managed Agents Session Status Terminated Event + +- `class BetaManagedAgentsSessionStatusTerminatedEvent:` + + Indicates the session has terminated, either due to an error or completion. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_terminated"SessionStatusTerminated` + +### Beta Managed Agents Span Model Request End Event + +- `class BetaManagedAgentsSpanModelRequestEndEvent:` + + Emitted when a model request completes. + + - `required string ID` + + Unique identifier for this event. + + - `required Boolean? IsError` + + Whether the model request resulted in an error. + + - `required string ModelRequestStartID` + + The id of the corresponding `span.model_request_start` event. + + - `required BetaManagedAgentsSpanModelUsage ModelUsage` + + Token usage for a single model request. + + - `required Int CacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `required Int CacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `required Int InputTokens` + + Input tokens consumed by this request. + + - `required Int OutputTokens` + + Output tokens generated by this request. + + - `Speed? Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_end"SpanModelRequestEnd` + +### Beta Managed Agents Span Model Request Start Event + +- `class BetaManagedAgentsSpanModelRequestStartEvent:` + + Emitted when a model request is initiated by the agent. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_start"SpanModelRequestStart` + +### Beta Managed Agents Span Model Usage + +- `class BetaManagedAgentsSpanModelUsage:` + + Token usage for a single model request. + + - `required Int CacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `required Int CacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `required Int InputTokens` + + Input tokens consumed by this request. + + - `required Int OutputTokens` + + Output tokens generated by this request. + + - `Speed? Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + +### Beta Managed Agents Stream Session Events + +- `class BetaManagedAgentsStreamSessionEvents: A class that can be one of several variants.union` + + Server-sent event in the session stream. + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `required string ID` + + Unique identifier for this event. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent:` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the custom tool being called. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.custom_tool_use"AgentCustomToolUse` + + - `class BetaManagedAgentsAgentMessageEvent:` + + An agent response event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of text blocks comprising the agent response. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.message"AgentMessage` + + - `class BetaManagedAgentsAgentThinkingEvent:` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thinking"AgentThinking` + + - `class BetaManagedAgentsAgentMcpToolUseEvent:` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string McpServerName` + + Name of the MCP server providing the tool. + + - `required string Name` + + Name of the MCP tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_use"AgentMcpToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + + - `class BetaManagedAgentsAgentMcpToolResultEvent:` + + Event representing the result of an MCP tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string McpToolUseID` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_result"AgentMcpToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent:` + + Event emitted when the agent invokes a built-in agent tool. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the agent tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.tool_use"AgentToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + + - `class BetaManagedAgentsAgentToolResultEvent:` + + Event representing the result of an agent tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required string ToolUseID` + + The id of the `agent.tool_use` event this result corresponds to. + + - `required Type Type` + + - `"agent.tool_result"AgentToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent:` + + Indicates that context compaction (summarization) occurred during the session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thread_context_compacted"AgentThreadContextCompacted` + + - `class BetaManagedAgentsSessionErrorEvent:` + + An error event indicating a problem occurred during session execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Error Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"unknown_error"UnknownError` + + - `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_overloaded_error"ModelOverloadedError` + + - `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_rate_limited_error"ModelRateLimitedError` + + - `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_request_failed_error"ModelRequestFailedError` + + - `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `required string McpServerName` + + Name of the MCP server that failed to connect. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_connection_failed_error"McpConnectionFailedError` + + - `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `required string McpServerName` + + Name of the MCP server that failed authentication. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_authentication_failed_error"McpAuthenticationFailedError` + + - `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"billing_error"BillingError` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.error"SessionError` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent:` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_rescheduled"SessionStatusRescheduled` + + - `class BetaManagedAgentsSessionStatusRunningEvent:` + + Indicates the session is actively running and the agent is working. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_running"SessionStatusRunning` + + - `class BetaManagedAgentsSessionStatusIdleEvent:` + + Indicates the agent has paused and is awaiting user input. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required StopReason StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `required Type Type` + + - `"end_turn"EndTurn` + + - `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `required IReadOnlyList EventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `required Type Type` + + - `"requires_action"RequiresAction` + + - `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `required Type Type` + + - `"retries_exhausted"RetriesExhausted` + + - `required Type Type` + + - `"session.status_idle"SessionStatusIdle` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent:` + + Indicates the session has terminated, either due to an error or completion. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_terminated"SessionStatusTerminated` + + - `class BetaManagedAgentsSpanModelRequestStartEvent:` + + Emitted when a model request is initiated by the agent. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_start"SpanModelRequestStart` + + - `class BetaManagedAgentsSpanModelRequestEndEvent:` + + Emitted when a model request completes. + + - `required string ID` + + Unique identifier for this event. + + - `required Boolean? IsError` + + Whether the model request resulted in an error. + + - `required string ModelRequestStartID` + + The id of the corresponding `span.model_request_start` event. + + - `required BetaManagedAgentsSpanModelUsage ModelUsage` + + Token usage for a single model request. + + - `required Int CacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `required Int CacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `required Int InputTokens` + + Input tokens consumed by this request. + + - `required Int OutputTokens` + + Output tokens generated by this request. + + - `Speed? Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_end"SpanModelRequestEnd` + + - `class BetaManagedAgentsSessionDeletedEvent:` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.deleted"SessionDeleted` + +### Beta Managed Agents Text Block + +- `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + +### Beta Managed Agents Unknown Error + +- `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"unknown_error"UnknownError` + +### Beta Managed Agents URL Document Source + +- `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + +### Beta Managed Agents URL Image Source + +- `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + +### Beta Managed Agents User Custom Tool Result Event + +- `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Custom Tool Result Event Params + +- `class BetaManagedAgentsUserCustomToolResultEventParams:` + + Parameters for providing the result of a custom tool execution. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents User Interrupt Event + +- `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `required string ID` + + Unique identifier for this event. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Interrupt Event Params + +- `class BetaManagedAgentsUserInterruptEventParams:` + + Parameters for sending an interrupt to pause the agent. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + +### Beta Managed Agents User Message Event + +- `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Message Event Params + +- `class BetaManagedAgentsUserMessageEventParams:` + + Parameters for sending a user message to the session. + + - `required IReadOnlyList Content` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + +### Beta Managed Agents User Tool Confirmation Event + +- `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Tool Confirmation Event Params + +- `class BetaManagedAgentsUserToolConfirmationEventParams:` + + Parameters for confirming or denying a tool execution request. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + +# Resources + +## Add + +`BetaManagedAgentsFileResource Beta.Sessions.Resources.Add(ResourceAddParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/sessions/{session_id}/resources` + +Add Session Resource + +### Parameters + +- `ResourceAddParams parameters` + + - `required string sessionID` + + Path param: Path parameter session_id + + - `required string fileID` + + Body param: ID of a previously uploaded file. + + - `required Type type` + + Body param + + - `"file"File` + + - `string? mountPath` + + Body param: Mount path in the container. Defaults to `/mnt/session/uploads/`. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + +### Example + +```csharp +ResourceAddParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7", + FileID = "file_011CNha8iCJcU1wXNR6q4V8w", + Type = Type.File, +}; + +var betaManagedAgentsFileResource = await client.Beta.Sessions.Resources.Add(parameters); + +Console.WriteLine(betaManagedAgentsFileResource); +``` + +## List + +`ResourceListPageResponse Beta.Sessions.Resources.List(ResourceListParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/sessions/{session_id}/resources` + +List Session Resources + +### Parameters + +- `ResourceListParams parameters` + + - `required string sessionID` + + Path param: Path parameter session_id + + - `Int limit` + + Query param: Maximum number of resources to return per page (max 1000). If omitted, returns all resources. + + - `string page` + + Query param: Opaque cursor from a previous response's next_page field. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class ResourceListPageResponse:` + + Paginated list of resources attached to a session. + + - `required IReadOnlyList Data` + + Resources for the session, ordered by `created_at`. + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `string? NextPage` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```csharp +ResourceListParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7" +}; + +var page = await client.Beta.Sessions.Resources.List(parameters); +await foreach (var item in page.Paginate()) +{ + Console.WriteLine(item); +} +``` + +## Retrieve + +`ResourceRetrieveResponse Beta.Sessions.Resources.Retrieve(ResourceRetrieveParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/sessions/{session_id}/resources/{resource_id}` + +Get Session Resource + +### Parameters + +- `ResourceRetrieveParams parameters` + + - `required string sessionID` + + Path param: Path parameter session_id + + - `required string resourceID` + + Path param: Path parameter resource_id + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class ResourceRetrieveResponse: A class that can be one of several variants.union` + + The requested session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + +### Example + +```csharp +ResourceRetrieveParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7", + ResourceID = "sesrsc_011CZkZBJq5dWxk9fVLNcPht", +}; + +var resource = await client.Beta.Sessions.Resources.Retrieve(parameters); + +Console.WriteLine(resource); +``` + +## Update + +`ResourceUpdateResponse Beta.Sessions.Resources.Update(ResourceUpdateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/sessions/{session_id}/resources/{resource_id}` + +Update Session Resource + +### Parameters + +- `ResourceUpdateParams parameters` + + - `required string sessionID` + + Path param: Path parameter session_id + + - `required string resourceID` + + Path param: Path parameter resource_id + + - `required string authorizationToken` + + Body param: New authorization token for the resource. Currently only `github_repository` resources support token rotation. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class ResourceUpdateResponse: A class that can be one of several variants.union` + + The updated session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + +### Example + +```csharp +ResourceUpdateParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7", + ResourceID = "sesrsc_011CZkZBJq5dWxk9fVLNcPht", + AuthorizationToken = "ghp_exampletoken", +}; + +var resource = await client.Beta.Sessions.Resources.Update(parameters); + +Console.WriteLine(resource); +``` + +## Delete + +`BetaManagedAgentsDeleteSessionResource Beta.Sessions.Resources.Delete(ResourceDeleteParamsparameters, CancellationTokencancellationToken = default)` + +**delete** `/v1/sessions/{session_id}/resources/{resource_id}` + +Delete Session Resource + +### Parameters + +- `ResourceDeleteParams parameters` + + - `required string sessionID` + + Path param: Path parameter session_id + + - `required string resourceID` + + Path param: Path parameter resource_id + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsDeleteSessionResource:` + + Confirmation of resource deletion. + + - `required string ID` + + - `required Type Type` + + - `"session_resource_deleted"SessionResourceDeleted` + +### Example + +```csharp +ResourceDeleteParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7", + ResourceID = "sesrsc_011CZkZBJq5dWxk9fVLNcPht", +}; + +var betaManagedAgentsDeleteSessionResource = await client.Beta.Sessions.Resources.Delete(parameters); + +Console.WriteLine(betaManagedAgentsDeleteSessionResource); +``` + +## Domain Types + +### Beta Managed Agents Delete Session Resource + +- `class BetaManagedAgentsDeleteSessionResource:` + + Confirmation of resource deletion. + + - `required string ID` + + - `required Type Type` + + - `"session_resource_deleted"SessionResourceDeleted` + +### Beta Managed Agents File Resource + +- `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + +### Beta Managed Agents GitHub Repository Resource + +- `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + +### Beta Managed Agents Session Resource + +- `class BetaManagedAgentsSessionResource: A class that can be one of several variants.union` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + +# Vaults + +## Create + +`BetaManagedAgentsVault Beta.Vaults.Create(VaultCreateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/vaults` + +Create Vault + +### Parameters + +- `VaultCreateParams parameters` + + - `required string displayName` + + Body param: Human-readable name for the vault. 1-255 characters. + + - `IReadOnlyDictionary metadata` + + Body param: Arbitrary key-value metadata to attach to the vault. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsVault:` + + A vault that stores credentials for use by agents during sessions. + + - `required string ID` + + Unique identifier for the vault. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string DisplayName` + + Human-readable name for the vault. + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the vault. + + - `required Type Type` + + - `"vault"Vault` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + +### Example + +```csharp +VaultCreateParams parameters = new() { DisplayName = "Example vault" }; + +var betaManagedAgentsVault = await client.Beta.Vaults.Create(parameters); + +Console.WriteLine(betaManagedAgentsVault); +``` + +## List + +`VaultListPageResponse Beta.Vaults.List(VaultListParams?parameters, CancellationTokencancellationToken = default)` + +**get** `/v1/vaults` + +List Vaults + +### Parameters + +- `VaultListParams parameters` + + - `Boolean includeArchived` + + Query param: Whether to include archived vaults in the results. + + - `Int limit` + + Query param: Maximum number of vaults to return per page. Defaults to 20, maximum 100. + + - `string page` + + Query param: Opaque pagination token from a previous `list_vaults` response. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class VaultListPageResponse:` + + Response containing a paginated list of vaults. + + - `IReadOnlyList Data` + + List of vaults. + + - `required string ID` + + Unique identifier for the vault. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string DisplayName` + + Human-readable name for the vault. + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the vault. + + - `required Type Type` + + - `"vault"Vault` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `string? NextPage` + + Pagination token for the next page, or null if no more results. + +### Example + +```csharp +VaultListParams parameters = new(); + +var page = await client.Beta.Vaults.List(parameters); +await foreach (var item in page.Paginate()) +{ + Console.WriteLine(item); +} +``` + +## Retrieve + +`BetaManagedAgentsVault Beta.Vaults.Retrieve(VaultRetrieveParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/vaults/{vault_id}` + +Get Vault + +### Parameters + +- `VaultRetrieveParams parameters` + + - `required string vaultID` + + Path parameter vault_id + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsVault:` + + A vault that stores credentials for use by agents during sessions. + + - `required string ID` + + Unique identifier for the vault. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string DisplayName` + + Human-readable name for the vault. + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the vault. + + - `required Type Type` + + - `"vault"Vault` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + +### Example + +```csharp +VaultRetrieveParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv" +}; + +var betaManagedAgentsVault = await client.Beta.Vaults.Retrieve(parameters); + +Console.WriteLine(betaManagedAgentsVault); +``` + +## Update + +`BetaManagedAgentsVault Beta.Vaults.Update(VaultUpdateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/vaults/{vault_id}` + +Update Vault + +### Parameters + +- `VaultUpdateParams parameters` + + - `required string vaultID` + + Path param: Path parameter vault_id + + - `string? displayName` + + Body param: Updated human-readable name for the vault. 1-255 characters. + + - `IReadOnlyDictionary? metadata` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsVault:` + + A vault that stores credentials for use by agents during sessions. + + - `required string ID` + + Unique identifier for the vault. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string DisplayName` + + Human-readable name for the vault. + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the vault. + + - `required Type Type` + + - `"vault"Vault` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + +### Example + +```csharp +VaultUpdateParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv" +}; + +var betaManagedAgentsVault = await client.Beta.Vaults.Update(parameters); + +Console.WriteLine(betaManagedAgentsVault); +``` + +## Delete + +`BetaManagedAgentsDeletedVault Beta.Vaults.Delete(VaultDeleteParamsparameters, CancellationTokencancellationToken = default)` + +**delete** `/v1/vaults/{vault_id}` + +Delete Vault + +### Parameters + +- `VaultDeleteParams parameters` + + - `required string vaultID` + + Path parameter vault_id + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsDeletedVault:` + + Confirmation of a deleted vault. + + - `required string ID` + + Unique identifier of the deleted vault. + + - `required Type Type` + + - `"vault_deleted"VaultDeleted` + +### Example + +```csharp +VaultDeleteParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv" +}; + +var betaManagedAgentsDeletedVault = await client.Beta.Vaults.Delete(parameters); + +Console.WriteLine(betaManagedAgentsDeletedVault); +``` + +## Archive + +`BetaManagedAgentsVault Beta.Vaults.Archive(VaultArchiveParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/vaults/{vault_id}/archive` + +Archive Vault + +### Parameters + +- `VaultArchiveParams parameters` + + - `required string vaultID` + + Path parameter vault_id + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsVault:` + + A vault that stores credentials for use by agents during sessions. + + - `required string ID` + + Unique identifier for the vault. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string DisplayName` + + Human-readable name for the vault. + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the vault. + + - `required Type Type` + + - `"vault"Vault` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + +### Example + +```csharp +VaultArchiveParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv" +}; + +var betaManagedAgentsVault = await client.Beta.Vaults.Archive(parameters); + +Console.WriteLine(betaManagedAgentsVault); +``` + +## Domain Types + +### Beta Managed Agents Deleted Vault + +- `class BetaManagedAgentsDeletedVault:` + + Confirmation of a deleted vault. + + - `required string ID` + + Unique identifier of the deleted vault. + + - `required Type Type` + + - `"vault_deleted"VaultDeleted` + +### Beta Managed Agents Vault + +- `class BetaManagedAgentsVault:` + + A vault that stores credentials for use by agents during sessions. + + - `required string ID` + + Unique identifier for the vault. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string DisplayName` + + Human-readable name for the vault. + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the vault. + + - `required Type Type` + + - `"vault"Vault` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + +# Credentials + +## Create + +`BetaManagedAgentsCredential Beta.Vaults.Credentials.Create(CredentialCreateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/vaults/{vault_id}/credentials` + +Create Credential + +### Parameters + +- `CredentialCreateParams parameters` + + - `required string vaultID` + + Path param: Path parameter vault_id + + - `required Auth auth` + + Body param: Authentication details for creating a credential. + + - `class BetaManagedAgentsMcpOAuthCreateParams:` + + Parameters for creating an MCP OAuth credential. + + - `required string AccessToken` + + OAuth access token. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshParams? Refresh` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `required string ClientID` + + OAuth client ID. + + - `required string RefreshToken` + + OAuth refresh token. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required string ClientSecret` + + OAuth client secret. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam:` + + Token endpoint uses POST body authentication with client credentials. + + - `required string ClientSecret` + + OAuth client secret. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerCreateParams:` + + Parameters for creating a static bearer token credential. + + - `required string Token` + + Static bearer token value. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `string? displayName` + + Body param: Human-readable name for the credential. Up to 255 characters. + + - `IReadOnlyDictionary metadata` + + Body param: Arbitrary key-value metadata to attach to the credential. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `required string ID` + + Unique identifier for the credential. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required Auth Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshResponse? Refresh` + + OAuth refresh token configuration returned in credential responses. + + - `required string ClientID` + + OAuth client ID. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the credential. + + - `required Type Type` + + - `"vault_credential"VaultCredential` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string VaultID` + + Identifier of the vault this credential belongs to. + + - `string? DisplayName` + + Human-readable name for the credential. + +### Example + +```csharp +CredentialCreateParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv", + Auth = new BetaManagedAgentsStaticBearerCreateParams() + { + Token = "bearer_exampletoken", + McpServerUrl = "https://example-server.modelcontextprotocol.io/sse", + Type = Type.StaticBearer, + }, +}; + +var betaManagedAgentsCredential = await client.Beta.Vaults.Credentials.Create(parameters); + +Console.WriteLine(betaManagedAgentsCredential); +``` + +## List + +`CredentialListPageResponse Beta.Vaults.Credentials.List(CredentialListParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/vaults/{vault_id}/credentials` + +List Credentials + +### Parameters + +- `CredentialListParams parameters` + + - `required string vaultID` + + Path param: Path parameter vault_id + + - `Boolean includeArchived` + + Query param: Whether to include archived credentials in the results. + + - `Int limit` + + Query param: Maximum number of credentials to return per page. Defaults to 20, maximum 100. + + - `string page` + + Query param: Opaque pagination token from a previous `list_credentials` response. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class CredentialListPageResponse:` + + Response containing a paginated list of credentials. + + - `IReadOnlyList Data` + + List of credentials. + + - `required string ID` + + Unique identifier for the credential. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required Auth Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshResponse? Refresh` + + OAuth refresh token configuration returned in credential responses. + + - `required string ClientID` + + OAuth client ID. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the credential. + + - `required Type Type` + + - `"vault_credential"VaultCredential` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string VaultID` + + Identifier of the vault this credential belongs to. + + - `string? DisplayName` + + Human-readable name for the credential. + + - `string? NextPage` + + Pagination token for the next page, or null if no more results. + +### Example + +```csharp +CredentialListParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv" +}; + +var page = await client.Beta.Vaults.Credentials.List(parameters); +await foreach (var item in page.Paginate()) +{ + Console.WriteLine(item); +} +``` + +## Retrieve + +`BetaManagedAgentsCredential Beta.Vaults.Credentials.Retrieve(CredentialRetrieveParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Get Credential + +### Parameters + +- `CredentialRetrieveParams parameters` + + - `required string vaultID` + + Path param: Path parameter vault_id + + - `required string credentialID` + + Path param: Path parameter credential_id + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `required string ID` + + Unique identifier for the credential. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required Auth Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshResponse? Refresh` + + OAuth refresh token configuration returned in credential responses. + + - `required string ClientID` + + OAuth client ID. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the credential. + + - `required Type Type` + + - `"vault_credential"VaultCredential` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string VaultID` + + Identifier of the vault this credential belongs to. + + - `string? DisplayName` + + Human-readable name for the credential. + +### Example + +```csharp +CredentialRetrieveParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv", + CredentialID = "vcrd_011CZkZEMt8gZan2iYOQfSkw", +}; + +var betaManagedAgentsCredential = await client.Beta.Vaults.Credentials.Retrieve(parameters); + +Console.WriteLine(betaManagedAgentsCredential); +``` + +## Update + +`BetaManagedAgentsCredential Beta.Vaults.Credentials.Update(CredentialUpdateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Update Credential + +### Parameters + +- `CredentialUpdateParams parameters` + + - `required string vaultID` + + Path param: Path parameter vault_id + + - `required string credentialID` + + Path param: Path parameter credential_id + + - `Auth auth` + + Body param: Updated authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthUpdateParams:` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `string? AccessToken` + + Updated OAuth access token. + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshUpdateParams? Refresh` + + Parameters for updating OAuth refresh token configuration. + + - `string? RefreshToken` + + Updated OAuth refresh token. + + - `string? Scope` + + Updated OAuth scope for the refresh request. + + - `TokenEndpointAuth TokenEndpointAuth` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam:` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `string? ClientSecret` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam:` + + Updated POST body authentication parameters for the token endpoint. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? ClientSecret` + + Updated OAuth client secret. + + - `class BetaManagedAgentsStaticBearerUpdateParams:` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `string? Token` + + Updated static bearer token value. + + - `string? displayName` + + Body param: Updated human-readable name for the credential. 1-255 characters. + + - `IReadOnlyDictionary? metadata` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `required string ID` + + Unique identifier for the credential. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required Auth Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshResponse? Refresh` + + OAuth refresh token configuration returned in credential responses. + + - `required string ClientID` + + OAuth client ID. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the credential. + + - `required Type Type` + + - `"vault_credential"VaultCredential` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string VaultID` + + Identifier of the vault this credential belongs to. + + - `string? DisplayName` + + Human-readable name for the credential. + +### Example + +```csharp +CredentialUpdateParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv", + CredentialID = "vcrd_011CZkZEMt8gZan2iYOQfSkw", +}; + +var betaManagedAgentsCredential = await client.Beta.Vaults.Credentials.Update(parameters); + +Console.WriteLine(betaManagedAgentsCredential); +``` + +## Delete + +`BetaManagedAgentsDeletedCredential Beta.Vaults.Credentials.Delete(CredentialDeleteParamsparameters, CancellationTokencancellationToken = default)` + +**delete** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Delete Credential + +### Parameters + +- `CredentialDeleteParams parameters` + + - `required string vaultID` + + Path param: Path parameter vault_id + + - `required string credentialID` + + Path param: Path parameter credential_id + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsDeletedCredential:` + + Confirmation of a deleted credential. + + - `required string ID` + + Unique identifier of the deleted credential. + + - `required Type Type` + + - `"vault_credential_deleted"VaultCredentialDeleted` + +### Example + +```csharp +CredentialDeleteParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv", + CredentialID = "vcrd_011CZkZEMt8gZan2iYOQfSkw", +}; + +var betaManagedAgentsDeletedCredential = await client.Beta.Vaults.Credentials.Delete(parameters); + +Console.WriteLine(betaManagedAgentsDeletedCredential); +``` + +## Archive + +`BetaManagedAgentsCredential Beta.Vaults.Credentials.Archive(CredentialArchiveParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}/archive` + +Archive Credential + +### Parameters + +- `CredentialArchiveParams parameters` + + - `required string vaultID` + + Path param: Path parameter vault_id + + - `required string credentialID` + + Path param: Path parameter credential_id + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `required string ID` + + Unique identifier for the credential. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required Auth Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshResponse? Refresh` + + OAuth refresh token configuration returned in credential responses. + + - `required string ClientID` + + OAuth client ID. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the credential. + + - `required Type Type` + + - `"vault_credential"VaultCredential` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string VaultID` + + Identifier of the vault this credential belongs to. + + - `string? DisplayName` + + Human-readable name for the credential. + +### Example + +```csharp +CredentialArchiveParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv", + CredentialID = "vcrd_011CZkZEMt8gZan2iYOQfSkw", +}; + +var betaManagedAgentsCredential = await client.Beta.Vaults.Credentials.Archive(parameters); + +Console.WriteLine(betaManagedAgentsCredential); +``` + +## Domain Types + +### Beta Managed Agents Credential + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `required string ID` + + Unique identifier for the credential. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required Auth Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshResponse? Refresh` + + OAuth refresh token configuration returned in credential responses. + + - `required string ClientID` + + OAuth client ID. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the credential. + + - `required Type Type` + + - `"vault_credential"VaultCredential` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string VaultID` + + Identifier of the vault this credential belongs to. + + - `string? DisplayName` + + Human-readable name for the credential. + +### Beta Managed Agents Deleted Credential + +- `class BetaManagedAgentsDeletedCredential:` + + Confirmation of a deleted credential. + + - `required string ID` + + Unique identifier of the deleted credential. + + - `required Type Type` + + - `"vault_credential_deleted"VaultCredentialDeleted` + +### Beta Managed Agents MCP OAuth Auth Response + +- `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshResponse? Refresh` + + OAuth refresh token configuration returned in credential responses. + + - `required string ClientID` + + OAuth client ID. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Create Params + +- `class BetaManagedAgentsMcpOAuthCreateParams:` + + Parameters for creating an MCP OAuth credential. + + - `required string AccessToken` + + OAuth access token. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshParams? Refresh` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `required string ClientID` + + OAuth client ID. + + - `required string RefreshToken` + + OAuth refresh token. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required string ClientSecret` + + OAuth client secret. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam:` + + Token endpoint uses POST body authentication with client credentials. + + - `required string ClientSecret` + + OAuth client secret. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Params + +- `class BetaManagedAgentsMcpOAuthRefreshParams:` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `required string ClientID` + + OAuth client ID. + + - `required string RefreshToken` + + OAuth refresh token. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required string ClientSecret` + + OAuth client secret. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam:` + + Token endpoint uses POST body authentication with client credentials. + + - `required string ClientSecret` + + OAuth client secret. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Response + +- `class BetaManagedAgentsMcpOAuthRefreshResponse:` + + OAuth refresh token configuration returned in credential responses. + + - `required string ClientID` + + OAuth client ID. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Update Params + +- `class BetaManagedAgentsMcpOAuthRefreshUpdateParams:` + + Parameters for updating OAuth refresh token configuration. + + - `string? RefreshToken` + + Updated OAuth refresh token. + + - `string? Scope` + + Updated OAuth scope for the refresh request. + + - `TokenEndpointAuth TokenEndpointAuth` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam:` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `string? ClientSecret` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam:` + + Updated POST body authentication parameters for the token endpoint. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? ClientSecret` + + Updated OAuth client secret. + +### Beta Managed Agents MCP OAuth Update Params + +- `class BetaManagedAgentsMcpOAuthUpdateParams:` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `string? AccessToken` + + Updated OAuth access token. + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshUpdateParams? Refresh` + + Parameters for updating OAuth refresh token configuration. + + - `string? RefreshToken` + + Updated OAuth refresh token. + + - `string? Scope` + + Updated OAuth scope for the refresh request. + + - `TokenEndpointAuth TokenEndpointAuth` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam:` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `string? ClientSecret` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam:` + + Updated POST body authentication parameters for the token endpoint. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? ClientSecret` + + Updated OAuth client secret. + +### Beta Managed Agents Static Bearer Auth Response + +- `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + +### Beta Managed Agents Static Bearer Create Params + +- `class BetaManagedAgentsStaticBearerCreateParams:` + + Parameters for creating a static bearer token credential. + + - `required string Token` + + Static bearer token value. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + +### Beta Managed Agents Static Bearer Update Params + +- `class BetaManagedAgentsStaticBearerUpdateParams:` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `string? Token` + + Updated static bearer token value. + +### Beta Managed Agents Token Endpoint Auth Basic Param + +- `class BetaManagedAgentsTokenEndpointAuthBasicParam:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required string ClientSecret` + + OAuth client secret. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + +### Beta Managed Agents Token Endpoint Auth Basic Response + +- `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + +### Beta Managed Agents Token Endpoint Auth Basic Update Param + +- `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam:` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `string? ClientSecret` + + Updated OAuth client secret. + +### Beta Managed Agents Token Endpoint Auth None Param + +- `class BetaManagedAgentsTokenEndpointAuthNoneParam:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + +### Beta Managed Agents Token Endpoint Auth None Response + +- `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + +### Beta Managed Agents Token Endpoint Auth Post Param + +- `class BetaManagedAgentsTokenEndpointAuthPostParam:` + + Token endpoint uses POST body authentication with client credentials. + + - `required string ClientSecret` + + OAuth client secret. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + +### Beta Managed Agents Token Endpoint Auth Post Response + +- `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + +### Beta Managed Agents Token Endpoint Auth Post Update Param + +- `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam:` + + Updated POST body authentication parameters for the token endpoint. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? ClientSecret` + + Updated OAuth client secret. + +# Files + +## Upload + +`FileMetadata Beta.Files.Upload(FileUploadParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/files` + +Upload File + +### Parameters + +- `FileUploadParams parameters` + + - `required string file` + + Body param: The file to upload + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` ### Returns @@ -39545,6 +61915,18 @@ Upload File Whether the file can be downloaded. + - `BetaFileScope? Scope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `required string ID` + + The ID of the scoping resource (e.g., the session ID). + + - `JsonElement Type "session"constant` + + The type of scope (e.g., `"session"`). + ### Example ```csharp @@ -39584,6 +61966,10 @@ List Files Defaults to `20`. Ranges from `1` to `1000`. + - `string scopeID` + + Query param: Filter by scope ID. Only returns files associated with the specified scope (e.g., a session ID). + - `IReadOnlyList betas` Header param: Optional header to specify the beta version(s) you want to use. @@ -39630,8 +62016,6 @@ List Files - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class FileListPageResponse:` @@ -39672,6 +62056,18 @@ List Files Whether the file can be downloaded. + - `BetaFileScope? Scope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `required string ID` + + The ID of the scoping resource (e.g., the session ID). + + - `JsonElement Type "session"constant` + + The type of scope (e.g., `"session"`). + - `string? FirstID` ID of the first file in this page of results. @@ -39758,8 +62154,6 @@ Download File - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Example ```csharp @@ -39832,8 +62226,6 @@ Get File Metadata - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class FileMetadata:` @@ -39870,6 +62262,18 @@ Get File Metadata Whether the file can be downloaded. + - `BetaFileScope? Scope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `required string ID` + + The ID of the scoping resource (e.g., the session ID). + + - `JsonElement Type "session"constant` + + The type of scope (e.g., `"session"`). + ### Example ```csharp @@ -39942,8 +62346,6 @@ Delete File - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class DeletedFile:` @@ -39972,6 +62374,18 @@ Console.WriteLine(deletedFile); ## Domain Types +### Beta File Scope + +- `class BetaFileScope:` + + - `required string ID` + + The ID of the scoping resource (e.g., the session ID). + + - `JsonElement Type "session"constant` + + The type of scope (e.g., `"session"`). + ### Deleted File - `class DeletedFile:` @@ -40024,6 +62438,18 @@ Console.WriteLine(deletedFile); Whether the file can be downloaded. + - `BetaFileScope? Scope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `required string ID` + + The ID of the scoping resource (e.g., the session ID). + + - `JsonElement Type "session"constant` + + The type of scope (e.g., `"session"`). + # Skills ## Create @@ -40096,8 +62522,6 @@ Create Skill - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class SkillCreateResponse:` @@ -40232,8 +62656,6 @@ List Skills - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class SkillListPageResponse:` @@ -40371,8 +62793,6 @@ Get Skill - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class SkillRetrieveResponse:` @@ -40492,8 +62912,6 @@ Delete Skill - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class SkillDeleteResponse:` @@ -40592,8 +63010,6 @@ Create Skill Version - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class VersionCreateResponse:` @@ -40726,8 +63142,6 @@ List Skill Versions - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class VersionListPageResponse:` @@ -40870,8 +63284,6 @@ Get Skill Version - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class VersionRetrieveResponse:` @@ -41004,8 +63416,6 @@ Delete Skill Version - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class VersionDeleteResponse:` @@ -41035,557 +63445,3 @@ var version = await client.Beta.Skills.Versions.Delete(parameters); Console.WriteLine(version); ``` - -# User Profiles - -## Create - -`BetaUserProfile Beta.UserProfiles.Create(UserProfileCreateParams?parameters, CancellationTokencancellationToken = default)` - -**post** `/v1/user_profiles` - -Create User Profile - -### Parameters - -- `UserProfileCreateParams parameters` - - - `string? externalID` - - Body param - - - `IReadOnlyDictionary metadata` - - Body param: Free-form key-value data to attach to this user profile. Maximum 16 keys, with keys up to 64 characters and values up to 512 characters. Values must be non-empty strings. - - - `IReadOnlyList betas` - - Header param: Optional header to specify the beta version(s) you want to use. - - - `"message-batches-2024-09-24"MessageBatches2024_09_24` - - - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` - - - `"computer-use-2024-10-22"ComputerUse2024_10_22` - - - `"computer-use-2025-01-24"ComputerUse2025_01_24` - - - `"pdfs-2024-09-25"Pdfs2024_09_25` - - - `"token-counting-2024-11-01"TokenCounting2024_11_01` - - - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` - - - `"output-128k-2025-02-19"Output128k2025_02_19` - - - `"files-api-2025-04-14"FilesApi2025_04_14` - - - `"mcp-client-2025-04-04"McpClient2025_04_04` - - - `"mcp-client-2025-11-20"McpClient2025_11_20` - - - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` - - - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` - - - `"code-execution-2025-05-22"CodeExecution2025_05_22` - - - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` - - - `"context-1m-2025-08-07"Context1m2025_08_07` - - - `"context-management-2025-06-27"ContextManagement2025_06_27` - - - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` - - - `"skills-2025-10-02"Skills2025_10_02` - - - `"fast-mode-2026-02-01"FastMode2026_02_01` - - - `"output-300k-2026-03-24"Output300k2026_03_24` - - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - -### Returns - -- `class BetaUserProfile:` - - - `required string ID` - - - `required DateTimeOffset CreatedAt` - - A timestamp in RFC 3339 format - - - `required IReadOnlyDictionary Metadata` - - - `required IReadOnlyDictionary TrustGrants` - - - `required string Status` - - - `required string Type` - - - `required DateTimeOffset UpdatedAt` - - A timestamp in RFC 3339 format - - - `string? ExternalID` - -### Example - -```csharp -UserProfileCreateParams parameters = new(); - -var betaUserProfile = await client.Beta.UserProfiles.Create(parameters); - -Console.WriteLine(betaUserProfile); -``` - -## List - -`UserProfileListPageResponse Beta.UserProfiles.List(UserProfileListParams?parameters, CancellationTokencancellationToken = default)` - -**get** `/v1/user_profiles` - -List User Profiles - -### Parameters - -- `UserProfileListParams parameters` - - - `Int limit` - - Query param: Query parameter for limit - - - `Order order` - - Query param: Query parameter for order - - - `"asc"Asc` - - - `"desc"Desc` - - - `string page` - - Query param: Query parameter for page - - - `IReadOnlyList betas` - - Header param: Optional header to specify the beta version(s) you want to use. - - - `"message-batches-2024-09-24"MessageBatches2024_09_24` - - - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` - - - `"computer-use-2024-10-22"ComputerUse2024_10_22` - - - `"computer-use-2025-01-24"ComputerUse2025_01_24` - - - `"pdfs-2024-09-25"Pdfs2024_09_25` - - - `"token-counting-2024-11-01"TokenCounting2024_11_01` - - - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` - - - `"output-128k-2025-02-19"Output128k2025_02_19` - - - `"files-api-2025-04-14"FilesApi2025_04_14` - - - `"mcp-client-2025-04-04"McpClient2025_04_04` - - - `"mcp-client-2025-11-20"McpClient2025_11_20` - - - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` - - - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` - - - `"code-execution-2025-05-22"CodeExecution2025_05_22` - - - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` - - - `"context-1m-2025-08-07"Context1m2025_08_07` - - - `"context-management-2025-06-27"ContextManagement2025_06_27` - - - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` - - - `"skills-2025-10-02"Skills2025_10_02` - - - `"fast-mode-2026-02-01"FastMode2026_02_01` - - - `"output-300k-2026-03-24"Output300k2026_03_24` - - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - -### Returns - -- `class UserProfileListPageResponse:` - - - `required IReadOnlyList Data` - - - `required string ID` - - - `required DateTimeOffset CreatedAt` - - A timestamp in RFC 3339 format - - - `required IReadOnlyDictionary Metadata` - - - `required IReadOnlyDictionary TrustGrants` - - - `required string Status` - - - `required string Type` - - - `required DateTimeOffset UpdatedAt` - - A timestamp in RFC 3339 format - - - `string? ExternalID` - - - `string? NextPage` - -### Example - -```csharp -UserProfileListParams parameters = new(); - -var page = await client.Beta.UserProfiles.List(parameters); -await foreach (var item in page.Paginate()) -{ - Console.WriteLine(item); -} -``` - -## Retrieve - -`BetaUserProfile Beta.UserProfiles.Retrieve(UserProfileRetrieveParamsparameters, CancellationTokencancellationToken = default)` - -**get** `/v1/user_profiles/{id}` - -Get User Profile - -### Parameters - -- `UserProfileRetrieveParams parameters` - - - `required string id` - - Path parameter id - - - `IReadOnlyList betas` - - Optional header to specify the beta version(s) you want to use. - - - `"message-batches-2024-09-24"MessageBatches2024_09_24` - - - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` - - - `"computer-use-2024-10-22"ComputerUse2024_10_22` - - - `"computer-use-2025-01-24"ComputerUse2025_01_24` - - - `"pdfs-2024-09-25"Pdfs2024_09_25` - - - `"token-counting-2024-11-01"TokenCounting2024_11_01` - - - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` - - - `"output-128k-2025-02-19"Output128k2025_02_19` - - - `"files-api-2025-04-14"FilesApi2025_04_14` - - - `"mcp-client-2025-04-04"McpClient2025_04_04` - - - `"mcp-client-2025-11-20"McpClient2025_11_20` - - - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` - - - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` - - - `"code-execution-2025-05-22"CodeExecution2025_05_22` - - - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` - - - `"context-1m-2025-08-07"Context1m2025_08_07` - - - `"context-management-2025-06-27"ContextManagement2025_06_27` - - - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` - - - `"skills-2025-10-02"Skills2025_10_02` - - - `"fast-mode-2026-02-01"FastMode2026_02_01` - - - `"output-300k-2026-03-24"Output300k2026_03_24` - - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - -### Returns - -- `class BetaUserProfile:` - - - `required string ID` - - - `required DateTimeOffset CreatedAt` - - A timestamp in RFC 3339 format - - - `required IReadOnlyDictionary Metadata` - - - `required IReadOnlyDictionary TrustGrants` - - - `required string Status` - - - `required string Type` - - - `required DateTimeOffset UpdatedAt` - - A timestamp in RFC 3339 format - - - `string? ExternalID` - -### Example - -```csharp -UserProfileRetrieveParams parameters = new() { ID = "id" }; - -var betaUserProfile = await client.Beta.UserProfiles.Retrieve(parameters); - -Console.WriteLine(betaUserProfile); -``` - -## Update - -`BetaUserProfile Beta.UserProfiles.Update(UserProfileUpdateParamsparameters, CancellationTokencancellationToken = default)` - -**post** `/v1/user_profiles/{id}` - -Update User Profile - -### Parameters - -- `UserProfileUpdateParams parameters` - - - `required string id` - - Path param: Path parameter id - - - `string? externalID` - - Body param - - - `IReadOnlyDictionary metadata` - - Body param: Key-value pairs to merge into the stored metadata. Keys provided overwrite existing values. To remove a key, set its value to an empty string. Keys not provided are left unchanged. Maximum 16 keys, with keys up to 64 characters and values up to 512 characters. - - - `IReadOnlyList betas` - - Header param: Optional header to specify the beta version(s) you want to use. - - - `"message-batches-2024-09-24"MessageBatches2024_09_24` - - - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` - - - `"computer-use-2024-10-22"ComputerUse2024_10_22` - - - `"computer-use-2025-01-24"ComputerUse2025_01_24` - - - `"pdfs-2024-09-25"Pdfs2024_09_25` - - - `"token-counting-2024-11-01"TokenCounting2024_11_01` - - - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` - - - `"output-128k-2025-02-19"Output128k2025_02_19` - - - `"files-api-2025-04-14"FilesApi2025_04_14` - - - `"mcp-client-2025-04-04"McpClient2025_04_04` - - - `"mcp-client-2025-11-20"McpClient2025_11_20` - - - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` - - - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` - - - `"code-execution-2025-05-22"CodeExecution2025_05_22` - - - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` - - - `"context-1m-2025-08-07"Context1m2025_08_07` - - - `"context-management-2025-06-27"ContextManagement2025_06_27` - - - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` - - - `"skills-2025-10-02"Skills2025_10_02` - - - `"fast-mode-2026-02-01"FastMode2026_02_01` - - - `"output-300k-2026-03-24"Output300k2026_03_24` - - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - -### Returns - -- `class BetaUserProfile:` - - - `required string ID` - - - `required DateTimeOffset CreatedAt` - - A timestamp in RFC 3339 format - - - `required IReadOnlyDictionary Metadata` - - - `required IReadOnlyDictionary TrustGrants` - - - `required string Status` - - - `required string Type` - - - `required DateTimeOffset UpdatedAt` - - A timestamp in RFC 3339 format - - - `string? ExternalID` - -### Example - -```csharp -UserProfileUpdateParams parameters = new() { ID = "id" }; - -var betaUserProfile = await client.Beta.UserProfiles.Update(parameters); - -Console.WriteLine(betaUserProfile); -``` - -## Create Enrollment URL - -`BetaUserProfileEnrollmentUrl Beta.UserProfiles.CreateEnrollmentUrl(UserProfileCreateEnrollmentUrlParamsparameters, CancellationTokencancellationToken = default)` - -**post** `/v1/user_profiles/{id}/enrollment_url` - -Create Enrollment URL - -### Parameters - -- `UserProfileCreateEnrollmentUrlParams parameters` - - - `required string id` - - Path parameter id - - - `IReadOnlyList betas` - - Optional header to specify the beta version(s) you want to use. - - - `"message-batches-2024-09-24"MessageBatches2024_09_24` - - - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` - - - `"computer-use-2024-10-22"ComputerUse2024_10_22` - - - `"computer-use-2025-01-24"ComputerUse2025_01_24` - - - `"pdfs-2024-09-25"Pdfs2024_09_25` - - - `"token-counting-2024-11-01"TokenCounting2024_11_01` - - - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` - - - `"output-128k-2025-02-19"Output128k2025_02_19` - - - `"files-api-2025-04-14"FilesApi2025_04_14` - - - `"mcp-client-2025-04-04"McpClient2025_04_04` - - - `"mcp-client-2025-11-20"McpClient2025_11_20` - - - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` - - - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` - - - `"code-execution-2025-05-22"CodeExecution2025_05_22` - - - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` - - - `"context-1m-2025-08-07"Context1m2025_08_07` - - - `"context-management-2025-06-27"ContextManagement2025_06_27` - - - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` - - - `"skills-2025-10-02"Skills2025_10_02` - - - `"fast-mode-2026-02-01"FastMode2026_02_01` - - - `"output-300k-2026-03-24"Output300k2026_03_24` - - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - -### Returns - -- `class BetaUserProfileEnrollmentUrl:` - - - `required DateTimeOffset ExpiresAt` - - A timestamp in RFC 3339 format - - - `required string Type` - - - `required string Url` - -### Example - -```csharp -UserProfileCreateEnrollmentUrlParams parameters = new() { ID = "id" }; - -var betaUserProfileEnrollmentUrl = await client.Beta.UserProfiles.CreateEnrollmentUrl(parameters); - -Console.WriteLine(betaUserProfileEnrollmentUrl); -``` - -## Domain Types - -### Beta User Profile - -- `class BetaUserProfile:` - - - `required string ID` - - - `required DateTimeOffset CreatedAt` - - A timestamp in RFC 3339 format - - - `required IReadOnlyDictionary Metadata` - - - `required IReadOnlyDictionary TrustGrants` - - - `required string Status` - - - `required string Type` - - - `required DateTimeOffset UpdatedAt` - - A timestamp in RFC 3339 format - - - `string? ExternalID` - -### Beta User Profile Enrollment URL - -- `class BetaUserProfileEnrollmentUrl:` - - - `required DateTimeOffset ExpiresAt` - - A timestamp in RFC 3339 format - - - `required string Type` - - - `required string Url` - -### Beta User Profile Trust Grant - -- `class BetaUserProfileTrustGrant:` - - - `required string Status` diff --git a/content/en/api/csharp/beta/agents.md b/content/en/api/csharp/beta/agents.md new file mode 100644 index 000000000..c93cc1805 --- /dev/null +++ b/content/en/api/csharp/beta/agents.md @@ -0,0 +1,4164 @@ +# Agents + +## Create + +`BetaManagedAgentsAgent Beta.Agents.Create(AgentCreateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/agents` + +Create Agent + +### Parameters + +- `AgentCreateParams parameters` + + - `required Model model` + + Body param: Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control + + - `enum BetaManagedAgentsModel:` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `class BetaManagedAgentsModelConfigParams:` + + An object that defines additional configuration control over model use + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed? Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string name` + + Body param: Human-readable name for the agent. 1-256 characters. + + - `string? description` + + Body param: Description of what the agent does. Up to 2048 characters. + + - `IReadOnlyList mcpServers` + + Body param: MCP servers this agent connects to. Maximum 20. Names must be unique within the array. + + - `required string Name` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + Endpoint URL for the MCP server. + + - `IReadOnlyDictionary metadata` + + Body param: Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars. + + - `IReadOnlyList skills` + + Body param: Skills available to the agent. Maximum 20. + + - `class BetaManagedAgentsAnthropicSkillParams:` + + An Anthropic-managed skill. + + - `required string SkillID` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `string? Version` + + Version to pin. Defaults to latest if omitted. + + - `class BetaManagedAgentsCustomSkillParams:` + + A user-created custom skill. + + - `required string SkillID` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `required Type Type` + + - `"custom"Custom` + + - `string? Version` + + Version to pin. Defaults to latest if omitted. + + - `string? system` + + Body param: System prompt for the agent. Up to 100,000 characters. + + - `IReadOnlyList tools` + + Body param: Tool configurations available to the agent. Maximum of 128 tools across all toolsets allowed. + + - `class BetaManagedAgentsAgentToolset20260401Params:` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `IReadOnlyList Configs` + + Per-tool configuration overrides. + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `Boolean? Enabled` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `BetaManagedAgentsAgentToolsetDefaultConfigParams? DefaultConfig` + + Default configuration for all tools in a toolset. + + - `Boolean? Enabled` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `class BetaManagedAgentsMcpToolsetParams:` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `required string McpServerName` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `IReadOnlyList Configs` + + Per-tool configuration overrides. + + - `required string Name` + + Name of the MCP tool to configure. 1-128 characters. + + - `Boolean? Enabled` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `BetaManagedAgentsMcpToolsetDefaultConfigParams? DefaultConfig` + + Default configuration for all tools from an MCP server. + + - `Boolean? Enabled` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `class BetaManagedAgentsCustomToolParams:` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `required string Description` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `required Type Type` + + - `"custom"Custom` + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsAgent:` + + A Managed Agents `agent`. + + - `required string ID` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required IReadOnlyDictionary Metadata` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required Int Version` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```csharp +AgentCreateParams parameters = new() +{ + Model = BetaManagedAgentsModel.ClaudeSonnet4_6, + Name = "My First Agent", +}; + +var betaManagedAgentsAgent = await client.Beta.Agents.Create(parameters); + +Console.WriteLine(betaManagedAgentsAgent); +``` + +## List + +`AgentListPageResponse Beta.Agents.List(AgentListParams?parameters, CancellationTokencancellationToken = default)` + +**get** `/v1/agents` + +List Agents + +### Parameters + +- `AgentListParams parameters` + + - `DateTimeOffset createdAtGte` + + Query param: Return agents created at or after this time (inclusive). + + - `DateTimeOffset createdAtLte` + + Query param: Return agents created at or before this time (inclusive). + + - `Boolean includeArchived` + + Query param: Include archived agents in results. Defaults to false. + + - `Int limit` + + Query param: Maximum results per page. Default 20, maximum 100. + + - `string page` + + Query param: Opaque pagination cursor from a previous response. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class AgentListPageResponse:` + + Paginated list of agents. + + - `IReadOnlyList Data` + + List of agents. + + - `required string ID` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required IReadOnlyDictionary Metadata` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required Int Version` + + The agent's current version. Starts at 1 and increments when the agent is modified. + + - `string? NextPage` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```csharp +AgentListParams parameters = new(); + +var page = await client.Beta.Agents.List(parameters); +await foreach (var item in page.Paginate()) +{ + Console.WriteLine(item); +} +``` + +## Retrieve + +`BetaManagedAgentsAgent Beta.Agents.Retrieve(AgentRetrieveParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/agents/{agent_id}` + +Get Agent + +### Parameters + +- `AgentRetrieveParams parameters` + + - `required string agentID` + + Path param: Path parameter agent_id + + - `Int version` + + Query param: Agent version. Omit for the most recent version. Must be at least 1 if specified. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsAgent:` + + A Managed Agents `agent`. + + - `required string ID` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required IReadOnlyDictionary Metadata` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required Int Version` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```csharp +AgentRetrieveParams parameters = new() +{ + AgentID = "agent_011CZkYpogX7uDKUyvBTophP" +}; + +var betaManagedAgentsAgent = await client.Beta.Agents.Retrieve(parameters); + +Console.WriteLine(betaManagedAgentsAgent); +``` + +## Update + +`BetaManagedAgentsAgent Beta.Agents.Update(AgentUpdateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/agents/{agent_id}` + +Update Agent + +### Parameters + +- `AgentUpdateParams parameters` + + - `required string agentID` + + Path param: Path parameter agent_id + + - `required Int version` + + Body param: The agent's current version, used to prevent concurrent overwrites. Obtain this value from a create or retrieve response. The request fails if this does not match the server's current version. + + - `string? description` + + Body param: Description. Up to 2048 characters. Omit to preserve; send empty string or null to clear. + + - `IReadOnlyList? mcpServers` + + Body param: MCP servers. Full replacement. Omit to preserve; send empty array or null to clear. Names must be unique. Maximum 20. + + - `required string Name` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + Endpoint URL for the MCP server. + + - `IReadOnlyDictionary? metadata` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. The stored bag is limited to 16 keys (up to 64 chars each) with values up to 512 chars. + + - `Model model` + + Body param: Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control. Omit to preserve. Cannot be cleared. + + - `enum BetaManagedAgentsModel:` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `class BetaManagedAgentsModelConfigParams:` + + An object that defines additional configuration control over model use + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed? Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `string name` + + Body param: Human-readable name. 1-256 characters. Omit to preserve. Cannot be cleared. + + - `IReadOnlyList? skills` + + Body param: Skills. Full replacement. Omit to preserve; send empty array or null to clear. Maximum 20. + + - `class BetaManagedAgentsAnthropicSkillParams:` + + An Anthropic-managed skill. + + - `required string SkillID` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `string? Version` + + Version to pin. Defaults to latest if omitted. + + - `class BetaManagedAgentsCustomSkillParams:` + + A user-created custom skill. + + - `required string SkillID` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `required Type Type` + + - `"custom"Custom` + + - `string? Version` + + Version to pin. Defaults to latest if omitted. + + - `string? system` + + Body param: System prompt. Up to 100,000 characters. Omit to preserve; send empty string or null to clear. + + - `IReadOnlyList? tools` + + Body param: Tool configurations available to the agent. Full replacement. Omit to preserve; send empty array or null to clear. Maximum of 128 tools across all toolsets allowed. + + - `class BetaManagedAgentsAgentToolset20260401Params:` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `IReadOnlyList Configs` + + Per-tool configuration overrides. + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `Boolean? Enabled` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `BetaManagedAgentsAgentToolsetDefaultConfigParams? DefaultConfig` + + Default configuration for all tools in a toolset. + + - `Boolean? Enabled` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `class BetaManagedAgentsMcpToolsetParams:` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `required string McpServerName` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `IReadOnlyList Configs` + + Per-tool configuration overrides. + + - `required string Name` + + Name of the MCP tool to configure. 1-128 characters. + + - `Boolean? Enabled` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `BetaManagedAgentsMcpToolsetDefaultConfigParams? DefaultConfig` + + Default configuration for all tools from an MCP server. + + - `Boolean? Enabled` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `class BetaManagedAgentsCustomToolParams:` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `required string Description` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `required Type Type` + + - `"custom"Custom` + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsAgent:` + + A Managed Agents `agent`. + + - `required string ID` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required IReadOnlyDictionary Metadata` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required Int Version` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```csharp +AgentUpdateParams parameters = new() +{ + AgentID = "agent_011CZkYpogX7uDKUyvBTophP", + Version = 1, +}; + +var betaManagedAgentsAgent = await client.Beta.Agents.Update(parameters); + +Console.WriteLine(betaManagedAgentsAgent); +``` + +## Archive + +`BetaManagedAgentsAgent Beta.Agents.Archive(AgentArchiveParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/agents/{agent_id}/archive` + +Archive Agent + +### Parameters + +- `AgentArchiveParams parameters` + + - `required string agentID` + + Path parameter agent_id + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsAgent:` + + A Managed Agents `agent`. + + - `required string ID` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required IReadOnlyDictionary Metadata` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required Int Version` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```csharp +AgentArchiveParams parameters = new() +{ + AgentID = "agent_011CZkYpogX7uDKUyvBTophP" +}; + +var betaManagedAgentsAgent = await client.Beta.Agents.Archive(parameters); + +Console.WriteLine(betaManagedAgentsAgent); +``` + +## Domain Types + +### Beta Managed Agents Agent + +- `class BetaManagedAgentsAgent:` + + A Managed Agents `agent`. + + - `required string ID` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required IReadOnlyDictionary Metadata` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required Int Version` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Beta Managed Agents Agent Tool Config + +- `class BetaManagedAgentsAgentToolConfig:` + + Configuration for a specific agent tool. + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + +### Beta Managed Agents Agent Tool Config Params + +- `class BetaManagedAgentsAgentToolConfigParams:` + + Configuration override for a specific tool within a toolset. + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `Boolean? Enabled` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + +### Beta Managed Agents Agent Toolset Default Config + +- `class BetaManagedAgentsAgentToolsetDefaultConfig:` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + +### Beta Managed Agents Agent Toolset Default Config Params + +- `class BetaManagedAgentsAgentToolsetDefaultConfigParams:` + + Default configuration for all tools in a toolset. + + - `Boolean? Enabled` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + +### Beta Managed Agents Agent Toolset20260401 + +- `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + +### Beta Managed Agents Agent Toolset20260401 Params + +- `class BetaManagedAgentsAgentToolset20260401Params:` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `IReadOnlyList Configs` + + Per-tool configuration overrides. + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `Boolean? Enabled` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `BetaManagedAgentsAgentToolsetDefaultConfigParams? DefaultConfig` + + Default configuration for all tools in a toolset. + + - `Boolean? Enabled` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + +### Beta Managed Agents Always Allow Policy + +- `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + +### Beta Managed Agents Always Ask Policy + +- `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + +### Beta Managed Agents Anthropic Skill + +- `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + +### Beta Managed Agents Anthropic Skill Params + +- `class BetaManagedAgentsAnthropicSkillParams:` + + An Anthropic-managed skill. + + - `required string SkillID` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `string? Version` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents Custom Skill + +- `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + +### Beta Managed Agents Custom Skill Params + +- `class BetaManagedAgentsCustomSkillParams:` + + A user-created custom skill. + + - `required string SkillID` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `required Type Type` + + - `"custom"Custom` + + - `string? Version` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents Custom Tool + +- `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + +### Beta Managed Agents Custom Tool Input Schema + +- `class BetaManagedAgentsCustomToolInputSchema:` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + +### Beta Managed Agents Custom Tool Params + +- `class BetaManagedAgentsCustomToolParams:` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `required string Description` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `required Type Type` + + - `"custom"Custom` + +### Beta Managed Agents MCP Server URL Definition + +- `class BetaManagedAgentsMcpServerUrlDefinition:` + + URL-based MCP server connection as returned in API responses. + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + +### Beta Managed Agents MCP Tool Config + +- `class BetaManagedAgentsMcpToolConfig:` + + Resolved configuration for a specific MCP tool. + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + +### Beta Managed Agents MCP Tool Config Params + +- `class BetaManagedAgentsMcpToolConfigParams:` + + Configuration override for a specific MCP tool. + + - `required string Name` + + Name of the MCP tool to configure. 1-128 characters. + + - `Boolean? Enabled` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + +### Beta Managed Agents MCP Toolset + +- `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + +### Beta Managed Agents MCP Toolset Default Config + +- `class BetaManagedAgentsMcpToolsetDefaultConfig:` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + +### Beta Managed Agents MCP Toolset Default Config Params + +- `class BetaManagedAgentsMcpToolsetDefaultConfigParams:` + + Default configuration for all tools from an MCP server. + + - `Boolean? Enabled` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + +### Beta Managed Agents MCP Toolset Params + +- `class BetaManagedAgentsMcpToolsetParams:` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `required string McpServerName` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `IReadOnlyList Configs` + + Per-tool configuration overrides. + + - `required string Name` + + Name of the MCP tool to configure. 1-128 characters. + + - `Boolean? Enabled` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `BetaManagedAgentsMcpToolsetDefaultConfigParams? DefaultConfig` + + Default configuration for all tools from an MCP server. + + - `Boolean? Enabled` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + +### Beta Managed Agents Model Config + +- `class BetaManagedAgentsModelConfig:` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + +### Beta Managed Agents Model Config Params + +- `class BetaManagedAgentsModelConfigParams:` + + An object that defines additional configuration control over model use + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed? Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + +### Beta Managed Agents Skill Params + +- `class BetaManagedAgentsSkillParams: A class that can be one of several variants.union` + + Skill to load in the session container. + + - `class BetaManagedAgentsAnthropicSkillParams:` + + An Anthropic-managed skill. + + - `required string SkillID` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `string? Version` + + Version to pin. Defaults to latest if omitted. + + - `class BetaManagedAgentsCustomSkillParams:` + + A user-created custom skill. + + - `required string SkillID` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `required Type Type` + + - `"custom"Custom` + + - `string? Version` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents URL MCP Server Params + +- `class BetaManagedAgentsUrlMcpServerParams:` + + URL-based MCP server connection. + + - `required string Name` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + Endpoint URL for the MCP server. + +# Versions + +## List + +`VersionListPageResponse Beta.Agents.Versions.List(VersionListParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/agents/{agent_id}/versions` + +List Agent Versions + +### Parameters + +- `VersionListParams parameters` + + - `required string agentID` + + Path param: Path parameter agent_id + + - `Int limit` + + Query param: Maximum results per page. Default 20, maximum 100. + + - `string page` + + Query param: Opaque pagination cursor. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class VersionListPageResponse:` + + Paginated list of agent versions. + + - `IReadOnlyList Data` + + Agent versions. + + - `required string ID` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required IReadOnlyDictionary Metadata` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required Int Version` + + The agent's current version. Starts at 1 and increments when the agent is modified. + + - `string? NextPage` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```csharp +VersionListParams parameters = new() +{ + AgentID = "agent_011CZkYpogX7uDKUyvBTophP" +}; + +var page = await client.Beta.Agents.Versions.List(parameters); +await foreach (var item in page.Paginate()) +{ + Console.WriteLine(item); +} +``` diff --git a/content/en/api/csharp/beta/agents/archive.md b/content/en/api/csharp/beta/agents/archive.md new file mode 100644 index 000000000..f8bcfb89b --- /dev/null +++ b/content/en/api/csharp/beta/agents/archive.md @@ -0,0 +1,364 @@ +## Archive + +`BetaManagedAgentsAgent Beta.Agents.Archive(AgentArchiveParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/agents/{agent_id}/archive` + +Archive Agent + +### Parameters + +- `AgentArchiveParams parameters` + + - `required string agentID` + + Path parameter agent_id + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsAgent:` + + A Managed Agents `agent`. + + - `required string ID` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required IReadOnlyDictionary Metadata` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required Int Version` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```csharp +AgentArchiveParams parameters = new() +{ + AgentID = "agent_011CZkYpogX7uDKUyvBTophP" +}; + +var betaManagedAgentsAgent = await client.Beta.Agents.Archive(parameters); + +Console.WriteLine(betaManagedAgentsAgent); +``` diff --git a/content/en/api/csharp/beta/agents/create.md b/content/en/api/csharp/beta/agents/create.md new file mode 100644 index 000000000..86e638b97 --- /dev/null +++ b/content/en/api/csharp/beta/agents/create.md @@ -0,0 +1,715 @@ +## Create + +`BetaManagedAgentsAgent Beta.Agents.Create(AgentCreateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/agents` + +Create Agent + +### Parameters + +- `AgentCreateParams parameters` + + - `required Model model` + + Body param: Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control + + - `enum BetaManagedAgentsModel:` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `class BetaManagedAgentsModelConfigParams:` + + An object that defines additional configuration control over model use + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed? Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string name` + + Body param: Human-readable name for the agent. 1-256 characters. + + - `string? description` + + Body param: Description of what the agent does. Up to 2048 characters. + + - `IReadOnlyList mcpServers` + + Body param: MCP servers this agent connects to. Maximum 20. Names must be unique within the array. + + - `required string Name` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + Endpoint URL for the MCP server. + + - `IReadOnlyDictionary metadata` + + Body param: Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars. + + - `IReadOnlyList skills` + + Body param: Skills available to the agent. Maximum 20. + + - `class BetaManagedAgentsAnthropicSkillParams:` + + An Anthropic-managed skill. + + - `required string SkillID` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `string? Version` + + Version to pin. Defaults to latest if omitted. + + - `class BetaManagedAgentsCustomSkillParams:` + + A user-created custom skill. + + - `required string SkillID` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `required Type Type` + + - `"custom"Custom` + + - `string? Version` + + Version to pin. Defaults to latest if omitted. + + - `string? system` + + Body param: System prompt for the agent. Up to 100,000 characters. + + - `IReadOnlyList tools` + + Body param: Tool configurations available to the agent. Maximum of 128 tools across all toolsets allowed. + + - `class BetaManagedAgentsAgentToolset20260401Params:` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `IReadOnlyList Configs` + + Per-tool configuration overrides. + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `Boolean? Enabled` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `BetaManagedAgentsAgentToolsetDefaultConfigParams? DefaultConfig` + + Default configuration for all tools in a toolset. + + - `Boolean? Enabled` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `class BetaManagedAgentsMcpToolsetParams:` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `required string McpServerName` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `IReadOnlyList Configs` + + Per-tool configuration overrides. + + - `required string Name` + + Name of the MCP tool to configure. 1-128 characters. + + - `Boolean? Enabled` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `BetaManagedAgentsMcpToolsetDefaultConfigParams? DefaultConfig` + + Default configuration for all tools from an MCP server. + + - `Boolean? Enabled` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `class BetaManagedAgentsCustomToolParams:` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `required string Description` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `required Type Type` + + - `"custom"Custom` + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsAgent:` + + A Managed Agents `agent`. + + - `required string ID` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required IReadOnlyDictionary Metadata` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required Int Version` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```csharp +AgentCreateParams parameters = new() +{ + Model = BetaManagedAgentsModel.ClaudeSonnet4_6, + Name = "My First Agent", +}; + +var betaManagedAgentsAgent = await client.Beta.Agents.Create(parameters); + +Console.WriteLine(betaManagedAgentsAgent); +``` diff --git a/content/en/api/csharp/beta/agents/list.md b/content/en/api/csharp/beta/agents/list.md new file mode 100644 index 000000000..4fa931c6b --- /dev/null +++ b/content/en/api/csharp/beta/agents/list.md @@ -0,0 +1,387 @@ +## List + +`AgentListPageResponse Beta.Agents.List(AgentListParams?parameters, CancellationTokencancellationToken = default)` + +**get** `/v1/agents` + +List Agents + +### Parameters + +- `AgentListParams parameters` + + - `DateTimeOffset createdAtGte` + + Query param: Return agents created at or after this time (inclusive). + + - `DateTimeOffset createdAtLte` + + Query param: Return agents created at or before this time (inclusive). + + - `Boolean includeArchived` + + Query param: Include archived agents in results. Defaults to false. + + - `Int limit` + + Query param: Maximum results per page. Default 20, maximum 100. + + - `string page` + + Query param: Opaque pagination cursor from a previous response. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class AgentListPageResponse:` + + Paginated list of agents. + + - `IReadOnlyList Data` + + List of agents. + + - `required string ID` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required IReadOnlyDictionary Metadata` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required Int Version` + + The agent's current version. Starts at 1 and increments when the agent is modified. + + - `string? NextPage` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```csharp +AgentListParams parameters = new(); + +var page = await client.Beta.Agents.List(parameters); +await foreach (var item in page.Paginate()) +{ + Console.WriteLine(item); +} +``` diff --git a/content/en/api/csharp/beta/agents/retrieve.md b/content/en/api/csharp/beta/agents/retrieve.md new file mode 100644 index 000000000..aadfa34b4 --- /dev/null +++ b/content/en/api/csharp/beta/agents/retrieve.md @@ -0,0 +1,368 @@ +## Retrieve + +`BetaManagedAgentsAgent Beta.Agents.Retrieve(AgentRetrieveParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/agents/{agent_id}` + +Get Agent + +### Parameters + +- `AgentRetrieveParams parameters` + + - `required string agentID` + + Path param: Path parameter agent_id + + - `Int version` + + Query param: Agent version. Omit for the most recent version. Must be at least 1 if specified. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsAgent:` + + A Managed Agents `agent`. + + - `required string ID` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required IReadOnlyDictionary Metadata` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required Int Version` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```csharp +AgentRetrieveParams parameters = new() +{ + AgentID = "agent_011CZkYpogX7uDKUyvBTophP" +}; + +var betaManagedAgentsAgent = await client.Beta.Agents.Retrieve(parameters); + +Console.WriteLine(betaManagedAgentsAgent); +``` diff --git a/content/en/api/csharp/beta/agents/update.md b/content/en/api/csharp/beta/agents/update.md new file mode 100644 index 000000000..11f43427c --- /dev/null +++ b/content/en/api/csharp/beta/agents/update.md @@ -0,0 +1,723 @@ +## Update + +`BetaManagedAgentsAgent Beta.Agents.Update(AgentUpdateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/agents/{agent_id}` + +Update Agent + +### Parameters + +- `AgentUpdateParams parameters` + + - `required string agentID` + + Path param: Path parameter agent_id + + - `required Int version` + + Body param: The agent's current version, used to prevent concurrent overwrites. Obtain this value from a create or retrieve response. The request fails if this does not match the server's current version. + + - `string? description` + + Body param: Description. Up to 2048 characters. Omit to preserve; send empty string or null to clear. + + - `IReadOnlyList? mcpServers` + + Body param: MCP servers. Full replacement. Omit to preserve; send empty array or null to clear. Names must be unique. Maximum 20. + + - `required string Name` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + Endpoint URL for the MCP server. + + - `IReadOnlyDictionary? metadata` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. The stored bag is limited to 16 keys (up to 64 chars each) with values up to 512 chars. + + - `Model model` + + Body param: Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control. Omit to preserve. Cannot be cleared. + + - `enum BetaManagedAgentsModel:` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `class BetaManagedAgentsModelConfigParams:` + + An object that defines additional configuration control over model use + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed? Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `string name` + + Body param: Human-readable name. 1-256 characters. Omit to preserve. Cannot be cleared. + + - `IReadOnlyList? skills` + + Body param: Skills. Full replacement. Omit to preserve; send empty array or null to clear. Maximum 20. + + - `class BetaManagedAgentsAnthropicSkillParams:` + + An Anthropic-managed skill. + + - `required string SkillID` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `string? Version` + + Version to pin. Defaults to latest if omitted. + + - `class BetaManagedAgentsCustomSkillParams:` + + A user-created custom skill. + + - `required string SkillID` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `required Type Type` + + - `"custom"Custom` + + - `string? Version` + + Version to pin. Defaults to latest if omitted. + + - `string? system` + + Body param: System prompt. Up to 100,000 characters. Omit to preserve; send empty string or null to clear. + + - `IReadOnlyList? tools` + + Body param: Tool configurations available to the agent. Full replacement. Omit to preserve; send empty array or null to clear. Maximum of 128 tools across all toolsets allowed. + + - `class BetaManagedAgentsAgentToolset20260401Params:` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `IReadOnlyList Configs` + + Per-tool configuration overrides. + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `Boolean? Enabled` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `BetaManagedAgentsAgentToolsetDefaultConfigParams? DefaultConfig` + + Default configuration for all tools in a toolset. + + - `Boolean? Enabled` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `class BetaManagedAgentsMcpToolsetParams:` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `required string McpServerName` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `IReadOnlyList Configs` + + Per-tool configuration overrides. + + - `required string Name` + + Name of the MCP tool to configure. 1-128 characters. + + - `Boolean? Enabled` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `BetaManagedAgentsMcpToolsetDefaultConfigParams? DefaultConfig` + + Default configuration for all tools from an MCP server. + + - `Boolean? Enabled` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `PermissionPolicy? PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `class BetaManagedAgentsCustomToolParams:` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `required string Description` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `required Type Type` + + - `"custom"Custom` + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsAgent:` + + A Managed Agents `agent`. + + - `required string ID` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required IReadOnlyDictionary Metadata` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required Int Version` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```csharp +AgentUpdateParams parameters = new() +{ + AgentID = "agent_011CZkYpogX7uDKUyvBTophP", + Version = 1, +}; + +var betaManagedAgentsAgent = await client.Beta.Agents.Update(parameters); + +Console.WriteLine(betaManagedAgentsAgent); +``` diff --git a/content/en/api/csharp/beta/agents/versions.md b/content/en/api/csharp/beta/agents/versions.md new file mode 100644 index 000000000..348f212e5 --- /dev/null +++ b/content/en/api/csharp/beta/agents/versions.md @@ -0,0 +1,384 @@ +# Versions + +## List + +`VersionListPageResponse Beta.Agents.Versions.List(VersionListParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/agents/{agent_id}/versions` + +List Agent Versions + +### Parameters + +- `VersionListParams parameters` + + - `required string agentID` + + Path param: Path parameter agent_id + + - `Int limit` + + Query param: Maximum results per page. Default 20, maximum 100. + + - `string page` + + Query param: Opaque pagination cursor. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class VersionListPageResponse:` + + Paginated list of agent versions. + + - `IReadOnlyList Data` + + Agent versions. + + - `required string ID` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required IReadOnlyDictionary Metadata` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required Int Version` + + The agent's current version. Starts at 1 and increments when the agent is modified. + + - `string? NextPage` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```csharp +VersionListParams parameters = new() +{ + AgentID = "agent_011CZkYpogX7uDKUyvBTophP" +}; + +var page = await client.Beta.Agents.Versions.List(parameters); +await foreach (var item in page.Paginate()) +{ + Console.WriteLine(item); +} +``` diff --git a/content/en/api/csharp/beta/agents/versions/list.md b/content/en/api/csharp/beta/agents/versions/list.md new file mode 100644 index 000000000..fa8480ccd --- /dev/null +++ b/content/en/api/csharp/beta/agents/versions/list.md @@ -0,0 +1,382 @@ +## List + +`VersionListPageResponse Beta.Agents.Versions.List(VersionListParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/agents/{agent_id}/versions` + +List Agent Versions + +### Parameters + +- `VersionListParams parameters` + + - `required string agentID` + + Path param: Path parameter agent_id + + - `Int limit` + + Query param: Maximum results per page. Default 20, maximum 100. + + - `string page` + + Query param: Opaque pagination cursor. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class VersionListPageResponse:` + + Paginated list of agent versions. + + - `IReadOnlyList Data` + + Agent versions. + + - `required string ID` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required IReadOnlyDictionary Metadata` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required Int Version` + + The agent's current version. Starts at 1 and increments when the agent is modified. + + - `string? NextPage` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```csharp +VersionListParams parameters = new() +{ + AgentID = "agent_011CZkYpogX7uDKUyvBTophP" +}; + +var page = await client.Beta.Agents.Versions.List(parameters); +await foreach (var item in page.Paginate()) +{ + Console.WriteLine(item); +} +``` diff --git a/content/en/api/csharp/beta/environments.md b/content/en/api/csharp/beta/environments.md new file mode 100644 index 000000000..5e16291f2 --- /dev/null +++ b/content/en/api/csharp/beta/environments.md @@ -0,0 +1,1487 @@ +# Environments + +## Create + +`BetaEnvironment Beta.Environments.Create(EnvironmentCreateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/environments` + +Create a new environment with the specified configuration. + +### Parameters + +- `EnvironmentCreateParams parameters` + + - `required string name` + + Body param: Human-readable name for the environment + + - `BetaCloudConfigParams? config` + + Body param: Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `string? description` + + Body param: Optional description of the environment + + - `IReadOnlyDictionary metadata` + + Body param: User-provided metadata key-value pairs + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaEnvironment:` + + Unified Environment resource for both cloud and BYOC environments. + + - `required string ID` + + Environment identifier (e.g., 'env_...') + + - `required string? ArchivedAt` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `required BetaCloudConfig Config` + + `cloud` environment configuration. + + - `required Networking Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonElement Type "unrestricted"constant` + + Network policy type + + - `class BetaLimitedNetwork:` + + Limited network access. + + - `required Boolean AllowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `required Boolean AllowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `required IReadOnlyList AllowedHosts` + + Specifies domains the container can reach. + + - `JsonElement Type "limited"constant` + + Network policy type + + - `required BetaPackages Packages` + + Package manager configuration. + + - `required IReadOnlyList Apt` + + Ubuntu/Debian packages to install + + - `required IReadOnlyList Cargo` + + Rust packages to install + + - `required IReadOnlyList Gem` + + Ruby packages to install + + - `required IReadOnlyList Go` + + Go packages to install + + - `required IReadOnlyList Npm` + + Node.js packages to install + + - `required IReadOnlyList Pip` + + Python packages to install + + - `Type Type` + + Package configuration type + + - `"packages"Packages` + + - `JsonElement Type "cloud"constant` + + Environment type + + - `required string CreatedAt` + + RFC 3339 timestamp when environment was created + + - `required string Description` + + User-provided description for the environment + + - `required IReadOnlyDictionary Metadata` + + User-provided metadata key-value pairs + + - `required string Name` + + Human-readable name for the environment + + - `JsonElement Type "environment"constant` + + The type of object (always 'environment') + + - `required string UpdatedAt` + + RFC 3339 timestamp when environment was last updated + +### Example + +```csharp +EnvironmentCreateParams parameters = new() { Name = "python-data-analysis" }; + +var betaEnvironment = await client.Beta.Environments.Create(parameters); + +Console.WriteLine(betaEnvironment); +``` + +## List + +`EnvironmentListPageResponse Beta.Environments.List(EnvironmentListParams?parameters, CancellationTokencancellationToken = default)` + +**get** `/v1/environments` + +List environments with pagination support. + +### Parameters + +- `EnvironmentListParams parameters` + + - `Boolean includeArchived` + + Query param: Include archived environments in the response + + - `Long limit` + + Query param: Maximum number of environments to return + + - `string? page` + + Query param: Opaque cursor from previous response for pagination. Pass the `next_page` value from the previous response. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class EnvironmentListPageResponse:` + + Response when listing environments. + + This response model uses opaque cursor-based pagination. Use the `page` + query parameter with the value from `next_page` to fetch the next page. + + - `required IReadOnlyList Data` + + List of environments. + + - `required string ID` + + Environment identifier (e.g., 'env_...') + + - `required string? ArchivedAt` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `required BetaCloudConfig Config` + + `cloud` environment configuration. + + - `required Networking Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonElement Type "unrestricted"constant` + + Network policy type + + - `class BetaLimitedNetwork:` + + Limited network access. + + - `required Boolean AllowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `required Boolean AllowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `required IReadOnlyList AllowedHosts` + + Specifies domains the container can reach. + + - `JsonElement Type "limited"constant` + + Network policy type + + - `required BetaPackages Packages` + + Package manager configuration. + + - `required IReadOnlyList Apt` + + Ubuntu/Debian packages to install + + - `required IReadOnlyList Cargo` + + Rust packages to install + + - `required IReadOnlyList Gem` + + Ruby packages to install + + - `required IReadOnlyList Go` + + Go packages to install + + - `required IReadOnlyList Npm` + + Node.js packages to install + + - `required IReadOnlyList Pip` + + Python packages to install + + - `Type Type` + + Package configuration type + + - `"packages"Packages` + + - `JsonElement Type "cloud"constant` + + Environment type + + - `required string CreatedAt` + + RFC 3339 timestamp when environment was created + + - `required string Description` + + User-provided description for the environment + + - `required IReadOnlyDictionary Metadata` + + User-provided metadata key-value pairs + + - `required string Name` + + Human-readable name for the environment + + - `JsonElement Type "environment"constant` + + The type of object (always 'environment') + + - `required string UpdatedAt` + + RFC 3339 timestamp when environment was last updated + + - `required string? NextPage` + + Token for fetching the next page of results. If `null`, there are no more results available. Pass this value to the `page` parameter in the next request. + +### Example + +```csharp +EnvironmentListParams parameters = new(); + +var page = await client.Beta.Environments.List(parameters); +await foreach (var item in page.Paginate()) +{ + Console.WriteLine(item); +} +``` + +## Retrieve + +`BetaEnvironment Beta.Environments.Retrieve(EnvironmentRetrieveParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/environments/{environment_id}` + +Retrieve a specific environment by ID. + +### Parameters + +- `EnvironmentRetrieveParams parameters` + + - `required string environmentID` + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaEnvironment:` + + Unified Environment resource for both cloud and BYOC environments. + + - `required string ID` + + Environment identifier (e.g., 'env_...') + + - `required string? ArchivedAt` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `required BetaCloudConfig Config` + + `cloud` environment configuration. + + - `required Networking Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonElement Type "unrestricted"constant` + + Network policy type + + - `class BetaLimitedNetwork:` + + Limited network access. + + - `required Boolean AllowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `required Boolean AllowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `required IReadOnlyList AllowedHosts` + + Specifies domains the container can reach. + + - `JsonElement Type "limited"constant` + + Network policy type + + - `required BetaPackages Packages` + + Package manager configuration. + + - `required IReadOnlyList Apt` + + Ubuntu/Debian packages to install + + - `required IReadOnlyList Cargo` + + Rust packages to install + + - `required IReadOnlyList Gem` + + Ruby packages to install + + - `required IReadOnlyList Go` + + Go packages to install + + - `required IReadOnlyList Npm` + + Node.js packages to install + + - `required IReadOnlyList Pip` + + Python packages to install + + - `Type Type` + + Package configuration type + + - `"packages"Packages` + + - `JsonElement Type "cloud"constant` + + Environment type + + - `required string CreatedAt` + + RFC 3339 timestamp when environment was created + + - `required string Description` + + User-provided description for the environment + + - `required IReadOnlyDictionary Metadata` + + User-provided metadata key-value pairs + + - `required string Name` + + Human-readable name for the environment + + - `JsonElement Type "environment"constant` + + The type of object (always 'environment') + + - `required string UpdatedAt` + + RFC 3339 timestamp when environment was last updated + +### Example + +```csharp +EnvironmentRetrieveParams parameters = new() +{ + EnvironmentID = "env_011CZkZ9X2dpNyB7HsEFoRfW" +}; + +var betaEnvironment = await client.Beta.Environments.Retrieve(parameters); + +Console.WriteLine(betaEnvironment); +``` + +## Update + +`BetaEnvironment Beta.Environments.Update(EnvironmentUpdateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/environments/{environment_id}` + +Update an existing environment's configuration. + +### Parameters + +- `EnvironmentUpdateParams parameters` + + - `required string environmentID` + + Path param + + - `BetaCloudConfigParams? config` + + Body param: Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `string? description` + + Body param: Updated description of the environment + + - `IReadOnlyDictionary metadata` + + Body param: User-provided metadata key-value pairs. Set a value to null or empty string to delete the key. + + - `string? name` + + Body param: Updated name for the environment + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaEnvironment:` + + Unified Environment resource for both cloud and BYOC environments. + + - `required string ID` + + Environment identifier (e.g., 'env_...') + + - `required string? ArchivedAt` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `required BetaCloudConfig Config` + + `cloud` environment configuration. + + - `required Networking Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonElement Type "unrestricted"constant` + + Network policy type + + - `class BetaLimitedNetwork:` + + Limited network access. + + - `required Boolean AllowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `required Boolean AllowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `required IReadOnlyList AllowedHosts` + + Specifies domains the container can reach. + + - `JsonElement Type "limited"constant` + + Network policy type + + - `required BetaPackages Packages` + + Package manager configuration. + + - `required IReadOnlyList Apt` + + Ubuntu/Debian packages to install + + - `required IReadOnlyList Cargo` + + Rust packages to install + + - `required IReadOnlyList Gem` + + Ruby packages to install + + - `required IReadOnlyList Go` + + Go packages to install + + - `required IReadOnlyList Npm` + + Node.js packages to install + + - `required IReadOnlyList Pip` + + Python packages to install + + - `Type Type` + + Package configuration type + + - `"packages"Packages` + + - `JsonElement Type "cloud"constant` + + Environment type + + - `required string CreatedAt` + + RFC 3339 timestamp when environment was created + + - `required string Description` + + User-provided description for the environment + + - `required IReadOnlyDictionary Metadata` + + User-provided metadata key-value pairs + + - `required string Name` + + Human-readable name for the environment + + - `JsonElement Type "environment"constant` + + The type of object (always 'environment') + + - `required string UpdatedAt` + + RFC 3339 timestamp when environment was last updated + +### Example + +```csharp +EnvironmentUpdateParams parameters = new() +{ + EnvironmentID = "env_011CZkZ9X2dpNyB7HsEFoRfW" +}; + +var betaEnvironment = await client.Beta.Environments.Update(parameters); + +Console.WriteLine(betaEnvironment); +``` + +## Delete + +`BetaEnvironmentDeleteResponse Beta.Environments.Delete(EnvironmentDeleteParamsparameters, CancellationTokencancellationToken = default)` + +**delete** `/v1/environments/{environment_id}` + +Delete an environment by ID. Returns a confirmation of the deletion. + +### Parameters + +- `EnvironmentDeleteParams parameters` + + - `required string environmentID` + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaEnvironmentDeleteResponse:` + + Response after deleting an environment. + + - `required string ID` + + Environment identifier + + - `JsonElement Type "environment_deleted"constant` + + The type of response + +### Example + +```csharp +EnvironmentDeleteParams parameters = new() +{ + EnvironmentID = "env_011CZkZ9X2dpNyB7HsEFoRfW" +}; + +var betaEnvironmentDeleteResponse = await client.Beta.Environments.Delete(parameters); + +Console.WriteLine(betaEnvironmentDeleteResponse); +``` + +## Archive + +`BetaEnvironment Beta.Environments.Archive(EnvironmentArchiveParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/environments/{environment_id}/archive` + +Archive an environment by ID. Archived environments cannot be used to create new sessions. + +### Parameters + +- `EnvironmentArchiveParams parameters` + + - `required string environmentID` + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaEnvironment:` + + Unified Environment resource for both cloud and BYOC environments. + + - `required string ID` + + Environment identifier (e.g., 'env_...') + + - `required string? ArchivedAt` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `required BetaCloudConfig Config` + + `cloud` environment configuration. + + - `required Networking Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonElement Type "unrestricted"constant` + + Network policy type + + - `class BetaLimitedNetwork:` + + Limited network access. + + - `required Boolean AllowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `required Boolean AllowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `required IReadOnlyList AllowedHosts` + + Specifies domains the container can reach. + + - `JsonElement Type "limited"constant` + + Network policy type + + - `required BetaPackages Packages` + + Package manager configuration. + + - `required IReadOnlyList Apt` + + Ubuntu/Debian packages to install + + - `required IReadOnlyList Cargo` + + Rust packages to install + + - `required IReadOnlyList Gem` + + Ruby packages to install + + - `required IReadOnlyList Go` + + Go packages to install + + - `required IReadOnlyList Npm` + + Node.js packages to install + + - `required IReadOnlyList Pip` + + Python packages to install + + - `Type Type` + + Package configuration type + + - `"packages"Packages` + + - `JsonElement Type "cloud"constant` + + Environment type + + - `required string CreatedAt` + + RFC 3339 timestamp when environment was created + + - `required string Description` + + User-provided description for the environment + + - `required IReadOnlyDictionary Metadata` + + User-provided metadata key-value pairs + + - `required string Name` + + Human-readable name for the environment + + - `JsonElement Type "environment"constant` + + The type of object (always 'environment') + + - `required string UpdatedAt` + + RFC 3339 timestamp when environment was last updated + +### Example + +```csharp +EnvironmentArchiveParams parameters = new() +{ + EnvironmentID = "env_011CZkZ9X2dpNyB7HsEFoRfW" +}; + +var betaEnvironment = await client.Beta.Environments.Archive(parameters); + +Console.WriteLine(betaEnvironment); +``` + +## Domain Types + +### Beta Cloud Config + +- `class BetaCloudConfig:` + + `cloud` environment configuration. + + - `required Networking Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonElement Type "unrestricted"constant` + + Network policy type + + - `class BetaLimitedNetwork:` + + Limited network access. + + - `required Boolean AllowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `required Boolean AllowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `required IReadOnlyList AllowedHosts` + + Specifies domains the container can reach. + + - `JsonElement Type "limited"constant` + + Network policy type + + - `required BetaPackages Packages` + + Package manager configuration. + + - `required IReadOnlyList Apt` + + Ubuntu/Debian packages to install + + - `required IReadOnlyList Cargo` + + Rust packages to install + + - `required IReadOnlyList Gem` + + Ruby packages to install + + - `required IReadOnlyList Go` + + Go packages to install + + - `required IReadOnlyList Npm` + + Node.js packages to install + + - `required IReadOnlyList Pip` + + Python packages to install + + - `Type Type` + + Package configuration type + + - `"packages"Packages` + + - `JsonElement Type "cloud"constant` + + Environment type + +### Beta Cloud Config Params + +- `class BetaCloudConfigParams:` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `JsonElement Type "cloud"constant` + + Environment type + + - `Networking? Networking` + + Network configuration policy. Omit on update to preserve the existing value. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonElement Type "unrestricted"constant` + + Network policy type + + - `class BetaLimitedNetworkParams:` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `JsonElement Type "limited"constant` + + Network policy type + + - `Boolean? AllowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `Boolean? AllowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `IReadOnlyList? AllowedHosts` + + Specifies domains the container can reach. + + - `BetaPackagesParams? Packages` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `IReadOnlyList? Apt` + + Ubuntu/Debian packages to install + + - `IReadOnlyList? Cargo` + + Rust packages to install + + - `IReadOnlyList? Gem` + + Ruby packages to install + + - `IReadOnlyList? Go` + + Go packages to install + + - `IReadOnlyList? Npm` + + Node.js packages to install + + - `IReadOnlyList? Pip` + + Python packages to install + + - `Type Type` + + Package configuration type + + - `"packages"Packages` + +### Beta Environment + +- `class BetaEnvironment:` + + Unified Environment resource for both cloud and BYOC environments. + + - `required string ID` + + Environment identifier (e.g., 'env_...') + + - `required string? ArchivedAt` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `required BetaCloudConfig Config` + + `cloud` environment configuration. + + - `required Networking Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonElement Type "unrestricted"constant` + + Network policy type + + - `class BetaLimitedNetwork:` + + Limited network access. + + - `required Boolean AllowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `required Boolean AllowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `required IReadOnlyList AllowedHosts` + + Specifies domains the container can reach. + + - `JsonElement Type "limited"constant` + + Network policy type + + - `required BetaPackages Packages` + + Package manager configuration. + + - `required IReadOnlyList Apt` + + Ubuntu/Debian packages to install + + - `required IReadOnlyList Cargo` + + Rust packages to install + + - `required IReadOnlyList Gem` + + Ruby packages to install + + - `required IReadOnlyList Go` + + Go packages to install + + - `required IReadOnlyList Npm` + + Node.js packages to install + + - `required IReadOnlyList Pip` + + Python packages to install + + - `Type Type` + + Package configuration type + + - `"packages"Packages` + + - `JsonElement Type "cloud"constant` + + Environment type + + - `required string CreatedAt` + + RFC 3339 timestamp when environment was created + + - `required string Description` + + User-provided description for the environment + + - `required IReadOnlyDictionary Metadata` + + User-provided metadata key-value pairs + + - `required string Name` + + Human-readable name for the environment + + - `JsonElement Type "environment"constant` + + The type of object (always 'environment') + + - `required string UpdatedAt` + + RFC 3339 timestamp when environment was last updated + +### Beta Environment Delete Response + +- `class BetaEnvironmentDeleteResponse:` + + Response after deleting an environment. + + - `required string ID` + + Environment identifier + + - `JsonElement Type "environment_deleted"constant` + + The type of response + +### Beta Limited Network + +- `class BetaLimitedNetwork:` + + Limited network access. + + - `required Boolean AllowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `required Boolean AllowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `required IReadOnlyList AllowedHosts` + + Specifies domains the container can reach. + + - `JsonElement Type "limited"constant` + + Network policy type + +### Beta Limited Network Params + +- `class BetaLimitedNetworkParams:` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `JsonElement Type "limited"constant` + + Network policy type + + - `Boolean? AllowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `Boolean? AllowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `IReadOnlyList? AllowedHosts` + + Specifies domains the container can reach. + +### Beta Packages + +- `class BetaPackages:` + + Packages (and their versions) available in this environment. + + - `required IReadOnlyList Apt` + + Ubuntu/Debian packages to install + + - `required IReadOnlyList Cargo` + + Rust packages to install + + - `required IReadOnlyList Gem` + + Ruby packages to install + + - `required IReadOnlyList Go` + + Go packages to install + + - `required IReadOnlyList Npm` + + Node.js packages to install + + - `required IReadOnlyList Pip` + + Python packages to install + + - `Type Type` + + Package configuration type + + - `"packages"Packages` + +### Beta Packages Params + +- `class BetaPackagesParams:` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `IReadOnlyList? Apt` + + Ubuntu/Debian packages to install + + - `IReadOnlyList? Cargo` + + Rust packages to install + + - `IReadOnlyList? Gem` + + Ruby packages to install + + - `IReadOnlyList? Go` + + Go packages to install + + - `IReadOnlyList? Npm` + + Node.js packages to install + + - `IReadOnlyList? Pip` + + Python packages to install + + - `Type Type` + + Package configuration type + + - `"packages"Packages` + +### Beta Unrestricted Network + +- `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonElement Type "unrestricted"constant` + + Network policy type diff --git a/content/en/api/csharp/beta/environments/archive.md b/content/en/api/csharp/beta/environments/archive.md new file mode 100644 index 000000000..f77d17754 --- /dev/null +++ b/content/en/api/csharp/beta/environments/archive.md @@ -0,0 +1,184 @@ +## Archive + +`BetaEnvironment Beta.Environments.Archive(EnvironmentArchiveParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/environments/{environment_id}/archive` + +Archive an environment by ID. Archived environments cannot be used to create new sessions. + +### Parameters + +- `EnvironmentArchiveParams parameters` + + - `required string environmentID` + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaEnvironment:` + + Unified Environment resource for both cloud and BYOC environments. + + - `required string ID` + + Environment identifier (e.g., 'env_...') + + - `required string? ArchivedAt` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `required BetaCloudConfig Config` + + `cloud` environment configuration. + + - `required Networking Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonElement Type "unrestricted"constant` + + Network policy type + + - `class BetaLimitedNetwork:` + + Limited network access. + + - `required Boolean AllowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `required Boolean AllowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `required IReadOnlyList AllowedHosts` + + Specifies domains the container can reach. + + - `JsonElement Type "limited"constant` + + Network policy type + + - `required BetaPackages Packages` + + Package manager configuration. + + - `required IReadOnlyList Apt` + + Ubuntu/Debian packages to install + + - `required IReadOnlyList Cargo` + + Rust packages to install + + - `required IReadOnlyList Gem` + + Ruby packages to install + + - `required IReadOnlyList Go` + + Go packages to install + + - `required IReadOnlyList Npm` + + Node.js packages to install + + - `required IReadOnlyList Pip` + + Python packages to install + + - `Type Type` + + Package configuration type + + - `"packages"Packages` + + - `JsonElement Type "cloud"constant` + + Environment type + + - `required string CreatedAt` + + RFC 3339 timestamp when environment was created + + - `required string Description` + + User-provided description for the environment + + - `required IReadOnlyDictionary Metadata` + + User-provided metadata key-value pairs + + - `required string Name` + + Human-readable name for the environment + + - `JsonElement Type "environment"constant` + + The type of object (always 'environment') + + - `required string UpdatedAt` + + RFC 3339 timestamp when environment was last updated + +### Example + +```csharp +EnvironmentArchiveParams parameters = new() +{ + EnvironmentID = "env_011CZkZ9X2dpNyB7HsEFoRfW" +}; + +var betaEnvironment = await client.Beta.Environments.Archive(parameters); + +Console.WriteLine(betaEnvironment); +``` diff --git a/content/en/api/csharp/beta/environments/create.md b/content/en/api/csharp/beta/environments/create.md new file mode 100644 index 000000000..9e7943614 --- /dev/null +++ b/content/en/api/csharp/beta/environments/create.md @@ -0,0 +1,198 @@ +## Create + +`BetaEnvironment Beta.Environments.Create(EnvironmentCreateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/environments` + +Create a new environment with the specified configuration. + +### Parameters + +- `EnvironmentCreateParams parameters` + + - `required string name` + + Body param: Human-readable name for the environment + + - `BetaCloudConfigParams? config` + + Body param: Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `string? description` + + Body param: Optional description of the environment + + - `IReadOnlyDictionary metadata` + + Body param: User-provided metadata key-value pairs + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaEnvironment:` + + Unified Environment resource for both cloud and BYOC environments. + + - `required string ID` + + Environment identifier (e.g., 'env_...') + + - `required string? ArchivedAt` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `required BetaCloudConfig Config` + + `cloud` environment configuration. + + - `required Networking Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonElement Type "unrestricted"constant` + + Network policy type + + - `class BetaLimitedNetwork:` + + Limited network access. + + - `required Boolean AllowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `required Boolean AllowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `required IReadOnlyList AllowedHosts` + + Specifies domains the container can reach. + + - `JsonElement Type "limited"constant` + + Network policy type + + - `required BetaPackages Packages` + + Package manager configuration. + + - `required IReadOnlyList Apt` + + Ubuntu/Debian packages to install + + - `required IReadOnlyList Cargo` + + Rust packages to install + + - `required IReadOnlyList Gem` + + Ruby packages to install + + - `required IReadOnlyList Go` + + Go packages to install + + - `required IReadOnlyList Npm` + + Node.js packages to install + + - `required IReadOnlyList Pip` + + Python packages to install + + - `Type Type` + + Package configuration type + + - `"packages"Packages` + + - `JsonElement Type "cloud"constant` + + Environment type + + - `required string CreatedAt` + + RFC 3339 timestamp when environment was created + + - `required string Description` + + User-provided description for the environment + + - `required IReadOnlyDictionary Metadata` + + User-provided metadata key-value pairs + + - `required string Name` + + Human-readable name for the environment + + - `JsonElement Type "environment"constant` + + The type of object (always 'environment') + + - `required string UpdatedAt` + + RFC 3339 timestamp when environment was last updated + +### Example + +```csharp +EnvironmentCreateParams parameters = new() { Name = "python-data-analysis" }; + +var betaEnvironment = await client.Beta.Environments.Create(parameters); + +Console.WriteLine(betaEnvironment); +``` diff --git a/content/en/api/csharp/beta/environments/delete.md b/content/en/api/csharp/beta/environments/delete.md new file mode 100644 index 000000000..2f23db698 --- /dev/null +++ b/content/en/api/csharp/beta/environments/delete.md @@ -0,0 +1,86 @@ +## Delete + +`BetaEnvironmentDeleteResponse Beta.Environments.Delete(EnvironmentDeleteParamsparameters, CancellationTokencancellationToken = default)` + +**delete** `/v1/environments/{environment_id}` + +Delete an environment by ID. Returns a confirmation of the deletion. + +### Parameters + +- `EnvironmentDeleteParams parameters` + + - `required string environmentID` + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaEnvironmentDeleteResponse:` + + Response after deleting an environment. + + - `required string ID` + + Environment identifier + + - `JsonElement Type "environment_deleted"constant` + + The type of response + +### Example + +```csharp +EnvironmentDeleteParams parameters = new() +{ + EnvironmentID = "env_011CZkZ9X2dpNyB7HsEFoRfW" +}; + +var betaEnvironmentDeleteResponse = await client.Beta.Environments.Delete(parameters); + +Console.WriteLine(betaEnvironmentDeleteResponse); +``` diff --git a/content/en/api/csharp/beta/environments/list.md b/content/en/api/csharp/beta/environments/list.md new file mode 100644 index 000000000..76e193cf0 --- /dev/null +++ b/content/en/api/csharp/beta/environments/list.md @@ -0,0 +1,204 @@ +## List + +`EnvironmentListPageResponse Beta.Environments.List(EnvironmentListParams?parameters, CancellationTokencancellationToken = default)` + +**get** `/v1/environments` + +List environments with pagination support. + +### Parameters + +- `EnvironmentListParams parameters` + + - `Boolean includeArchived` + + Query param: Include archived environments in the response + + - `Long limit` + + Query param: Maximum number of environments to return + + - `string? page` + + Query param: Opaque cursor from previous response for pagination. Pass the `next_page` value from the previous response. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class EnvironmentListPageResponse:` + + Response when listing environments. + + This response model uses opaque cursor-based pagination. Use the `page` + query parameter with the value from `next_page` to fetch the next page. + + - `required IReadOnlyList Data` + + List of environments. + + - `required string ID` + + Environment identifier (e.g., 'env_...') + + - `required string? ArchivedAt` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `required BetaCloudConfig Config` + + `cloud` environment configuration. + + - `required Networking Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonElement Type "unrestricted"constant` + + Network policy type + + - `class BetaLimitedNetwork:` + + Limited network access. + + - `required Boolean AllowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `required Boolean AllowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `required IReadOnlyList AllowedHosts` + + Specifies domains the container can reach. + + - `JsonElement Type "limited"constant` + + Network policy type + + - `required BetaPackages Packages` + + Package manager configuration. + + - `required IReadOnlyList Apt` + + Ubuntu/Debian packages to install + + - `required IReadOnlyList Cargo` + + Rust packages to install + + - `required IReadOnlyList Gem` + + Ruby packages to install + + - `required IReadOnlyList Go` + + Go packages to install + + - `required IReadOnlyList Npm` + + Node.js packages to install + + - `required IReadOnlyList Pip` + + Python packages to install + + - `Type Type` + + Package configuration type + + - `"packages"Packages` + + - `JsonElement Type "cloud"constant` + + Environment type + + - `required string CreatedAt` + + RFC 3339 timestamp when environment was created + + - `required string Description` + + User-provided description for the environment + + - `required IReadOnlyDictionary Metadata` + + User-provided metadata key-value pairs + + - `required string Name` + + Human-readable name for the environment + + - `JsonElement Type "environment"constant` + + The type of object (always 'environment') + + - `required string UpdatedAt` + + RFC 3339 timestamp when environment was last updated + + - `required string? NextPage` + + Token for fetching the next page of results. If `null`, there are no more results available. Pass this value to the `page` parameter in the next request. + +### Example + +```csharp +EnvironmentListParams parameters = new(); + +var page = await client.Beta.Environments.List(parameters); +await foreach (var item in page.Paginate()) +{ + Console.WriteLine(item); +} +``` diff --git a/content/en/api/csharp/beta/environments/retrieve.md b/content/en/api/csharp/beta/environments/retrieve.md new file mode 100644 index 000000000..2a5439941 --- /dev/null +++ b/content/en/api/csharp/beta/environments/retrieve.md @@ -0,0 +1,184 @@ +## Retrieve + +`BetaEnvironment Beta.Environments.Retrieve(EnvironmentRetrieveParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/environments/{environment_id}` + +Retrieve a specific environment by ID. + +### Parameters + +- `EnvironmentRetrieveParams parameters` + + - `required string environmentID` + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaEnvironment:` + + Unified Environment resource for both cloud and BYOC environments. + + - `required string ID` + + Environment identifier (e.g., 'env_...') + + - `required string? ArchivedAt` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `required BetaCloudConfig Config` + + `cloud` environment configuration. + + - `required Networking Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonElement Type "unrestricted"constant` + + Network policy type + + - `class BetaLimitedNetwork:` + + Limited network access. + + - `required Boolean AllowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `required Boolean AllowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `required IReadOnlyList AllowedHosts` + + Specifies domains the container can reach. + + - `JsonElement Type "limited"constant` + + Network policy type + + - `required BetaPackages Packages` + + Package manager configuration. + + - `required IReadOnlyList Apt` + + Ubuntu/Debian packages to install + + - `required IReadOnlyList Cargo` + + Rust packages to install + + - `required IReadOnlyList Gem` + + Ruby packages to install + + - `required IReadOnlyList Go` + + Go packages to install + + - `required IReadOnlyList Npm` + + Node.js packages to install + + - `required IReadOnlyList Pip` + + Python packages to install + + - `Type Type` + + Package configuration type + + - `"packages"Packages` + + - `JsonElement Type "cloud"constant` + + Environment type + + - `required string CreatedAt` + + RFC 3339 timestamp when environment was created + + - `required string Description` + + User-provided description for the environment + + - `required IReadOnlyDictionary Metadata` + + User-provided metadata key-value pairs + + - `required string Name` + + Human-readable name for the environment + + - `JsonElement Type "environment"constant` + + The type of object (always 'environment') + + - `required string UpdatedAt` + + RFC 3339 timestamp when environment was last updated + +### Example + +```csharp +EnvironmentRetrieveParams parameters = new() +{ + EnvironmentID = "env_011CZkZ9X2dpNyB7HsEFoRfW" +}; + +var betaEnvironment = await client.Beta.Environments.Retrieve(parameters); + +Console.WriteLine(betaEnvironment); +``` diff --git a/content/en/api/csharp/beta/environments/update.md b/content/en/api/csharp/beta/environments/update.md new file mode 100644 index 000000000..0caa1992f --- /dev/null +++ b/content/en/api/csharp/beta/environments/update.md @@ -0,0 +1,205 @@ +## Update + +`BetaEnvironment Beta.Environments.Update(EnvironmentUpdateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/environments/{environment_id}` + +Update an existing environment's configuration. + +### Parameters + +- `EnvironmentUpdateParams parameters` + + - `required string environmentID` + + Path param + + - `BetaCloudConfigParams? config` + + Body param: Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `string? description` + + Body param: Updated description of the environment + + - `IReadOnlyDictionary metadata` + + Body param: User-provided metadata key-value pairs. Set a value to null or empty string to delete the key. + + - `string? name` + + Body param: Updated name for the environment + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaEnvironment:` + + Unified Environment resource for both cloud and BYOC environments. + + - `required string ID` + + Environment identifier (e.g., 'env_...') + + - `required string? ArchivedAt` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `required BetaCloudConfig Config` + + `cloud` environment configuration. + + - `required Networking Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonElement Type "unrestricted"constant` + + Network policy type + + - `class BetaLimitedNetwork:` + + Limited network access. + + - `required Boolean AllowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `required Boolean AllowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `required IReadOnlyList AllowedHosts` + + Specifies domains the container can reach. + + - `JsonElement Type "limited"constant` + + Network policy type + + - `required BetaPackages Packages` + + Package manager configuration. + + - `required IReadOnlyList Apt` + + Ubuntu/Debian packages to install + + - `required IReadOnlyList Cargo` + + Rust packages to install + + - `required IReadOnlyList Gem` + + Ruby packages to install + + - `required IReadOnlyList Go` + + Go packages to install + + - `required IReadOnlyList Npm` + + Node.js packages to install + + - `required IReadOnlyList Pip` + + Python packages to install + + - `Type Type` + + Package configuration type + + - `"packages"Packages` + + - `JsonElement Type "cloud"constant` + + Environment type + + - `required string CreatedAt` + + RFC 3339 timestamp when environment was created + + - `required string Description` + + User-provided description for the environment + + - `required IReadOnlyDictionary Metadata` + + User-provided metadata key-value pairs + + - `required string Name` + + Human-readable name for the environment + + - `JsonElement Type "environment"constant` + + The type of object (always 'environment') + + - `required string UpdatedAt` + + RFC 3339 timestamp when environment was last updated + +### Example + +```csharp +EnvironmentUpdateParams parameters = new() +{ + EnvironmentID = "env_011CZkZ9X2dpNyB7HsEFoRfW" +}; + +var betaEnvironment = await client.Beta.Environments.Update(parameters); + +Console.WriteLine(betaEnvironment); +``` diff --git a/content/en/api/csharp/beta/files.md b/content/en/api/csharp/beta/files.md index 6d97185f1..bc3a1f0a6 100644 --- a/content/en/api/csharp/beta/files.md +++ b/content/en/api/csharp/beta/files.md @@ -62,8 +62,6 @@ Upload File - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class FileMetadata:` @@ -100,6 +98,18 @@ Upload File Whether the file can be downloaded. + - `BetaFileScope? Scope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `required string ID` + + The ID of the scoping resource (e.g., the session ID). + + - `JsonElement Type "session"constant` + + The type of scope (e.g., `"session"`). + ### Example ```csharp @@ -139,6 +149,10 @@ List Files Defaults to `20`. Ranges from `1` to `1000`. + - `string scopeID` + + Query param: Filter by scope ID. Only returns files associated with the specified scope (e.g., a session ID). + - `IReadOnlyList betas` Header param: Optional header to specify the beta version(s) you want to use. @@ -185,8 +199,6 @@ List Files - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class FileListPageResponse:` @@ -227,6 +239,18 @@ List Files Whether the file can be downloaded. + - `BetaFileScope? Scope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `required string ID` + + The ID of the scoping resource (e.g., the session ID). + + - `JsonElement Type "session"constant` + + The type of scope (e.g., `"session"`). + - `string? FirstID` ID of the first file in this page of results. @@ -313,8 +337,6 @@ Download File - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Example ```csharp @@ -387,8 +409,6 @@ Get File Metadata - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class FileMetadata:` @@ -425,6 +445,18 @@ Get File Metadata Whether the file can be downloaded. + - `BetaFileScope? Scope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `required string ID` + + The ID of the scoping resource (e.g., the session ID). + + - `JsonElement Type "session"constant` + + The type of scope (e.g., `"session"`). + ### Example ```csharp @@ -497,8 +529,6 @@ Delete File - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class DeletedFile:` @@ -527,6 +557,18 @@ Console.WriteLine(deletedFile); ## Domain Types +### Beta File Scope + +- `class BetaFileScope:` + + - `required string ID` + + The ID of the scoping resource (e.g., the session ID). + + - `JsonElement Type "session"constant` + + The type of scope (e.g., `"session"`). + ### Deleted File - `class DeletedFile:` @@ -578,3 +620,15 @@ Console.WriteLine(deletedFile); - `Boolean Downloadable` Whether the file can be downloaded. + + - `BetaFileScope? Scope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `required string ID` + + The ID of the scoping resource (e.g., the session ID). + + - `JsonElement Type "session"constant` + + The type of scope (e.g., `"session"`). diff --git a/content/en/api/csharp/beta/files/delete.md b/content/en/api/csharp/beta/files/delete.md index de5acdea8..a17f02dc4 100644 --- a/content/en/api/csharp/beta/files/delete.md +++ b/content/en/api/csharp/beta/files/delete.md @@ -60,8 +60,6 @@ Delete File - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class DeletedFile:` diff --git a/content/en/api/csharp/beta/files/download.md b/content/en/api/csharp/beta/files/download.md index 756aa1cc5..3002bb749 100644 --- a/content/en/api/csharp/beta/files/download.md +++ b/content/en/api/csharp/beta/files/download.md @@ -60,8 +60,6 @@ Download File - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Example ```csharp diff --git a/content/en/api/csharp/beta/files/list.md b/content/en/api/csharp/beta/files/list.md index 81859978f..fb48b1b4d 100644 --- a/content/en/api/csharp/beta/files/list.md +++ b/content/en/api/csharp/beta/files/list.md @@ -24,6 +24,10 @@ List Files Defaults to `20`. Ranges from `1` to `1000`. + - `string scopeID` + + Query param: Filter by scope ID. Only returns files associated with the specified scope (e.g., a session ID). + - `IReadOnlyList betas` Header param: Optional header to specify the beta version(s) you want to use. @@ -70,8 +74,6 @@ List Files - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class FileListPageResponse:` @@ -112,6 +114,18 @@ List Files Whether the file can be downloaded. + - `BetaFileScope? Scope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `required string ID` + + The ID of the scoping resource (e.g., the session ID). + + - `JsonElement Type "session"constant` + + The type of scope (e.g., `"session"`). + - `string? FirstID` ID of the first file in this page of results. diff --git a/content/en/api/csharp/beta/files/retrieve_metadata.md b/content/en/api/csharp/beta/files/retrieve_metadata.md index 8f47c3f16..8b3539326 100644 --- a/content/en/api/csharp/beta/files/retrieve_metadata.md +++ b/content/en/api/csharp/beta/files/retrieve_metadata.md @@ -60,8 +60,6 @@ Get File Metadata - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class FileMetadata:` @@ -98,6 +96,18 @@ Get File Metadata Whether the file can be downloaded. + - `BetaFileScope? Scope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `required string ID` + + The ID of the scoping resource (e.g., the session ID). + + - `JsonElement Type "session"constant` + + The type of scope (e.g., `"session"`). + ### Example ```csharp diff --git a/content/en/api/csharp/beta/files/upload.md b/content/en/api/csharp/beta/files/upload.md index 55c9c5f04..39f8358e8 100644 --- a/content/en/api/csharp/beta/files/upload.md +++ b/content/en/api/csharp/beta/files/upload.md @@ -60,8 +60,6 @@ Upload File - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class FileMetadata:` @@ -98,6 +96,18 @@ Upload File Whether the file can be downloaded. + - `BetaFileScope? Scope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `required string ID` + + The ID of the scoping resource (e.g., the session ID). + + - `JsonElement Type "session"constant` + + The type of scope (e.g., `"session"`). + ### Example ```csharp diff --git a/content/en/api/csharp/beta/messages.md b/content/en/api/csharp/beta/messages.md index e942144ca..5200e7641 100644 --- a/content/en/api/csharp/beta/messages.md +++ b/content/en/api/csharp/beta/messages.md @@ -3843,10 +3843,6 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en Recommended for advanced use cases only. You usually only need to use `temperature`. - - `string? userProfileID` - - Body param: The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `IReadOnlyList betas` Header param: Optional header to specify the beta version(s) you want to use. @@ -3893,8 +3889,6 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class BetaMessage:` @@ -4690,9 +4684,13 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -8796,8 +8794,6 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class BetaMessageTokensCount:` @@ -8827,7 +8823,7 @@ MessageCountTokensParams parameters = new() Role = Role.User, }, ], - Model = Model.ClaudeOpus4_6, + Model = Model.ClaudeMythosPreview, }; var betaMessageTokensCount = await client.Beta.Messages.CountTokens(parameters); @@ -14962,9 +14958,13 @@ Console.WriteLine(betaMessageTokensCount); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -19614,9 +19614,13 @@ Console.WriteLine(betaMessageTokensCount); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -20708,9 +20712,13 @@ Console.WriteLine(betaMessageTokensCount); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -30512,9 +30520,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -32395,10 +32407,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Recommended for advanced use cases only. You usually only need to use `temperature`. - - `string? UserProfileID` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `IReadOnlyList betas` Header param: Optional header to specify the beta version(s) you want to use. @@ -32445,8 +32453,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class BetaMessageBatch:` @@ -32703,7 +32709,6 @@ BatchCreateParams parameters = new() ], TopK = 5, TopP = 0.7, - UserProfileID = "user_profile_id", }, }, ], @@ -32778,8 +32783,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class BetaMessageBatch:` @@ -32952,8 +32955,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class BatchListPageResponse:` @@ -33134,8 +33135,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class BetaMessageBatch:` @@ -33300,8 +33299,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class BetaDeletedMessageBatch:` @@ -33392,8 +33389,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class BetaMessageBatchIndividualResponse:` @@ -34207,9 +34202,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -35578,9 +35577,13 @@ await foreach (var betaMessageBatchIndividualResponse in client.Beta.Messages.Ba See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -36776,9 +36779,13 @@ await foreach (var betaMessageBatchIndividualResponse in client.Beta.Messages.Ba See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -37936,9 +37943,13 @@ await foreach (var betaMessageBatchIndividualResponse in client.Beta.Messages.Ba See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` diff --git a/content/en/api/csharp/beta/messages/batches.md b/content/en/api/csharp/beta/messages/batches.md index 335f474d9..3d9236a08 100644 --- a/content/en/api/csharp/beta/messages/batches.md +++ b/content/en/api/csharp/beta/messages/batches.md @@ -2269,9 +2269,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -4152,10 +4156,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Recommended for advanced use cases only. You usually only need to use `temperature`. - - `string? UserProfileID` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `IReadOnlyList betas` Header param: Optional header to specify the beta version(s) you want to use. @@ -4202,8 +4202,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class BetaMessageBatch:` @@ -4460,7 +4458,6 @@ BatchCreateParams parameters = new() ], TopK = 5, TopP = 0.7, - UserProfileID = "user_profile_id", }, }, ], @@ -4535,8 +4532,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class BetaMessageBatch:` @@ -4709,8 +4704,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class BatchListPageResponse:` @@ -4891,8 +4884,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class BetaMessageBatch:` @@ -5057,8 +5048,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class BetaDeletedMessageBatch:` @@ -5149,8 +5138,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class BetaMessageBatchIndividualResponse:` @@ -5964,9 +5951,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -7335,9 +7326,13 @@ await foreach (var betaMessageBatchIndividualResponse in client.Beta.Messages.Ba See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -8533,9 +8528,13 @@ await foreach (var betaMessageBatchIndividualResponse in client.Beta.Messages.Ba See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -9693,9 +9692,13 @@ await foreach (var betaMessageBatchIndividualResponse in client.Beta.Messages.Ba See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` diff --git a/content/en/api/csharp/beta/messages/batches/cancel.md b/content/en/api/csharp/beta/messages/batches/cancel.md index 940e86fbe..d8f4e09ac 100644 --- a/content/en/api/csharp/beta/messages/batches/cancel.md +++ b/content/en/api/csharp/beta/messages/batches/cancel.md @@ -64,8 +64,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class BetaMessageBatch:` diff --git a/content/en/api/csharp/beta/messages/batches/create.md b/content/en/api/csharp/beta/messages/batches/create.md index e166c4080..456158959 100644 --- a/content/en/api/csharp/beta/messages/batches/create.md +++ b/content/en/api/csharp/beta/messages/batches/create.md @@ -2267,9 +2267,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -4150,10 +4154,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Recommended for advanced use cases only. You usually only need to use `temperature`. - - `string? UserProfileID` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `IReadOnlyList betas` Header param: Optional header to specify the beta version(s) you want to use. @@ -4200,8 +4200,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class BetaMessageBatch:` @@ -4458,7 +4456,6 @@ BatchCreateParams parameters = new() ], TopK = 5, TopP = 0.7, - UserProfileID = "user_profile_id", }, }, ], diff --git a/content/en/api/csharp/beta/messages/batches/delete.md b/content/en/api/csharp/beta/messages/batches/delete.md index 2bbfc8e71..de0cec201 100644 --- a/content/en/api/csharp/beta/messages/batches/delete.md +++ b/content/en/api/csharp/beta/messages/batches/delete.md @@ -64,8 +64,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class BetaDeletedMessageBatch:` diff --git a/content/en/api/csharp/beta/messages/batches/list.md b/content/en/api/csharp/beta/messages/batches/list.md index 40b45ba44..af714accc 100644 --- a/content/en/api/csharp/beta/messages/batches/list.md +++ b/content/en/api/csharp/beta/messages/batches/list.md @@ -72,8 +72,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class BatchListPageResponse:` diff --git a/content/en/api/csharp/beta/messages/batches/results.md b/content/en/api/csharp/beta/messages/batches/results.md index 075bbbba3..c9b05a0e3 100644 --- a/content/en/api/csharp/beta/messages/batches/results.md +++ b/content/en/api/csharp/beta/messages/batches/results.md @@ -64,8 +64,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class BetaMessageBatchIndividualResponse:` @@ -879,9 +877,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` diff --git a/content/en/api/csharp/beta/messages/batches/retrieve.md b/content/en/api/csharp/beta/messages/batches/retrieve.md index 120cd39b4..759e7229d 100644 --- a/content/en/api/csharp/beta/messages/batches/retrieve.md +++ b/content/en/api/csharp/beta/messages/batches/retrieve.md @@ -62,8 +62,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class BetaMessageBatch:` diff --git a/content/en/api/csharp/beta/messages/count_tokens.md b/content/en/api/csharp/beta/messages/count_tokens.md index 7da0539c7..87f80a717 100644 --- a/content/en/api/csharp/beta/messages/count_tokens.md +++ b/content/en/api/csharp/beta/messages/count_tokens.md @@ -3795,8 +3795,6 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class BetaMessageTokensCount:` @@ -3826,7 +3824,7 @@ MessageCountTokensParams parameters = new() Role = Role.User, }, ], - Model = Model.ClaudeOpus4_6, + Model = Model.ClaudeMythosPreview, }; var betaMessageTokensCount = await client.Beta.Messages.CountTokens(parameters); diff --git a/content/en/api/csharp/beta/messages/create.md b/content/en/api/csharp/beta/messages/create.md index 12ed43cbc..a1ce597e6 100644 --- a/content/en/api/csharp/beta/messages/create.md +++ b/content/en/api/csharp/beta/messages/create.md @@ -3841,10 +3841,6 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en Recommended for advanced use cases only. You usually only need to use `temperature`. - - `string? userProfileID` - - Body param: The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `IReadOnlyList betas` Header param: Optional header to specify the beta version(s) you want to use. @@ -3891,8 +3887,6 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class BetaMessage:` @@ -4688,9 +4682,13 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` diff --git a/content/en/api/csharp/beta/models.md b/content/en/api/csharp/beta/models.md index f900cde32..fe0a0a7b3 100644 --- a/content/en/api/csharp/beta/models.md +++ b/content/en/api/csharp/beta/models.md @@ -74,8 +74,6 @@ The Models API response can be used to determine which models are available for - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class ModelListPageResponse:` @@ -348,8 +346,6 @@ The Models API response can be used to determine information about a specific mo - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class BetaModelInfo:` diff --git a/content/en/api/csharp/beta/models/list.md b/content/en/api/csharp/beta/models/list.md index 99701c992..aec631a6e 100644 --- a/content/en/api/csharp/beta/models/list.md +++ b/content/en/api/csharp/beta/models/list.md @@ -72,8 +72,6 @@ The Models API response can be used to determine which models are available for - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class ModelListPageResponse:` diff --git a/content/en/api/csharp/beta/models/retrieve.md b/content/en/api/csharp/beta/models/retrieve.md index 231d82a10..8a883df44 100644 --- a/content/en/api/csharp/beta/models/retrieve.md +++ b/content/en/api/csharp/beta/models/retrieve.md @@ -62,8 +62,6 @@ The Models API response can be used to determine information about a specific mo - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class BetaModelInfo:` diff --git a/content/en/api/csharp/beta/sessions.md b/content/en/api/csharp/beta/sessions.md new file mode 100644 index 000000000..633a1cb55 --- /dev/null +++ b/content/en/api/csharp/beta/sessions.md @@ -0,0 +1,14073 @@ +# Sessions + +## Create + +`BetaManagedAgentsSession Beta.Sessions.Create(SessionCreateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/sessions` + +Create Session + +### Parameters + +- `SessionCreateParams parameters` + + - `required Agent agent` + + Body param: Agent identifier. Accepts the `agent` ID string, which pins the latest version for the session, or an `agent` object with both id and version specified. + + - `string` + + - `class BetaManagedAgentsAgentParams:` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `required string ID` + + The `agent` ID. + + - `required Type Type` + + - `"agent"Agent` + + - `Int Version` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + + - `required string environmentID` + + Body param: ID of the `environment` defining the container configuration for this session. + + - `IReadOnlyDictionary metadata` + + Body param: Arbitrary key-value metadata attached to the session. + + - `IReadOnlyList resources` + + Body param: Resources (e.g. repositories, files) to mount into the session's container. + + - `class BetaManagedAgentsGitHubRepositoryResourceParams:` + + Mount a GitHub repository into the session's container. + + - `required string AuthorizationToken` + + GitHub authorization token used to clone the repository. + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required string Url` + + Github URL of the repository + + - `Checkout? Checkout` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `string? MountPath` + + Mount path in the container. Defaults to `/workspace/`. + + - `class BetaManagedAgentsFileResourceParams:` + + Mount a file uploaded via the Files API into the session. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `string? MountPath` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + + - `string? title` + + Body param: Human-readable session title. + + - `IReadOnlyList vaultIds` + + Body param: Vault IDs for stored credentials the agent can use during the session. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsSession:` + + A Managed Agents `session`. + + - `required string ID` + + - `required BetaManagedAgentsSessionAgent Agent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `required string ID` + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required Int Version` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string EnvironmentID` + + - `required IReadOnlyDictionary Metadata` + + - `required IReadOnlyList Resources` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionStats Stats` + + Timing statistics for a session. + + - `Double ActiveSeconds` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `Double DurationSeconds` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `required Status Status` + + SessionStatus enum + + - `"rescheduling"Rescheduling` + + - `"running"Running` + + - `"idle"Idle` + + - `"terminated"Terminated` + + - `required string? Title` + + - `required Type Type` + + - `"session"Session` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionUsage Usage` + + Cumulative token usage for a session across all turns. + + - `BetaManagedAgentsCacheCreationUsage CacheCreation` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Int Ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Int Ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + + - `Int CacheReadInputTokens` + + Total tokens read from prompt cache. + + - `Int InputTokens` + + Total input tokens consumed across all turns. + + - `Int OutputTokens` + + Total output tokens generated across all turns. + + - `required IReadOnlyList VaultIds` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```csharp +SessionCreateParams parameters = new() +{ + Agent = "agent_011CZkYpogX7uDKUyvBTophP", + EnvironmentID = "env_011CZkZ9X2dpNyB7HsEFoRfW", +}; + +var betaManagedAgentsSession = await client.Beta.Sessions.Create(parameters); + +Console.WriteLine(betaManagedAgentsSession); +``` + +## List + +`SessionListPageResponse Beta.Sessions.List(SessionListParams?parameters, CancellationTokencancellationToken = default)` + +**get** `/v1/sessions` + +List Sessions + +### Parameters + +- `SessionListParams parameters` + + - `string agentID` + + Query param: Filter sessions created with this agent ID. + + - `Int agentVersion` + + Query param: Filter by agent version. Only applies when agent_id is also set. + + - `DateTimeOffset createdAtGt` + + Query param: Return sessions created after this time (exclusive). + + - `DateTimeOffset createdAtGte` + + Query param: Return sessions created at or after this time (inclusive). + + - `DateTimeOffset createdAtLt` + + Query param: Return sessions created before this time (exclusive). + + - `DateTimeOffset createdAtLte` + + Query param: Return sessions created at or before this time (inclusive). + + - `Boolean includeArchived` + + Query param: When true, includes archived sessions. Default: false (exclude archived). + + - `Int limit` + + Query param: Maximum number of results to return. + + - `Order order` + + Query param: Sort direction for results, ordered by created_at. Defaults to desc (newest first). + + - `"asc"Asc` + + - `"desc"Desc` + + - `string page` + + Query param: Opaque pagination cursor from a previous response's next_page. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class SessionListPageResponse:` + + Paginated list of sessions. + + - `IReadOnlyList Data` + + List of sessions. + + - `required string ID` + + - `required BetaManagedAgentsSessionAgent Agent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `required string ID` + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required Int Version` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string EnvironmentID` + + - `required IReadOnlyDictionary Metadata` + + - `required IReadOnlyList Resources` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionStats Stats` + + Timing statistics for a session. + + - `Double ActiveSeconds` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `Double DurationSeconds` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `required Status Status` + + SessionStatus enum + + - `"rescheduling"Rescheduling` + + - `"running"Running` + + - `"idle"Idle` + + - `"terminated"Terminated` + + - `required string? Title` + + - `required Type Type` + + - `"session"Session` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionUsage Usage` + + Cumulative token usage for a session across all turns. + + - `BetaManagedAgentsCacheCreationUsage CacheCreation` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Int Ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Int Ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + + - `Int CacheReadInputTokens` + + Total tokens read from prompt cache. + + - `Int InputTokens` + + Total input tokens consumed across all turns. + + - `Int OutputTokens` + + Total output tokens generated across all turns. + + - `required IReadOnlyList VaultIds` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + + - `string? NextPage` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```csharp +SessionListParams parameters = new(); + +var page = await client.Beta.Sessions.List(parameters); +await foreach (var item in page.Paginate()) +{ + Console.WriteLine(item); +} +``` + +## Retrieve + +`BetaManagedAgentsSession Beta.Sessions.Retrieve(SessionRetrieveParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/sessions/{session_id}` + +Get Session + +### Parameters + +- `SessionRetrieveParams parameters` + + - `required string sessionID` + + Path parameter session_id + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsSession:` + + A Managed Agents `session`. + + - `required string ID` + + - `required BetaManagedAgentsSessionAgent Agent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `required string ID` + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required Int Version` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string EnvironmentID` + + - `required IReadOnlyDictionary Metadata` + + - `required IReadOnlyList Resources` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionStats Stats` + + Timing statistics for a session. + + - `Double ActiveSeconds` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `Double DurationSeconds` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `required Status Status` + + SessionStatus enum + + - `"rescheduling"Rescheduling` + + - `"running"Running` + + - `"idle"Idle` + + - `"terminated"Terminated` + + - `required string? Title` + + - `required Type Type` + + - `"session"Session` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionUsage Usage` + + Cumulative token usage for a session across all turns. + + - `BetaManagedAgentsCacheCreationUsage CacheCreation` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Int Ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Int Ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + + - `Int CacheReadInputTokens` + + Total tokens read from prompt cache. + + - `Int InputTokens` + + Total input tokens consumed across all turns. + + - `Int OutputTokens` + + Total output tokens generated across all turns. + + - `required IReadOnlyList VaultIds` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```csharp +SessionRetrieveParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7" +}; + +var betaManagedAgentsSession = await client.Beta.Sessions.Retrieve(parameters); + +Console.WriteLine(betaManagedAgentsSession); +``` + +## Update + +`BetaManagedAgentsSession Beta.Sessions.Update(SessionUpdateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/sessions/{session_id}` + +Update Session + +### Parameters + +- `SessionUpdateParams parameters` + + - `required string sessionID` + + Path param: Path parameter session_id + + - `IReadOnlyDictionary? metadata` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. + + - `string? title` + + Body param: Human-readable session title. + + - `IReadOnlyList vaultIds` + + Body param: Vault IDs (`vlt_*`) to attach to the session. Not yet supported; requests setting this field are rejected. Reserved for future use. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsSession:` + + A Managed Agents `session`. + + - `required string ID` + + - `required BetaManagedAgentsSessionAgent Agent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `required string ID` + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required Int Version` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string EnvironmentID` + + - `required IReadOnlyDictionary Metadata` + + - `required IReadOnlyList Resources` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionStats Stats` + + Timing statistics for a session. + + - `Double ActiveSeconds` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `Double DurationSeconds` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `required Status Status` + + SessionStatus enum + + - `"rescheduling"Rescheduling` + + - `"running"Running` + + - `"idle"Idle` + + - `"terminated"Terminated` + + - `required string? Title` + + - `required Type Type` + + - `"session"Session` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionUsage Usage` + + Cumulative token usage for a session across all turns. + + - `BetaManagedAgentsCacheCreationUsage CacheCreation` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Int Ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Int Ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + + - `Int CacheReadInputTokens` + + Total tokens read from prompt cache. + + - `Int InputTokens` + + Total input tokens consumed across all turns. + + - `Int OutputTokens` + + Total output tokens generated across all turns. + + - `required IReadOnlyList VaultIds` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```csharp +SessionUpdateParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7" +}; + +var betaManagedAgentsSession = await client.Beta.Sessions.Update(parameters); + +Console.WriteLine(betaManagedAgentsSession); +``` + +## Delete + +`BetaManagedAgentsDeletedSession Beta.Sessions.Delete(SessionDeleteParamsparameters, CancellationTokencancellationToken = default)` + +**delete** `/v1/sessions/{session_id}` + +Delete Session + +### Parameters + +- `SessionDeleteParams parameters` + + - `required string sessionID` + + Path parameter session_id + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsDeletedSession:` + + Confirmation that a `session` has been permanently deleted. + + - `required string ID` + + - `required Type Type` + + - `"session_deleted"SessionDeleted` + +### Example + +```csharp +SessionDeleteParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7" +}; + +var betaManagedAgentsDeletedSession = await client.Beta.Sessions.Delete(parameters); + +Console.WriteLine(betaManagedAgentsDeletedSession); +``` + +## Archive + +`BetaManagedAgentsSession Beta.Sessions.Archive(SessionArchiveParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/sessions/{session_id}/archive` + +Archive Session + +### Parameters + +- `SessionArchiveParams parameters` + + - `required string sessionID` + + Path parameter session_id + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsSession:` + + A Managed Agents `session`. + + - `required string ID` + + - `required BetaManagedAgentsSessionAgent Agent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `required string ID` + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required Int Version` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string EnvironmentID` + + - `required IReadOnlyDictionary Metadata` + + - `required IReadOnlyList Resources` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionStats Stats` + + Timing statistics for a session. + + - `Double ActiveSeconds` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `Double DurationSeconds` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `required Status Status` + + SessionStatus enum + + - `"rescheduling"Rescheduling` + + - `"running"Running` + + - `"idle"Idle` + + - `"terminated"Terminated` + + - `required string? Title` + + - `required Type Type` + + - `"session"Session` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionUsage Usage` + + Cumulative token usage for a session across all turns. + + - `BetaManagedAgentsCacheCreationUsage CacheCreation` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Int Ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Int Ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + + - `Int CacheReadInputTokens` + + Total tokens read from prompt cache. + + - `Int InputTokens` + + Total input tokens consumed across all turns. + + - `Int OutputTokens` + + Total output tokens generated across all turns. + + - `required IReadOnlyList VaultIds` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```csharp +SessionArchiveParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7" +}; + +var betaManagedAgentsSession = await client.Beta.Sessions.Archive(parameters); + +Console.WriteLine(betaManagedAgentsSession); +``` + +## Domain Types + +### Beta Managed Agents Agent Params + +- `class BetaManagedAgentsAgentParams:` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `required string ID` + + The `agent` ID. + + - `required Type Type` + + - `"agent"Agent` + + - `Int Version` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + +### Beta Managed Agents Branch Checkout + +- `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + +### Beta Managed Agents Cache Creation Usage + +- `class BetaManagedAgentsCacheCreationUsage:` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Int Ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Int Ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + +### Beta Managed Agents Commit Checkout + +- `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + +### Beta Managed Agents Deleted Session + +- `class BetaManagedAgentsDeletedSession:` + + Confirmation that a `session` has been permanently deleted. + + - `required string ID` + + - `required Type Type` + + - `"session_deleted"SessionDeleted` + +### Beta Managed Agents File Resource Params + +- `class BetaManagedAgentsFileResourceParams:` + + Mount a file uploaded via the Files API into the session. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `string? MountPath` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +### Beta Managed Agents GitHub Repository Resource Params + +- `class BetaManagedAgentsGitHubRepositoryResourceParams:` + + Mount a GitHub repository into the session's container. + + - `required string AuthorizationToken` + + GitHub authorization token used to clone the repository. + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required string Url` + + Github URL of the repository + + - `Checkout? Checkout` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `string? MountPath` + + Mount path in the container. Defaults to `/workspace/`. + +### Beta Managed Agents Session + +- `class BetaManagedAgentsSession:` + + A Managed Agents `session`. + + - `required string ID` + + - `required BetaManagedAgentsSessionAgent Agent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `required string ID` + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required Int Version` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string EnvironmentID` + + - `required IReadOnlyDictionary Metadata` + + - `required IReadOnlyList Resources` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionStats Stats` + + Timing statistics for a session. + + - `Double ActiveSeconds` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `Double DurationSeconds` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `required Status Status` + + SessionStatus enum + + - `"rescheduling"Rescheduling` + + - `"running"Running` + + - `"idle"Idle` + + - `"terminated"Terminated` + + - `required string? Title` + + - `required Type Type` + + - `"session"Session` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionUsage Usage` + + Cumulative token usage for a session across all turns. + + - `BetaManagedAgentsCacheCreationUsage CacheCreation` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Int Ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Int Ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + + - `Int CacheReadInputTokens` + + Total tokens read from prompt cache. + + - `Int InputTokens` + + Total input tokens consumed across all turns. + + - `Int OutputTokens` + + Total output tokens generated across all turns. + + - `required IReadOnlyList VaultIds` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Beta Managed Agents Session Agent + +- `class BetaManagedAgentsSessionAgent:` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `required string ID` + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required Int Version` + +### Beta Managed Agents Session Stats + +- `class BetaManagedAgentsSessionStats:` + + Timing statistics for a session. + + - `Double ActiveSeconds` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `Double DurationSeconds` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + +### Beta Managed Agents Session Usage + +- `class BetaManagedAgentsSessionUsage:` + + Cumulative token usage for a session across all turns. + + - `BetaManagedAgentsCacheCreationUsage CacheCreation` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Int Ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Int Ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + + - `Int CacheReadInputTokens` + + Total tokens read from prompt cache. + + - `Int InputTokens` + + Total input tokens consumed across all turns. + + - `Int OutputTokens` + + Total output tokens generated across all turns. + +# Events + +## List + +`EventListPageResponse Beta.Sessions.Events.List(EventListParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/sessions/{session_id}/events` + +List Events + +### Parameters + +- `EventListParams parameters` + + - `required string sessionID` + + Path param: Path parameter session_id + + - `Int limit` + + Query param: Query parameter for limit + + - `Order order` + + Query param: Sort direction for results, ordered by created_at. Defaults to asc (chronological). + + - `"asc"Asc` + + - `"desc"Desc` + + - `string page` + + Query param: Opaque pagination cursor from a previous response's next_page. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class EventListPageResponse:` + + Paginated list of events for a `session`. + + - `IReadOnlyList Data` + + Events for the session, ordered by `created_at`. + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `required string ID` + + Unique identifier for this event. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent:` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the custom tool being called. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.custom_tool_use"AgentCustomToolUse` + + - `class BetaManagedAgentsAgentMessageEvent:` + + An agent response event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of text blocks comprising the agent response. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.message"AgentMessage` + + - `class BetaManagedAgentsAgentThinkingEvent:` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thinking"AgentThinking` + + - `class BetaManagedAgentsAgentMcpToolUseEvent:` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string McpServerName` + + Name of the MCP server providing the tool. + + - `required string Name` + + Name of the MCP tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_use"AgentMcpToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + + - `class BetaManagedAgentsAgentMcpToolResultEvent:` + + Event representing the result of an MCP tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string McpToolUseID` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_result"AgentMcpToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent:` + + Event emitted when the agent invokes a built-in agent tool. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the agent tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.tool_use"AgentToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + + - `class BetaManagedAgentsAgentToolResultEvent:` + + Event representing the result of an agent tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required string ToolUseID` + + The id of the `agent.tool_use` event this result corresponds to. + + - `required Type Type` + + - `"agent.tool_result"AgentToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent:` + + Indicates that context compaction (summarization) occurred during the session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thread_context_compacted"AgentThreadContextCompacted` + + - `class BetaManagedAgentsSessionErrorEvent:` + + An error event indicating a problem occurred during session execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Error Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"unknown_error"UnknownError` + + - `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_overloaded_error"ModelOverloadedError` + + - `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_rate_limited_error"ModelRateLimitedError` + + - `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_request_failed_error"ModelRequestFailedError` + + - `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `required string McpServerName` + + Name of the MCP server that failed to connect. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_connection_failed_error"McpConnectionFailedError` + + - `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `required string McpServerName` + + Name of the MCP server that failed authentication. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_authentication_failed_error"McpAuthenticationFailedError` + + - `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"billing_error"BillingError` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.error"SessionError` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent:` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_rescheduled"SessionStatusRescheduled` + + - `class BetaManagedAgentsSessionStatusRunningEvent:` + + Indicates the session is actively running and the agent is working. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_running"SessionStatusRunning` + + - `class BetaManagedAgentsSessionStatusIdleEvent:` + + Indicates the agent has paused and is awaiting user input. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required StopReason StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `required Type Type` + + - `"end_turn"EndTurn` + + - `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `required IReadOnlyList EventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `required Type Type` + + - `"requires_action"RequiresAction` + + - `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `required Type Type` + + - `"retries_exhausted"RetriesExhausted` + + - `required Type Type` + + - `"session.status_idle"SessionStatusIdle` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent:` + + Indicates the session has terminated, either due to an error or completion. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_terminated"SessionStatusTerminated` + + - `class BetaManagedAgentsSpanModelRequestStartEvent:` + + Emitted when a model request is initiated by the agent. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_start"SpanModelRequestStart` + + - `class BetaManagedAgentsSpanModelRequestEndEvent:` + + Emitted when a model request completes. + + - `required string ID` + + Unique identifier for this event. + + - `required Boolean? IsError` + + Whether the model request resulted in an error. + + - `required string ModelRequestStartID` + + The id of the corresponding `span.model_request_start` event. + + - `required BetaManagedAgentsSpanModelUsage ModelUsage` + + Token usage for a single model request. + + - `required Int CacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `required Int CacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `required Int InputTokens` + + Input tokens consumed by this request. + + - `required Int OutputTokens` + + Output tokens generated by this request. + + - `Speed? Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_end"SpanModelRequestEnd` + + - `class BetaManagedAgentsSessionDeletedEvent:` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.deleted"SessionDeleted` + + - `string? NextPage` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```csharp +EventListParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7" +}; + +var page = await client.Beta.Sessions.Events.List(parameters); +await foreach (var item in page.Paginate()) +{ + Console.WriteLine(item); +} +``` + +## Send + +`BetaManagedAgentsSendSessionEvents Beta.Sessions.Events.Send(EventSendParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/sessions/{session_id}/events` + +Send Events + +### Parameters + +- `EventSendParams parameters` + + - `required string sessionID` + + Path param: Path parameter session_id + + - `required IReadOnlyList events` + + Body param: Events to send to the `session`. + + - `class BetaManagedAgentsUserMessageEventParams:` + + Parameters for sending a user message to the session. + + - `required IReadOnlyList Content` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + + - `class BetaManagedAgentsUserInterruptEventParams:` + + Parameters for sending an interrupt to pause the agent. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + + - `class BetaManagedAgentsUserToolConfirmationEventParams:` + + Parameters for confirming or denying a tool execution request. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `class BetaManagedAgentsUserCustomToolResultEventParams:` + + Parameters for providing the result of a custom tool execution. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsSendSessionEvents:` + + Events that were successfully sent to the session. + + - `IReadOnlyList Data` + + Sent events + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `required string ID` + + Unique identifier for this event. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + +### Example + +```csharp +EventSendParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7", + Events = + [ + new BetaManagedAgentsUserMessageEventParams() + { + Content = + [ + new BetaManagedAgentsTextBlock() + { + Text = "Where is my order #1234?", + Type = Type.Text, + }, + ], + Type = Type.UserMessage, + }, + ], +}; + +var betaManagedAgentsSendSessionEvents = await client.Beta.Sessions.Events.Send(parameters); + +Console.WriteLine(betaManagedAgentsSendSessionEvents); +``` + +## Stream + +`BetaManagedAgentsStreamSessionEvents Beta.Sessions.Events.StreamStreaming(EventStreamParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/sessions/{session_id}/events/stream` + +Stream Events + +### Parameters + +- `EventStreamParams parameters` + + - `required string sessionID` + + Path parameter session_id + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsStreamSessionEvents: A class that can be one of several variants.union` + + Server-sent event in the session stream. + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `required string ID` + + Unique identifier for this event. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent:` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the custom tool being called. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.custom_tool_use"AgentCustomToolUse` + + - `class BetaManagedAgentsAgentMessageEvent:` + + An agent response event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of text blocks comprising the agent response. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.message"AgentMessage` + + - `class BetaManagedAgentsAgentThinkingEvent:` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thinking"AgentThinking` + + - `class BetaManagedAgentsAgentMcpToolUseEvent:` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string McpServerName` + + Name of the MCP server providing the tool. + + - `required string Name` + + Name of the MCP tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_use"AgentMcpToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + + - `class BetaManagedAgentsAgentMcpToolResultEvent:` + + Event representing the result of an MCP tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string McpToolUseID` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_result"AgentMcpToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent:` + + Event emitted when the agent invokes a built-in agent tool. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the agent tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.tool_use"AgentToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + + - `class BetaManagedAgentsAgentToolResultEvent:` + + Event representing the result of an agent tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required string ToolUseID` + + The id of the `agent.tool_use` event this result corresponds to. + + - `required Type Type` + + - `"agent.tool_result"AgentToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent:` + + Indicates that context compaction (summarization) occurred during the session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thread_context_compacted"AgentThreadContextCompacted` + + - `class BetaManagedAgentsSessionErrorEvent:` + + An error event indicating a problem occurred during session execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Error Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"unknown_error"UnknownError` + + - `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_overloaded_error"ModelOverloadedError` + + - `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_rate_limited_error"ModelRateLimitedError` + + - `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_request_failed_error"ModelRequestFailedError` + + - `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `required string McpServerName` + + Name of the MCP server that failed to connect. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_connection_failed_error"McpConnectionFailedError` + + - `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `required string McpServerName` + + Name of the MCP server that failed authentication. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_authentication_failed_error"McpAuthenticationFailedError` + + - `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"billing_error"BillingError` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.error"SessionError` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent:` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_rescheduled"SessionStatusRescheduled` + + - `class BetaManagedAgentsSessionStatusRunningEvent:` + + Indicates the session is actively running and the agent is working. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_running"SessionStatusRunning` + + - `class BetaManagedAgentsSessionStatusIdleEvent:` + + Indicates the agent has paused and is awaiting user input. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required StopReason StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `required Type Type` + + - `"end_turn"EndTurn` + + - `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `required IReadOnlyList EventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `required Type Type` + + - `"requires_action"RequiresAction` + + - `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `required Type Type` + + - `"retries_exhausted"RetriesExhausted` + + - `required Type Type` + + - `"session.status_idle"SessionStatusIdle` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent:` + + Indicates the session has terminated, either due to an error or completion. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_terminated"SessionStatusTerminated` + + - `class BetaManagedAgentsSpanModelRequestStartEvent:` + + Emitted when a model request is initiated by the agent. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_start"SpanModelRequestStart` + + - `class BetaManagedAgentsSpanModelRequestEndEvent:` + + Emitted when a model request completes. + + - `required string ID` + + Unique identifier for this event. + + - `required Boolean? IsError` + + Whether the model request resulted in an error. + + - `required string ModelRequestStartID` + + The id of the corresponding `span.model_request_start` event. + + - `required BetaManagedAgentsSpanModelUsage ModelUsage` + + Token usage for a single model request. + + - `required Int CacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `required Int CacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `required Int InputTokens` + + Input tokens consumed by this request. + + - `required Int OutputTokens` + + Output tokens generated by this request. + + - `Speed? Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_end"SpanModelRequestEnd` + + - `class BetaManagedAgentsSessionDeletedEvent:` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.deleted"SessionDeleted` + +### Example + +```csharp +EventStreamParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7" +}; + +await foreach (var betaManagedAgentsStreamSessionEvents in client.Beta.Sessions.Events.StreamStreaming(parameters)) +{ + Console.WriteLine(betaManagedAgentsStreamSessionEvents); +} +``` + +## Domain Types + +### Beta Managed Agents Agent Custom Tool Use Event + +- `class BetaManagedAgentsAgentCustomToolUseEvent:` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the custom tool being called. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.custom_tool_use"AgentCustomToolUse` + +### Beta Managed Agents Agent MCP Tool Result Event + +- `class BetaManagedAgentsAgentMcpToolResultEvent:` + + Event representing the result of an MCP tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string McpToolUseID` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_result"AgentMcpToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent MCP Tool Use Event + +- `class BetaManagedAgentsAgentMcpToolUseEvent:` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string McpServerName` + + Name of the MCP server providing the tool. + + - `required string Name` + + Name of the MCP tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_use"AgentMcpToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + +### Beta Managed Agents Agent Message Event + +- `class BetaManagedAgentsAgentMessageEvent:` + + An agent response event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of text blocks comprising the agent response. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.message"AgentMessage` + +### Beta Managed Agents Agent Thinking Event + +- `class BetaManagedAgentsAgentThinkingEvent:` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thinking"AgentThinking` + +### Beta Managed Agents Agent Thread Context Compacted Event + +- `class BetaManagedAgentsAgentThreadContextCompactedEvent:` + + Indicates that context compaction (summarization) occurred during the session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thread_context_compacted"AgentThreadContextCompacted` + +### Beta Managed Agents Agent Tool Result Event + +- `class BetaManagedAgentsAgentToolResultEvent:` + + Event representing the result of an agent tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required string ToolUseID` + + The id of the `agent.tool_use` event this result corresponds to. + + - `required Type Type` + + - `"agent.tool_result"AgentToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent Tool Use Event + +- `class BetaManagedAgentsAgentToolUseEvent:` + + Event emitted when the agent invokes a built-in agent tool. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the agent tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.tool_use"AgentToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + +### Beta Managed Agents Base64 Document Source + +- `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + +### Beta Managed Agents Base64 Image Source + +- `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + +### Beta Managed Agents Billing Error + +- `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"billing_error"BillingError` + +### Beta Managed Agents Document Block + +- `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + +### Beta Managed Agents Event Params + +- `class BetaManagedAgentsEventParams: A class that can be one of several variants.union` + + Union type for event parameters that can be sent to a session. + + - `class BetaManagedAgentsUserMessageEventParams:` + + Parameters for sending a user message to the session. + + - `required IReadOnlyList Content` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + + - `class BetaManagedAgentsUserInterruptEventParams:` + + Parameters for sending an interrupt to pause the agent. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + + - `class BetaManagedAgentsUserToolConfirmationEventParams:` + + Parameters for confirming or denying a tool execution request. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `class BetaManagedAgentsUserCustomToolResultEventParams:` + + Parameters for providing the result of a custom tool execution. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents File Document Source + +- `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + +### Beta Managed Agents File Image Source + +- `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + +### Beta Managed Agents Image Block + +- `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + +### Beta Managed Agents MCP Authentication Failed Error + +- `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `required string McpServerName` + + Name of the MCP server that failed authentication. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_authentication_failed_error"McpAuthenticationFailedError` + +### Beta Managed Agents MCP Connection Failed Error + +- `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `required string McpServerName` + + Name of the MCP server that failed to connect. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_connection_failed_error"McpConnectionFailedError` + +### Beta Managed Agents Model Overloaded Error + +- `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_overloaded_error"ModelOverloadedError` + +### Beta Managed Agents Model Rate Limited Error + +- `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_rate_limited_error"ModelRateLimitedError` + +### Beta Managed Agents Model Request Failed Error + +- `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_request_failed_error"ModelRequestFailedError` + +### Beta Managed Agents Plain Text Document Source + +- `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + +### Beta Managed Agents Retry Status Exhausted + +- `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + +### Beta Managed Agents Retry Status Retrying + +- `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + +### Beta Managed Agents Retry Status Terminal + +- `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + +### Beta Managed Agents Send Session Events + +- `class BetaManagedAgentsSendSessionEvents:` + + Events that were successfully sent to the session. + + - `IReadOnlyList Data` + + Sent events + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `required string ID` + + Unique identifier for this event. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + +### Beta Managed Agents Session Deleted Event + +- `class BetaManagedAgentsSessionDeletedEvent:` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.deleted"SessionDeleted` + +### Beta Managed Agents Session End Turn + +- `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `required Type Type` + + - `"end_turn"EndTurn` + +### Beta Managed Agents Session Error Event + +- `class BetaManagedAgentsSessionErrorEvent:` + + An error event indicating a problem occurred during session execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Error Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"unknown_error"UnknownError` + + - `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_overloaded_error"ModelOverloadedError` + + - `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_rate_limited_error"ModelRateLimitedError` + + - `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_request_failed_error"ModelRequestFailedError` + + - `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `required string McpServerName` + + Name of the MCP server that failed to connect. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_connection_failed_error"McpConnectionFailedError` + + - `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `required string McpServerName` + + Name of the MCP server that failed authentication. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_authentication_failed_error"McpAuthenticationFailedError` + + - `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"billing_error"BillingError` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.error"SessionError` + +### Beta Managed Agents Session Event + +- `class BetaManagedAgentsSessionEvent: A class that can be one of several variants.union` + + Union type for all event types in a session. + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `required string ID` + + Unique identifier for this event. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent:` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the custom tool being called. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.custom_tool_use"AgentCustomToolUse` + + - `class BetaManagedAgentsAgentMessageEvent:` + + An agent response event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of text blocks comprising the agent response. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.message"AgentMessage` + + - `class BetaManagedAgentsAgentThinkingEvent:` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thinking"AgentThinking` + + - `class BetaManagedAgentsAgentMcpToolUseEvent:` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string McpServerName` + + Name of the MCP server providing the tool. + + - `required string Name` + + Name of the MCP tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_use"AgentMcpToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + + - `class BetaManagedAgentsAgentMcpToolResultEvent:` + + Event representing the result of an MCP tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string McpToolUseID` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_result"AgentMcpToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent:` + + Event emitted when the agent invokes a built-in agent tool. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the agent tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.tool_use"AgentToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + + - `class BetaManagedAgentsAgentToolResultEvent:` + + Event representing the result of an agent tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required string ToolUseID` + + The id of the `agent.tool_use` event this result corresponds to. + + - `required Type Type` + + - `"agent.tool_result"AgentToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent:` + + Indicates that context compaction (summarization) occurred during the session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thread_context_compacted"AgentThreadContextCompacted` + + - `class BetaManagedAgentsSessionErrorEvent:` + + An error event indicating a problem occurred during session execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Error Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"unknown_error"UnknownError` + + - `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_overloaded_error"ModelOverloadedError` + + - `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_rate_limited_error"ModelRateLimitedError` + + - `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_request_failed_error"ModelRequestFailedError` + + - `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `required string McpServerName` + + Name of the MCP server that failed to connect. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_connection_failed_error"McpConnectionFailedError` + + - `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `required string McpServerName` + + Name of the MCP server that failed authentication. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_authentication_failed_error"McpAuthenticationFailedError` + + - `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"billing_error"BillingError` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.error"SessionError` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent:` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_rescheduled"SessionStatusRescheduled` + + - `class BetaManagedAgentsSessionStatusRunningEvent:` + + Indicates the session is actively running and the agent is working. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_running"SessionStatusRunning` + + - `class BetaManagedAgentsSessionStatusIdleEvent:` + + Indicates the agent has paused and is awaiting user input. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required StopReason StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `required Type Type` + + - `"end_turn"EndTurn` + + - `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `required IReadOnlyList EventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `required Type Type` + + - `"requires_action"RequiresAction` + + - `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `required Type Type` + + - `"retries_exhausted"RetriesExhausted` + + - `required Type Type` + + - `"session.status_idle"SessionStatusIdle` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent:` + + Indicates the session has terminated, either due to an error or completion. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_terminated"SessionStatusTerminated` + + - `class BetaManagedAgentsSpanModelRequestStartEvent:` + + Emitted when a model request is initiated by the agent. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_start"SpanModelRequestStart` + + - `class BetaManagedAgentsSpanModelRequestEndEvent:` + + Emitted when a model request completes. + + - `required string ID` + + Unique identifier for this event. + + - `required Boolean? IsError` + + Whether the model request resulted in an error. + + - `required string ModelRequestStartID` + + The id of the corresponding `span.model_request_start` event. + + - `required BetaManagedAgentsSpanModelUsage ModelUsage` + + Token usage for a single model request. + + - `required Int CacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `required Int CacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `required Int InputTokens` + + Input tokens consumed by this request. + + - `required Int OutputTokens` + + Output tokens generated by this request. + + - `Speed? Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_end"SpanModelRequestEnd` + + - `class BetaManagedAgentsSessionDeletedEvent:` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.deleted"SessionDeleted` + +### Beta Managed Agents Session Requires Action + +- `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `required IReadOnlyList EventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `required Type Type` + + - `"requires_action"RequiresAction` + +### Beta Managed Agents Session Retries Exhausted + +- `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `required Type Type` + + - `"retries_exhausted"RetriesExhausted` + +### Beta Managed Agents Session Status Idle Event + +- `class BetaManagedAgentsSessionStatusIdleEvent:` + + Indicates the agent has paused and is awaiting user input. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required StopReason StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `required Type Type` + + - `"end_turn"EndTurn` + + - `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `required IReadOnlyList EventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `required Type Type` + + - `"requires_action"RequiresAction` + + - `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `required Type Type` + + - `"retries_exhausted"RetriesExhausted` + + - `required Type Type` + + - `"session.status_idle"SessionStatusIdle` + +### Beta Managed Agents Session Status Rescheduled Event + +- `class BetaManagedAgentsSessionStatusRescheduledEvent:` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_rescheduled"SessionStatusRescheduled` + +### Beta Managed Agents Session Status Running Event + +- `class BetaManagedAgentsSessionStatusRunningEvent:` + + Indicates the session is actively running and the agent is working. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_running"SessionStatusRunning` + +### Beta Managed Agents Session Status Terminated Event + +- `class BetaManagedAgentsSessionStatusTerminatedEvent:` + + Indicates the session has terminated, either due to an error or completion. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_terminated"SessionStatusTerminated` + +### Beta Managed Agents Span Model Request End Event + +- `class BetaManagedAgentsSpanModelRequestEndEvent:` + + Emitted when a model request completes. + + - `required string ID` + + Unique identifier for this event. + + - `required Boolean? IsError` + + Whether the model request resulted in an error. + + - `required string ModelRequestStartID` + + The id of the corresponding `span.model_request_start` event. + + - `required BetaManagedAgentsSpanModelUsage ModelUsage` + + Token usage for a single model request. + + - `required Int CacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `required Int CacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `required Int InputTokens` + + Input tokens consumed by this request. + + - `required Int OutputTokens` + + Output tokens generated by this request. + + - `Speed? Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_end"SpanModelRequestEnd` + +### Beta Managed Agents Span Model Request Start Event + +- `class BetaManagedAgentsSpanModelRequestStartEvent:` + + Emitted when a model request is initiated by the agent. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_start"SpanModelRequestStart` + +### Beta Managed Agents Span Model Usage + +- `class BetaManagedAgentsSpanModelUsage:` + + Token usage for a single model request. + + - `required Int CacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `required Int CacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `required Int InputTokens` + + Input tokens consumed by this request. + + - `required Int OutputTokens` + + Output tokens generated by this request. + + - `Speed? Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + +### Beta Managed Agents Stream Session Events + +- `class BetaManagedAgentsStreamSessionEvents: A class that can be one of several variants.union` + + Server-sent event in the session stream. + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `required string ID` + + Unique identifier for this event. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent:` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the custom tool being called. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.custom_tool_use"AgentCustomToolUse` + + - `class BetaManagedAgentsAgentMessageEvent:` + + An agent response event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of text blocks comprising the agent response. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.message"AgentMessage` + + - `class BetaManagedAgentsAgentThinkingEvent:` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thinking"AgentThinking` + + - `class BetaManagedAgentsAgentMcpToolUseEvent:` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string McpServerName` + + Name of the MCP server providing the tool. + + - `required string Name` + + Name of the MCP tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_use"AgentMcpToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + + - `class BetaManagedAgentsAgentMcpToolResultEvent:` + + Event representing the result of an MCP tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string McpToolUseID` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_result"AgentMcpToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent:` + + Event emitted when the agent invokes a built-in agent tool. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the agent tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.tool_use"AgentToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + + - `class BetaManagedAgentsAgentToolResultEvent:` + + Event representing the result of an agent tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required string ToolUseID` + + The id of the `agent.tool_use` event this result corresponds to. + + - `required Type Type` + + - `"agent.tool_result"AgentToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent:` + + Indicates that context compaction (summarization) occurred during the session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thread_context_compacted"AgentThreadContextCompacted` + + - `class BetaManagedAgentsSessionErrorEvent:` + + An error event indicating a problem occurred during session execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Error Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"unknown_error"UnknownError` + + - `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_overloaded_error"ModelOverloadedError` + + - `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_rate_limited_error"ModelRateLimitedError` + + - `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_request_failed_error"ModelRequestFailedError` + + - `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `required string McpServerName` + + Name of the MCP server that failed to connect. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_connection_failed_error"McpConnectionFailedError` + + - `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `required string McpServerName` + + Name of the MCP server that failed authentication. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_authentication_failed_error"McpAuthenticationFailedError` + + - `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"billing_error"BillingError` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.error"SessionError` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent:` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_rescheduled"SessionStatusRescheduled` + + - `class BetaManagedAgentsSessionStatusRunningEvent:` + + Indicates the session is actively running and the agent is working. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_running"SessionStatusRunning` + + - `class BetaManagedAgentsSessionStatusIdleEvent:` + + Indicates the agent has paused and is awaiting user input. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required StopReason StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `required Type Type` + + - `"end_turn"EndTurn` + + - `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `required IReadOnlyList EventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `required Type Type` + + - `"requires_action"RequiresAction` + + - `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `required Type Type` + + - `"retries_exhausted"RetriesExhausted` + + - `required Type Type` + + - `"session.status_idle"SessionStatusIdle` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent:` + + Indicates the session has terminated, either due to an error or completion. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_terminated"SessionStatusTerminated` + + - `class BetaManagedAgentsSpanModelRequestStartEvent:` + + Emitted when a model request is initiated by the agent. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_start"SpanModelRequestStart` + + - `class BetaManagedAgentsSpanModelRequestEndEvent:` + + Emitted when a model request completes. + + - `required string ID` + + Unique identifier for this event. + + - `required Boolean? IsError` + + Whether the model request resulted in an error. + + - `required string ModelRequestStartID` + + The id of the corresponding `span.model_request_start` event. + + - `required BetaManagedAgentsSpanModelUsage ModelUsage` + + Token usage for a single model request. + + - `required Int CacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `required Int CacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `required Int InputTokens` + + Input tokens consumed by this request. + + - `required Int OutputTokens` + + Output tokens generated by this request. + + - `Speed? Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_end"SpanModelRequestEnd` + + - `class BetaManagedAgentsSessionDeletedEvent:` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.deleted"SessionDeleted` + +### Beta Managed Agents Text Block + +- `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + +### Beta Managed Agents Unknown Error + +- `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"unknown_error"UnknownError` + +### Beta Managed Agents URL Document Source + +- `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + +### Beta Managed Agents URL Image Source + +- `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + +### Beta Managed Agents User Custom Tool Result Event + +- `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Custom Tool Result Event Params + +- `class BetaManagedAgentsUserCustomToolResultEventParams:` + + Parameters for providing the result of a custom tool execution. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents User Interrupt Event + +- `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `required string ID` + + Unique identifier for this event. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Interrupt Event Params + +- `class BetaManagedAgentsUserInterruptEventParams:` + + Parameters for sending an interrupt to pause the agent. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + +### Beta Managed Agents User Message Event + +- `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Message Event Params + +- `class BetaManagedAgentsUserMessageEventParams:` + + Parameters for sending a user message to the session. + + - `required IReadOnlyList Content` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + +### Beta Managed Agents User Tool Confirmation Event + +- `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Tool Confirmation Event Params + +- `class BetaManagedAgentsUserToolConfirmationEventParams:` + + Parameters for confirming or denying a tool execution request. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + +# Resources + +## Add + +`BetaManagedAgentsFileResource Beta.Sessions.Resources.Add(ResourceAddParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/sessions/{session_id}/resources` + +Add Session Resource + +### Parameters + +- `ResourceAddParams parameters` + + - `required string sessionID` + + Path param: Path parameter session_id + + - `required string fileID` + + Body param: ID of a previously uploaded file. + + - `required Type type` + + Body param + + - `"file"File` + + - `string? mountPath` + + Body param: Mount path in the container. Defaults to `/mnt/session/uploads/`. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + +### Example + +```csharp +ResourceAddParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7", + FileID = "file_011CNha8iCJcU1wXNR6q4V8w", + Type = Type.File, +}; + +var betaManagedAgentsFileResource = await client.Beta.Sessions.Resources.Add(parameters); + +Console.WriteLine(betaManagedAgentsFileResource); +``` + +## List + +`ResourceListPageResponse Beta.Sessions.Resources.List(ResourceListParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/sessions/{session_id}/resources` + +List Session Resources + +### Parameters + +- `ResourceListParams parameters` + + - `required string sessionID` + + Path param: Path parameter session_id + + - `Int limit` + + Query param: Maximum number of resources to return per page (max 1000). If omitted, returns all resources. + + - `string page` + + Query param: Opaque cursor from a previous response's next_page field. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class ResourceListPageResponse:` + + Paginated list of resources attached to a session. + + - `required IReadOnlyList Data` + + Resources for the session, ordered by `created_at`. + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `string? NextPage` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```csharp +ResourceListParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7" +}; + +var page = await client.Beta.Sessions.Resources.List(parameters); +await foreach (var item in page.Paginate()) +{ + Console.WriteLine(item); +} +``` + +## Retrieve + +`ResourceRetrieveResponse Beta.Sessions.Resources.Retrieve(ResourceRetrieveParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/sessions/{session_id}/resources/{resource_id}` + +Get Session Resource + +### Parameters + +- `ResourceRetrieveParams parameters` + + - `required string sessionID` + + Path param: Path parameter session_id + + - `required string resourceID` + + Path param: Path parameter resource_id + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class ResourceRetrieveResponse: A class that can be one of several variants.union` + + The requested session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + +### Example + +```csharp +ResourceRetrieveParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7", + ResourceID = "sesrsc_011CZkZBJq5dWxk9fVLNcPht", +}; + +var resource = await client.Beta.Sessions.Resources.Retrieve(parameters); + +Console.WriteLine(resource); +``` + +## Update + +`ResourceUpdateResponse Beta.Sessions.Resources.Update(ResourceUpdateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/sessions/{session_id}/resources/{resource_id}` + +Update Session Resource + +### Parameters + +- `ResourceUpdateParams parameters` + + - `required string sessionID` + + Path param: Path parameter session_id + + - `required string resourceID` + + Path param: Path parameter resource_id + + - `required string authorizationToken` + + Body param: New authorization token for the resource. Currently only `github_repository` resources support token rotation. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class ResourceUpdateResponse: A class that can be one of several variants.union` + + The updated session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + +### Example + +```csharp +ResourceUpdateParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7", + ResourceID = "sesrsc_011CZkZBJq5dWxk9fVLNcPht", + AuthorizationToken = "ghp_exampletoken", +}; + +var resource = await client.Beta.Sessions.Resources.Update(parameters); + +Console.WriteLine(resource); +``` + +## Delete + +`BetaManagedAgentsDeleteSessionResource Beta.Sessions.Resources.Delete(ResourceDeleteParamsparameters, CancellationTokencancellationToken = default)` + +**delete** `/v1/sessions/{session_id}/resources/{resource_id}` + +Delete Session Resource + +### Parameters + +- `ResourceDeleteParams parameters` + + - `required string sessionID` + + Path param: Path parameter session_id + + - `required string resourceID` + + Path param: Path parameter resource_id + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsDeleteSessionResource:` + + Confirmation of resource deletion. + + - `required string ID` + + - `required Type Type` + + - `"session_resource_deleted"SessionResourceDeleted` + +### Example + +```csharp +ResourceDeleteParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7", + ResourceID = "sesrsc_011CZkZBJq5dWxk9fVLNcPht", +}; + +var betaManagedAgentsDeleteSessionResource = await client.Beta.Sessions.Resources.Delete(parameters); + +Console.WriteLine(betaManagedAgentsDeleteSessionResource); +``` + +## Domain Types + +### Beta Managed Agents Delete Session Resource + +- `class BetaManagedAgentsDeleteSessionResource:` + + Confirmation of resource deletion. + + - `required string ID` + + - `required Type Type` + + - `"session_resource_deleted"SessionResourceDeleted` + +### Beta Managed Agents File Resource + +- `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + +### Beta Managed Agents GitHub Repository Resource + +- `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + +### Beta Managed Agents Session Resource + +- `class BetaManagedAgentsSessionResource: A class that can be one of several variants.union` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format diff --git a/content/en/api/csharp/beta/sessions/archive.md b/content/en/api/csharp/beta/sessions/archive.md new file mode 100644 index 000000000..8d9aa8e12 --- /dev/null +++ b/content/en/api/csharp/beta/sessions/archive.md @@ -0,0 +1,496 @@ +## Archive + +`BetaManagedAgentsSession Beta.Sessions.Archive(SessionArchiveParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/sessions/{session_id}/archive` + +Archive Session + +### Parameters + +- `SessionArchiveParams parameters` + + - `required string sessionID` + + Path parameter session_id + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsSession:` + + A Managed Agents `session`. + + - `required string ID` + + - `required BetaManagedAgentsSessionAgent Agent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `required string ID` + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required Int Version` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string EnvironmentID` + + - `required IReadOnlyDictionary Metadata` + + - `required IReadOnlyList Resources` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionStats Stats` + + Timing statistics for a session. + + - `Double ActiveSeconds` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `Double DurationSeconds` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `required Status Status` + + SessionStatus enum + + - `"rescheduling"Rescheduling` + + - `"running"Running` + + - `"idle"Idle` + + - `"terminated"Terminated` + + - `required string? Title` + + - `required Type Type` + + - `"session"Session` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionUsage Usage` + + Cumulative token usage for a session across all turns. + + - `BetaManagedAgentsCacheCreationUsage CacheCreation` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Int Ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Int Ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + + - `Int CacheReadInputTokens` + + Total tokens read from prompt cache. + + - `Int InputTokens` + + Total input tokens consumed across all turns. + + - `Int OutputTokens` + + Total output tokens generated across all turns. + + - `required IReadOnlyList VaultIds` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```csharp +SessionArchiveParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7" +}; + +var betaManagedAgentsSession = await client.Beta.Sessions.Archive(parameters); + +Console.WriteLine(betaManagedAgentsSession); +``` diff --git a/content/en/api/csharp/beta/sessions/create.md b/content/en/api/csharp/beta/sessions/create.md new file mode 100644 index 000000000..95c5a34c4 --- /dev/null +++ b/content/en/api/csharp/beta/sessions/create.md @@ -0,0 +1,595 @@ +## Create + +`BetaManagedAgentsSession Beta.Sessions.Create(SessionCreateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/sessions` + +Create Session + +### Parameters + +- `SessionCreateParams parameters` + + - `required Agent agent` + + Body param: Agent identifier. Accepts the `agent` ID string, which pins the latest version for the session, or an `agent` object with both id and version specified. + + - `string` + + - `class BetaManagedAgentsAgentParams:` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `required string ID` + + The `agent` ID. + + - `required Type Type` + + - `"agent"Agent` + + - `Int Version` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + + - `required string environmentID` + + Body param: ID of the `environment` defining the container configuration for this session. + + - `IReadOnlyDictionary metadata` + + Body param: Arbitrary key-value metadata attached to the session. + + - `IReadOnlyList resources` + + Body param: Resources (e.g. repositories, files) to mount into the session's container. + + - `class BetaManagedAgentsGitHubRepositoryResourceParams:` + + Mount a GitHub repository into the session's container. + + - `required string AuthorizationToken` + + GitHub authorization token used to clone the repository. + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required string Url` + + Github URL of the repository + + - `Checkout? Checkout` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `string? MountPath` + + Mount path in the container. Defaults to `/workspace/`. + + - `class BetaManagedAgentsFileResourceParams:` + + Mount a file uploaded via the Files API into the session. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `string? MountPath` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + + - `string? title` + + Body param: Human-readable session title. + + - `IReadOnlyList vaultIds` + + Body param: Vault IDs for stored credentials the agent can use during the session. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsSession:` + + A Managed Agents `session`. + + - `required string ID` + + - `required BetaManagedAgentsSessionAgent Agent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `required string ID` + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required Int Version` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string EnvironmentID` + + - `required IReadOnlyDictionary Metadata` + + - `required IReadOnlyList Resources` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionStats Stats` + + Timing statistics for a session. + + - `Double ActiveSeconds` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `Double DurationSeconds` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `required Status Status` + + SessionStatus enum + + - `"rescheduling"Rescheduling` + + - `"running"Running` + + - `"idle"Idle` + + - `"terminated"Terminated` + + - `required string? Title` + + - `required Type Type` + + - `"session"Session` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionUsage Usage` + + Cumulative token usage for a session across all turns. + + - `BetaManagedAgentsCacheCreationUsage CacheCreation` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Int Ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Int Ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + + - `Int CacheReadInputTokens` + + Total tokens read from prompt cache. + + - `Int InputTokens` + + Total input tokens consumed across all turns. + + - `Int OutputTokens` + + Total output tokens generated across all turns. + + - `required IReadOnlyList VaultIds` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```csharp +SessionCreateParams parameters = new() +{ + Agent = "agent_011CZkYpogX7uDKUyvBTophP", + EnvironmentID = "env_011CZkZ9X2dpNyB7HsEFoRfW", +}; + +var betaManagedAgentsSession = await client.Beta.Sessions.Create(parameters); + +Console.WriteLine(betaManagedAgentsSession); +``` diff --git a/content/en/api/csharp/beta/sessions/delete.md b/content/en/api/csharp/beta/sessions/delete.md new file mode 100644 index 000000000..a788e23dc --- /dev/null +++ b/content/en/api/csharp/beta/sessions/delete.md @@ -0,0 +1,86 @@ +## Delete + +`BetaManagedAgentsDeletedSession Beta.Sessions.Delete(SessionDeleteParamsparameters, CancellationTokencancellationToken = default)` + +**delete** `/v1/sessions/{session_id}` + +Delete Session + +### Parameters + +- `SessionDeleteParams parameters` + + - `required string sessionID` + + Path parameter session_id + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsDeletedSession:` + + Confirmation that a `session` has been permanently deleted. + + - `required string ID` + + - `required Type Type` + + - `"session_deleted"SessionDeleted` + +### Example + +```csharp +SessionDeleteParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7" +}; + +var betaManagedAgentsDeletedSession = await client.Beta.Sessions.Delete(parameters); + +Console.WriteLine(betaManagedAgentsDeletedSession); +``` diff --git a/content/en/api/csharp/beta/sessions/events.md b/content/en/api/csharp/beta/sessions/events.md new file mode 100644 index 000000000..d23c36a3c --- /dev/null +++ b/content/en/api/csharp/beta/sessions/events.md @@ -0,0 +1,9652 @@ +# Events + +## List + +`EventListPageResponse Beta.Sessions.Events.List(EventListParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/sessions/{session_id}/events` + +List Events + +### Parameters + +- `EventListParams parameters` + + - `required string sessionID` + + Path param: Path parameter session_id + + - `Int limit` + + Query param: Query parameter for limit + + - `Order order` + + Query param: Sort direction for results, ordered by created_at. Defaults to asc (chronological). + + - `"asc"Asc` + + - `"desc"Desc` + + - `string page` + + Query param: Opaque pagination cursor from a previous response's next_page. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class EventListPageResponse:` + + Paginated list of events for a `session`. + + - `IReadOnlyList Data` + + Events for the session, ordered by `created_at`. + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `required string ID` + + Unique identifier for this event. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent:` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the custom tool being called. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.custom_tool_use"AgentCustomToolUse` + + - `class BetaManagedAgentsAgentMessageEvent:` + + An agent response event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of text blocks comprising the agent response. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.message"AgentMessage` + + - `class BetaManagedAgentsAgentThinkingEvent:` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thinking"AgentThinking` + + - `class BetaManagedAgentsAgentMcpToolUseEvent:` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string McpServerName` + + Name of the MCP server providing the tool. + + - `required string Name` + + Name of the MCP tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_use"AgentMcpToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + + - `class BetaManagedAgentsAgentMcpToolResultEvent:` + + Event representing the result of an MCP tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string McpToolUseID` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_result"AgentMcpToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent:` + + Event emitted when the agent invokes a built-in agent tool. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the agent tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.tool_use"AgentToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + + - `class BetaManagedAgentsAgentToolResultEvent:` + + Event representing the result of an agent tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required string ToolUseID` + + The id of the `agent.tool_use` event this result corresponds to. + + - `required Type Type` + + - `"agent.tool_result"AgentToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent:` + + Indicates that context compaction (summarization) occurred during the session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thread_context_compacted"AgentThreadContextCompacted` + + - `class BetaManagedAgentsSessionErrorEvent:` + + An error event indicating a problem occurred during session execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Error Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"unknown_error"UnknownError` + + - `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_overloaded_error"ModelOverloadedError` + + - `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_rate_limited_error"ModelRateLimitedError` + + - `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_request_failed_error"ModelRequestFailedError` + + - `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `required string McpServerName` + + Name of the MCP server that failed to connect. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_connection_failed_error"McpConnectionFailedError` + + - `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `required string McpServerName` + + Name of the MCP server that failed authentication. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_authentication_failed_error"McpAuthenticationFailedError` + + - `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"billing_error"BillingError` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.error"SessionError` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent:` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_rescheduled"SessionStatusRescheduled` + + - `class BetaManagedAgentsSessionStatusRunningEvent:` + + Indicates the session is actively running and the agent is working. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_running"SessionStatusRunning` + + - `class BetaManagedAgentsSessionStatusIdleEvent:` + + Indicates the agent has paused and is awaiting user input. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required StopReason StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `required Type Type` + + - `"end_turn"EndTurn` + + - `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `required IReadOnlyList EventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `required Type Type` + + - `"requires_action"RequiresAction` + + - `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `required Type Type` + + - `"retries_exhausted"RetriesExhausted` + + - `required Type Type` + + - `"session.status_idle"SessionStatusIdle` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent:` + + Indicates the session has terminated, either due to an error or completion. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_terminated"SessionStatusTerminated` + + - `class BetaManagedAgentsSpanModelRequestStartEvent:` + + Emitted when a model request is initiated by the agent. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_start"SpanModelRequestStart` + + - `class BetaManagedAgentsSpanModelRequestEndEvent:` + + Emitted when a model request completes. + + - `required string ID` + + Unique identifier for this event. + + - `required Boolean? IsError` + + Whether the model request resulted in an error. + + - `required string ModelRequestStartID` + + The id of the corresponding `span.model_request_start` event. + + - `required BetaManagedAgentsSpanModelUsage ModelUsage` + + Token usage for a single model request. + + - `required Int CacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `required Int CacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `required Int InputTokens` + + Input tokens consumed by this request. + + - `required Int OutputTokens` + + Output tokens generated by this request. + + - `Speed? Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_end"SpanModelRequestEnd` + + - `class BetaManagedAgentsSessionDeletedEvent:` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.deleted"SessionDeleted` + + - `string? NextPage` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```csharp +EventListParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7" +}; + +var page = await client.Beta.Sessions.Events.List(parameters); +await foreach (var item in page.Paginate()) +{ + Console.WriteLine(item); +} +``` + +## Send + +`BetaManagedAgentsSendSessionEvents Beta.Sessions.Events.Send(EventSendParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/sessions/{session_id}/events` + +Send Events + +### Parameters + +- `EventSendParams parameters` + + - `required string sessionID` + + Path param: Path parameter session_id + + - `required IReadOnlyList events` + + Body param: Events to send to the `session`. + + - `class BetaManagedAgentsUserMessageEventParams:` + + Parameters for sending a user message to the session. + + - `required IReadOnlyList Content` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + + - `class BetaManagedAgentsUserInterruptEventParams:` + + Parameters for sending an interrupt to pause the agent. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + + - `class BetaManagedAgentsUserToolConfirmationEventParams:` + + Parameters for confirming or denying a tool execution request. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `class BetaManagedAgentsUserCustomToolResultEventParams:` + + Parameters for providing the result of a custom tool execution. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsSendSessionEvents:` + + Events that were successfully sent to the session. + + - `IReadOnlyList Data` + + Sent events + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `required string ID` + + Unique identifier for this event. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + +### Example + +```csharp +EventSendParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7", + Events = + [ + new BetaManagedAgentsUserMessageEventParams() + { + Content = + [ + new BetaManagedAgentsTextBlock() + { + Text = "Where is my order #1234?", + Type = Type.Text, + }, + ], + Type = Type.UserMessage, + }, + ], +}; + +var betaManagedAgentsSendSessionEvents = await client.Beta.Sessions.Events.Send(parameters); + +Console.WriteLine(betaManagedAgentsSendSessionEvents); +``` + +## Stream + +`BetaManagedAgentsStreamSessionEvents Beta.Sessions.Events.StreamStreaming(EventStreamParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/sessions/{session_id}/events/stream` + +Stream Events + +### Parameters + +- `EventStreamParams parameters` + + - `required string sessionID` + + Path parameter session_id + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsStreamSessionEvents: A class that can be one of several variants.union` + + Server-sent event in the session stream. + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `required string ID` + + Unique identifier for this event. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent:` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the custom tool being called. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.custom_tool_use"AgentCustomToolUse` + + - `class BetaManagedAgentsAgentMessageEvent:` + + An agent response event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of text blocks comprising the agent response. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.message"AgentMessage` + + - `class BetaManagedAgentsAgentThinkingEvent:` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thinking"AgentThinking` + + - `class BetaManagedAgentsAgentMcpToolUseEvent:` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string McpServerName` + + Name of the MCP server providing the tool. + + - `required string Name` + + Name of the MCP tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_use"AgentMcpToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + + - `class BetaManagedAgentsAgentMcpToolResultEvent:` + + Event representing the result of an MCP tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string McpToolUseID` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_result"AgentMcpToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent:` + + Event emitted when the agent invokes a built-in agent tool. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the agent tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.tool_use"AgentToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + + - `class BetaManagedAgentsAgentToolResultEvent:` + + Event representing the result of an agent tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required string ToolUseID` + + The id of the `agent.tool_use` event this result corresponds to. + + - `required Type Type` + + - `"agent.tool_result"AgentToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent:` + + Indicates that context compaction (summarization) occurred during the session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thread_context_compacted"AgentThreadContextCompacted` + + - `class BetaManagedAgentsSessionErrorEvent:` + + An error event indicating a problem occurred during session execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Error Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"unknown_error"UnknownError` + + - `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_overloaded_error"ModelOverloadedError` + + - `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_rate_limited_error"ModelRateLimitedError` + + - `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_request_failed_error"ModelRequestFailedError` + + - `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `required string McpServerName` + + Name of the MCP server that failed to connect. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_connection_failed_error"McpConnectionFailedError` + + - `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `required string McpServerName` + + Name of the MCP server that failed authentication. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_authentication_failed_error"McpAuthenticationFailedError` + + - `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"billing_error"BillingError` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.error"SessionError` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent:` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_rescheduled"SessionStatusRescheduled` + + - `class BetaManagedAgentsSessionStatusRunningEvent:` + + Indicates the session is actively running and the agent is working. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_running"SessionStatusRunning` + + - `class BetaManagedAgentsSessionStatusIdleEvent:` + + Indicates the agent has paused and is awaiting user input. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required StopReason StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `required Type Type` + + - `"end_turn"EndTurn` + + - `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `required IReadOnlyList EventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `required Type Type` + + - `"requires_action"RequiresAction` + + - `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `required Type Type` + + - `"retries_exhausted"RetriesExhausted` + + - `required Type Type` + + - `"session.status_idle"SessionStatusIdle` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent:` + + Indicates the session has terminated, either due to an error or completion. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_terminated"SessionStatusTerminated` + + - `class BetaManagedAgentsSpanModelRequestStartEvent:` + + Emitted when a model request is initiated by the agent. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_start"SpanModelRequestStart` + + - `class BetaManagedAgentsSpanModelRequestEndEvent:` + + Emitted when a model request completes. + + - `required string ID` + + Unique identifier for this event. + + - `required Boolean? IsError` + + Whether the model request resulted in an error. + + - `required string ModelRequestStartID` + + The id of the corresponding `span.model_request_start` event. + + - `required BetaManagedAgentsSpanModelUsage ModelUsage` + + Token usage for a single model request. + + - `required Int CacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `required Int CacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `required Int InputTokens` + + Input tokens consumed by this request. + + - `required Int OutputTokens` + + Output tokens generated by this request. + + - `Speed? Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_end"SpanModelRequestEnd` + + - `class BetaManagedAgentsSessionDeletedEvent:` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.deleted"SessionDeleted` + +### Example + +```csharp +EventStreamParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7" +}; + +await foreach (var betaManagedAgentsStreamSessionEvents in client.Beta.Sessions.Events.StreamStreaming(parameters)) +{ + Console.WriteLine(betaManagedAgentsStreamSessionEvents); +} +``` + +## Domain Types + +### Beta Managed Agents Agent Custom Tool Use Event + +- `class BetaManagedAgentsAgentCustomToolUseEvent:` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the custom tool being called. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.custom_tool_use"AgentCustomToolUse` + +### Beta Managed Agents Agent MCP Tool Result Event + +- `class BetaManagedAgentsAgentMcpToolResultEvent:` + + Event representing the result of an MCP tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string McpToolUseID` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_result"AgentMcpToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent MCP Tool Use Event + +- `class BetaManagedAgentsAgentMcpToolUseEvent:` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string McpServerName` + + Name of the MCP server providing the tool. + + - `required string Name` + + Name of the MCP tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_use"AgentMcpToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + +### Beta Managed Agents Agent Message Event + +- `class BetaManagedAgentsAgentMessageEvent:` + + An agent response event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of text blocks comprising the agent response. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.message"AgentMessage` + +### Beta Managed Agents Agent Thinking Event + +- `class BetaManagedAgentsAgentThinkingEvent:` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thinking"AgentThinking` + +### Beta Managed Agents Agent Thread Context Compacted Event + +- `class BetaManagedAgentsAgentThreadContextCompactedEvent:` + + Indicates that context compaction (summarization) occurred during the session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thread_context_compacted"AgentThreadContextCompacted` + +### Beta Managed Agents Agent Tool Result Event + +- `class BetaManagedAgentsAgentToolResultEvent:` + + Event representing the result of an agent tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required string ToolUseID` + + The id of the `agent.tool_use` event this result corresponds to. + + - `required Type Type` + + - `"agent.tool_result"AgentToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent Tool Use Event + +- `class BetaManagedAgentsAgentToolUseEvent:` + + Event emitted when the agent invokes a built-in agent tool. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the agent tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.tool_use"AgentToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + +### Beta Managed Agents Base64 Document Source + +- `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + +### Beta Managed Agents Base64 Image Source + +- `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + +### Beta Managed Agents Billing Error + +- `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"billing_error"BillingError` + +### Beta Managed Agents Document Block + +- `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + +### Beta Managed Agents Event Params + +- `class BetaManagedAgentsEventParams: A class that can be one of several variants.union` + + Union type for event parameters that can be sent to a session. + + - `class BetaManagedAgentsUserMessageEventParams:` + + Parameters for sending a user message to the session. + + - `required IReadOnlyList Content` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + + - `class BetaManagedAgentsUserInterruptEventParams:` + + Parameters for sending an interrupt to pause the agent. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + + - `class BetaManagedAgentsUserToolConfirmationEventParams:` + + Parameters for confirming or denying a tool execution request. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `class BetaManagedAgentsUserCustomToolResultEventParams:` + + Parameters for providing the result of a custom tool execution. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents File Document Source + +- `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + +### Beta Managed Agents File Image Source + +- `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + +### Beta Managed Agents Image Block + +- `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + +### Beta Managed Agents MCP Authentication Failed Error + +- `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `required string McpServerName` + + Name of the MCP server that failed authentication. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_authentication_failed_error"McpAuthenticationFailedError` + +### Beta Managed Agents MCP Connection Failed Error + +- `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `required string McpServerName` + + Name of the MCP server that failed to connect. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_connection_failed_error"McpConnectionFailedError` + +### Beta Managed Agents Model Overloaded Error + +- `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_overloaded_error"ModelOverloadedError` + +### Beta Managed Agents Model Rate Limited Error + +- `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_rate_limited_error"ModelRateLimitedError` + +### Beta Managed Agents Model Request Failed Error + +- `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_request_failed_error"ModelRequestFailedError` + +### Beta Managed Agents Plain Text Document Source + +- `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + +### Beta Managed Agents Retry Status Exhausted + +- `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + +### Beta Managed Agents Retry Status Retrying + +- `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + +### Beta Managed Agents Retry Status Terminal + +- `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + +### Beta Managed Agents Send Session Events + +- `class BetaManagedAgentsSendSessionEvents:` + + Events that were successfully sent to the session. + + - `IReadOnlyList Data` + + Sent events + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `required string ID` + + Unique identifier for this event. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + +### Beta Managed Agents Session Deleted Event + +- `class BetaManagedAgentsSessionDeletedEvent:` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.deleted"SessionDeleted` + +### Beta Managed Agents Session End Turn + +- `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `required Type Type` + + - `"end_turn"EndTurn` + +### Beta Managed Agents Session Error Event + +- `class BetaManagedAgentsSessionErrorEvent:` + + An error event indicating a problem occurred during session execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Error Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"unknown_error"UnknownError` + + - `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_overloaded_error"ModelOverloadedError` + + - `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_rate_limited_error"ModelRateLimitedError` + + - `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_request_failed_error"ModelRequestFailedError` + + - `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `required string McpServerName` + + Name of the MCP server that failed to connect. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_connection_failed_error"McpConnectionFailedError` + + - `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `required string McpServerName` + + Name of the MCP server that failed authentication. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_authentication_failed_error"McpAuthenticationFailedError` + + - `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"billing_error"BillingError` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.error"SessionError` + +### Beta Managed Agents Session Event + +- `class BetaManagedAgentsSessionEvent: A class that can be one of several variants.union` + + Union type for all event types in a session. + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `required string ID` + + Unique identifier for this event. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent:` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the custom tool being called. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.custom_tool_use"AgentCustomToolUse` + + - `class BetaManagedAgentsAgentMessageEvent:` + + An agent response event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of text blocks comprising the agent response. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.message"AgentMessage` + + - `class BetaManagedAgentsAgentThinkingEvent:` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thinking"AgentThinking` + + - `class BetaManagedAgentsAgentMcpToolUseEvent:` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string McpServerName` + + Name of the MCP server providing the tool. + + - `required string Name` + + Name of the MCP tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_use"AgentMcpToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + + - `class BetaManagedAgentsAgentMcpToolResultEvent:` + + Event representing the result of an MCP tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string McpToolUseID` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_result"AgentMcpToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent:` + + Event emitted when the agent invokes a built-in agent tool. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the agent tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.tool_use"AgentToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + + - `class BetaManagedAgentsAgentToolResultEvent:` + + Event representing the result of an agent tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required string ToolUseID` + + The id of the `agent.tool_use` event this result corresponds to. + + - `required Type Type` + + - `"agent.tool_result"AgentToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent:` + + Indicates that context compaction (summarization) occurred during the session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thread_context_compacted"AgentThreadContextCompacted` + + - `class BetaManagedAgentsSessionErrorEvent:` + + An error event indicating a problem occurred during session execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Error Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"unknown_error"UnknownError` + + - `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_overloaded_error"ModelOverloadedError` + + - `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_rate_limited_error"ModelRateLimitedError` + + - `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_request_failed_error"ModelRequestFailedError` + + - `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `required string McpServerName` + + Name of the MCP server that failed to connect. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_connection_failed_error"McpConnectionFailedError` + + - `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `required string McpServerName` + + Name of the MCP server that failed authentication. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_authentication_failed_error"McpAuthenticationFailedError` + + - `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"billing_error"BillingError` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.error"SessionError` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent:` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_rescheduled"SessionStatusRescheduled` + + - `class BetaManagedAgentsSessionStatusRunningEvent:` + + Indicates the session is actively running and the agent is working. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_running"SessionStatusRunning` + + - `class BetaManagedAgentsSessionStatusIdleEvent:` + + Indicates the agent has paused and is awaiting user input. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required StopReason StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `required Type Type` + + - `"end_turn"EndTurn` + + - `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `required IReadOnlyList EventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `required Type Type` + + - `"requires_action"RequiresAction` + + - `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `required Type Type` + + - `"retries_exhausted"RetriesExhausted` + + - `required Type Type` + + - `"session.status_idle"SessionStatusIdle` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent:` + + Indicates the session has terminated, either due to an error or completion. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_terminated"SessionStatusTerminated` + + - `class BetaManagedAgentsSpanModelRequestStartEvent:` + + Emitted when a model request is initiated by the agent. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_start"SpanModelRequestStart` + + - `class BetaManagedAgentsSpanModelRequestEndEvent:` + + Emitted when a model request completes. + + - `required string ID` + + Unique identifier for this event. + + - `required Boolean? IsError` + + Whether the model request resulted in an error. + + - `required string ModelRequestStartID` + + The id of the corresponding `span.model_request_start` event. + + - `required BetaManagedAgentsSpanModelUsage ModelUsage` + + Token usage for a single model request. + + - `required Int CacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `required Int CacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `required Int InputTokens` + + Input tokens consumed by this request. + + - `required Int OutputTokens` + + Output tokens generated by this request. + + - `Speed? Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_end"SpanModelRequestEnd` + + - `class BetaManagedAgentsSessionDeletedEvent:` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.deleted"SessionDeleted` + +### Beta Managed Agents Session Requires Action + +- `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `required IReadOnlyList EventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `required Type Type` + + - `"requires_action"RequiresAction` + +### Beta Managed Agents Session Retries Exhausted + +- `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `required Type Type` + + - `"retries_exhausted"RetriesExhausted` + +### Beta Managed Agents Session Status Idle Event + +- `class BetaManagedAgentsSessionStatusIdleEvent:` + + Indicates the agent has paused and is awaiting user input. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required StopReason StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `required Type Type` + + - `"end_turn"EndTurn` + + - `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `required IReadOnlyList EventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `required Type Type` + + - `"requires_action"RequiresAction` + + - `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `required Type Type` + + - `"retries_exhausted"RetriesExhausted` + + - `required Type Type` + + - `"session.status_idle"SessionStatusIdle` + +### Beta Managed Agents Session Status Rescheduled Event + +- `class BetaManagedAgentsSessionStatusRescheduledEvent:` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_rescheduled"SessionStatusRescheduled` + +### Beta Managed Agents Session Status Running Event + +- `class BetaManagedAgentsSessionStatusRunningEvent:` + + Indicates the session is actively running and the agent is working. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_running"SessionStatusRunning` + +### Beta Managed Agents Session Status Terminated Event + +- `class BetaManagedAgentsSessionStatusTerminatedEvent:` + + Indicates the session has terminated, either due to an error or completion. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_terminated"SessionStatusTerminated` + +### Beta Managed Agents Span Model Request End Event + +- `class BetaManagedAgentsSpanModelRequestEndEvent:` + + Emitted when a model request completes. + + - `required string ID` + + Unique identifier for this event. + + - `required Boolean? IsError` + + Whether the model request resulted in an error. + + - `required string ModelRequestStartID` + + The id of the corresponding `span.model_request_start` event. + + - `required BetaManagedAgentsSpanModelUsage ModelUsage` + + Token usage for a single model request. + + - `required Int CacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `required Int CacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `required Int InputTokens` + + Input tokens consumed by this request. + + - `required Int OutputTokens` + + Output tokens generated by this request. + + - `Speed? Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_end"SpanModelRequestEnd` + +### Beta Managed Agents Span Model Request Start Event + +- `class BetaManagedAgentsSpanModelRequestStartEvent:` + + Emitted when a model request is initiated by the agent. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_start"SpanModelRequestStart` + +### Beta Managed Agents Span Model Usage + +- `class BetaManagedAgentsSpanModelUsage:` + + Token usage for a single model request. + + - `required Int CacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `required Int CacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `required Int InputTokens` + + Input tokens consumed by this request. + + - `required Int OutputTokens` + + Output tokens generated by this request. + + - `Speed? Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + +### Beta Managed Agents Stream Session Events + +- `class BetaManagedAgentsStreamSessionEvents: A class that can be one of several variants.union` + + Server-sent event in the session stream. + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `required string ID` + + Unique identifier for this event. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent:` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the custom tool being called. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.custom_tool_use"AgentCustomToolUse` + + - `class BetaManagedAgentsAgentMessageEvent:` + + An agent response event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of text blocks comprising the agent response. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.message"AgentMessage` + + - `class BetaManagedAgentsAgentThinkingEvent:` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thinking"AgentThinking` + + - `class BetaManagedAgentsAgentMcpToolUseEvent:` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string McpServerName` + + Name of the MCP server providing the tool. + + - `required string Name` + + Name of the MCP tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_use"AgentMcpToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + + - `class BetaManagedAgentsAgentMcpToolResultEvent:` + + Event representing the result of an MCP tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string McpToolUseID` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_result"AgentMcpToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent:` + + Event emitted when the agent invokes a built-in agent tool. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the agent tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.tool_use"AgentToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + + - `class BetaManagedAgentsAgentToolResultEvent:` + + Event representing the result of an agent tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required string ToolUseID` + + The id of the `agent.tool_use` event this result corresponds to. + + - `required Type Type` + + - `"agent.tool_result"AgentToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent:` + + Indicates that context compaction (summarization) occurred during the session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thread_context_compacted"AgentThreadContextCompacted` + + - `class BetaManagedAgentsSessionErrorEvent:` + + An error event indicating a problem occurred during session execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Error Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"unknown_error"UnknownError` + + - `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_overloaded_error"ModelOverloadedError` + + - `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_rate_limited_error"ModelRateLimitedError` + + - `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_request_failed_error"ModelRequestFailedError` + + - `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `required string McpServerName` + + Name of the MCP server that failed to connect. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_connection_failed_error"McpConnectionFailedError` + + - `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `required string McpServerName` + + Name of the MCP server that failed authentication. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_authentication_failed_error"McpAuthenticationFailedError` + + - `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"billing_error"BillingError` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.error"SessionError` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent:` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_rescheduled"SessionStatusRescheduled` + + - `class BetaManagedAgentsSessionStatusRunningEvent:` + + Indicates the session is actively running and the agent is working. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_running"SessionStatusRunning` + + - `class BetaManagedAgentsSessionStatusIdleEvent:` + + Indicates the agent has paused and is awaiting user input. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required StopReason StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `required Type Type` + + - `"end_turn"EndTurn` + + - `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `required IReadOnlyList EventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `required Type Type` + + - `"requires_action"RequiresAction` + + - `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `required Type Type` + + - `"retries_exhausted"RetriesExhausted` + + - `required Type Type` + + - `"session.status_idle"SessionStatusIdle` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent:` + + Indicates the session has terminated, either due to an error or completion. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_terminated"SessionStatusTerminated` + + - `class BetaManagedAgentsSpanModelRequestStartEvent:` + + Emitted when a model request is initiated by the agent. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_start"SpanModelRequestStart` + + - `class BetaManagedAgentsSpanModelRequestEndEvent:` + + Emitted when a model request completes. + + - `required string ID` + + Unique identifier for this event. + + - `required Boolean? IsError` + + Whether the model request resulted in an error. + + - `required string ModelRequestStartID` + + The id of the corresponding `span.model_request_start` event. + + - `required BetaManagedAgentsSpanModelUsage ModelUsage` + + Token usage for a single model request. + + - `required Int CacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `required Int CacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `required Int InputTokens` + + Input tokens consumed by this request. + + - `required Int OutputTokens` + + Output tokens generated by this request. + + - `Speed? Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_end"SpanModelRequestEnd` + + - `class BetaManagedAgentsSessionDeletedEvent:` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.deleted"SessionDeleted` + +### Beta Managed Agents Text Block + +- `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + +### Beta Managed Agents Unknown Error + +- `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"unknown_error"UnknownError` + +### Beta Managed Agents URL Document Source + +- `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + +### Beta Managed Agents URL Image Source + +- `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + +### Beta Managed Agents User Custom Tool Result Event + +- `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Custom Tool Result Event Params + +- `class BetaManagedAgentsUserCustomToolResultEventParams:` + + Parameters for providing the result of a custom tool execution. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents User Interrupt Event + +- `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `required string ID` + + Unique identifier for this event. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Interrupt Event Params + +- `class BetaManagedAgentsUserInterruptEventParams:` + + Parameters for sending an interrupt to pause the agent. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + +### Beta Managed Agents User Message Event + +- `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Message Event Params + +- `class BetaManagedAgentsUserMessageEventParams:` + + Parameters for sending a user message to the session. + + - `required IReadOnlyList Content` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + +### Beta Managed Agents User Tool Confirmation Event + +- `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Tool Confirmation Event Params + +- `class BetaManagedAgentsUserToolConfirmationEventParams:` + + Parameters for confirming or denying a tool execution request. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. diff --git a/content/en/api/csharp/beta/sessions/events/list.md b/content/en/api/csharp/beta/sessions/events/list.md new file mode 100644 index 000000000..21236a8b0 --- /dev/null +++ b/content/en/api/csharp/beta/sessions/events/list.md @@ -0,0 +1,1470 @@ +## List + +`EventListPageResponse Beta.Sessions.Events.List(EventListParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/sessions/{session_id}/events` + +List Events + +### Parameters + +- `EventListParams parameters` + + - `required string sessionID` + + Path param: Path parameter session_id + + - `Int limit` + + Query param: Query parameter for limit + + - `Order order` + + Query param: Sort direction for results, ordered by created_at. Defaults to asc (chronological). + + - `"asc"Asc` + + - `"desc"Desc` + + - `string page` + + Query param: Opaque pagination cursor from a previous response's next_page. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class EventListPageResponse:` + + Paginated list of events for a `session`. + + - `IReadOnlyList Data` + + Events for the session, ordered by `created_at`. + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `required string ID` + + Unique identifier for this event. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent:` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the custom tool being called. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.custom_tool_use"AgentCustomToolUse` + + - `class BetaManagedAgentsAgentMessageEvent:` + + An agent response event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of text blocks comprising the agent response. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.message"AgentMessage` + + - `class BetaManagedAgentsAgentThinkingEvent:` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thinking"AgentThinking` + + - `class BetaManagedAgentsAgentMcpToolUseEvent:` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string McpServerName` + + Name of the MCP server providing the tool. + + - `required string Name` + + Name of the MCP tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_use"AgentMcpToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + + - `class BetaManagedAgentsAgentMcpToolResultEvent:` + + Event representing the result of an MCP tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string McpToolUseID` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_result"AgentMcpToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent:` + + Event emitted when the agent invokes a built-in agent tool. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the agent tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.tool_use"AgentToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + + - `class BetaManagedAgentsAgentToolResultEvent:` + + Event representing the result of an agent tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required string ToolUseID` + + The id of the `agent.tool_use` event this result corresponds to. + + - `required Type Type` + + - `"agent.tool_result"AgentToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent:` + + Indicates that context compaction (summarization) occurred during the session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thread_context_compacted"AgentThreadContextCompacted` + + - `class BetaManagedAgentsSessionErrorEvent:` + + An error event indicating a problem occurred during session execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Error Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"unknown_error"UnknownError` + + - `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_overloaded_error"ModelOverloadedError` + + - `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_rate_limited_error"ModelRateLimitedError` + + - `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_request_failed_error"ModelRequestFailedError` + + - `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `required string McpServerName` + + Name of the MCP server that failed to connect. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_connection_failed_error"McpConnectionFailedError` + + - `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `required string McpServerName` + + Name of the MCP server that failed authentication. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_authentication_failed_error"McpAuthenticationFailedError` + + - `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"billing_error"BillingError` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.error"SessionError` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent:` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_rescheduled"SessionStatusRescheduled` + + - `class BetaManagedAgentsSessionStatusRunningEvent:` + + Indicates the session is actively running and the agent is working. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_running"SessionStatusRunning` + + - `class BetaManagedAgentsSessionStatusIdleEvent:` + + Indicates the agent has paused and is awaiting user input. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required StopReason StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `required Type Type` + + - `"end_turn"EndTurn` + + - `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `required IReadOnlyList EventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `required Type Type` + + - `"requires_action"RequiresAction` + + - `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `required Type Type` + + - `"retries_exhausted"RetriesExhausted` + + - `required Type Type` + + - `"session.status_idle"SessionStatusIdle` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent:` + + Indicates the session has terminated, either due to an error or completion. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_terminated"SessionStatusTerminated` + + - `class BetaManagedAgentsSpanModelRequestStartEvent:` + + Emitted when a model request is initiated by the agent. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_start"SpanModelRequestStart` + + - `class BetaManagedAgentsSpanModelRequestEndEvent:` + + Emitted when a model request completes. + + - `required string ID` + + Unique identifier for this event. + + - `required Boolean? IsError` + + Whether the model request resulted in an error. + + - `required string ModelRequestStartID` + + The id of the corresponding `span.model_request_start` event. + + - `required BetaManagedAgentsSpanModelUsage ModelUsage` + + Token usage for a single model request. + + - `required Int CacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `required Int CacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `required Int InputTokens` + + Input tokens consumed by this request. + + - `required Int OutputTokens` + + Output tokens generated by this request. + + - `Speed? Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_end"SpanModelRequestEnd` + + - `class BetaManagedAgentsSessionDeletedEvent:` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.deleted"SessionDeleted` + + - `string? NextPage` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```csharp +EventListParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7" +}; + +var page = await client.Beta.Sessions.Events.List(parameters); +await foreach (var item in page.Paginate()) +{ + Console.WriteLine(item); +} +``` diff --git a/content/en/api/csharp/beta/sessions/events/send.md b/content/en/api/csharp/beta/sessions/events/send.md new file mode 100644 index 000000000..10c5eabd5 --- /dev/null +++ b/content/en/api/csharp/beta/sessions/events/send.md @@ -0,0 +1,831 @@ +## Send + +`BetaManagedAgentsSendSessionEvents Beta.Sessions.Events.Send(EventSendParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/sessions/{session_id}/events` + +Send Events + +### Parameters + +- `EventSendParams parameters` + + - `required string sessionID` + + Path param: Path parameter session_id + + - `required IReadOnlyList events` + + Body param: Events to send to the `session`. + + - `class BetaManagedAgentsUserMessageEventParams:` + + Parameters for sending a user message to the session. + + - `required IReadOnlyList Content` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + + - `class BetaManagedAgentsUserInterruptEventParams:` + + Parameters for sending an interrupt to pause the agent. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + + - `class BetaManagedAgentsUserToolConfirmationEventParams:` + + Parameters for confirming or denying a tool execution request. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `class BetaManagedAgentsUserCustomToolResultEventParams:` + + Parameters for providing the result of a custom tool execution. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsSendSessionEvents:` + + Events that were successfully sent to the session. + + - `IReadOnlyList Data` + + Sent events + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `required string ID` + + Unique identifier for this event. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + +### Example + +```csharp +EventSendParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7", + Events = + [ + new BetaManagedAgentsUserMessageEventParams() + { + Content = + [ + new BetaManagedAgentsTextBlock() + { + Text = "Where is my order #1234?", + Type = Type.Text, + }, + ], + Type = Type.UserMessage, + }, + ], +}; + +var betaManagedAgentsSendSessionEvents = await client.Beta.Sessions.Events.Send(parameters); + +Console.WriteLine(betaManagedAgentsSendSessionEvents); +``` diff --git a/content/en/api/csharp/beta/sessions/events/stream.md b/content/en/api/csharp/beta/sessions/events/stream.md new file mode 100644 index 000000000..c0742c024 --- /dev/null +++ b/content/en/api/csharp/beta/sessions/events/stream.md @@ -0,0 +1,1445 @@ +## Stream + +`BetaManagedAgentsStreamSessionEvents Beta.Sessions.Events.StreamStreaming(EventStreamParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/sessions/{session_id}/events/stream` + +Stream Events + +### Parameters + +- `EventStreamParams parameters` + + - `required string sessionID` + + Path parameter session_id + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsStreamSessionEvents: A class that can be one of several variants.union` + + Server-sent event in the session stream. + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `required Type Type` + + - `"user.message"UserMessage` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `required string ID` + + Unique identifier for this event. + + - `required Type Type` + + - `"user.interrupt"UserInterrupt` + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Result Result` + + UserToolConfirmationResult enum + + - `"allow"Allow` + + - `"deny"Deny` + + - `required string ToolUseID` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.tool_confirmation"UserToolConfirmation` + + - `string? DenyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string CustomToolUseID` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `required Type Type` + + - `"user.custom_tool_result"UserCustomToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `DateTimeOffset? ProcessedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent:` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the custom tool being called. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.custom_tool_use"AgentCustomToolUse` + + - `class BetaManagedAgentsAgentMessageEvent:` + + An agent response event in the session conversation. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyList Content` + + Array of text blocks comprising the agent response. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.message"AgentMessage` + + - `class BetaManagedAgentsAgentThinkingEvent:` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thinking"AgentThinking` + + - `class BetaManagedAgentsAgentMcpToolUseEvent:` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string McpServerName` + + Name of the MCP server providing the tool. + + - `required string Name` + + Name of the MCP tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_use"AgentMcpToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + + - `class BetaManagedAgentsAgentMcpToolResultEvent:` + + Event representing the result of an MCP tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required string McpToolUseID` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.mcp_tool_result"AgentMcpToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent:` + + Event emitted when the agent invokes a built-in agent tool. + + - `required string ID` + + Unique identifier for this event. + + - `required IReadOnlyDictionary Input` + + Input parameters for the tool call. + + - `required string Name` + + Name of the agent tool being used. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.tool_use"AgentToolUse` + + - `EvaluatedPermission EvaluatedPermission` + + AgentEvaluatedPermission enum + + - `"allow"Allow` + + - `"ask"Ask` + + - `"deny"Deny` + + - `class BetaManagedAgentsAgentToolResultEvent:` + + Event representing the result of an agent tool execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required string ToolUseID` + + The id of the `agent.tool_use` event this result corresponds to. + + - `required Type Type` + + - `"agent.tool_result"AgentToolResult` + + - `IReadOnlyList Content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `required string Text` + + The text content. + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `required Source Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `required string Data` + + Base64-encoded image data. + + - `required string MediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"image"Image` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `required Source Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `required string Data` + + Base64-encoded document data. + + - `required string MediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `required Type Type` + + - `"base64"Base64` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `required string Data` + + The plain text content. + + - `required MediaType MediaType` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"TextPlain` + + - `required Type Type` + + - `"text"Text` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `required string FileID` + + ID of a previously uploaded file. + + - `required Type Type` + + - `"file"File` + + - `required Type Type` + + - `"document"Document` + + - `string? Context` + + Additional context about the document for the model. + + - `string? Title` + + The title of the document. + + - `Boolean? IsError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent:` + + Indicates that context compaction (summarization) occurred during the session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"agent.thread_context_compacted"AgentThreadContextCompacted` + + - `class BetaManagedAgentsSessionErrorEvent:` + + An error event indicating a problem occurred during session execution. + + - `required string ID` + + Unique identifier for this event. + + - `required Error Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"unknown_error"UnknownError` + + - `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_overloaded_error"ModelOverloadedError` + + - `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_rate_limited_error"ModelRateLimitedError` + + - `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"model_request_failed_error"ModelRequestFailedError` + + - `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `required string McpServerName` + + Name of the MCP server that failed to connect. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_connection_failed_error"McpConnectionFailedError` + + - `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `required string McpServerName` + + Name of the MCP server that failed authentication. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"mcp_authentication_failed_error"McpAuthenticationFailedError` + + - `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `required string Message` + + Human-readable error description. + + - `required RetryStatus RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `required Type Type` + + - `"retrying"Retrying` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `required Type Type` + + - `"exhausted"Exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `required Type Type` + + - `"terminal"Terminal` + + - `required Type Type` + + - `"billing_error"BillingError` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.error"SessionError` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent:` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_rescheduled"SessionStatusRescheduled` + + - `class BetaManagedAgentsSessionStatusRunningEvent:` + + Indicates the session is actively running and the agent is working. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_running"SessionStatusRunning` + + - `class BetaManagedAgentsSessionStatusIdleEvent:` + + Indicates the agent has paused and is awaiting user input. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required StopReason StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `required Type Type` + + - `"end_turn"EndTurn` + + - `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `required IReadOnlyList EventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `required Type Type` + + - `"requires_action"RequiresAction` + + - `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `required Type Type` + + - `"retries_exhausted"RetriesExhausted` + + - `required Type Type` + + - `"session.status_idle"SessionStatusIdle` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent:` + + Indicates the session has terminated, either due to an error or completion. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.status_terminated"SessionStatusTerminated` + + - `class BetaManagedAgentsSpanModelRequestStartEvent:` + + Emitted when a model request is initiated by the agent. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_start"SpanModelRequestStart` + + - `class BetaManagedAgentsSpanModelRequestEndEvent:` + + Emitted when a model request completes. + + - `required string ID` + + Unique identifier for this event. + + - `required Boolean? IsError` + + Whether the model request resulted in an error. + + - `required string ModelRequestStartID` + + The id of the corresponding `span.model_request_start` event. + + - `required BetaManagedAgentsSpanModelUsage ModelUsage` + + Token usage for a single model request. + + - `required Int CacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `required Int CacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `required Int InputTokens` + + Input tokens consumed by this request. + + - `required Int OutputTokens` + + Output tokens generated by this request. + + - `Speed? Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"span.model_request_end"SpanModelRequestEnd` + + - `class BetaManagedAgentsSessionDeletedEvent:` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `required string ID` + + Unique identifier for this event. + + - `required DateTimeOffset ProcessedAt` + + A timestamp in RFC 3339 format + + - `required Type Type` + + - `"session.deleted"SessionDeleted` + +### Example + +```csharp +EventStreamParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7" +}; + +await foreach (var betaManagedAgentsStreamSessionEvents in client.Beta.Sessions.Events.StreamStreaming(parameters)) +{ + Console.WriteLine(betaManagedAgentsStreamSessionEvents); +} +``` diff --git a/content/en/api/csharp/beta/sessions/list.md b/content/en/api/csharp/beta/sessions/list.md new file mode 100644 index 000000000..5e5c58123 --- /dev/null +++ b/content/en/api/csharp/beta/sessions/list.md @@ -0,0 +1,543 @@ +## List + +`SessionListPageResponse Beta.Sessions.List(SessionListParams?parameters, CancellationTokencancellationToken = default)` + +**get** `/v1/sessions` + +List Sessions + +### Parameters + +- `SessionListParams parameters` + + - `string agentID` + + Query param: Filter sessions created with this agent ID. + + - `Int agentVersion` + + Query param: Filter by agent version. Only applies when agent_id is also set. + + - `DateTimeOffset createdAtGt` + + Query param: Return sessions created after this time (exclusive). + + - `DateTimeOffset createdAtGte` + + Query param: Return sessions created at or after this time (inclusive). + + - `DateTimeOffset createdAtLt` + + Query param: Return sessions created before this time (exclusive). + + - `DateTimeOffset createdAtLte` + + Query param: Return sessions created at or before this time (inclusive). + + - `Boolean includeArchived` + + Query param: When true, includes archived sessions. Default: false (exclude archived). + + - `Int limit` + + Query param: Maximum number of results to return. + + - `Order order` + + Query param: Sort direction for results, ordered by created_at. Defaults to desc (newest first). + + - `"asc"Asc` + + - `"desc"Desc` + + - `string page` + + Query param: Opaque pagination cursor from a previous response's next_page. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class SessionListPageResponse:` + + Paginated list of sessions. + + - `IReadOnlyList Data` + + List of sessions. + + - `required string ID` + + - `required BetaManagedAgentsSessionAgent Agent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `required string ID` + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required Int Version` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string EnvironmentID` + + - `required IReadOnlyDictionary Metadata` + + - `required IReadOnlyList Resources` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionStats Stats` + + Timing statistics for a session. + + - `Double ActiveSeconds` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `Double DurationSeconds` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `required Status Status` + + SessionStatus enum + + - `"rescheduling"Rescheduling` + + - `"running"Running` + + - `"idle"Idle` + + - `"terminated"Terminated` + + - `required string? Title` + + - `required Type Type` + + - `"session"Session` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionUsage Usage` + + Cumulative token usage for a session across all turns. + + - `BetaManagedAgentsCacheCreationUsage CacheCreation` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Int Ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Int Ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + + - `Int CacheReadInputTokens` + + Total tokens read from prompt cache. + + - `Int InputTokens` + + Total input tokens consumed across all turns. + + - `Int OutputTokens` + + Total output tokens generated across all turns. + + - `required IReadOnlyList VaultIds` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + + - `string? NextPage` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```csharp +SessionListParams parameters = new(); + +var page = await client.Beta.Sessions.List(parameters); +await foreach (var item in page.Paginate()) +{ + Console.WriteLine(item); +} +``` diff --git a/content/en/api/csharp/beta/sessions/resources.md b/content/en/api/csharp/beta/sessions/resources.md new file mode 100644 index 000000000..80f328857 --- /dev/null +++ b/content/en/api/csharp/beta/sessions/resources.md @@ -0,0 +1,814 @@ +# Resources + +## Add + +`BetaManagedAgentsFileResource Beta.Sessions.Resources.Add(ResourceAddParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/sessions/{session_id}/resources` + +Add Session Resource + +### Parameters + +- `ResourceAddParams parameters` + + - `required string sessionID` + + Path param: Path parameter session_id + + - `required string fileID` + + Body param: ID of a previously uploaded file. + + - `required Type type` + + Body param + + - `"file"File` + + - `string? mountPath` + + Body param: Mount path in the container. Defaults to `/mnt/session/uploads/`. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + +### Example + +```csharp +ResourceAddParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7", + FileID = "file_011CNha8iCJcU1wXNR6q4V8w", + Type = Type.File, +}; + +var betaManagedAgentsFileResource = await client.Beta.Sessions.Resources.Add(parameters); + +Console.WriteLine(betaManagedAgentsFileResource); +``` + +## List + +`ResourceListPageResponse Beta.Sessions.Resources.List(ResourceListParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/sessions/{session_id}/resources` + +List Session Resources + +### Parameters + +- `ResourceListParams parameters` + + - `required string sessionID` + + Path param: Path parameter session_id + + - `Int limit` + + Query param: Maximum number of resources to return per page (max 1000). If omitted, returns all resources. + + - `string page` + + Query param: Opaque cursor from a previous response's next_page field. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class ResourceListPageResponse:` + + Paginated list of resources attached to a session. + + - `required IReadOnlyList Data` + + Resources for the session, ordered by `created_at`. + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `string? NextPage` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```csharp +ResourceListParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7" +}; + +var page = await client.Beta.Sessions.Resources.List(parameters); +await foreach (var item in page.Paginate()) +{ + Console.WriteLine(item); +} +``` + +## Retrieve + +`ResourceRetrieveResponse Beta.Sessions.Resources.Retrieve(ResourceRetrieveParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/sessions/{session_id}/resources/{resource_id}` + +Get Session Resource + +### Parameters + +- `ResourceRetrieveParams parameters` + + - `required string sessionID` + + Path param: Path parameter session_id + + - `required string resourceID` + + Path param: Path parameter resource_id + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class ResourceRetrieveResponse: A class that can be one of several variants.union` + + The requested session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + +### Example + +```csharp +ResourceRetrieveParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7", + ResourceID = "sesrsc_011CZkZBJq5dWxk9fVLNcPht", +}; + +var resource = await client.Beta.Sessions.Resources.Retrieve(parameters); + +Console.WriteLine(resource); +``` + +## Update + +`ResourceUpdateResponse Beta.Sessions.Resources.Update(ResourceUpdateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/sessions/{session_id}/resources/{resource_id}` + +Update Session Resource + +### Parameters + +- `ResourceUpdateParams parameters` + + - `required string sessionID` + + Path param: Path parameter session_id + + - `required string resourceID` + + Path param: Path parameter resource_id + + - `required string authorizationToken` + + Body param: New authorization token for the resource. Currently only `github_repository` resources support token rotation. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class ResourceUpdateResponse: A class that can be one of several variants.union` + + The updated session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + +### Example + +```csharp +ResourceUpdateParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7", + ResourceID = "sesrsc_011CZkZBJq5dWxk9fVLNcPht", + AuthorizationToken = "ghp_exampletoken", +}; + +var resource = await client.Beta.Sessions.Resources.Update(parameters); + +Console.WriteLine(resource); +``` + +## Delete + +`BetaManagedAgentsDeleteSessionResource Beta.Sessions.Resources.Delete(ResourceDeleteParamsparameters, CancellationTokencancellationToken = default)` + +**delete** `/v1/sessions/{session_id}/resources/{resource_id}` + +Delete Session Resource + +### Parameters + +- `ResourceDeleteParams parameters` + + - `required string sessionID` + + Path param: Path parameter session_id + + - `required string resourceID` + + Path param: Path parameter resource_id + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsDeleteSessionResource:` + + Confirmation of resource deletion. + + - `required string ID` + + - `required Type Type` + + - `"session_resource_deleted"SessionResourceDeleted` + +### Example + +```csharp +ResourceDeleteParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7", + ResourceID = "sesrsc_011CZkZBJq5dWxk9fVLNcPht", +}; + +var betaManagedAgentsDeleteSessionResource = await client.Beta.Sessions.Resources.Delete(parameters); + +Console.WriteLine(betaManagedAgentsDeleteSessionResource); +``` + +## Domain Types + +### Beta Managed Agents Delete Session Resource + +- `class BetaManagedAgentsDeleteSessionResource:` + + Confirmation of resource deletion. + + - `required string ID` + + - `required Type Type` + + - `"session_resource_deleted"SessionResourceDeleted` + +### Beta Managed Agents File Resource + +- `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + +### Beta Managed Agents GitHub Repository Resource + +- `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + +### Beta Managed Agents Session Resource + +- `class BetaManagedAgentsSessionResource: A class that can be one of several variants.union` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format diff --git a/content/en/api/csharp/beta/sessions/resources/add.md b/content/en/api/csharp/beta/sessions/resources/add.md new file mode 100644 index 000000000..bf445b11a --- /dev/null +++ b/content/en/api/csharp/beta/sessions/resources/add.md @@ -0,0 +1,112 @@ +## Add + +`BetaManagedAgentsFileResource Beta.Sessions.Resources.Add(ResourceAddParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/sessions/{session_id}/resources` + +Add Session Resource + +### Parameters + +- `ResourceAddParams parameters` + + - `required string sessionID` + + Path param: Path parameter session_id + + - `required string fileID` + + Body param: ID of a previously uploaded file. + + - `required Type type` + + Body param + + - `"file"File` + + - `string? mountPath` + + Body param: Mount path in the container. Defaults to `/mnt/session/uploads/`. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + +### Example + +```csharp +ResourceAddParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7", + FileID = "file_011CNha8iCJcU1wXNR6q4V8w", + Type = Type.File, +}; + +var betaManagedAgentsFileResource = await client.Beta.Sessions.Resources.Add(parameters); + +Console.WriteLine(betaManagedAgentsFileResource); +``` diff --git a/content/en/api/csharp/beta/sessions/resources/delete.md b/content/en/api/csharp/beta/sessions/resources/delete.md new file mode 100644 index 000000000..f99c7cc96 --- /dev/null +++ b/content/en/api/csharp/beta/sessions/resources/delete.md @@ -0,0 +1,91 @@ +## Delete + +`BetaManagedAgentsDeleteSessionResource Beta.Sessions.Resources.Delete(ResourceDeleteParamsparameters, CancellationTokencancellationToken = default)` + +**delete** `/v1/sessions/{session_id}/resources/{resource_id}` + +Delete Session Resource + +### Parameters + +- `ResourceDeleteParams parameters` + + - `required string sessionID` + + Path param: Path parameter session_id + + - `required string resourceID` + + Path param: Path parameter resource_id + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsDeleteSessionResource:` + + Confirmation of resource deletion. + + - `required string ID` + + - `required Type Type` + + - `"session_resource_deleted"SessionResourceDeleted` + +### Example + +```csharp +ResourceDeleteParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7", + ResourceID = "sesrsc_011CZkZBJq5dWxk9fVLNcPht", +}; + +var betaManagedAgentsDeleteSessionResource = await client.Beta.Sessions.Resources.Delete(parameters); + +Console.WriteLine(betaManagedAgentsDeleteSessionResource); +``` diff --git a/content/en/api/csharp/beta/sessions/resources/list.md b/content/en/api/csharp/beta/sessions/resources/list.md new file mode 100644 index 000000000..c44abc391 --- /dev/null +++ b/content/en/api/csharp/beta/sessions/resources/list.md @@ -0,0 +1,160 @@ +## List + +`ResourceListPageResponse Beta.Sessions.Resources.List(ResourceListParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/sessions/{session_id}/resources` + +List Session Resources + +### Parameters + +- `ResourceListParams parameters` + + - `required string sessionID` + + Path param: Path parameter session_id + + - `Int limit` + + Query param: Maximum number of resources to return per page (max 1000). If omitted, returns all resources. + + - `string page` + + Query param: Opaque cursor from a previous response's next_page field. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class ResourceListPageResponse:` + + Paginated list of resources attached to a session. + + - `required IReadOnlyList Data` + + Resources for the session, ordered by `created_at`. + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `string? NextPage` + + Opaque cursor for the next page. Null when no more results. + +### Example + +```csharp +ResourceListParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7" +}; + +var page = await client.Beta.Sessions.Resources.List(parameters); +await foreach (var item in page.Paginate()) +{ + Console.WriteLine(item); +} +``` diff --git a/content/en/api/csharp/beta/sessions/resources/retrieve.md b/content/en/api/csharp/beta/sessions/resources/retrieve.md new file mode 100644 index 000000000..c8b53f564 --- /dev/null +++ b/content/en/api/csharp/beta/sessions/resources/retrieve.md @@ -0,0 +1,147 @@ +## Retrieve + +`ResourceRetrieveResponse Beta.Sessions.Resources.Retrieve(ResourceRetrieveParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/sessions/{session_id}/resources/{resource_id}` + +Get Session Resource + +### Parameters + +- `ResourceRetrieveParams parameters` + + - `required string sessionID` + + Path param: Path parameter session_id + + - `required string resourceID` + + Path param: Path parameter resource_id + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class ResourceRetrieveResponse: A class that can be one of several variants.union` + + The requested session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + +### Example + +```csharp +ResourceRetrieveParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7", + ResourceID = "sesrsc_011CZkZBJq5dWxk9fVLNcPht", +}; + +var resource = await client.Beta.Sessions.Resources.Retrieve(parameters); + +Console.WriteLine(resource); +``` diff --git a/content/en/api/csharp/beta/sessions/resources/update.md b/content/en/api/csharp/beta/sessions/resources/update.md new file mode 100644 index 000000000..0dee54aca --- /dev/null +++ b/content/en/api/csharp/beta/sessions/resources/update.md @@ -0,0 +1,152 @@ +## Update + +`ResourceUpdateResponse Beta.Sessions.Resources.Update(ResourceUpdateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/sessions/{session_id}/resources/{resource_id}` + +Update Session Resource + +### Parameters + +- `ResourceUpdateParams parameters` + + - `required string sessionID` + + Path param: Path parameter session_id + + - `required string resourceID` + + Path param: Path parameter resource_id + + - `required string authorizationToken` + + Body param: New authorization token for the resource. Currently only `github_repository` resources support token rotation. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class ResourceUpdateResponse: A class that can be one of several variants.union` + + The updated session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + +### Example + +```csharp +ResourceUpdateParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7", + ResourceID = "sesrsc_011CZkZBJq5dWxk9fVLNcPht", + AuthorizationToken = "ghp_exampletoken", +}; + +var resource = await client.Beta.Sessions.Resources.Update(parameters); + +Console.WriteLine(resource); +``` diff --git a/content/en/api/csharp/beta/sessions/retrieve.md b/content/en/api/csharp/beta/sessions/retrieve.md new file mode 100644 index 000000000..252a56cd1 --- /dev/null +++ b/content/en/api/csharp/beta/sessions/retrieve.md @@ -0,0 +1,496 @@ +## Retrieve + +`BetaManagedAgentsSession Beta.Sessions.Retrieve(SessionRetrieveParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/sessions/{session_id}` + +Get Session + +### Parameters + +- `SessionRetrieveParams parameters` + + - `required string sessionID` + + Path parameter session_id + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsSession:` + + A Managed Agents `session`. + + - `required string ID` + + - `required BetaManagedAgentsSessionAgent Agent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `required string ID` + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required Int Version` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string EnvironmentID` + + - `required IReadOnlyDictionary Metadata` + + - `required IReadOnlyList Resources` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionStats Stats` + + Timing statistics for a session. + + - `Double ActiveSeconds` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `Double DurationSeconds` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `required Status Status` + + SessionStatus enum + + - `"rescheduling"Rescheduling` + + - `"running"Running` + + - `"idle"Idle` + + - `"terminated"Terminated` + + - `required string? Title` + + - `required Type Type` + + - `"session"Session` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionUsage Usage` + + Cumulative token usage for a session across all turns. + + - `BetaManagedAgentsCacheCreationUsage CacheCreation` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Int Ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Int Ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + + - `Int CacheReadInputTokens` + + Total tokens read from prompt cache. + + - `Int InputTokens` + + Total input tokens consumed across all turns. + + - `Int OutputTokens` + + Total output tokens generated across all turns. + + - `required IReadOnlyList VaultIds` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```csharp +SessionRetrieveParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7" +}; + +var betaManagedAgentsSession = await client.Beta.Sessions.Retrieve(parameters); + +Console.WriteLine(betaManagedAgentsSession); +``` diff --git a/content/en/api/csharp/beta/sessions/update.md b/content/en/api/csharp/beta/sessions/update.md new file mode 100644 index 000000000..77ce195df --- /dev/null +++ b/content/en/api/csharp/beta/sessions/update.md @@ -0,0 +1,508 @@ +## Update + +`BetaManagedAgentsSession Beta.Sessions.Update(SessionUpdateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/sessions/{session_id}` + +Update Session + +### Parameters + +- `SessionUpdateParams parameters` + + - `required string sessionID` + + Path param: Path parameter session_id + + - `IReadOnlyDictionary? metadata` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. + + - `string? title` + + Body param: Human-readable session title. + + - `IReadOnlyList vaultIds` + + Body param: Vault IDs (`vlt_*`) to attach to the session. Not yet supported; requests setting this field are rejected. Reserved for future use. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsSession:` + + A Managed Agents `session`. + + - `required string ID` + + - `required BetaManagedAgentsSessionAgent Agent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `required string ID` + + - `required string? Description` + + - `required IReadOnlyList McpServers` + + - `required string Name` + + - `required Type Type` + + - `"url"Url` + + - `required string Url` + + - `required BetaManagedAgentsModelConfig Model` + + Model identifier and configuration. + + - `required BetaManagedAgentsModel ID` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6"ClaudeOpus4_6` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"ClaudeSonnet4_6` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"ClaudeHaiku4_5` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"ClaudeOpus4_5` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"ClaudeSonnet4_5` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929` + + High-performance model for agents and coding + + - `Speed Speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"Standard` + + - `"fast"Fast` + + - `required string Name` + + - `required IReadOnlyList Skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `required string SkillID` + + - `required Type Type` + + - `"anthropic"Anthropic` + + - `required string Version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `required string SkillID` + + - `required Type Type` + + - `"custom"Custom` + + - `required string Version` + + - `required string? System` + + - `required IReadOnlyList Tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required Name Name` + + Built-in agent tool identifier. + + - `"bash"Bash` + + - `"edit"Edit` + + - `"read"Read` + + - `"write"Write` + + - `"glob"Glob` + + - `"grep"Grep` + + - `"web_fetch"WebFetch` + + - `"web_search"WebSearch` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for agent tools. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required Type Type` + + - `"agent_toolset_20260401"AgentToolset20260401` + + - `class BetaManagedAgentsMcpToolset:` + + - `required IReadOnlyList Configs` + + - `required Boolean Enabled` + + - `required string Name` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `required Boolean Enabled` + + - `required PermissionPolicy PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `required Type Type` + + - `"always_allow"AlwaysAllow` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `required Type Type` + + - `"always_ask"AlwaysAsk` + + - `required string McpServerName` + + - `required Type Type` + + - `"mcp_toolset"McpToolset` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `required string Description` + + - `required BetaManagedAgentsCustomToolInputSchema InputSchema` + + JSON Schema for custom tool input parameters. + + - `IReadOnlyDictionary? Properties` + + JSON Schema properties defining the tool's input parameters. + + - `IReadOnlyList Required` + + List of required property names. + + - `Type Type` + + Must be 'object' for tool input schemas. + + - `"object"Object` + + - `required string Name` + + - `required Type Type` + + - `"custom"Custom` + + - `required Type Type` + + - `"agent"Agent` + + - `required Int Version` + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string EnvironmentID` + + - `required IReadOnlyDictionary Metadata` + + - `required IReadOnlyList Resources` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string MountPath` + + - `required Type Type` + + - `"github_repository"GitHubRepository` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string Url` + + - `Checkout? Checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `required string Name` + + Branch name to check out. + + - `required Type Type` + + - `"branch"Branch` + + - `class BetaManagedAgentsCommitCheckout:` + + - `required string Sha` + + Full commit SHA to check out. + + - `required Type Type` + + - `"commit"Commit` + + - `class BetaManagedAgentsFileResource:` + + - `required string ID` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string FileID` + + - `required string MountPath` + + - `required Type Type` + + - `"file"File` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionStats Stats` + + Timing statistics for a session. + + - `Double ActiveSeconds` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `Double DurationSeconds` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `required Status Status` + + SessionStatus enum + + - `"rescheduling"Rescheduling` + + - `"running"Running` + + - `"idle"Idle` + + - `"terminated"Terminated` + + - `required string? Title` + + - `required Type Type` + + - `"session"Session` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required BetaManagedAgentsSessionUsage Usage` + + Cumulative token usage for a session across all turns. + + - `BetaManagedAgentsCacheCreationUsage CacheCreation` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Int Ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Int Ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + + - `Int CacheReadInputTokens` + + Total tokens read from prompt cache. + + - `Int InputTokens` + + Total input tokens consumed across all turns. + + - `Int OutputTokens` + + Total output tokens generated across all turns. + + - `required IReadOnlyList VaultIds` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```csharp +SessionUpdateParams parameters = new() +{ + SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7" +}; + +var betaManagedAgentsSession = await client.Beta.Sessions.Update(parameters); + +Console.WriteLine(betaManagedAgentsSession); +``` diff --git a/content/en/api/csharp/beta/skills.md b/content/en/api/csharp/beta/skills.md index 9d7c4f9e9..41e488824 100644 --- a/content/en/api/csharp/beta/skills.md +++ b/content/en/api/csharp/beta/skills.md @@ -70,8 +70,6 @@ Create Skill - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class SkillCreateResponse:` @@ -206,8 +204,6 @@ List Skills - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class SkillListPageResponse:` @@ -345,8 +341,6 @@ Get Skill - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class SkillRetrieveResponse:` @@ -466,8 +460,6 @@ Delete Skill - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class SkillDeleteResponse:` @@ -566,8 +558,6 @@ Create Skill Version - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class VersionCreateResponse:` @@ -700,8 +690,6 @@ List Skill Versions - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class VersionListPageResponse:` @@ -844,8 +832,6 @@ Get Skill Version - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class VersionRetrieveResponse:` @@ -978,8 +964,6 @@ Delete Skill Version - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class VersionDeleteResponse:` diff --git a/content/en/api/csharp/beta/skills/create.md b/content/en/api/csharp/beta/skills/create.md index e0c3aa4b6..fa5e09c71 100644 --- a/content/en/api/csharp/beta/skills/create.md +++ b/content/en/api/csharp/beta/skills/create.md @@ -68,8 +68,6 @@ Create Skill - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class SkillCreateResponse:` diff --git a/content/en/api/csharp/beta/skills/delete.md b/content/en/api/csharp/beta/skills/delete.md index f8bae7df6..cf1347e49 100644 --- a/content/en/api/csharp/beta/skills/delete.md +++ b/content/en/api/csharp/beta/skills/delete.md @@ -62,8 +62,6 @@ Delete Skill - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class SkillDeleteResponse:` diff --git a/content/en/api/csharp/beta/skills/list.md b/content/en/api/csharp/beta/skills/list.md index 7d875f696..476890294 100644 --- a/content/en/api/csharp/beta/skills/list.md +++ b/content/en/api/csharp/beta/skills/list.md @@ -77,8 +77,6 @@ List Skills - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class SkillListPageResponse:` diff --git a/content/en/api/csharp/beta/skills/retrieve.md b/content/en/api/csharp/beta/skills/retrieve.md index d0f38b3da..94db22875 100644 --- a/content/en/api/csharp/beta/skills/retrieve.md +++ b/content/en/api/csharp/beta/skills/retrieve.md @@ -62,8 +62,6 @@ Get Skill - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class SkillRetrieveResponse:` diff --git a/content/en/api/csharp/beta/skills/versions.md b/content/en/api/csharp/beta/skills/versions.md index 7f21fa68e..c2bbc487f 100644 --- a/content/en/api/csharp/beta/skills/versions.md +++ b/content/en/api/csharp/beta/skills/versions.md @@ -70,8 +70,6 @@ Create Skill Version - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class VersionCreateResponse:` @@ -204,8 +202,6 @@ List Skill Versions - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class VersionListPageResponse:` @@ -348,8 +344,6 @@ Get Skill Version - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class VersionRetrieveResponse:` @@ -482,8 +476,6 @@ Delete Skill Version - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class VersionDeleteResponse:` diff --git a/content/en/api/csharp/beta/skills/versions/create.md b/content/en/api/csharp/beta/skills/versions/create.md index 5fcd14d30..d6e15e088 100644 --- a/content/en/api/csharp/beta/skills/versions/create.md +++ b/content/en/api/csharp/beta/skills/versions/create.md @@ -68,8 +68,6 @@ Create Skill Version - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class VersionCreateResponse:` diff --git a/content/en/api/csharp/beta/skills/versions/delete.md b/content/en/api/csharp/beta/skills/versions/delete.md index cba2130f9..e6613e852 100644 --- a/content/en/api/csharp/beta/skills/versions/delete.md +++ b/content/en/api/csharp/beta/skills/versions/delete.md @@ -68,8 +68,6 @@ Delete Skill Version - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class VersionDeleteResponse:` diff --git a/content/en/api/csharp/beta/skills/versions/list.md b/content/en/api/csharp/beta/skills/versions/list.md index 5d2f6ef1a..4a2a42e01 100644 --- a/content/en/api/csharp/beta/skills/versions/list.md +++ b/content/en/api/csharp/beta/skills/versions/list.md @@ -72,8 +72,6 @@ List Skill Versions - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class VersionListPageResponse:` diff --git a/content/en/api/csharp/beta/skills/versions/retrieve.md b/content/en/api/csharp/beta/skills/versions/retrieve.md index 0609c6415..8447faf29 100644 --- a/content/en/api/csharp/beta/skills/versions/retrieve.md +++ b/content/en/api/csharp/beta/skills/versions/retrieve.md @@ -68,8 +68,6 @@ Get Skill Version - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class VersionRetrieveResponse:` diff --git a/content/en/api/csharp/beta/vaults.md b/content/en/api/csharp/beta/vaults.md new file mode 100644 index 000000000..baa806670 --- /dev/null +++ b/content/en/api/csharp/beta/vaults.md @@ -0,0 +1,2637 @@ +# Vaults + +## Create + +`BetaManagedAgentsVault Beta.Vaults.Create(VaultCreateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/vaults` + +Create Vault + +### Parameters + +- `VaultCreateParams parameters` + + - `required string displayName` + + Body param: Human-readable name for the vault. 1-255 characters. + + - `IReadOnlyDictionary metadata` + + Body param: Arbitrary key-value metadata to attach to the vault. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsVault:` + + A vault that stores credentials for use by agents during sessions. + + - `required string ID` + + Unique identifier for the vault. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string DisplayName` + + Human-readable name for the vault. + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the vault. + + - `required Type Type` + + - `"vault"Vault` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + +### Example + +```csharp +VaultCreateParams parameters = new() { DisplayName = "Example vault" }; + +var betaManagedAgentsVault = await client.Beta.Vaults.Create(parameters); + +Console.WriteLine(betaManagedAgentsVault); +``` + +## List + +`VaultListPageResponse Beta.Vaults.List(VaultListParams?parameters, CancellationTokencancellationToken = default)` + +**get** `/v1/vaults` + +List Vaults + +### Parameters + +- `VaultListParams parameters` + + - `Boolean includeArchived` + + Query param: Whether to include archived vaults in the results. + + - `Int limit` + + Query param: Maximum number of vaults to return per page. Defaults to 20, maximum 100. + + - `string page` + + Query param: Opaque pagination token from a previous `list_vaults` response. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class VaultListPageResponse:` + + Response containing a paginated list of vaults. + + - `IReadOnlyList Data` + + List of vaults. + + - `required string ID` + + Unique identifier for the vault. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string DisplayName` + + Human-readable name for the vault. + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the vault. + + - `required Type Type` + + - `"vault"Vault` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `string? NextPage` + + Pagination token for the next page, or null if no more results. + +### Example + +```csharp +VaultListParams parameters = new(); + +var page = await client.Beta.Vaults.List(parameters); +await foreach (var item in page.Paginate()) +{ + Console.WriteLine(item); +} +``` + +## Retrieve + +`BetaManagedAgentsVault Beta.Vaults.Retrieve(VaultRetrieveParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/vaults/{vault_id}` + +Get Vault + +### Parameters + +- `VaultRetrieveParams parameters` + + - `required string vaultID` + + Path parameter vault_id + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsVault:` + + A vault that stores credentials for use by agents during sessions. + + - `required string ID` + + Unique identifier for the vault. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string DisplayName` + + Human-readable name for the vault. + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the vault. + + - `required Type Type` + + - `"vault"Vault` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + +### Example + +```csharp +VaultRetrieveParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv" +}; + +var betaManagedAgentsVault = await client.Beta.Vaults.Retrieve(parameters); + +Console.WriteLine(betaManagedAgentsVault); +``` + +## Update + +`BetaManagedAgentsVault Beta.Vaults.Update(VaultUpdateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/vaults/{vault_id}` + +Update Vault + +### Parameters + +- `VaultUpdateParams parameters` + + - `required string vaultID` + + Path param: Path parameter vault_id + + - `string? displayName` + + Body param: Updated human-readable name for the vault. 1-255 characters. + + - `IReadOnlyDictionary? metadata` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsVault:` + + A vault that stores credentials for use by agents during sessions. + + - `required string ID` + + Unique identifier for the vault. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string DisplayName` + + Human-readable name for the vault. + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the vault. + + - `required Type Type` + + - `"vault"Vault` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + +### Example + +```csharp +VaultUpdateParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv" +}; + +var betaManagedAgentsVault = await client.Beta.Vaults.Update(parameters); + +Console.WriteLine(betaManagedAgentsVault); +``` + +## Delete + +`BetaManagedAgentsDeletedVault Beta.Vaults.Delete(VaultDeleteParamsparameters, CancellationTokencancellationToken = default)` + +**delete** `/v1/vaults/{vault_id}` + +Delete Vault + +### Parameters + +- `VaultDeleteParams parameters` + + - `required string vaultID` + + Path parameter vault_id + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsDeletedVault:` + + Confirmation of a deleted vault. + + - `required string ID` + + Unique identifier of the deleted vault. + + - `required Type Type` + + - `"vault_deleted"VaultDeleted` + +### Example + +```csharp +VaultDeleteParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv" +}; + +var betaManagedAgentsDeletedVault = await client.Beta.Vaults.Delete(parameters); + +Console.WriteLine(betaManagedAgentsDeletedVault); +``` + +## Archive + +`BetaManagedAgentsVault Beta.Vaults.Archive(VaultArchiveParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/vaults/{vault_id}/archive` + +Archive Vault + +### Parameters + +- `VaultArchiveParams parameters` + + - `required string vaultID` + + Path parameter vault_id + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsVault:` + + A vault that stores credentials for use by agents during sessions. + + - `required string ID` + + Unique identifier for the vault. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string DisplayName` + + Human-readable name for the vault. + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the vault. + + - `required Type Type` + + - `"vault"Vault` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + +### Example + +```csharp +VaultArchiveParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv" +}; + +var betaManagedAgentsVault = await client.Beta.Vaults.Archive(parameters); + +Console.WriteLine(betaManagedAgentsVault); +``` + +## Domain Types + +### Beta Managed Agents Deleted Vault + +- `class BetaManagedAgentsDeletedVault:` + + Confirmation of a deleted vault. + + - `required string ID` + + Unique identifier of the deleted vault. + + - `required Type Type` + + - `"vault_deleted"VaultDeleted` + +### Beta Managed Agents Vault + +- `class BetaManagedAgentsVault:` + + A vault that stores credentials for use by agents during sessions. + + - `required string ID` + + Unique identifier for the vault. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string DisplayName` + + Human-readable name for the vault. + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the vault. + + - `required Type Type` + + - `"vault"Vault` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + +# Credentials + +## Create + +`BetaManagedAgentsCredential Beta.Vaults.Credentials.Create(CredentialCreateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/vaults/{vault_id}/credentials` + +Create Credential + +### Parameters + +- `CredentialCreateParams parameters` + + - `required string vaultID` + + Path param: Path parameter vault_id + + - `required Auth auth` + + Body param: Authentication details for creating a credential. + + - `class BetaManagedAgentsMcpOAuthCreateParams:` + + Parameters for creating an MCP OAuth credential. + + - `required string AccessToken` + + OAuth access token. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshParams? Refresh` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `required string ClientID` + + OAuth client ID. + + - `required string RefreshToken` + + OAuth refresh token. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required string ClientSecret` + + OAuth client secret. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam:` + + Token endpoint uses POST body authentication with client credentials. + + - `required string ClientSecret` + + OAuth client secret. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerCreateParams:` + + Parameters for creating a static bearer token credential. + + - `required string Token` + + Static bearer token value. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `string? displayName` + + Body param: Human-readable name for the credential. Up to 255 characters. + + - `IReadOnlyDictionary metadata` + + Body param: Arbitrary key-value metadata to attach to the credential. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `required string ID` + + Unique identifier for the credential. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required Auth Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshResponse? Refresh` + + OAuth refresh token configuration returned in credential responses. + + - `required string ClientID` + + OAuth client ID. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the credential. + + - `required Type Type` + + - `"vault_credential"VaultCredential` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string VaultID` + + Identifier of the vault this credential belongs to. + + - `string? DisplayName` + + Human-readable name for the credential. + +### Example + +```csharp +CredentialCreateParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv", + Auth = new BetaManagedAgentsStaticBearerCreateParams() + { + Token = "bearer_exampletoken", + McpServerUrl = "https://example-server.modelcontextprotocol.io/sse", + Type = Type.StaticBearer, + }, +}; + +var betaManagedAgentsCredential = await client.Beta.Vaults.Credentials.Create(parameters); + +Console.WriteLine(betaManagedAgentsCredential); +``` + +## List + +`CredentialListPageResponse Beta.Vaults.Credentials.List(CredentialListParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/vaults/{vault_id}/credentials` + +List Credentials + +### Parameters + +- `CredentialListParams parameters` + + - `required string vaultID` + + Path param: Path parameter vault_id + + - `Boolean includeArchived` + + Query param: Whether to include archived credentials in the results. + + - `Int limit` + + Query param: Maximum number of credentials to return per page. Defaults to 20, maximum 100. + + - `string page` + + Query param: Opaque pagination token from a previous `list_credentials` response. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class CredentialListPageResponse:` + + Response containing a paginated list of credentials. + + - `IReadOnlyList Data` + + List of credentials. + + - `required string ID` + + Unique identifier for the credential. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required Auth Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshResponse? Refresh` + + OAuth refresh token configuration returned in credential responses. + + - `required string ClientID` + + OAuth client ID. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the credential. + + - `required Type Type` + + - `"vault_credential"VaultCredential` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string VaultID` + + Identifier of the vault this credential belongs to. + + - `string? DisplayName` + + Human-readable name for the credential. + + - `string? NextPage` + + Pagination token for the next page, or null if no more results. + +### Example + +```csharp +CredentialListParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv" +}; + +var page = await client.Beta.Vaults.Credentials.List(parameters); +await foreach (var item in page.Paginate()) +{ + Console.WriteLine(item); +} +``` + +## Retrieve + +`BetaManagedAgentsCredential Beta.Vaults.Credentials.Retrieve(CredentialRetrieveParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Get Credential + +### Parameters + +- `CredentialRetrieveParams parameters` + + - `required string vaultID` + + Path param: Path parameter vault_id + + - `required string credentialID` + + Path param: Path parameter credential_id + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `required string ID` + + Unique identifier for the credential. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required Auth Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshResponse? Refresh` + + OAuth refresh token configuration returned in credential responses. + + - `required string ClientID` + + OAuth client ID. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the credential. + + - `required Type Type` + + - `"vault_credential"VaultCredential` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string VaultID` + + Identifier of the vault this credential belongs to. + + - `string? DisplayName` + + Human-readable name for the credential. + +### Example + +```csharp +CredentialRetrieveParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv", + CredentialID = "vcrd_011CZkZEMt8gZan2iYOQfSkw", +}; + +var betaManagedAgentsCredential = await client.Beta.Vaults.Credentials.Retrieve(parameters); + +Console.WriteLine(betaManagedAgentsCredential); +``` + +## Update + +`BetaManagedAgentsCredential Beta.Vaults.Credentials.Update(CredentialUpdateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Update Credential + +### Parameters + +- `CredentialUpdateParams parameters` + + - `required string vaultID` + + Path param: Path parameter vault_id + + - `required string credentialID` + + Path param: Path parameter credential_id + + - `Auth auth` + + Body param: Updated authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthUpdateParams:` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `string? AccessToken` + + Updated OAuth access token. + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshUpdateParams? Refresh` + + Parameters for updating OAuth refresh token configuration. + + - `string? RefreshToken` + + Updated OAuth refresh token. + + - `string? Scope` + + Updated OAuth scope for the refresh request. + + - `TokenEndpointAuth TokenEndpointAuth` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam:` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `string? ClientSecret` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam:` + + Updated POST body authentication parameters for the token endpoint. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? ClientSecret` + + Updated OAuth client secret. + + - `class BetaManagedAgentsStaticBearerUpdateParams:` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `string? Token` + + Updated static bearer token value. + + - `string? displayName` + + Body param: Updated human-readable name for the credential. 1-255 characters. + + - `IReadOnlyDictionary? metadata` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `required string ID` + + Unique identifier for the credential. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required Auth Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshResponse? Refresh` + + OAuth refresh token configuration returned in credential responses. + + - `required string ClientID` + + OAuth client ID. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the credential. + + - `required Type Type` + + - `"vault_credential"VaultCredential` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string VaultID` + + Identifier of the vault this credential belongs to. + + - `string? DisplayName` + + Human-readable name for the credential. + +### Example + +```csharp +CredentialUpdateParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv", + CredentialID = "vcrd_011CZkZEMt8gZan2iYOQfSkw", +}; + +var betaManagedAgentsCredential = await client.Beta.Vaults.Credentials.Update(parameters); + +Console.WriteLine(betaManagedAgentsCredential); +``` + +## Delete + +`BetaManagedAgentsDeletedCredential Beta.Vaults.Credentials.Delete(CredentialDeleteParamsparameters, CancellationTokencancellationToken = default)` + +**delete** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Delete Credential + +### Parameters + +- `CredentialDeleteParams parameters` + + - `required string vaultID` + + Path param: Path parameter vault_id + + - `required string credentialID` + + Path param: Path parameter credential_id + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsDeletedCredential:` + + Confirmation of a deleted credential. + + - `required string ID` + + Unique identifier of the deleted credential. + + - `required Type Type` + + - `"vault_credential_deleted"VaultCredentialDeleted` + +### Example + +```csharp +CredentialDeleteParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv", + CredentialID = "vcrd_011CZkZEMt8gZan2iYOQfSkw", +}; + +var betaManagedAgentsDeletedCredential = await client.Beta.Vaults.Credentials.Delete(parameters); + +Console.WriteLine(betaManagedAgentsDeletedCredential); +``` + +## Archive + +`BetaManagedAgentsCredential Beta.Vaults.Credentials.Archive(CredentialArchiveParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}/archive` + +Archive Credential + +### Parameters + +- `CredentialArchiveParams parameters` + + - `required string vaultID` + + Path param: Path parameter vault_id + + - `required string credentialID` + + Path param: Path parameter credential_id + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `required string ID` + + Unique identifier for the credential. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required Auth Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshResponse? Refresh` + + OAuth refresh token configuration returned in credential responses. + + - `required string ClientID` + + OAuth client ID. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the credential. + + - `required Type Type` + + - `"vault_credential"VaultCredential` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string VaultID` + + Identifier of the vault this credential belongs to. + + - `string? DisplayName` + + Human-readable name for the credential. + +### Example + +```csharp +CredentialArchiveParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv", + CredentialID = "vcrd_011CZkZEMt8gZan2iYOQfSkw", +}; + +var betaManagedAgentsCredential = await client.Beta.Vaults.Credentials.Archive(parameters); + +Console.WriteLine(betaManagedAgentsCredential); +``` + +## Domain Types + +### Beta Managed Agents Credential + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `required string ID` + + Unique identifier for the credential. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required Auth Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshResponse? Refresh` + + OAuth refresh token configuration returned in credential responses. + + - `required string ClientID` + + OAuth client ID. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the credential. + + - `required Type Type` + + - `"vault_credential"VaultCredential` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string VaultID` + + Identifier of the vault this credential belongs to. + + - `string? DisplayName` + + Human-readable name for the credential. + +### Beta Managed Agents Deleted Credential + +- `class BetaManagedAgentsDeletedCredential:` + + Confirmation of a deleted credential. + + - `required string ID` + + Unique identifier of the deleted credential. + + - `required Type Type` + + - `"vault_credential_deleted"VaultCredentialDeleted` + +### Beta Managed Agents MCP OAuth Auth Response + +- `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshResponse? Refresh` + + OAuth refresh token configuration returned in credential responses. + + - `required string ClientID` + + OAuth client ID. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Create Params + +- `class BetaManagedAgentsMcpOAuthCreateParams:` + + Parameters for creating an MCP OAuth credential. + + - `required string AccessToken` + + OAuth access token. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshParams? Refresh` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `required string ClientID` + + OAuth client ID. + + - `required string RefreshToken` + + OAuth refresh token. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required string ClientSecret` + + OAuth client secret. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam:` + + Token endpoint uses POST body authentication with client credentials. + + - `required string ClientSecret` + + OAuth client secret. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Params + +- `class BetaManagedAgentsMcpOAuthRefreshParams:` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `required string ClientID` + + OAuth client ID. + + - `required string RefreshToken` + + OAuth refresh token. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required string ClientSecret` + + OAuth client secret. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam:` + + Token endpoint uses POST body authentication with client credentials. + + - `required string ClientSecret` + + OAuth client secret. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Response + +- `class BetaManagedAgentsMcpOAuthRefreshResponse:` + + OAuth refresh token configuration returned in credential responses. + + - `required string ClientID` + + OAuth client ID. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Update Params + +- `class BetaManagedAgentsMcpOAuthRefreshUpdateParams:` + + Parameters for updating OAuth refresh token configuration. + + - `string? RefreshToken` + + Updated OAuth refresh token. + + - `string? Scope` + + Updated OAuth scope for the refresh request. + + - `TokenEndpointAuth TokenEndpointAuth` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam:` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `string? ClientSecret` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam:` + + Updated POST body authentication parameters for the token endpoint. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? ClientSecret` + + Updated OAuth client secret. + +### Beta Managed Agents MCP OAuth Update Params + +- `class BetaManagedAgentsMcpOAuthUpdateParams:` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `string? AccessToken` + + Updated OAuth access token. + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshUpdateParams? Refresh` + + Parameters for updating OAuth refresh token configuration. + + - `string? RefreshToken` + + Updated OAuth refresh token. + + - `string? Scope` + + Updated OAuth scope for the refresh request. + + - `TokenEndpointAuth TokenEndpointAuth` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam:` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `string? ClientSecret` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam:` + + Updated POST body authentication parameters for the token endpoint. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? ClientSecret` + + Updated OAuth client secret. + +### Beta Managed Agents Static Bearer Auth Response + +- `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + +### Beta Managed Agents Static Bearer Create Params + +- `class BetaManagedAgentsStaticBearerCreateParams:` + + Parameters for creating a static bearer token credential. + + - `required string Token` + + Static bearer token value. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + +### Beta Managed Agents Static Bearer Update Params + +- `class BetaManagedAgentsStaticBearerUpdateParams:` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `string? Token` + + Updated static bearer token value. + +### Beta Managed Agents Token Endpoint Auth Basic Param + +- `class BetaManagedAgentsTokenEndpointAuthBasicParam:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required string ClientSecret` + + OAuth client secret. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + +### Beta Managed Agents Token Endpoint Auth Basic Response + +- `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + +### Beta Managed Agents Token Endpoint Auth Basic Update Param + +- `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam:` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `string? ClientSecret` + + Updated OAuth client secret. + +### Beta Managed Agents Token Endpoint Auth None Param + +- `class BetaManagedAgentsTokenEndpointAuthNoneParam:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + +### Beta Managed Agents Token Endpoint Auth None Response + +- `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + +### Beta Managed Agents Token Endpoint Auth Post Param + +- `class BetaManagedAgentsTokenEndpointAuthPostParam:` + + Token endpoint uses POST body authentication with client credentials. + + - `required string ClientSecret` + + OAuth client secret. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + +### Beta Managed Agents Token Endpoint Auth Post Response + +- `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + +### Beta Managed Agents Token Endpoint Auth Post Update Param + +- `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam:` + + Updated POST body authentication parameters for the token endpoint. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? ClientSecret` + + Updated OAuth client secret. diff --git a/content/en/api/csharp/beta/vaults/archive.md b/content/en/api/csharp/beta/vaults/archive.md new file mode 100644 index 000000000..f6c915989 --- /dev/null +++ b/content/en/api/csharp/beta/vaults/archive.md @@ -0,0 +1,108 @@ +## Archive + +`BetaManagedAgentsVault Beta.Vaults.Archive(VaultArchiveParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/vaults/{vault_id}/archive` + +Archive Vault + +### Parameters + +- `VaultArchiveParams parameters` + + - `required string vaultID` + + Path parameter vault_id + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsVault:` + + A vault that stores credentials for use by agents during sessions. + + - `required string ID` + + Unique identifier for the vault. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string DisplayName` + + Human-readable name for the vault. + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the vault. + + - `required Type Type` + + - `"vault"Vault` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + +### Example + +```csharp +VaultArchiveParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv" +}; + +var betaManagedAgentsVault = await client.Beta.Vaults.Archive(parameters); + +Console.WriteLine(betaManagedAgentsVault); +``` diff --git a/content/en/api/csharp/beta/vaults/create.md b/content/en/api/csharp/beta/vaults/create.md new file mode 100644 index 000000000..8303effac --- /dev/null +++ b/content/en/api/csharp/beta/vaults/create.md @@ -0,0 +1,109 @@ +## Create + +`BetaManagedAgentsVault Beta.Vaults.Create(VaultCreateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/vaults` + +Create Vault + +### Parameters + +- `VaultCreateParams parameters` + + - `required string displayName` + + Body param: Human-readable name for the vault. 1-255 characters. + + - `IReadOnlyDictionary metadata` + + Body param: Arbitrary key-value metadata to attach to the vault. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsVault:` + + A vault that stores credentials for use by agents during sessions. + + - `required string ID` + + Unique identifier for the vault. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string DisplayName` + + Human-readable name for the vault. + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the vault. + + - `required Type Type` + + - `"vault"Vault` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + +### Example + +```csharp +VaultCreateParams parameters = new() { DisplayName = "Example vault" }; + +var betaManagedAgentsVault = await client.Beta.Vaults.Create(parameters); + +Console.WriteLine(betaManagedAgentsVault); +``` diff --git a/content/en/api/csharp/beta/vaults/credentials.md b/content/en/api/csharp/beta/vaults/credentials.md new file mode 100644 index 000000000..789739117 --- /dev/null +++ b/content/en/api/csharp/beta/vaults/credentials.md @@ -0,0 +1,1927 @@ +# Credentials + +## Create + +`BetaManagedAgentsCredential Beta.Vaults.Credentials.Create(CredentialCreateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/vaults/{vault_id}/credentials` + +Create Credential + +### Parameters + +- `CredentialCreateParams parameters` + + - `required string vaultID` + + Path param: Path parameter vault_id + + - `required Auth auth` + + Body param: Authentication details for creating a credential. + + - `class BetaManagedAgentsMcpOAuthCreateParams:` + + Parameters for creating an MCP OAuth credential. + + - `required string AccessToken` + + OAuth access token. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshParams? Refresh` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `required string ClientID` + + OAuth client ID. + + - `required string RefreshToken` + + OAuth refresh token. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required string ClientSecret` + + OAuth client secret. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam:` + + Token endpoint uses POST body authentication with client credentials. + + - `required string ClientSecret` + + OAuth client secret. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerCreateParams:` + + Parameters for creating a static bearer token credential. + + - `required string Token` + + Static bearer token value. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `string? displayName` + + Body param: Human-readable name for the credential. Up to 255 characters. + + - `IReadOnlyDictionary metadata` + + Body param: Arbitrary key-value metadata to attach to the credential. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `required string ID` + + Unique identifier for the credential. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required Auth Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshResponse? Refresh` + + OAuth refresh token configuration returned in credential responses. + + - `required string ClientID` + + OAuth client ID. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the credential. + + - `required Type Type` + + - `"vault_credential"VaultCredential` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string VaultID` + + Identifier of the vault this credential belongs to. + + - `string? DisplayName` + + Human-readable name for the credential. + +### Example + +```csharp +CredentialCreateParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv", + Auth = new BetaManagedAgentsStaticBearerCreateParams() + { + Token = "bearer_exampletoken", + McpServerUrl = "https://example-server.modelcontextprotocol.io/sse", + Type = Type.StaticBearer, + }, +}; + +var betaManagedAgentsCredential = await client.Beta.Vaults.Credentials.Create(parameters); + +Console.WriteLine(betaManagedAgentsCredential); +``` + +## List + +`CredentialListPageResponse Beta.Vaults.Credentials.List(CredentialListParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/vaults/{vault_id}/credentials` + +List Credentials + +### Parameters + +- `CredentialListParams parameters` + + - `required string vaultID` + + Path param: Path parameter vault_id + + - `Boolean includeArchived` + + Query param: Whether to include archived credentials in the results. + + - `Int limit` + + Query param: Maximum number of credentials to return per page. Defaults to 20, maximum 100. + + - `string page` + + Query param: Opaque pagination token from a previous `list_credentials` response. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class CredentialListPageResponse:` + + Response containing a paginated list of credentials. + + - `IReadOnlyList Data` + + List of credentials. + + - `required string ID` + + Unique identifier for the credential. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required Auth Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshResponse? Refresh` + + OAuth refresh token configuration returned in credential responses. + + - `required string ClientID` + + OAuth client ID. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the credential. + + - `required Type Type` + + - `"vault_credential"VaultCredential` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string VaultID` + + Identifier of the vault this credential belongs to. + + - `string? DisplayName` + + Human-readable name for the credential. + + - `string? NextPage` + + Pagination token for the next page, or null if no more results. + +### Example + +```csharp +CredentialListParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv" +}; + +var page = await client.Beta.Vaults.Credentials.List(parameters); +await foreach (var item in page.Paginate()) +{ + Console.WriteLine(item); +} +``` + +## Retrieve + +`BetaManagedAgentsCredential Beta.Vaults.Credentials.Retrieve(CredentialRetrieveParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Get Credential + +### Parameters + +- `CredentialRetrieveParams parameters` + + - `required string vaultID` + + Path param: Path parameter vault_id + + - `required string credentialID` + + Path param: Path parameter credential_id + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `required string ID` + + Unique identifier for the credential. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required Auth Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshResponse? Refresh` + + OAuth refresh token configuration returned in credential responses. + + - `required string ClientID` + + OAuth client ID. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the credential. + + - `required Type Type` + + - `"vault_credential"VaultCredential` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string VaultID` + + Identifier of the vault this credential belongs to. + + - `string? DisplayName` + + Human-readable name for the credential. + +### Example + +```csharp +CredentialRetrieveParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv", + CredentialID = "vcrd_011CZkZEMt8gZan2iYOQfSkw", +}; + +var betaManagedAgentsCredential = await client.Beta.Vaults.Credentials.Retrieve(parameters); + +Console.WriteLine(betaManagedAgentsCredential); +``` + +## Update + +`BetaManagedAgentsCredential Beta.Vaults.Credentials.Update(CredentialUpdateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Update Credential + +### Parameters + +- `CredentialUpdateParams parameters` + + - `required string vaultID` + + Path param: Path parameter vault_id + + - `required string credentialID` + + Path param: Path parameter credential_id + + - `Auth auth` + + Body param: Updated authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthUpdateParams:` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `string? AccessToken` + + Updated OAuth access token. + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshUpdateParams? Refresh` + + Parameters for updating OAuth refresh token configuration. + + - `string? RefreshToken` + + Updated OAuth refresh token. + + - `string? Scope` + + Updated OAuth scope for the refresh request. + + - `TokenEndpointAuth TokenEndpointAuth` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam:` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `string? ClientSecret` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam:` + + Updated POST body authentication parameters for the token endpoint. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? ClientSecret` + + Updated OAuth client secret. + + - `class BetaManagedAgentsStaticBearerUpdateParams:` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `string? Token` + + Updated static bearer token value. + + - `string? displayName` + + Body param: Updated human-readable name for the credential. 1-255 characters. + + - `IReadOnlyDictionary? metadata` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `required string ID` + + Unique identifier for the credential. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required Auth Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshResponse? Refresh` + + OAuth refresh token configuration returned in credential responses. + + - `required string ClientID` + + OAuth client ID. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the credential. + + - `required Type Type` + + - `"vault_credential"VaultCredential` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string VaultID` + + Identifier of the vault this credential belongs to. + + - `string? DisplayName` + + Human-readable name for the credential. + +### Example + +```csharp +CredentialUpdateParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv", + CredentialID = "vcrd_011CZkZEMt8gZan2iYOQfSkw", +}; + +var betaManagedAgentsCredential = await client.Beta.Vaults.Credentials.Update(parameters); + +Console.WriteLine(betaManagedAgentsCredential); +``` + +## Delete + +`BetaManagedAgentsDeletedCredential Beta.Vaults.Credentials.Delete(CredentialDeleteParamsparameters, CancellationTokencancellationToken = default)` + +**delete** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Delete Credential + +### Parameters + +- `CredentialDeleteParams parameters` + + - `required string vaultID` + + Path param: Path parameter vault_id + + - `required string credentialID` + + Path param: Path parameter credential_id + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsDeletedCredential:` + + Confirmation of a deleted credential. + + - `required string ID` + + Unique identifier of the deleted credential. + + - `required Type Type` + + - `"vault_credential_deleted"VaultCredentialDeleted` + +### Example + +```csharp +CredentialDeleteParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv", + CredentialID = "vcrd_011CZkZEMt8gZan2iYOQfSkw", +}; + +var betaManagedAgentsDeletedCredential = await client.Beta.Vaults.Credentials.Delete(parameters); + +Console.WriteLine(betaManagedAgentsDeletedCredential); +``` + +## Archive + +`BetaManagedAgentsCredential Beta.Vaults.Credentials.Archive(CredentialArchiveParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}/archive` + +Archive Credential + +### Parameters + +- `CredentialArchiveParams parameters` + + - `required string vaultID` + + Path param: Path parameter vault_id + + - `required string credentialID` + + Path param: Path parameter credential_id + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `required string ID` + + Unique identifier for the credential. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required Auth Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshResponse? Refresh` + + OAuth refresh token configuration returned in credential responses. + + - `required string ClientID` + + OAuth client ID. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the credential. + + - `required Type Type` + + - `"vault_credential"VaultCredential` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string VaultID` + + Identifier of the vault this credential belongs to. + + - `string? DisplayName` + + Human-readable name for the credential. + +### Example + +```csharp +CredentialArchiveParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv", + CredentialID = "vcrd_011CZkZEMt8gZan2iYOQfSkw", +}; + +var betaManagedAgentsCredential = await client.Beta.Vaults.Credentials.Archive(parameters); + +Console.WriteLine(betaManagedAgentsCredential); +``` + +## Domain Types + +### Beta Managed Agents Credential + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `required string ID` + + Unique identifier for the credential. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required Auth Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshResponse? Refresh` + + OAuth refresh token configuration returned in credential responses. + + - `required string ClientID` + + OAuth client ID. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the credential. + + - `required Type Type` + + - `"vault_credential"VaultCredential` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string VaultID` + + Identifier of the vault this credential belongs to. + + - `string? DisplayName` + + Human-readable name for the credential. + +### Beta Managed Agents Deleted Credential + +- `class BetaManagedAgentsDeletedCredential:` + + Confirmation of a deleted credential. + + - `required string ID` + + Unique identifier of the deleted credential. + + - `required Type Type` + + - `"vault_credential_deleted"VaultCredentialDeleted` + +### Beta Managed Agents MCP OAuth Auth Response + +- `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshResponse? Refresh` + + OAuth refresh token configuration returned in credential responses. + + - `required string ClientID` + + OAuth client ID. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Create Params + +- `class BetaManagedAgentsMcpOAuthCreateParams:` + + Parameters for creating an MCP OAuth credential. + + - `required string AccessToken` + + OAuth access token. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshParams? Refresh` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `required string ClientID` + + OAuth client ID. + + - `required string RefreshToken` + + OAuth refresh token. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required string ClientSecret` + + OAuth client secret. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam:` + + Token endpoint uses POST body authentication with client credentials. + + - `required string ClientSecret` + + OAuth client secret. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Params + +- `class BetaManagedAgentsMcpOAuthRefreshParams:` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `required string ClientID` + + OAuth client ID. + + - `required string RefreshToken` + + OAuth refresh token. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required string ClientSecret` + + OAuth client secret. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam:` + + Token endpoint uses POST body authentication with client credentials. + + - `required string ClientSecret` + + OAuth client secret. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Response + +- `class BetaManagedAgentsMcpOAuthRefreshResponse:` + + OAuth refresh token configuration returned in credential responses. + + - `required string ClientID` + + OAuth client ID. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Update Params + +- `class BetaManagedAgentsMcpOAuthRefreshUpdateParams:` + + Parameters for updating OAuth refresh token configuration. + + - `string? RefreshToken` + + Updated OAuth refresh token. + + - `string? Scope` + + Updated OAuth scope for the refresh request. + + - `TokenEndpointAuth TokenEndpointAuth` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam:` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `string? ClientSecret` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam:` + + Updated POST body authentication parameters for the token endpoint. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? ClientSecret` + + Updated OAuth client secret. + +### Beta Managed Agents MCP OAuth Update Params + +- `class BetaManagedAgentsMcpOAuthUpdateParams:` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `string? AccessToken` + + Updated OAuth access token. + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshUpdateParams? Refresh` + + Parameters for updating OAuth refresh token configuration. + + - `string? RefreshToken` + + Updated OAuth refresh token. + + - `string? Scope` + + Updated OAuth scope for the refresh request. + + - `TokenEndpointAuth TokenEndpointAuth` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam:` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `string? ClientSecret` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam:` + + Updated POST body authentication parameters for the token endpoint. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? ClientSecret` + + Updated OAuth client secret. + +### Beta Managed Agents Static Bearer Auth Response + +- `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + +### Beta Managed Agents Static Bearer Create Params + +- `class BetaManagedAgentsStaticBearerCreateParams:` + + Parameters for creating a static bearer token credential. + + - `required string Token` + + Static bearer token value. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + +### Beta Managed Agents Static Bearer Update Params + +- `class BetaManagedAgentsStaticBearerUpdateParams:` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `string? Token` + + Updated static bearer token value. + +### Beta Managed Agents Token Endpoint Auth Basic Param + +- `class BetaManagedAgentsTokenEndpointAuthBasicParam:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required string ClientSecret` + + OAuth client secret. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + +### Beta Managed Agents Token Endpoint Auth Basic Response + +- `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + +### Beta Managed Agents Token Endpoint Auth Basic Update Param + +- `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam:` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `string? ClientSecret` + + Updated OAuth client secret. + +### Beta Managed Agents Token Endpoint Auth None Param + +- `class BetaManagedAgentsTokenEndpointAuthNoneParam:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + +### Beta Managed Agents Token Endpoint Auth None Response + +- `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + +### Beta Managed Agents Token Endpoint Auth Post Param + +- `class BetaManagedAgentsTokenEndpointAuthPostParam:` + + Token endpoint uses POST body authentication with client credentials. + + - `required string ClientSecret` + + OAuth client secret. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + +### Beta Managed Agents Token Endpoint Auth Post Response + +- `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + +### Beta Managed Agents Token Endpoint Auth Post Update Param + +- `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam:` + + Updated POST body authentication parameters for the token endpoint. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? ClientSecret` + + Updated OAuth client secret. diff --git a/content/en/api/csharp/beta/vaults/credentials/archive.md b/content/en/api/csharp/beta/vaults/credentials/archive.md new file mode 100644 index 000000000..ace12a612 --- /dev/null +++ b/content/en/api/csharp/beta/vaults/credentials/archive.md @@ -0,0 +1,197 @@ +## Archive + +`BetaManagedAgentsCredential Beta.Vaults.Credentials.Archive(CredentialArchiveParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}/archive` + +Archive Credential + +### Parameters + +- `CredentialArchiveParams parameters` + + - `required string vaultID` + + Path param: Path parameter vault_id + + - `required string credentialID` + + Path param: Path parameter credential_id + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `required string ID` + + Unique identifier for the credential. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required Auth Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshResponse? Refresh` + + OAuth refresh token configuration returned in credential responses. + + - `required string ClientID` + + OAuth client ID. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the credential. + + - `required Type Type` + + - `"vault_credential"VaultCredential` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string VaultID` + + Identifier of the vault this credential belongs to. + + - `string? DisplayName` + + Human-readable name for the credential. + +### Example + +```csharp +CredentialArchiveParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv", + CredentialID = "vcrd_011CZkZEMt8gZan2iYOQfSkw", +}; + +var betaManagedAgentsCredential = await client.Beta.Vaults.Credentials.Archive(parameters); + +Console.WriteLine(betaManagedAgentsCredential); +``` diff --git a/content/en/api/csharp/beta/vaults/credentials/create.md b/content/en/api/csharp/beta/vaults/credentials/create.md new file mode 100644 index 000000000..5dff94cc7 --- /dev/null +++ b/content/en/api/csharp/beta/vaults/credentials/create.md @@ -0,0 +1,306 @@ +## Create + +`BetaManagedAgentsCredential Beta.Vaults.Credentials.Create(CredentialCreateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/vaults/{vault_id}/credentials` + +Create Credential + +### Parameters + +- `CredentialCreateParams parameters` + + - `required string vaultID` + + Path param: Path parameter vault_id + + - `required Auth auth` + + Body param: Authentication details for creating a credential. + + - `class BetaManagedAgentsMcpOAuthCreateParams:` + + Parameters for creating an MCP OAuth credential. + + - `required string AccessToken` + + OAuth access token. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshParams? Refresh` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `required string ClientID` + + OAuth client ID. + + - `required string RefreshToken` + + OAuth refresh token. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required string ClientSecret` + + OAuth client secret. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam:` + + Token endpoint uses POST body authentication with client credentials. + + - `required string ClientSecret` + + OAuth client secret. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerCreateParams:` + + Parameters for creating a static bearer token credential. + + - `required string Token` + + Static bearer token value. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `string? displayName` + + Body param: Human-readable name for the credential. Up to 255 characters. + + - `IReadOnlyDictionary metadata` + + Body param: Arbitrary key-value metadata to attach to the credential. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `required string ID` + + Unique identifier for the credential. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required Auth Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshResponse? Refresh` + + OAuth refresh token configuration returned in credential responses. + + - `required string ClientID` + + OAuth client ID. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the credential. + + - `required Type Type` + + - `"vault_credential"VaultCredential` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string VaultID` + + Identifier of the vault this credential belongs to. + + - `string? DisplayName` + + Human-readable name for the credential. + +### Example + +```csharp +CredentialCreateParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv", + Auth = new BetaManagedAgentsStaticBearerCreateParams() + { + Token = "bearer_exampletoken", + McpServerUrl = "https://example-server.modelcontextprotocol.io/sse", + Type = Type.StaticBearer, + }, +}; + +var betaManagedAgentsCredential = await client.Beta.Vaults.Credentials.Create(parameters); + +Console.WriteLine(betaManagedAgentsCredential); +``` diff --git a/content/en/api/csharp/beta/vaults/credentials/delete.md b/content/en/api/csharp/beta/vaults/credentials/delete.md new file mode 100644 index 000000000..c70045b4f --- /dev/null +++ b/content/en/api/csharp/beta/vaults/credentials/delete.md @@ -0,0 +1,93 @@ +## Delete + +`BetaManagedAgentsDeletedCredential Beta.Vaults.Credentials.Delete(CredentialDeleteParamsparameters, CancellationTokencancellationToken = default)` + +**delete** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Delete Credential + +### Parameters + +- `CredentialDeleteParams parameters` + + - `required string vaultID` + + Path param: Path parameter vault_id + + - `required string credentialID` + + Path param: Path parameter credential_id + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsDeletedCredential:` + + Confirmation of a deleted credential. + + - `required string ID` + + Unique identifier of the deleted credential. + + - `required Type Type` + + - `"vault_credential_deleted"VaultCredentialDeleted` + +### Example + +```csharp +CredentialDeleteParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv", + CredentialID = "vcrd_011CZkZEMt8gZan2iYOQfSkw", +}; + +var betaManagedAgentsDeletedCredential = await client.Beta.Vaults.Credentials.Delete(parameters); + +Console.WriteLine(betaManagedAgentsDeletedCredential); +``` diff --git a/content/en/api/csharp/beta/vaults/credentials/list.md b/content/en/api/csharp/beta/vaults/credentials/list.md new file mode 100644 index 000000000..675566e31 --- /dev/null +++ b/content/en/api/csharp/beta/vaults/credentials/list.md @@ -0,0 +1,214 @@ +## List + +`CredentialListPageResponse Beta.Vaults.Credentials.List(CredentialListParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/vaults/{vault_id}/credentials` + +List Credentials + +### Parameters + +- `CredentialListParams parameters` + + - `required string vaultID` + + Path param: Path parameter vault_id + + - `Boolean includeArchived` + + Query param: Whether to include archived credentials in the results. + + - `Int limit` + + Query param: Maximum number of credentials to return per page. Defaults to 20, maximum 100. + + - `string page` + + Query param: Opaque pagination token from a previous `list_credentials` response. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class CredentialListPageResponse:` + + Response containing a paginated list of credentials. + + - `IReadOnlyList Data` + + List of credentials. + + - `required string ID` + + Unique identifier for the credential. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required Auth Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshResponse? Refresh` + + OAuth refresh token configuration returned in credential responses. + + - `required string ClientID` + + OAuth client ID. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the credential. + + - `required Type Type` + + - `"vault_credential"VaultCredential` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string VaultID` + + Identifier of the vault this credential belongs to. + + - `string? DisplayName` + + Human-readable name for the credential. + + - `string? NextPage` + + Pagination token for the next page, or null if no more results. + +### Example + +```csharp +CredentialListParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv" +}; + +var page = await client.Beta.Vaults.Credentials.List(parameters); +await foreach (var item in page.Paginate()) +{ + Console.WriteLine(item); +} +``` diff --git a/content/en/api/csharp/beta/vaults/credentials/retrieve.md b/content/en/api/csharp/beta/vaults/credentials/retrieve.md new file mode 100644 index 000000000..1d26c7d07 --- /dev/null +++ b/content/en/api/csharp/beta/vaults/credentials/retrieve.md @@ -0,0 +1,197 @@ +## Retrieve + +`BetaManagedAgentsCredential Beta.Vaults.Credentials.Retrieve(CredentialRetrieveParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Get Credential + +### Parameters + +- `CredentialRetrieveParams parameters` + + - `required string vaultID` + + Path param: Path parameter vault_id + + - `required string credentialID` + + Path param: Path parameter credential_id + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `required string ID` + + Unique identifier for the credential. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required Auth Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshResponse? Refresh` + + OAuth refresh token configuration returned in credential responses. + + - `required string ClientID` + + OAuth client ID. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the credential. + + - `required Type Type` + + - `"vault_credential"VaultCredential` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string VaultID` + + Identifier of the vault this credential belongs to. + + - `string? DisplayName` + + Human-readable name for the credential. + +### Example + +```csharp +CredentialRetrieveParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv", + CredentialID = "vcrd_011CZkZEMt8gZan2iYOQfSkw", +}; + +var betaManagedAgentsCredential = await client.Beta.Vaults.Credentials.Retrieve(parameters); + +Console.WriteLine(betaManagedAgentsCredential); +``` diff --git a/content/en/api/csharp/beta/vaults/credentials/update.md b/content/en/api/csharp/beta/vaults/credentials/update.md new file mode 100644 index 000000000..180dafff6 --- /dev/null +++ b/content/en/api/csharp/beta/vaults/credentials/update.md @@ -0,0 +1,277 @@ +## Update + +`BetaManagedAgentsCredential Beta.Vaults.Credentials.Update(CredentialUpdateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Update Credential + +### Parameters + +- `CredentialUpdateParams parameters` + + - `required string vaultID` + + Path param: Path parameter vault_id + + - `required string credentialID` + + Path param: Path parameter credential_id + + - `Auth auth` + + Body param: Updated authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthUpdateParams:` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `string? AccessToken` + + Updated OAuth access token. + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshUpdateParams? Refresh` + + Parameters for updating OAuth refresh token configuration. + + - `string? RefreshToken` + + Updated OAuth refresh token. + + - `string? Scope` + + Updated OAuth scope for the refresh request. + + - `TokenEndpointAuth TokenEndpointAuth` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam:` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `string? ClientSecret` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam:` + + Updated POST body authentication parameters for the token endpoint. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? ClientSecret` + + Updated OAuth client secret. + + - `class BetaManagedAgentsStaticBearerUpdateParams:` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `string? Token` + + Updated static bearer token value. + + - `string? displayName` + + Body param: Updated human-readable name for the credential. 1-255 characters. + + - `IReadOnlyDictionary? metadata` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `required string ID` + + Unique identifier for the credential. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required Auth Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"mcp_oauth"McpOAuth` + + - `DateTimeOffset? ExpiresAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsMcpOAuthRefreshResponse? Refresh` + + OAuth refresh token configuration returned in credential responses. + + - `required string ClientID` + + OAuth client ID. + + - `required string TokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `required TokenEndpointAuth TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `required Type Type` + + - `"none"None` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `required Type Type` + + - `"client_secret_basic"ClientSecretBasic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `required Type Type` + + - `"client_secret_post"ClientSecretPost` + + - `string? Resource` + + OAuth resource indicator. + + - `string? Scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `required string McpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `required Type Type` + + - `"static_bearer"StaticBearer` + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the credential. + + - `required Type Type` + + - `"vault_credential"VaultCredential` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `required string VaultID` + + Identifier of the vault this credential belongs to. + + - `string? DisplayName` + + Human-readable name for the credential. + +### Example + +```csharp +CredentialUpdateParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv", + CredentialID = "vcrd_011CZkZEMt8gZan2iYOQfSkw", +}; + +var betaManagedAgentsCredential = await client.Beta.Vaults.Credentials.Update(parameters); + +Console.WriteLine(betaManagedAgentsCredential); +``` diff --git a/content/en/api/csharp/beta/vaults/delete.md b/content/en/api/csharp/beta/vaults/delete.md new file mode 100644 index 000000000..fd4704022 --- /dev/null +++ b/content/en/api/csharp/beta/vaults/delete.md @@ -0,0 +1,88 @@ +## Delete + +`BetaManagedAgentsDeletedVault Beta.Vaults.Delete(VaultDeleteParamsparameters, CancellationTokencancellationToken = default)` + +**delete** `/v1/vaults/{vault_id}` + +Delete Vault + +### Parameters + +- `VaultDeleteParams parameters` + + - `required string vaultID` + + Path parameter vault_id + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsDeletedVault:` + + Confirmation of a deleted vault. + + - `required string ID` + + Unique identifier of the deleted vault. + + - `required Type Type` + + - `"vault_deleted"VaultDeleted` + +### Example + +```csharp +VaultDeleteParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv" +}; + +var betaManagedAgentsDeletedVault = await client.Beta.Vaults.Delete(parameters); + +Console.WriteLine(betaManagedAgentsDeletedVault); +``` diff --git a/content/en/api/csharp/beta/vaults/list.md b/content/en/api/csharp/beta/vaults/list.md new file mode 100644 index 000000000..ed95544eb --- /dev/null +++ b/content/en/api/csharp/beta/vaults/list.md @@ -0,0 +1,123 @@ +## List + +`VaultListPageResponse Beta.Vaults.List(VaultListParams?parameters, CancellationTokencancellationToken = default)` + +**get** `/v1/vaults` + +List Vaults + +### Parameters + +- `VaultListParams parameters` + + - `Boolean includeArchived` + + Query param: Whether to include archived vaults in the results. + + - `Int limit` + + Query param: Maximum number of vaults to return per page. Defaults to 20, maximum 100. + + - `string page` + + Query param: Opaque pagination token from a previous `list_vaults` response. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class VaultListPageResponse:` + + Response containing a paginated list of vaults. + + - `IReadOnlyList Data` + + List of vaults. + + - `required string ID` + + Unique identifier for the vault. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string DisplayName` + + Human-readable name for the vault. + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the vault. + + - `required Type Type` + + - `"vault"Vault` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + + - `string? NextPage` + + Pagination token for the next page, or null if no more results. + +### Example + +```csharp +VaultListParams parameters = new(); + +var page = await client.Beta.Vaults.List(parameters); +await foreach (var item in page.Paginate()) +{ + Console.WriteLine(item); +} +``` diff --git a/content/en/api/csharp/beta/vaults/retrieve.md b/content/en/api/csharp/beta/vaults/retrieve.md new file mode 100644 index 000000000..1bee36a46 --- /dev/null +++ b/content/en/api/csharp/beta/vaults/retrieve.md @@ -0,0 +1,108 @@ +## Retrieve + +`BetaManagedAgentsVault Beta.Vaults.Retrieve(VaultRetrieveParamsparameters, CancellationTokencancellationToken = default)` + +**get** `/v1/vaults/{vault_id}` + +Get Vault + +### Parameters + +- `VaultRetrieveParams parameters` + + - `required string vaultID` + + Path parameter vault_id + + - `IReadOnlyList betas` + + Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsVault:` + + A vault that stores credentials for use by agents during sessions. + + - `required string ID` + + Unique identifier for the vault. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string DisplayName` + + Human-readable name for the vault. + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the vault. + + - `required Type Type` + + - `"vault"Vault` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + +### Example + +```csharp +VaultRetrieveParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv" +}; + +var betaManagedAgentsVault = await client.Beta.Vaults.Retrieve(parameters); + +Console.WriteLine(betaManagedAgentsVault); +``` diff --git a/content/en/api/csharp/beta/vaults/update.md b/content/en/api/csharp/beta/vaults/update.md new file mode 100644 index 000000000..9256d8dd5 --- /dev/null +++ b/content/en/api/csharp/beta/vaults/update.md @@ -0,0 +1,116 @@ +## Update + +`BetaManagedAgentsVault Beta.Vaults.Update(VaultUpdateParamsparameters, CancellationTokencancellationToken = default)` + +**post** `/v1/vaults/{vault_id}` + +Update Vault + +### Parameters + +- `VaultUpdateParams parameters` + + - `required string vaultID` + + Path param: Path parameter vault_id + + - `string? displayName` + + Body param: Updated human-readable name for the vault. 1-255 characters. + + - `IReadOnlyDictionary? metadata` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + + - `IReadOnlyList betas` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `"message-batches-2024-09-24"MessageBatches2024_09_24` + + - `"prompt-caching-2024-07-31"PromptCaching2024_07_31` + + - `"computer-use-2024-10-22"ComputerUse2024_10_22` + + - `"computer-use-2025-01-24"ComputerUse2025_01_24` + + - `"pdfs-2024-09-25"Pdfs2024_09_25` + + - `"token-counting-2024-11-01"TokenCounting2024_11_01` + + - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19` + + - `"output-128k-2025-02-19"Output128k2025_02_19` + + - `"files-api-2025-04-14"FilesApi2025_04_14` + + - `"mcp-client-2025-04-04"McpClient2025_04_04` + + - `"mcp-client-2025-11-20"McpClient2025_11_20` + + - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14` + + - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14` + + - `"code-execution-2025-05-22"CodeExecution2025_05_22` + + - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11` + + - `"context-1m-2025-08-07"Context1m2025_08_07` + + - `"context-management-2025-06-27"ContextManagement2025_06_27` + + - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26` + + - `"skills-2025-10-02"Skills2025_10_02` + + - `"fast-mode-2026-02-01"FastMode2026_02_01` + + - `"output-300k-2026-03-24"Output300k2026_03_24` + +### Returns + +- `class BetaManagedAgentsVault:` + + A vault that stores credentials for use by agents during sessions. + + - `required string ID` + + Unique identifier for the vault. + + - `required DateTimeOffset? ArchivedAt` + + A timestamp in RFC 3339 format + + - `required DateTimeOffset CreatedAt` + + A timestamp in RFC 3339 format + + - `required string DisplayName` + + Human-readable name for the vault. + + - `required IReadOnlyDictionary Metadata` + + Arbitrary key-value metadata attached to the vault. + + - `required Type Type` + + - `"vault"Vault` + + - `required DateTimeOffset UpdatedAt` + + A timestamp in RFC 3339 format + +### Example + +```csharp +VaultUpdateParams parameters = new() +{ + VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv" +}; + +var betaManagedAgentsVault = await client.Beta.Vaults.Update(parameters); + +Console.WriteLine(betaManagedAgentsVault); +``` diff --git a/content/en/api/csharp/messages.md b/content/en/api/csharp/messages.md index 7afe48264..24cdfbdd2 100644 --- a/content/en/api/csharp/messages.md +++ b/content/en/api/csharp/messages.md @@ -3795,9 +3795,13 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -7157,7 +7161,7 @@ MessageCountTokensParams parameters = new() Role = Role.User, }, ], - Model = Model.ClaudeOpus4_6, + Model = Model.ClaudeMythosPreview, }; var messageTokensCount = await client.Messages.CountTokens(parameters); @@ -12055,9 +12059,13 @@ Console.WriteLine(messageTokensCount); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -16709,9 +16717,13 @@ Console.WriteLine(messageTokensCount); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -17521,9 +17533,13 @@ Console.WriteLine(messageTokensCount); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -25504,9 +25520,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -28161,9 +28181,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -29250,9 +29274,13 @@ await foreach (var messageBatchIndividualResponse in client.Messages.Batches.Res See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -30166,9 +30194,13 @@ await foreach (var messageBatchIndividualResponse in client.Messages.Batches.Res See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -31044,9 +31076,13 @@ await foreach (var messageBatchIndividualResponse in client.Messages.Batches.Res See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` diff --git a/content/en/api/csharp/messages/batches.md b/content/en/api/csharp/messages/batches.md index 042d7258a..b6984ccdf 100644 --- a/content/en/api/csharp/messages/batches.md +++ b/content/en/api/csharp/messages/batches.md @@ -2017,9 +2017,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -4674,9 +4678,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -5763,9 +5771,13 @@ await foreach (var messageBatchIndividualResponse in client.Messages.Batches.Res See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -6679,9 +6691,13 @@ await foreach (var messageBatchIndividualResponse in client.Messages.Batches.Res See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` @@ -7557,9 +7573,13 @@ await foreach (var messageBatchIndividualResponse in client.Messages.Batches.Res See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` diff --git a/content/en/api/csharp/messages/batches/create.md b/content/en/api/csharp/messages/batches/create.md index 45b2ca55f..e2821d1ae 100644 --- a/content/en/api/csharp/messages/batches/create.md +++ b/content/en/api/csharp/messages/batches/create.md @@ -2015,9 +2015,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` diff --git a/content/en/api/csharp/messages/batches/results.md b/content/en/api/csharp/messages/batches/results.md index f4be58ea3..d900a75ab 100644 --- a/content/en/api/csharp/messages/batches/results.md +++ b/content/en/api/csharp/messages/batches/results.md @@ -643,9 +643,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` diff --git a/content/en/api/csharp/messages/count_tokens.md b/content/en/api/csharp/messages/count_tokens.md index 40dd7ca72..fde49266f 100644 --- a/content/en/api/csharp/messages/count_tokens.md +++ b/content/en/api/csharp/messages/count_tokens.md @@ -3145,7 +3145,7 @@ MessageCountTokensParams parameters = new() Role = Role.User, }, ], - Model = Model.ClaudeOpus4_6, + Model = Model.ClaudeMythosPreview, }; var messageTokensCount = await client.Messages.CountTokens(parameters); diff --git a/content/en/api/csharp/messages/create.md b/content/en/api/csharp/messages/create.md index bb797667e..238964b4b 100644 --- a/content/en/api/csharp/messages/create.md +++ b/content/en/api/csharp/messages/create.md @@ -3793,9 +3793,13 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"ClaudeMythosPreview` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"ClaudeOpus4_6` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"ClaudeSonnet4_6` diff --git a/content/en/api/csharp/models.md b/content/en/api/csharp/models.md index 019b011a8..ed1e922e3 100644 --- a/content/en/api/csharp/models.md +++ b/content/en/api/csharp/models.md @@ -74,8 +74,6 @@ The Models API response can be used to determine which models are available for - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class ModelListPageResponse:` @@ -348,8 +346,6 @@ The Models API response can be used to determine information about a specific mo - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class ModelInfo:` diff --git a/content/en/api/csharp/models/list.md b/content/en/api/csharp/models/list.md index c7e5767cc..7ca0967ba 100644 --- a/content/en/api/csharp/models/list.md +++ b/content/en/api/csharp/models/list.md @@ -72,8 +72,6 @@ The Models API response can be used to determine which models are available for - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class ModelListPageResponse:` diff --git a/content/en/api/csharp/models/retrieve.md b/content/en/api/csharp/models/retrieve.md index 006d3be5f..bbd6bac08 100644 --- a/content/en/api/csharp/models/retrieve.md +++ b/content/en/api/csharp/models/retrieve.md @@ -62,8 +62,6 @@ The Models API response can be used to determine information about a specific mo - `"output-300k-2026-03-24"Output300k2026_03_24` - - `"user-profiles-2026-03-24"UserProfiles2026_03_24` - ### Returns - `class ModelInfo:` diff --git a/content/en/api/errors.md b/content/en/api/errors.md index 41ab7bf23..9a9fee83c 100644 --- a/content/en/api/errors.md +++ b/content/en/api/errors.md @@ -62,6 +62,14 @@ Every API response includes a unique `request-id` header. This header contains a The official SDKs provide this value as a property on top-level response objects, containing the value of the `request-id` header: + ```bash CLI + # The request-id header is printed to stderr with --debug: + ant --debug messages create \ + --model claude-opus-4-6 \ + --max-tokens 1024 \ + --message '{role: user, content: "Hello, Claude"}' + ``` + ```python Python hidelines={1..2} import anthropic diff --git a/content/en/api/go/beta.md b/content/en/api/go/beta.md index 3fc56ff41..b6784a6aa 100644 --- a/content/en/api/go/beta.md +++ b/content/en/api/go/beta.md @@ -52,8 +52,6 @@ - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Beta API Error - `type BetaAPIError struct{…}` @@ -384,8 +382,6 @@ The Models API response can be used to determine which models are available for - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaModelInfo struct{…}` @@ -665,8 +661,6 @@ The Models API response can be used to determine information about a specific mo - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaModelInfo struct{…}` @@ -5693,10 +5687,6 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en Recommended for advanced use cases only. You usually only need to use `temperature`. - - `UserProfileID param.Field[string]` - - Body param: The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `Betas param.Field[[]AnthropicBeta]` Header param: Optional header to specify the beta version(s) you want to use. @@ -5747,8 +5737,6 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaMessage struct{…}` @@ -6678,9 +6666,13 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -11302,8 +11294,6 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaMessageTokensCount struct{…}` @@ -11346,7 +11336,7 @@ func main() { }}, Role: anthropic.BetaMessageParamRoleUser, }}, - Model: anthropic.ModelClaudeOpus4_6, + Model: anthropic.ModelClaudeMythosPreview, }) if err != nil { panic(err.Error()) @@ -18544,9 +18534,13 @@ func main() { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -23884,9 +23878,13 @@ func main() { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -25128,9 +25126,13 @@ func main() { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -36264,9 +36266,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -38333,10 +38339,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Recommended for advanced use cases only. You usually only need to use `temperature`. - - `UserProfileID string` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `Betas param.Field[[]AnthropicBeta]` Header param: Optional header to specify the beta version(s) you want to use. @@ -38387,8 +38389,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaMessageBatch struct{…}` @@ -38588,8 +38588,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaMessageBatch struct{…}` @@ -38789,8 +38787,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaMessageBatch struct{…}` @@ -38978,8 +38974,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaMessageBatch struct{…}` @@ -39171,8 +39165,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaDeletedMessageBatch struct{…}` @@ -39290,8 +39282,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaMessageBatchIndividualResponse struct{…}` @@ -40239,9 +40229,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -41837,9 +41831,13 @@ func main() { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -43209,9 +43207,13 @@ func main() { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -44543,9 +44545,13 @@ func main() { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -44846,305 +44852,347 @@ func main() { - `const SucceededSucceeded Succeeded = "succeeded"` -# Files +# Agents -## Upload +## Create -`client.Beta.Files.Upload(ctx, params) (*FileMetadata, error)` +`client.Beta.Agents.New(ctx, params) (*BetaManagedAgentsAgent, error)` -**post** `/v1/files` +**post** `/v1/agents` -Upload File +Create Agent ### Parameters -- `params BetaFileUploadParams` +- `params BetaAgentNewParams` - - `File param.Field[Reader]` + - `Model param.Field[BetaManagedAgentsModelConfigParamsResp]` - Body param: The file to upload + Body param: Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control - - `Betas param.Field[[]AnthropicBeta]` + - `type BetaManagedAgentsModelConfigParamsResp struct{…}` - Header param: Optional header to specify the beta version(s) you want to use. + An object that defines additional configuration control over model use - - `string` + - `ID BetaManagedAgentsModel` - - `type AnthropicBeta string` + The model that will power your agent. - - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + - `type BetaManagedAgentsModel string` - - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + The model that will power your agent. - - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` - - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + Most intelligent model for building agents and coding - - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` - - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + Best combination of speed and intelligence - - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` - - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + Fastest model with near-frontier intelligence - - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` - - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + Fastest model with near-frontier intelligence - - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` - - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + Premium model combining maximum intelligence with practical performance - - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` - - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + Premium model combining maximum intelligence with practical performance - - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` - - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + High-performance model for agents and coding - - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` - - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + High-performance model for agents and coding - - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + - `string` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` + - `Speed BetaManagedAgentsModelConfigParamsSpeed` -### Returns + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. -- `type FileMetadata struct{…}` + - `const BetaManagedAgentsModelConfigParamsSpeedStandard BetaManagedAgentsModelConfigParamsSpeed = "standard"` - - `ID string` + - `const BetaManagedAgentsModelConfigParamsSpeedFast BetaManagedAgentsModelConfigParamsSpeed = "fast"` - Unique object identifier. + - `Name param.Field[string]` - The format and length of IDs may change over time. + Body param: Human-readable name for the agent. 1-256 characters. - - `CreatedAt Time` + - `Description param.Field[string]` - RFC 3339 datetime string representing when the file was created. + Body param: Description of what the agent does. Up to 2048 characters. - - `Filename string` + - `MCPServers param.Field[[]BetaManagedAgentsURLMCPServerParamsResp]` - Original filename of the uploaded file. + Body param: MCP servers this agent connects to. Maximum 20. Names must be unique within the array. - - `MimeType string` + - `Name string` - MIME type of the file. + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. - - `SizeBytes int64` + - `Type BetaManagedAgentsURLMCPServerParamsType` - Size of the file in bytes. + - `const BetaManagedAgentsURLMCPServerParamsTypeURL BetaManagedAgentsURLMCPServerParamsType = "url"` - - `Type File` + - `URL string` - Object type. + Endpoint URL for the MCP server. - For files, this is always `"file"`. + - `Metadata param.Field[map[string, string]]` - - `const FileFile File = "file"` + Body param: Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars. - - `Downloadable bool` + - `Skills param.Field[[]BetaManagedAgentsSkillParamsUnionResp]` - Whether the file can be downloaded. + Body param: Skills available to the agent. Maximum 20. -### Example + - `type BetaManagedAgentsAnthropicSkillParamsResp struct{…}` -```go -package main + An Anthropic-managed skill. -import ( - "bytes" - "context" - "fmt" - "io" + - `SkillID string` - "github.com/anthropics/anthropic-sdk-go" - "github.com/anthropics/anthropic-sdk-go/option" -) + Identifier of the Anthropic skill (e.g., "xlsx"). -func main() { - client := anthropic.NewClient( - option.WithAPIKey("my-anthropic-api-key"), - ) - fileMetadata, err := client.Beta.Files.Upload(context.TODO(), anthropic.BetaFileUploadParams{ - File: io.Reader(bytes.NewBuffer([]byte("Example data"))), - }) - if err != nil { - panic(err.Error()) - } - fmt.Printf("%+v\n", fileMetadata.ID) -} -``` + - `Type BetaManagedAgentsAnthropicSkillParamsType` -## List + - `const BetaManagedAgentsAnthropicSkillParamsTypeAnthropic BetaManagedAgentsAnthropicSkillParamsType = "anthropic"` -`client.Beta.Files.List(ctx, params) (*Page[FileMetadata], error)` + - `Version string` -**get** `/v1/files` + Version to pin. Defaults to latest if omitted. -List Files + - `type BetaManagedAgentsCustomSkillParamsResp struct{…}` -### Parameters + A user-created custom skill. -- `params BetaFileListParams` + - `SkillID string` - - `AfterID param.Field[string]` + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). - Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object. + - `Type BetaManagedAgentsCustomSkillParamsType` - - `BeforeID param.Field[string]` + - `const BetaManagedAgentsCustomSkillParamsTypeCustom BetaManagedAgentsCustomSkillParamsType = "custom"` - Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object. + - `Version string` - - `Limit param.Field[int64]` + Version to pin. Defaults to latest if omitted. - Query param: Number of items to return per page. + - `System param.Field[string]` - Defaults to `20`. Ranges from `1` to `1000`. + Body param: System prompt for the agent. Up to 100,000 characters. - - `Betas param.Field[[]AnthropicBeta]` + - `Tools param.Field[[]BetaAgentNewParamsToolUnion]` - Header param: Optional header to specify the beta version(s) you want to use. + Body param: Tool configurations available to the agent. Maximum of 128 tools across all toolsets allowed. - - `string` + - `type BetaManagedAgentsAgentToolset20260401ParamsResp struct{…}` - - `type AnthropicBeta string` + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. - - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + - `Type BetaManagedAgentsAgentToolset20260401ParamsType` - - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + - `const BetaManagedAgentsAgentToolset20260401ParamsTypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401ParamsType = "agent_toolset_20260401"` - - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + - `Configs []BetaManagedAgentsAgentToolConfigParamsResp` - - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + Per-tool configuration overrides. - - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + - `Name BetaManagedAgentsAgentToolConfigParamsName` - - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + Built-in agent tool identifier. - - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + - `const BetaManagedAgentsAgentToolConfigParamsNameBash BetaManagedAgentsAgentToolConfigParamsName = "bash"` - - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + - `const BetaManagedAgentsAgentToolConfigParamsNameEdit BetaManagedAgentsAgentToolConfigParamsName = "edit"` - - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + - `const BetaManagedAgentsAgentToolConfigParamsNameRead BetaManagedAgentsAgentToolConfigParamsName = "read"` - - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + - `const BetaManagedAgentsAgentToolConfigParamsNameWrite BetaManagedAgentsAgentToolConfigParamsName = "write"` - - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + - `const BetaManagedAgentsAgentToolConfigParamsNameGlob BetaManagedAgentsAgentToolConfigParamsName = "glob"` - - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + - `const BetaManagedAgentsAgentToolConfigParamsNameGrep BetaManagedAgentsAgentToolConfigParamsName = "grep"` - - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + - `const BetaManagedAgentsAgentToolConfigParamsNameWebFetch BetaManagedAgentsAgentToolConfigParamsName = "web_fetch"` - - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + - `const BetaManagedAgentsAgentToolConfigParamsNameWebSearch BetaManagedAgentsAgentToolConfigParamsName = "web_search"` - - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + - `Enabled bool` - - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + Whether this tool is enabled and available to Claude. Overrides the default_config setting. - - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + - `PermissionPolicy BetaManagedAgentsAgentToolConfigParamsPermissionPolicyUnionResp` - - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + Permission policy for tool execution. - - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` - - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + Tool calls are automatically approved without user confirmation. - - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + - `Type BetaManagedAgentsAlwaysAllowPolicyType` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` -### Returns + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` -- `type FileMetadata struct{…}` + Tool calls require user confirmation before execution. - - `ID string` + - `Type BetaManagedAgentsAlwaysAskPolicyType` - Unique object identifier. + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` - The format and length of IDs may change over time. + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfigParamsResp` - - `CreatedAt Time` + Default configuration for all tools in a toolset. - RFC 3339 datetime string representing when the file was created. + - `Enabled bool` - - `Filename string` + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. - Original filename of the uploaded file. + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigParamsPermissionPolicyUnionResp` - - `MimeType string` + Permission policy for tool execution. - MIME type of the file. + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` - - `SizeBytes int64` + Tool calls are automatically approved without user confirmation. - Size of the file in bytes. + - `Type BetaManagedAgentsAlwaysAllowPolicyType` - - `Type File` + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` - Object type. + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` - For files, this is always `"file"`. + Tool calls require user confirmation before execution. - - `const FileFile File = "file"` + - `Type BetaManagedAgentsAlwaysAskPolicyType` - - `Downloadable bool` + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` - Whether the file can be downloaded. + - `type BetaManagedAgentsMCPToolsetParamsResp struct{…}` -### Example + Configuration for tools from an MCP server defined in `mcp_servers`. -```go -package main + - `MCPServerName string` -import ( - "context" - "fmt" + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. - "github.com/anthropics/anthropic-sdk-go" - "github.com/anthropics/anthropic-sdk-go/option" -) + - `Type BetaManagedAgentsMCPToolsetParamsType` -func main() { - client := anthropic.NewClient( - option.WithAPIKey("my-anthropic-api-key"), - ) - page, err := client.Beta.Files.List(context.TODO(), anthropic.BetaFileListParams{ + - `const BetaManagedAgentsMCPToolsetParamsTypeMCPToolset BetaManagedAgentsMCPToolsetParamsType = "mcp_toolset"` - }) - if err != nil { - panic(err.Error()) - } - fmt.Printf("%+v\n", page) -} -``` + - `Configs []BetaManagedAgentsMCPToolConfigParamsResp` -## Download + Per-tool configuration overrides. -`client.Beta.Files.Download(ctx, fileID, query) (*Response, error)` + - `Name string` -**get** `/v1/files/{file_id}/content` + Name of the MCP tool to configure. 1-128 characters. -Download File + - `Enabled bool` -### Parameters + Whether this tool is enabled. Overrides the `default_config` setting. -- `fileID string` + - `PermissionPolicy BetaManagedAgentsMCPToolConfigParamsPermissionPolicyUnionResp` - ID of the File. + Permission policy for tool execution. -- `query BetaFileDownloadParams` + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfigParamsResp` + + Default configuration for all tools from an MCP server. + + - `Enabled bool` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `type BetaManagedAgentsCustomToolParamsResp struct{…}` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `Description string` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `Type BetaManagedAgentsCustomToolParamsType` + + - `const BetaManagedAgentsCustomToolParamsTypeCustom BetaManagedAgentsCustomToolParamsType = "custom"` - `Betas param.Field[[]AnthropicBeta]` - Optional header to specify the beta version(s) you want to use. + Header param: Optional header to specify the beta version(s) you want to use. - `string` @@ -45192,11 +45240,303 @@ Download File - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns -- `type BetaFileDownloadResponse interface{…}` +- `type BetaManagedAgentsAgent struct{…}` + + A Managed Agents `agent`. + + - `ID string` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Metadata map[string, string]` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsAgentType` + + - `const BetaManagedAgentsAgentTypeAgent BetaManagedAgentsAgentType = "agent"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Version int64` + + The agent's current version. Starts at 1 and increments when the agent is modified. ### Example @@ -45215,39 +45555,54 @@ func main() { client := anthropic.NewClient( option.WithAPIKey("my-anthropic-api-key"), ) - response, err := client.Beta.Files.Download( - context.TODO(), - "file_id", - anthropic.BetaFileDownloadParams{ - + betaManagedAgentsAgent, err := client.Beta.Agents.New(context.TODO(), anthropic.BetaAgentNewParams{ + Model: anthropic.BetaManagedAgentsModelConfigParams{ + ID: anthropic.BetaManagedAgentsModelClaudeOpus4_6, }, - ) + Name: "My First Agent", + }) if err != nil { panic(err.Error()) } - fmt.Printf("%+v\n", response) + fmt.Printf("%+v\n", betaManagedAgentsAgent.ID) } ``` -## Retrieve Metadata +## List -`client.Beta.Files.GetMetadata(ctx, fileID, query) (*FileMetadata, error)` +`client.Beta.Agents.List(ctx, params) (*PageCursor[BetaManagedAgentsAgent], error)` -**get** `/v1/files/{file_id}` +**get** `/v1/agents` -Get File Metadata +List Agents ### Parameters -- `fileID string` +- `params BetaAgentListParams` - ID of the File. + - `CreatedAtGte param.Field[Time]` -- `query BetaFileGetMetadataParams` + Query param: Return agents created at or after this time (inclusive). + + - `CreatedAtLte param.Field[Time]` + + Query param: Return agents created at or before this time (inclusive). + + - `IncludeArchived param.Field[bool]` + + Query param: Include archived agents in results. Defaults to false. + + - `Limit param.Field[int64]` + + Query param: Maximum results per page. Default 20, maximum 100. + + - `Page param.Field[string]` + + Query param: Opaque pagination cursor from a previous response. - `Betas param.Field[[]AnthropicBeta]` - Optional header to specify the beta version(s) you want to use. + Header param: Optional header to specify the beta version(s) you want to use. - `string` @@ -45295,45 +45650,303 @@ Get File Metadata - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns -- `type FileMetadata struct{…}` +- `type BetaManagedAgentsAgent struct{…}` + + A Managed Agents `agent`. - `ID string` - Unique object identifier. + - `ArchivedAt Time` - The format and length of IDs may change over time. + A timestamp in RFC 3339 format - `CreatedAt Time` - RFC 3339 datetime string representing when the file was created. + A timestamp in RFC 3339 format - - `Filename string` + - `Description string` - Original filename of the uploaded file. + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` - - `MimeType string` + - `Name string` - MIME type of the file. + - `Type BetaManagedAgentsMCPServerURLDefinitionType` - - `SizeBytes int64` + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` - Size of the file in bytes. + - `URL string` - - `Type File` + - `Metadata map[string, string]` - Object type. + - `Model BetaManagedAgentsModelConfig` - For files, this is always `"file"`. + Model identifier and configuration. - - `const FileFile File = "file"` + - `ID BetaManagedAgentsModel` - - `Downloadable bool` + The model that will power your agent. - Whether the file can be downloaded. + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsAgentType` + + - `const BetaManagedAgentsAgentTypeAgent BetaManagedAgentsAgentType = "agent"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Version int64` + + The agent's current version. Starts at 1 and increments when the agent is modified. ### Example @@ -45352,39 +45965,37 @@ func main() { client := anthropic.NewClient( option.WithAPIKey("my-anthropic-api-key"), ) - fileMetadata, err := client.Beta.Files.GetMetadata( - context.TODO(), - "file_id", - anthropic.BetaFileGetMetadataParams{ + page, err := client.Beta.Agents.List(context.TODO(), anthropic.BetaAgentListParams{ - }, - ) + }) if err != nil { panic(err.Error()) } - fmt.Printf("%+v\n", fileMetadata.ID) + fmt.Printf("%+v\n", page) } ``` -## Delete +## Retrieve -`client.Beta.Files.Delete(ctx, fileID, body) (*DeletedFile, error)` +`client.Beta.Agents.Get(ctx, agentID, params) (*BetaManagedAgentsAgent, error)` -**delete** `/v1/files/{file_id}` +**get** `/v1/agents/{agent_id}` -Delete File +Get Agent ### Parameters -- `fileID string` +- `agentID string` - ID of the File. +- `params BetaAgentGetParams` -- `body BetaFileDeleteParams` + - `Version param.Field[int64]` + + Query param: Agent version. Omit for the most recent version. Must be at least 1 if specified. - `Betas param.Field[[]AnthropicBeta]` - Optional header to specify the beta version(s) you want to use. + Header param: Optional header to specify the beta version(s) you want to use. - `string` @@ -45416,152 +46027,22066 @@ Delete File - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` - - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsAgent struct{…}` + + A Managed Agents `agent`. + + - `ID string` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Metadata map[string, string]` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsAgentType` + + - `const BetaManagedAgentsAgentTypeAgent BetaManagedAgentsAgentType = "agent"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Version int64` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsAgent, err := client.Beta.Agents.Get( + context.TODO(), + "agent_011CZkYpogX7uDKUyvBTophP", + anthropic.BetaAgentGetParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsAgent.ID) +} +``` + +## Update + +`client.Beta.Agents.Update(ctx, agentID, params) (*BetaManagedAgentsAgent, error)` + +**post** `/v1/agents/{agent_id}` + +Update Agent + +### Parameters + +- `agentID string` + +- `params BetaAgentUpdateParams` + + - `Version param.Field[int64]` + + Body param: The agent's current version, used to prevent concurrent overwrites. Obtain this value from a create or retrieve response. The request fails if this does not match the server's current version. + + - `Description param.Field[string]` + + Body param: Description. Up to 2048 characters. Omit to preserve; send empty string or null to clear. + + - `MCPServers param.Field[[]BetaManagedAgentsURLMCPServerParamsResp]` + + Body param: MCP servers. Full replacement. Omit to preserve; send empty array or null to clear. Names must be unique. Maximum 20. + + - `Name string` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `Type BetaManagedAgentsURLMCPServerParamsType` + + - `const BetaManagedAgentsURLMCPServerParamsTypeURL BetaManagedAgentsURLMCPServerParamsType = "url"` + + - `URL string` + + Endpoint URL for the MCP server. + + - `Metadata param.Field[map[string, string]]` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. The stored bag is limited to 16 keys (up to 64 chars each) with values up to 512 chars. + + - `Model param.Field[BetaManagedAgentsModelConfigParamsResp]` + + Body param: Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control. Omit to preserve. Cannot be cleared. + + - `type BetaManagedAgentsModelConfigParamsResp struct{…}` + + An object that defines additional configuration control over model use + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigParamsSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigParamsSpeedStandard BetaManagedAgentsModelConfigParamsSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigParamsSpeedFast BetaManagedAgentsModelConfigParamsSpeed = "fast"` + + - `Name param.Field[string]` + + Body param: Human-readable name. 1-256 characters. Omit to preserve. Cannot be cleared. + + - `Skills param.Field[[]BetaManagedAgentsSkillParamsUnionResp]` + + Body param: Skills. Full replacement. Omit to preserve; send empty array or null to clear. Maximum 20. + + - `type BetaManagedAgentsAnthropicSkillParamsResp struct{…}` + + An Anthropic-managed skill. + + - `SkillID string` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `Type BetaManagedAgentsAnthropicSkillParamsType` + + - `const BetaManagedAgentsAnthropicSkillParamsTypeAnthropic BetaManagedAgentsAnthropicSkillParamsType = "anthropic"` + + - `Version string` + + Version to pin. Defaults to latest if omitted. + + - `type BetaManagedAgentsCustomSkillParamsResp struct{…}` + + A user-created custom skill. + + - `SkillID string` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `Type BetaManagedAgentsCustomSkillParamsType` + + - `const BetaManagedAgentsCustomSkillParamsTypeCustom BetaManagedAgentsCustomSkillParamsType = "custom"` + + - `Version string` + + Version to pin. Defaults to latest if omitted. + + - `System param.Field[string]` + + Body param: System prompt. Up to 100,000 characters. Omit to preserve; send empty string or null to clear. + + - `Tools param.Field[[]BetaAgentUpdateParamsToolUnion]` + + Body param: Tool configurations available to the agent. Full replacement. Omit to preserve; send empty array or null to clear. Maximum of 128 tools across all toolsets allowed. + + - `type BetaManagedAgentsAgentToolset20260401ParamsResp struct{…}` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `Type BetaManagedAgentsAgentToolset20260401ParamsType` + + - `const BetaManagedAgentsAgentToolset20260401ParamsTypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401ParamsType = "agent_toolset_20260401"` + + - `Configs []BetaManagedAgentsAgentToolConfigParamsResp` + + Per-tool configuration overrides. + + - `Name BetaManagedAgentsAgentToolConfigParamsName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigParamsNameBash BetaManagedAgentsAgentToolConfigParamsName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameEdit BetaManagedAgentsAgentToolConfigParamsName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameRead BetaManagedAgentsAgentToolConfigParamsName = "read"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameWrite BetaManagedAgentsAgentToolConfigParamsName = "write"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameGlob BetaManagedAgentsAgentToolConfigParamsName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameGrep BetaManagedAgentsAgentToolConfigParamsName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameWebFetch BetaManagedAgentsAgentToolConfigParamsName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameWebSearch BetaManagedAgentsAgentToolConfigParamsName = "web_search"` + + - `Enabled bool` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfigParamsResp` + + Default configuration for all tools in a toolset. + + - `Enabled bool` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `type BetaManagedAgentsMCPToolsetParamsResp struct{…}` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `MCPServerName string` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `Type BetaManagedAgentsMCPToolsetParamsType` + + - `const BetaManagedAgentsMCPToolsetParamsTypeMCPToolset BetaManagedAgentsMCPToolsetParamsType = "mcp_toolset"` + + - `Configs []BetaManagedAgentsMCPToolConfigParamsResp` + + Per-tool configuration overrides. + + - `Name string` + + Name of the MCP tool to configure. 1-128 characters. + + - `Enabled bool` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfigParamsResp` + + Default configuration for all tools from an MCP server. + + - `Enabled bool` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `type BetaManagedAgentsCustomToolParamsResp struct{…}` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `Description string` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `Type BetaManagedAgentsCustomToolParamsType` + + - `const BetaManagedAgentsCustomToolParamsTypeCustom BetaManagedAgentsCustomToolParamsType = "custom"` + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsAgent struct{…}` + + A Managed Agents `agent`. + + - `ID string` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Metadata map[string, string]` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsAgentType` + + - `const BetaManagedAgentsAgentTypeAgent BetaManagedAgentsAgentType = "agent"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Version int64` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsAgent, err := client.Beta.Agents.Update( + context.TODO(), + "agent_011CZkYpogX7uDKUyvBTophP", + anthropic.BetaAgentUpdateParams{ + Version: 1, + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsAgent.ID) +} +``` + +## Archive + +`client.Beta.Agents.Archive(ctx, agentID, body) (*BetaManagedAgentsAgent, error)` + +**post** `/v1/agents/{agent_id}/archive` + +Archive Agent + +### Parameters + +- `agentID string` + +- `body BetaAgentArchiveParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsAgent struct{…}` + + A Managed Agents `agent`. + + - `ID string` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Metadata map[string, string]` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsAgentType` + + - `const BetaManagedAgentsAgentTypeAgent BetaManagedAgentsAgentType = "agent"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Version int64` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsAgent, err := client.Beta.Agents.Archive( + context.TODO(), + "agent_011CZkYpogX7uDKUyvBTophP", + anthropic.BetaAgentArchiveParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsAgent.ID) +} +``` + +## Domain Types + +### Beta Managed Agents Agent + +- `type BetaManagedAgentsAgent struct{…}` + + A Managed Agents `agent`. + + - `ID string` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Metadata map[string, string]` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsAgentType` + + - `const BetaManagedAgentsAgentTypeAgent BetaManagedAgentsAgentType = "agent"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Version int64` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Beta Managed Agents Agent Tool Config + +- `type BetaManagedAgentsAgentToolConfig struct{…}` + + Configuration for a specific agent tool. + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + +### Beta Managed Agents Agent Tool Config Params + +- `type BetaManagedAgentsAgentToolConfigParamsResp struct{…}` + + Configuration override for a specific tool within a toolset. + + - `Name BetaManagedAgentsAgentToolConfigParamsName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigParamsNameBash BetaManagedAgentsAgentToolConfigParamsName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameEdit BetaManagedAgentsAgentToolConfigParamsName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameRead BetaManagedAgentsAgentToolConfigParamsName = "read"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameWrite BetaManagedAgentsAgentToolConfigParamsName = "write"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameGlob BetaManagedAgentsAgentToolConfigParamsName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameGrep BetaManagedAgentsAgentToolConfigParamsName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameWebFetch BetaManagedAgentsAgentToolConfigParamsName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameWebSearch BetaManagedAgentsAgentToolConfigParamsName = "web_search"` + + - `Enabled bool` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + +### Beta Managed Agents Agent Toolset Default Config + +- `type BetaManagedAgentsAgentToolsetDefaultConfig struct{…}` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + +### Beta Managed Agents Agent Toolset Default Config Params + +- `type BetaManagedAgentsAgentToolsetDefaultConfigParamsResp struct{…}` + + Default configuration for all tools in a toolset. + + - `Enabled bool` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + +### Beta Managed Agents Agent Toolset20260401 + +- `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + +### Beta Managed Agents Agent Toolset20260401 Params + +- `type BetaManagedAgentsAgentToolset20260401ParamsResp struct{…}` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `Type BetaManagedAgentsAgentToolset20260401ParamsType` + + - `const BetaManagedAgentsAgentToolset20260401ParamsTypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401ParamsType = "agent_toolset_20260401"` + + - `Configs []BetaManagedAgentsAgentToolConfigParamsResp` + + Per-tool configuration overrides. + + - `Name BetaManagedAgentsAgentToolConfigParamsName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigParamsNameBash BetaManagedAgentsAgentToolConfigParamsName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameEdit BetaManagedAgentsAgentToolConfigParamsName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameRead BetaManagedAgentsAgentToolConfigParamsName = "read"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameWrite BetaManagedAgentsAgentToolConfigParamsName = "write"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameGlob BetaManagedAgentsAgentToolConfigParamsName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameGrep BetaManagedAgentsAgentToolConfigParamsName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameWebFetch BetaManagedAgentsAgentToolConfigParamsName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameWebSearch BetaManagedAgentsAgentToolConfigParamsName = "web_search"` + + - `Enabled bool` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfigParamsResp` + + Default configuration for all tools in a toolset. + + - `Enabled bool` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + +### Beta Managed Agents Always Allow Policy + +- `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + +### Beta Managed Agents Always Ask Policy + +- `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + +### Beta Managed Agents Anthropic Skill + +- `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + +### Beta Managed Agents Anthropic Skill Params + +- `type BetaManagedAgentsAnthropicSkillParamsResp struct{…}` + + An Anthropic-managed skill. + + - `SkillID string` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `Type BetaManagedAgentsAnthropicSkillParamsType` + + - `const BetaManagedAgentsAnthropicSkillParamsTypeAnthropic BetaManagedAgentsAnthropicSkillParamsType = "anthropic"` + + - `Version string` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents Custom Skill + +- `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + +### Beta Managed Agents Custom Skill Params + +- `type BetaManagedAgentsCustomSkillParamsResp struct{…}` + + A user-created custom skill. + + - `SkillID string` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `Type BetaManagedAgentsCustomSkillParamsType` + + - `const BetaManagedAgentsCustomSkillParamsTypeCustom BetaManagedAgentsCustomSkillParamsType = "custom"` + + - `Version string` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents Custom Tool + +- `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + +### Beta Managed Agents Custom Tool Input Schema + +- `type BetaManagedAgentsCustomToolInputSchema struct{…}` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + +### Beta Managed Agents Custom Tool Params + +- `type BetaManagedAgentsCustomToolParamsResp struct{…}` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `Description string` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `Type BetaManagedAgentsCustomToolParamsType` + + - `const BetaManagedAgentsCustomToolParamsTypeCustom BetaManagedAgentsCustomToolParamsType = "custom"` + +### Beta Managed Agents MCP Server URL Definition + +- `type BetaManagedAgentsMCPServerURLDefinition struct{…}` + + URL-based MCP server connection as returned in API responses. + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + +### Beta Managed Agents MCP Tool Config + +- `type BetaManagedAgentsMCPToolConfig struct{…}` + + Resolved configuration for a specific MCP tool. + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + +### Beta Managed Agents MCP Tool Config Params + +- `type BetaManagedAgentsMCPToolConfigParamsResp struct{…}` + + Configuration override for a specific MCP tool. + + - `Name string` + + Name of the MCP tool to configure. 1-128 characters. + + - `Enabled bool` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + +### Beta Managed Agents MCP Toolset + +- `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + +### Beta Managed Agents MCP Toolset Default Config + +- `type BetaManagedAgentsMCPToolsetDefaultConfig struct{…}` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + +### Beta Managed Agents MCP Toolset Default Config Params + +- `type BetaManagedAgentsMCPToolsetDefaultConfigParamsResp struct{…}` + + Default configuration for all tools from an MCP server. + + - `Enabled bool` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + +### Beta Managed Agents MCP Toolset Params + +- `type BetaManagedAgentsMCPToolsetParamsResp struct{…}` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `MCPServerName string` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `Type BetaManagedAgentsMCPToolsetParamsType` + + - `const BetaManagedAgentsMCPToolsetParamsTypeMCPToolset BetaManagedAgentsMCPToolsetParamsType = "mcp_toolset"` + + - `Configs []BetaManagedAgentsMCPToolConfigParamsResp` + + Per-tool configuration overrides. + + - `Name string` + + Name of the MCP tool to configure. 1-128 characters. + + - `Enabled bool` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfigParamsResp` + + Default configuration for all tools from an MCP server. + + - `Enabled bool` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + +### Beta Managed Agents Model + +- `type BetaManagedAgentsModel interface{…}` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + +### Beta Managed Agents Model Config + +- `type BetaManagedAgentsModelConfig struct{…}` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + +### Beta Managed Agents Model Config Params + +- `type BetaManagedAgentsModelConfigParamsResp struct{…}` + + An object that defines additional configuration control over model use + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigParamsSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigParamsSpeedStandard BetaManagedAgentsModelConfigParamsSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigParamsSpeedFast BetaManagedAgentsModelConfigParamsSpeed = "fast"` + +### Beta Managed Agents Skill Params + +- `type BetaManagedAgentsSkillParamsUnionResp interface{…}` + + Skill to load in the session container. + + - `type BetaManagedAgentsAnthropicSkillParamsResp struct{…}` + + An Anthropic-managed skill. + + - `SkillID string` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `Type BetaManagedAgentsAnthropicSkillParamsType` + + - `const BetaManagedAgentsAnthropicSkillParamsTypeAnthropic BetaManagedAgentsAnthropicSkillParamsType = "anthropic"` + + - `Version string` + + Version to pin. Defaults to latest if omitted. + + - `type BetaManagedAgentsCustomSkillParamsResp struct{…}` + + A user-created custom skill. + + - `SkillID string` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `Type BetaManagedAgentsCustomSkillParamsType` + + - `const BetaManagedAgentsCustomSkillParamsTypeCustom BetaManagedAgentsCustomSkillParamsType = "custom"` + + - `Version string` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents URL MCP Server Params + +- `type BetaManagedAgentsURLMCPServerParamsResp struct{…}` + + URL-based MCP server connection. + + - `Name string` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `Type BetaManagedAgentsURLMCPServerParamsType` + + - `const BetaManagedAgentsURLMCPServerParamsTypeURL BetaManagedAgentsURLMCPServerParamsType = "url"` + + - `URL string` + + Endpoint URL for the MCP server. + +# Versions + +## List + +`client.Beta.Agents.Versions.List(ctx, agentID, params) (*PageCursor[BetaManagedAgentsAgent], error)` + +**get** `/v1/agents/{agent_id}/versions` + +List Agent Versions + +### Parameters + +- `agentID string` + +- `params BetaAgentVersionListParams` + + - `Limit param.Field[int64]` + + Query param: Maximum results per page. Default 20, maximum 100. + + - `Page param.Field[string]` + + Query param: Opaque pagination cursor. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsAgent struct{…}` + + A Managed Agents `agent`. + + - `ID string` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Metadata map[string, string]` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsAgentType` + + - `const BetaManagedAgentsAgentTypeAgent BetaManagedAgentsAgentType = "agent"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Version int64` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Beta.Agents.Versions.List( + context.TODO(), + "agent_011CZkYpogX7uDKUyvBTophP", + anthropic.BetaAgentVersionListParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", page) +} +``` + +# Environments + +## Create + +`client.Beta.Environments.New(ctx, params) (*BetaEnvironment, error)` + +**post** `/v1/environments` + +Create a new environment with the specified configuration. + +### Parameters + +- `params BetaEnvironmentNewParams` + + - `Name param.Field[string]` + + Body param: Human-readable name for the environment + + - `Config param.Field[BetaCloudConfigParamsResp]` + + Body param: Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `Description param.Field[string]` + + Body param: Optional description of the environment + + - `Metadata param.Field[map[string, string]]` + + Body param: User-provided metadata key-value pairs + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaEnvironment struct{…}` + + Unified Environment resource for both cloud and BYOC environments. + + - `ID string` + + Environment identifier (e.g., 'env_...') + + - `ArchivedAt string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `Config BetaCloudConfig` + + `cloud` environment configuration. + + - `Networking BetaCloudConfigNetworkingUnion` + + Network configuration policy. + + - `type BetaUnrestrictedNetwork struct{…}` + + Unrestricted network access. + + - `Type Unrestricted` + + Network policy type + + - `const UnrestrictedUnrestricted Unrestricted = "unrestricted"` + + - `type BetaLimitedNetwork struct{…}` + + Limited network access. + + - `AllowMCPServers bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `AllowPackageManagers bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `AllowedHosts []string` + + Specifies domains the container can reach. + + - `Type Limited` + + Network policy type + + - `const LimitedLimited Limited = "limited"` + + - `Packages BetaPackages` + + Package manager configuration. + + - `Apt []string` + + Ubuntu/Debian packages to install + + - `Cargo []string` + + Rust packages to install + + - `Gem []string` + + Ruby packages to install + + - `Go []string` + + Go packages to install + + - `Npm []string` + + Node.js packages to install + + - `Pip []string` + + Python packages to install + + - `Type BetaPackagesType` + + Package configuration type + + - `const BetaPackagesTypePackages BetaPackagesType = "packages"` + + - `Type Cloud` + + Environment type + + - `const CloudCloud Cloud = "cloud"` + + - `CreatedAt string` + + RFC 3339 timestamp when environment was created + + - `Description string` + + User-provided description for the environment + + - `Metadata map[string, string]` + + User-provided metadata key-value pairs + + - `Name string` + + Human-readable name for the environment + + - `Type Environment` + + The type of object (always 'environment') + + - `const EnvironmentEnvironment Environment = "environment"` + + - `UpdatedAt string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaEnvironment, err := client.Beta.Environments.New(context.TODO(), anthropic.BetaEnvironmentNewParams{ + Name: "python-data-analysis", + }) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaEnvironment.ID) +} +``` + +## List + +`client.Beta.Environments.List(ctx, params) (*PageCursor[BetaEnvironment], error)` + +**get** `/v1/environments` + +List environments with pagination support. + +### Parameters + +- `params BetaEnvironmentListParams` + + - `IncludeArchived param.Field[bool]` + + Query param: Include archived environments in the response + + - `Limit param.Field[int64]` + + Query param: Maximum number of environments to return + + - `Page param.Field[string]` + + Query param: Opaque cursor from previous response for pagination. Pass the `next_page` value from the previous response. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaEnvironment struct{…}` + + Unified Environment resource for both cloud and BYOC environments. + + - `ID string` + + Environment identifier (e.g., 'env_...') + + - `ArchivedAt string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `Config BetaCloudConfig` + + `cloud` environment configuration. + + - `Networking BetaCloudConfigNetworkingUnion` + + Network configuration policy. + + - `type BetaUnrestrictedNetwork struct{…}` + + Unrestricted network access. + + - `Type Unrestricted` + + Network policy type + + - `const UnrestrictedUnrestricted Unrestricted = "unrestricted"` + + - `type BetaLimitedNetwork struct{…}` + + Limited network access. + + - `AllowMCPServers bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `AllowPackageManagers bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `AllowedHosts []string` + + Specifies domains the container can reach. + + - `Type Limited` + + Network policy type + + - `const LimitedLimited Limited = "limited"` + + - `Packages BetaPackages` + + Package manager configuration. + + - `Apt []string` + + Ubuntu/Debian packages to install + + - `Cargo []string` + + Rust packages to install + + - `Gem []string` + + Ruby packages to install + + - `Go []string` + + Go packages to install + + - `Npm []string` + + Node.js packages to install + + - `Pip []string` + + Python packages to install + + - `Type BetaPackagesType` + + Package configuration type + + - `const BetaPackagesTypePackages BetaPackagesType = "packages"` + + - `Type Cloud` + + Environment type + + - `const CloudCloud Cloud = "cloud"` + + - `CreatedAt string` + + RFC 3339 timestamp when environment was created + + - `Description string` + + User-provided description for the environment + + - `Metadata map[string, string]` + + User-provided metadata key-value pairs + + - `Name string` + + Human-readable name for the environment + + - `Type Environment` + + The type of object (always 'environment') + + - `const EnvironmentEnvironment Environment = "environment"` + + - `UpdatedAt string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Beta.Environments.List(context.TODO(), anthropic.BetaEnvironmentListParams{ + + }) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", page) +} +``` + +## Retrieve + +`client.Beta.Environments.Get(ctx, environmentID, query) (*BetaEnvironment, error)` + +**get** `/v1/environments/{environment_id}` + +Retrieve a specific environment by ID. + +### Parameters + +- `environmentID string` + +- `query BetaEnvironmentGetParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaEnvironment struct{…}` + + Unified Environment resource for both cloud and BYOC environments. + + - `ID string` + + Environment identifier (e.g., 'env_...') + + - `ArchivedAt string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `Config BetaCloudConfig` + + `cloud` environment configuration. + + - `Networking BetaCloudConfigNetworkingUnion` + + Network configuration policy. + + - `type BetaUnrestrictedNetwork struct{…}` + + Unrestricted network access. + + - `Type Unrestricted` + + Network policy type + + - `const UnrestrictedUnrestricted Unrestricted = "unrestricted"` + + - `type BetaLimitedNetwork struct{…}` + + Limited network access. + + - `AllowMCPServers bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `AllowPackageManagers bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `AllowedHosts []string` + + Specifies domains the container can reach. + + - `Type Limited` + + Network policy type + + - `const LimitedLimited Limited = "limited"` + + - `Packages BetaPackages` + + Package manager configuration. + + - `Apt []string` + + Ubuntu/Debian packages to install + + - `Cargo []string` + + Rust packages to install + + - `Gem []string` + + Ruby packages to install + + - `Go []string` + + Go packages to install + + - `Npm []string` + + Node.js packages to install + + - `Pip []string` + + Python packages to install + + - `Type BetaPackagesType` + + Package configuration type + + - `const BetaPackagesTypePackages BetaPackagesType = "packages"` + + - `Type Cloud` + + Environment type + + - `const CloudCloud Cloud = "cloud"` + + - `CreatedAt string` + + RFC 3339 timestamp when environment was created + + - `Description string` + + User-provided description for the environment + + - `Metadata map[string, string]` + + User-provided metadata key-value pairs + + - `Name string` + + Human-readable name for the environment + + - `Type Environment` + + The type of object (always 'environment') + + - `const EnvironmentEnvironment Environment = "environment"` + + - `UpdatedAt string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaEnvironment, err := client.Beta.Environments.Get( + context.TODO(), + "env_011CZkZ9X2dpNyB7HsEFoRfW", + anthropic.BetaEnvironmentGetParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaEnvironment.ID) +} +``` + +## Update + +`client.Beta.Environments.Update(ctx, environmentID, params) (*BetaEnvironment, error)` + +**post** `/v1/environments/{environment_id}` + +Update an existing environment's configuration. + +### Parameters + +- `environmentID string` + +- `params BetaEnvironmentUpdateParams` + + - `Config param.Field[BetaCloudConfigParamsResp]` + + Body param: Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `Description param.Field[string]` + + Body param: Updated description of the environment + + - `Metadata param.Field[map[string, string]]` + + Body param: User-provided metadata key-value pairs. Set a value to null or empty string to delete the key. + + - `Name param.Field[string]` + + Body param: Updated name for the environment + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaEnvironment struct{…}` + + Unified Environment resource for both cloud and BYOC environments. + + - `ID string` + + Environment identifier (e.g., 'env_...') + + - `ArchivedAt string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `Config BetaCloudConfig` + + `cloud` environment configuration. + + - `Networking BetaCloudConfigNetworkingUnion` + + Network configuration policy. + + - `type BetaUnrestrictedNetwork struct{…}` + + Unrestricted network access. + + - `Type Unrestricted` + + Network policy type + + - `const UnrestrictedUnrestricted Unrestricted = "unrestricted"` + + - `type BetaLimitedNetwork struct{…}` + + Limited network access. + + - `AllowMCPServers bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `AllowPackageManagers bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `AllowedHosts []string` + + Specifies domains the container can reach. + + - `Type Limited` + + Network policy type + + - `const LimitedLimited Limited = "limited"` + + - `Packages BetaPackages` + + Package manager configuration. + + - `Apt []string` + + Ubuntu/Debian packages to install + + - `Cargo []string` + + Rust packages to install + + - `Gem []string` + + Ruby packages to install + + - `Go []string` + + Go packages to install + + - `Npm []string` + + Node.js packages to install + + - `Pip []string` + + Python packages to install + + - `Type BetaPackagesType` + + Package configuration type + + - `const BetaPackagesTypePackages BetaPackagesType = "packages"` + + - `Type Cloud` + + Environment type + + - `const CloudCloud Cloud = "cloud"` + + - `CreatedAt string` + + RFC 3339 timestamp when environment was created + + - `Description string` + + User-provided description for the environment + + - `Metadata map[string, string]` + + User-provided metadata key-value pairs + + - `Name string` + + Human-readable name for the environment + + - `Type Environment` + + The type of object (always 'environment') + + - `const EnvironmentEnvironment Environment = "environment"` + + - `UpdatedAt string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaEnvironment, err := client.Beta.Environments.Update( + context.TODO(), + "env_011CZkZ9X2dpNyB7HsEFoRfW", + anthropic.BetaEnvironmentUpdateParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaEnvironment.ID) +} +``` + +## Delete + +`client.Beta.Environments.Delete(ctx, environmentID, body) (*BetaEnvironmentDeleteResponse, error)` + +**delete** `/v1/environments/{environment_id}` + +Delete an environment by ID. Returns a confirmation of the deletion. + +### Parameters + +- `environmentID string` + +- `body BetaEnvironmentDeleteParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaEnvironmentDeleteResponse struct{…}` + + Response after deleting an environment. + + - `ID string` + + Environment identifier + + - `Type EnvironmentDeleted` + + The type of response + + - `const EnvironmentDeletedEnvironmentDeleted EnvironmentDeleted = "environment_deleted"` + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaEnvironmentDeleteResponse, err := client.Beta.Environments.Delete( + context.TODO(), + "env_011CZkZ9X2dpNyB7HsEFoRfW", + anthropic.BetaEnvironmentDeleteParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaEnvironmentDeleteResponse.ID) +} +``` + +## Archive + +`client.Beta.Environments.Archive(ctx, environmentID, body) (*BetaEnvironment, error)` + +**post** `/v1/environments/{environment_id}/archive` + +Archive an environment by ID. Archived environments cannot be used to create new sessions. + +### Parameters + +- `environmentID string` + +- `body BetaEnvironmentArchiveParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaEnvironment struct{…}` + + Unified Environment resource for both cloud and BYOC environments. + + - `ID string` + + Environment identifier (e.g., 'env_...') + + - `ArchivedAt string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `Config BetaCloudConfig` + + `cloud` environment configuration. + + - `Networking BetaCloudConfigNetworkingUnion` + + Network configuration policy. + + - `type BetaUnrestrictedNetwork struct{…}` + + Unrestricted network access. + + - `Type Unrestricted` + + Network policy type + + - `const UnrestrictedUnrestricted Unrestricted = "unrestricted"` + + - `type BetaLimitedNetwork struct{…}` + + Limited network access. + + - `AllowMCPServers bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `AllowPackageManagers bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `AllowedHosts []string` + + Specifies domains the container can reach. + + - `Type Limited` + + Network policy type + + - `const LimitedLimited Limited = "limited"` + + - `Packages BetaPackages` + + Package manager configuration. + + - `Apt []string` + + Ubuntu/Debian packages to install + + - `Cargo []string` + + Rust packages to install + + - `Gem []string` + + Ruby packages to install + + - `Go []string` + + Go packages to install + + - `Npm []string` + + Node.js packages to install + + - `Pip []string` + + Python packages to install + + - `Type BetaPackagesType` + + Package configuration type + + - `const BetaPackagesTypePackages BetaPackagesType = "packages"` + + - `Type Cloud` + + Environment type + + - `const CloudCloud Cloud = "cloud"` + + - `CreatedAt string` + + RFC 3339 timestamp when environment was created + + - `Description string` + + User-provided description for the environment + + - `Metadata map[string, string]` + + User-provided metadata key-value pairs + + - `Name string` + + Human-readable name for the environment + + - `Type Environment` + + The type of object (always 'environment') + + - `const EnvironmentEnvironment Environment = "environment"` + + - `UpdatedAt string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaEnvironment, err := client.Beta.Environments.Archive( + context.TODO(), + "env_011CZkZ9X2dpNyB7HsEFoRfW", + anthropic.BetaEnvironmentArchiveParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaEnvironment.ID) +} +``` + +## Domain Types + +### Beta Cloud Config + +- `type BetaCloudConfig struct{…}` + + `cloud` environment configuration. + + - `Networking BetaCloudConfigNetworkingUnion` + + Network configuration policy. + + - `type BetaUnrestrictedNetwork struct{…}` + + Unrestricted network access. + + - `Type Unrestricted` + + Network policy type + + - `const UnrestrictedUnrestricted Unrestricted = "unrestricted"` + + - `type BetaLimitedNetwork struct{…}` + + Limited network access. + + - `AllowMCPServers bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `AllowPackageManagers bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `AllowedHosts []string` + + Specifies domains the container can reach. + + - `Type Limited` + + Network policy type + + - `const LimitedLimited Limited = "limited"` + + - `Packages BetaPackages` + + Package manager configuration. + + - `Apt []string` + + Ubuntu/Debian packages to install + + - `Cargo []string` + + Rust packages to install + + - `Gem []string` + + Ruby packages to install + + - `Go []string` + + Go packages to install + + - `Npm []string` + + Node.js packages to install + + - `Pip []string` + + Python packages to install + + - `Type BetaPackagesType` + + Package configuration type + + - `const BetaPackagesTypePackages BetaPackagesType = "packages"` + + - `Type Cloud` + + Environment type + + - `const CloudCloud Cloud = "cloud"` + +### Beta Cloud Config Params + +- `type BetaCloudConfigParamsResp struct{…}` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `Type Cloud` + + Environment type + + - `const CloudCloud Cloud = "cloud"` + + - `Networking BetaCloudConfigParamsNetworkingUnionResp` + + Network configuration policy. Omit on update to preserve the existing value. + + - `type BetaUnrestrictedNetwork struct{…}` + + Unrestricted network access. + + - `Type Unrestricted` + + Network policy type + + - `const UnrestrictedUnrestricted Unrestricted = "unrestricted"` + + - `type BetaLimitedNetworkParamsResp struct{…}` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `Type Limited` + + Network policy type + + - `const LimitedLimited Limited = "limited"` + + - `AllowMCPServers bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `AllowPackageManagers bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `AllowedHosts []string` + + Specifies domains the container can reach. + + - `Packages BetaPackagesParamsResp` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `Apt []string` + + Ubuntu/Debian packages to install + + - `Cargo []string` + + Rust packages to install + + - `Gem []string` + + Ruby packages to install + + - `Go []string` + + Go packages to install + + - `Npm []string` + + Node.js packages to install + + - `Pip []string` + + Python packages to install + + - `Type BetaPackagesParamsType` + + Package configuration type + + - `const BetaPackagesParamsTypePackages BetaPackagesParamsType = "packages"` + +### Beta Environment + +- `type BetaEnvironment struct{…}` + + Unified Environment resource for both cloud and BYOC environments. + + - `ID string` + + Environment identifier (e.g., 'env_...') + + - `ArchivedAt string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `Config BetaCloudConfig` + + `cloud` environment configuration. + + - `Networking BetaCloudConfigNetworkingUnion` + + Network configuration policy. + + - `type BetaUnrestrictedNetwork struct{…}` + + Unrestricted network access. + + - `Type Unrestricted` + + Network policy type + + - `const UnrestrictedUnrestricted Unrestricted = "unrestricted"` + + - `type BetaLimitedNetwork struct{…}` + + Limited network access. + + - `AllowMCPServers bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `AllowPackageManagers bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `AllowedHosts []string` + + Specifies domains the container can reach. + + - `Type Limited` + + Network policy type + + - `const LimitedLimited Limited = "limited"` + + - `Packages BetaPackages` + + Package manager configuration. + + - `Apt []string` + + Ubuntu/Debian packages to install + + - `Cargo []string` + + Rust packages to install + + - `Gem []string` + + Ruby packages to install + + - `Go []string` + + Go packages to install + + - `Npm []string` + + Node.js packages to install + + - `Pip []string` + + Python packages to install + + - `Type BetaPackagesType` + + Package configuration type + + - `const BetaPackagesTypePackages BetaPackagesType = "packages"` + + - `Type Cloud` + + Environment type + + - `const CloudCloud Cloud = "cloud"` + + - `CreatedAt string` + + RFC 3339 timestamp when environment was created + + - `Description string` + + User-provided description for the environment + + - `Metadata map[string, string]` + + User-provided metadata key-value pairs + + - `Name string` + + Human-readable name for the environment + + - `Type Environment` + + The type of object (always 'environment') + + - `const EnvironmentEnvironment Environment = "environment"` + + - `UpdatedAt string` + + RFC 3339 timestamp when environment was last updated + +### Beta Environment Delete Response + +- `type BetaEnvironmentDeleteResponse struct{…}` + + Response after deleting an environment. + + - `ID string` + + Environment identifier + + - `Type EnvironmentDeleted` + + The type of response + + - `const EnvironmentDeletedEnvironmentDeleted EnvironmentDeleted = "environment_deleted"` + +### Beta Limited Network + +- `type BetaLimitedNetwork struct{…}` + + Limited network access. + + - `AllowMCPServers bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `AllowPackageManagers bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `AllowedHosts []string` + + Specifies domains the container can reach. + + - `Type Limited` + + Network policy type + + - `const LimitedLimited Limited = "limited"` + +### Beta Limited Network Params + +- `type BetaLimitedNetworkParamsResp struct{…}` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `Type Limited` + + Network policy type + + - `const LimitedLimited Limited = "limited"` + + - `AllowMCPServers bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `AllowPackageManagers bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `AllowedHosts []string` + + Specifies domains the container can reach. + +### Beta Packages + +- `type BetaPackages struct{…}` + + Packages (and their versions) available in this environment. + + - `Apt []string` + + Ubuntu/Debian packages to install + + - `Cargo []string` + + Rust packages to install + + - `Gem []string` + + Ruby packages to install + + - `Go []string` + + Go packages to install + + - `Npm []string` + + Node.js packages to install + + - `Pip []string` + + Python packages to install + + - `Type BetaPackagesType` + + Package configuration type + + - `const BetaPackagesTypePackages BetaPackagesType = "packages"` + +### Beta Packages Params + +- `type BetaPackagesParamsResp struct{…}` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `Apt []string` + + Ubuntu/Debian packages to install + + - `Cargo []string` + + Rust packages to install + + - `Gem []string` + + Ruby packages to install + + - `Go []string` + + Go packages to install + + - `Npm []string` + + Node.js packages to install + + - `Pip []string` + + Python packages to install + + - `Type BetaPackagesParamsType` + + Package configuration type + + - `const BetaPackagesParamsTypePackages BetaPackagesParamsType = "packages"` + +### Beta Unrestricted Network + +- `type BetaUnrestrictedNetwork struct{…}` + + Unrestricted network access. + + - `Type Unrestricted` + + Network policy type + + - `const UnrestrictedUnrestricted Unrestricted = "unrestricted"` + +# Sessions + +## Create + +`client.Beta.Sessions.New(ctx, params) (*BetaManagedAgentsSession, error)` + +**post** `/v1/sessions` + +Create Session + +### Parameters + +- `params BetaSessionNewParams` + + - `Agent param.Field[BetaSessionNewParamsAgentUnion]` + + Body param: Agent identifier. Accepts the `agent` ID string, which pins the latest version for the session, or an `agent` object with both id and version specified. + + - `string` + + - `type BetaManagedAgentsAgentParamsResp struct{…}` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `ID string` + + The `agent` ID. + + - `Type BetaManagedAgentsAgentParamsType` + + - `const BetaManagedAgentsAgentParamsTypeAgent BetaManagedAgentsAgentParamsType = "agent"` + + - `Version int64` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + + - `EnvironmentID param.Field[string]` + + Body param: ID of the `environment` defining the container configuration for this session. + + - `Metadata param.Field[map[string, string]]` + + Body param: Arbitrary key-value metadata attached to the session. + + - `Resources param.Field[[]BetaSessionNewParamsResourceUnion]` + + Body param: Resources (e.g. repositories, files) to mount into the session's container. + + - `type BetaManagedAgentsGitHubRepositoryResourceParamsResp struct{…}` + + Mount a GitHub repository into the session's container. + + - `AuthorizationToken string` + + GitHub authorization token used to clone the repository. + + - `Type BetaManagedAgentsGitHubRepositoryResourceParamsType` + + - `const BetaManagedAgentsGitHubRepositoryResourceParamsTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceParamsType = "github_repository"` + + - `URL string` + + Github URL of the repository + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceParamsCheckoutUnionResp` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `MountPath string` + + Mount path in the container. Defaults to `/workspace/`. + + - `type BetaManagedAgentsFileResourceParamsResp struct{…}` + + Mount a file uploaded via the Files API into the session. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileResourceParamsType` + + - `const BetaManagedAgentsFileResourceParamsTypeFile BetaManagedAgentsFileResourceParamsType = "file"` + + - `MountPath string` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + + - `Title param.Field[string]` + + Body param: Human-readable session title. + + - `VaultIDs param.Field[[]string]` + + Body param: Vault IDs for stored credentials the agent can use during the session. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsSession struct{…}` + + A Managed Agents `session`. + + - `ID string` + + - `Agent BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `ID string` + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsSessionAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsSessionAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsSessionAgentType` + + - `const BetaManagedAgentsSessionAgentTypeAgent BetaManagedAgentsSessionAgentType = "agent"` + + - `Version int64` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `EnvironmentID string` + + - `Metadata map[string, string]` + + - `Resources []BetaManagedAgentsSessionResourceUnion` + + - `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Stats BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `ActiveSeconds float64` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `DurationSeconds float64` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `Status BetaManagedAgentsSessionStatus` + + SessionStatus enum + + - `const BetaManagedAgentsSessionStatusRescheduling BetaManagedAgentsSessionStatus = "rescheduling"` + + - `const BetaManagedAgentsSessionStatusRunning BetaManagedAgentsSessionStatus = "running"` + + - `const BetaManagedAgentsSessionStatusIdle BetaManagedAgentsSessionStatus = "idle"` + + - `const BetaManagedAgentsSessionStatusTerminated BetaManagedAgentsSessionStatus = "terminated"` + + - `Title string` + + - `Type BetaManagedAgentsSessionType` + + - `const BetaManagedAgentsSessionTypeSession BetaManagedAgentsSessionType = "session"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Usage BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `CacheCreation BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Ephemeral1hInputTokens int64` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Ephemeral5mInputTokens int64` + + Tokens used to create 5-minute ephemeral cache entries. + + - `CacheReadInputTokens int64` + + Total tokens read from prompt cache. + + - `InputTokens int64` + + Total input tokens consumed across all turns. + + - `OutputTokens int64` + + Total output tokens generated across all turns. + + - `VaultIDs []string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsSession, err := client.Beta.Sessions.New(context.TODO(), anthropic.BetaSessionNewParams{ + Agent: anthropic.BetaSessionNewParamsAgentUnion{ + OfString: anthropic.String("agent_011CZkYpogX7uDKUyvBTophP"), + }, + EnvironmentID: "env_011CZkZ9X2dpNyB7HsEFoRfW", + }) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsSession.ID) +} +``` + +## List + +`client.Beta.Sessions.List(ctx, params) (*PageCursor[BetaManagedAgentsSession], error)` + +**get** `/v1/sessions` + +List Sessions + +### Parameters + +- `params BetaSessionListParams` + + - `AgentID param.Field[string]` + + Query param: Filter sessions created with this agent ID. + + - `AgentVersion param.Field[int64]` + + Query param: Filter by agent version. Only applies when agent_id is also set. + + - `CreatedAtGt param.Field[Time]` + + Query param: Return sessions created after this time (exclusive). + + - `CreatedAtGte param.Field[Time]` + + Query param: Return sessions created at or after this time (inclusive). + + - `CreatedAtLt param.Field[Time]` + + Query param: Return sessions created before this time (exclusive). + + - `CreatedAtLte param.Field[Time]` + + Query param: Return sessions created at or before this time (inclusive). + + - `IncludeArchived param.Field[bool]` + + Query param: When true, includes archived sessions. Default: false (exclude archived). + + - `Limit param.Field[int64]` + + Query param: Maximum number of results to return. + + - `Order param.Field[BetaSessionListParamsOrder]` + + Query param: Sort direction for results, ordered by created_at. Defaults to desc (newest first). + + - `const BetaSessionListParamsOrderAsc BetaSessionListParamsOrder = "asc"` + + - `const BetaSessionListParamsOrderDesc BetaSessionListParamsOrder = "desc"` + + - `Page param.Field[string]` + + Query param: Opaque pagination cursor from a previous response's next_page. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsSession struct{…}` + + A Managed Agents `session`. + + - `ID string` + + - `Agent BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `ID string` + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsSessionAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsSessionAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsSessionAgentType` + + - `const BetaManagedAgentsSessionAgentTypeAgent BetaManagedAgentsSessionAgentType = "agent"` + + - `Version int64` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `EnvironmentID string` + + - `Metadata map[string, string]` + + - `Resources []BetaManagedAgentsSessionResourceUnion` + + - `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Stats BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `ActiveSeconds float64` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `DurationSeconds float64` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `Status BetaManagedAgentsSessionStatus` + + SessionStatus enum + + - `const BetaManagedAgentsSessionStatusRescheduling BetaManagedAgentsSessionStatus = "rescheduling"` + + - `const BetaManagedAgentsSessionStatusRunning BetaManagedAgentsSessionStatus = "running"` + + - `const BetaManagedAgentsSessionStatusIdle BetaManagedAgentsSessionStatus = "idle"` + + - `const BetaManagedAgentsSessionStatusTerminated BetaManagedAgentsSessionStatus = "terminated"` + + - `Title string` + + - `Type BetaManagedAgentsSessionType` + + - `const BetaManagedAgentsSessionTypeSession BetaManagedAgentsSessionType = "session"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Usage BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `CacheCreation BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Ephemeral1hInputTokens int64` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Ephemeral5mInputTokens int64` + + Tokens used to create 5-minute ephemeral cache entries. + + - `CacheReadInputTokens int64` + + Total tokens read from prompt cache. + + - `InputTokens int64` + + Total input tokens consumed across all turns. + + - `OutputTokens int64` + + Total output tokens generated across all turns. + + - `VaultIDs []string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Beta.Sessions.List(context.TODO(), anthropic.BetaSessionListParams{ + + }) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", page) +} +``` + +## Retrieve + +`client.Beta.Sessions.Get(ctx, sessionID, query) (*BetaManagedAgentsSession, error)` + +**get** `/v1/sessions/{session_id}` + +Get Session + +### Parameters + +- `sessionID string` + +- `query BetaSessionGetParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsSession struct{…}` + + A Managed Agents `session`. + + - `ID string` + + - `Agent BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `ID string` + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsSessionAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsSessionAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsSessionAgentType` + + - `const BetaManagedAgentsSessionAgentTypeAgent BetaManagedAgentsSessionAgentType = "agent"` + + - `Version int64` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `EnvironmentID string` + + - `Metadata map[string, string]` + + - `Resources []BetaManagedAgentsSessionResourceUnion` + + - `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Stats BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `ActiveSeconds float64` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `DurationSeconds float64` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `Status BetaManagedAgentsSessionStatus` + + SessionStatus enum + + - `const BetaManagedAgentsSessionStatusRescheduling BetaManagedAgentsSessionStatus = "rescheduling"` + + - `const BetaManagedAgentsSessionStatusRunning BetaManagedAgentsSessionStatus = "running"` + + - `const BetaManagedAgentsSessionStatusIdle BetaManagedAgentsSessionStatus = "idle"` + + - `const BetaManagedAgentsSessionStatusTerminated BetaManagedAgentsSessionStatus = "terminated"` + + - `Title string` + + - `Type BetaManagedAgentsSessionType` + + - `const BetaManagedAgentsSessionTypeSession BetaManagedAgentsSessionType = "session"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Usage BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `CacheCreation BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Ephemeral1hInputTokens int64` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Ephemeral5mInputTokens int64` + + Tokens used to create 5-minute ephemeral cache entries. + + - `CacheReadInputTokens int64` + + Total tokens read from prompt cache. + + - `InputTokens int64` + + Total input tokens consumed across all turns. + + - `OutputTokens int64` + + Total output tokens generated across all turns. + + - `VaultIDs []string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsSession, err := client.Beta.Sessions.Get( + context.TODO(), + "sesn_011CZkZAtmR3yMPDzynEDxu7", + anthropic.BetaSessionGetParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsSession.ID) +} +``` + +## Update + +`client.Beta.Sessions.Update(ctx, sessionID, params) (*BetaManagedAgentsSession, error)` + +**post** `/v1/sessions/{session_id}` + +Update Session + +### Parameters + +- `sessionID string` + +- `params BetaSessionUpdateParams` + + - `Metadata param.Field[map[string, string]]` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. + + - `Title param.Field[string]` + + Body param: Human-readable session title. + + - `VaultIDs param.Field[[]string]` + + Body param: Vault IDs (`vlt_*`) to attach to the session. Not yet supported; requests setting this field are rejected. Reserved for future use. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsSession struct{…}` + + A Managed Agents `session`. + + - `ID string` + + - `Agent BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `ID string` + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsSessionAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsSessionAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsSessionAgentType` + + - `const BetaManagedAgentsSessionAgentTypeAgent BetaManagedAgentsSessionAgentType = "agent"` + + - `Version int64` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `EnvironmentID string` + + - `Metadata map[string, string]` + + - `Resources []BetaManagedAgentsSessionResourceUnion` + + - `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Stats BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `ActiveSeconds float64` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `DurationSeconds float64` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `Status BetaManagedAgentsSessionStatus` + + SessionStatus enum + + - `const BetaManagedAgentsSessionStatusRescheduling BetaManagedAgentsSessionStatus = "rescheduling"` + + - `const BetaManagedAgentsSessionStatusRunning BetaManagedAgentsSessionStatus = "running"` + + - `const BetaManagedAgentsSessionStatusIdle BetaManagedAgentsSessionStatus = "idle"` + + - `const BetaManagedAgentsSessionStatusTerminated BetaManagedAgentsSessionStatus = "terminated"` + + - `Title string` + + - `Type BetaManagedAgentsSessionType` + + - `const BetaManagedAgentsSessionTypeSession BetaManagedAgentsSessionType = "session"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Usage BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `CacheCreation BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Ephemeral1hInputTokens int64` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Ephemeral5mInputTokens int64` + + Tokens used to create 5-minute ephemeral cache entries. + + - `CacheReadInputTokens int64` + + Total tokens read from prompt cache. + + - `InputTokens int64` + + Total input tokens consumed across all turns. + + - `OutputTokens int64` + + Total output tokens generated across all turns. + + - `VaultIDs []string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsSession, err := client.Beta.Sessions.Update( + context.TODO(), + "sesn_011CZkZAtmR3yMPDzynEDxu7", + anthropic.BetaSessionUpdateParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsSession.ID) +} +``` + +## Delete + +`client.Beta.Sessions.Delete(ctx, sessionID, body) (*BetaManagedAgentsDeletedSession, error)` + +**delete** `/v1/sessions/{session_id}` + +Delete Session + +### Parameters + +- `sessionID string` + +- `body BetaSessionDeleteParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsDeletedSession struct{…}` + + Confirmation that a `session` has been permanently deleted. + + - `ID string` + + - `Type BetaManagedAgentsDeletedSessionType` + + - `const BetaManagedAgentsDeletedSessionTypeSessionDeleted BetaManagedAgentsDeletedSessionType = "session_deleted"` + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsDeletedSession, err := client.Beta.Sessions.Delete( + context.TODO(), + "sesn_011CZkZAtmR3yMPDzynEDxu7", + anthropic.BetaSessionDeleteParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsDeletedSession.ID) +} +``` + +## Archive + +`client.Beta.Sessions.Archive(ctx, sessionID, body) (*BetaManagedAgentsSession, error)` + +**post** `/v1/sessions/{session_id}/archive` + +Archive Session + +### Parameters + +- `sessionID string` + +- `body BetaSessionArchiveParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsSession struct{…}` + + A Managed Agents `session`. + + - `ID string` + + - `Agent BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `ID string` + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsSessionAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsSessionAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsSessionAgentType` + + - `const BetaManagedAgentsSessionAgentTypeAgent BetaManagedAgentsSessionAgentType = "agent"` + + - `Version int64` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `EnvironmentID string` + + - `Metadata map[string, string]` + + - `Resources []BetaManagedAgentsSessionResourceUnion` + + - `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Stats BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `ActiveSeconds float64` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `DurationSeconds float64` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `Status BetaManagedAgentsSessionStatus` + + SessionStatus enum + + - `const BetaManagedAgentsSessionStatusRescheduling BetaManagedAgentsSessionStatus = "rescheduling"` + + - `const BetaManagedAgentsSessionStatusRunning BetaManagedAgentsSessionStatus = "running"` + + - `const BetaManagedAgentsSessionStatusIdle BetaManagedAgentsSessionStatus = "idle"` + + - `const BetaManagedAgentsSessionStatusTerminated BetaManagedAgentsSessionStatus = "terminated"` + + - `Title string` + + - `Type BetaManagedAgentsSessionType` + + - `const BetaManagedAgentsSessionTypeSession BetaManagedAgentsSessionType = "session"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Usage BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `CacheCreation BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Ephemeral1hInputTokens int64` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Ephemeral5mInputTokens int64` + + Tokens used to create 5-minute ephemeral cache entries. + + - `CacheReadInputTokens int64` + + Total tokens read from prompt cache. + + - `InputTokens int64` + + Total input tokens consumed across all turns. + + - `OutputTokens int64` + + Total output tokens generated across all turns. + + - `VaultIDs []string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsSession, err := client.Beta.Sessions.Archive( + context.TODO(), + "sesn_011CZkZAtmR3yMPDzynEDxu7", + anthropic.BetaSessionArchiveParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsSession.ID) +} +``` + +## Domain Types + +### Beta Managed Agents Agent Params + +- `type BetaManagedAgentsAgentParamsResp struct{…}` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `ID string` + + The `agent` ID. + + - `Type BetaManagedAgentsAgentParamsType` + + - `const BetaManagedAgentsAgentParamsTypeAgent BetaManagedAgentsAgentParamsType = "agent"` + + - `Version int64` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + +### Beta Managed Agents Branch Checkout + +- `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + +### Beta Managed Agents Cache Creation Usage + +- `type BetaManagedAgentsCacheCreationUsage struct{…}` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Ephemeral1hInputTokens int64` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Ephemeral5mInputTokens int64` + + Tokens used to create 5-minute ephemeral cache entries. + +### Beta Managed Agents Commit Checkout + +- `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + +### Beta Managed Agents Deleted Session + +- `type BetaManagedAgentsDeletedSession struct{…}` + + Confirmation that a `session` has been permanently deleted. + + - `ID string` + + - `Type BetaManagedAgentsDeletedSessionType` + + - `const BetaManagedAgentsDeletedSessionTypeSessionDeleted BetaManagedAgentsDeletedSessionType = "session_deleted"` + +### Beta Managed Agents File Resource Params + +- `type BetaManagedAgentsFileResourceParamsResp struct{…}` + + Mount a file uploaded via the Files API into the session. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileResourceParamsType` + + - `const BetaManagedAgentsFileResourceParamsTypeFile BetaManagedAgentsFileResourceParamsType = "file"` + + - `MountPath string` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +### Beta Managed Agents GitHub Repository Resource Params + +- `type BetaManagedAgentsGitHubRepositoryResourceParamsResp struct{…}` + + Mount a GitHub repository into the session's container. + + - `AuthorizationToken string` + + GitHub authorization token used to clone the repository. + + - `Type BetaManagedAgentsGitHubRepositoryResourceParamsType` + + - `const BetaManagedAgentsGitHubRepositoryResourceParamsTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceParamsType = "github_repository"` + + - `URL string` + + Github URL of the repository + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceParamsCheckoutUnionResp` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `MountPath string` + + Mount path in the container. Defaults to `/workspace/`. + +### Beta Managed Agents Session + +- `type BetaManagedAgentsSession struct{…}` + + A Managed Agents `session`. + + - `ID string` + + - `Agent BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `ID string` + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsSessionAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsSessionAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsSessionAgentType` + + - `const BetaManagedAgentsSessionAgentTypeAgent BetaManagedAgentsSessionAgentType = "agent"` + + - `Version int64` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `EnvironmentID string` + + - `Metadata map[string, string]` + + - `Resources []BetaManagedAgentsSessionResourceUnion` + + - `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Stats BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `ActiveSeconds float64` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `DurationSeconds float64` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `Status BetaManagedAgentsSessionStatus` + + SessionStatus enum + + - `const BetaManagedAgentsSessionStatusRescheduling BetaManagedAgentsSessionStatus = "rescheduling"` + + - `const BetaManagedAgentsSessionStatusRunning BetaManagedAgentsSessionStatus = "running"` + + - `const BetaManagedAgentsSessionStatusIdle BetaManagedAgentsSessionStatus = "idle"` + + - `const BetaManagedAgentsSessionStatusTerminated BetaManagedAgentsSessionStatus = "terminated"` + + - `Title string` + + - `Type BetaManagedAgentsSessionType` + + - `const BetaManagedAgentsSessionTypeSession BetaManagedAgentsSessionType = "session"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Usage BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `CacheCreation BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Ephemeral1hInputTokens int64` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Ephemeral5mInputTokens int64` + + Tokens used to create 5-minute ephemeral cache entries. + + - `CacheReadInputTokens int64` + + Total tokens read from prompt cache. + + - `InputTokens int64` + + Total input tokens consumed across all turns. + + - `OutputTokens int64` + + Total output tokens generated across all turns. + + - `VaultIDs []string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Beta Managed Agents Session Agent + +- `type BetaManagedAgentsSessionAgent struct{…}` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `ID string` + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsSessionAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsSessionAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsSessionAgentType` + + - `const BetaManagedAgentsSessionAgentTypeAgent BetaManagedAgentsSessionAgentType = "agent"` + + - `Version int64` + +### Beta Managed Agents Session Stats + +- `type BetaManagedAgentsSessionStats struct{…}` + + Timing statistics for a session. + + - `ActiveSeconds float64` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `DurationSeconds float64` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + +### Beta Managed Agents Session Usage + +- `type BetaManagedAgentsSessionUsage struct{…}` + + Cumulative token usage for a session across all turns. + + - `CacheCreation BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Ephemeral1hInputTokens int64` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Ephemeral5mInputTokens int64` + + Tokens used to create 5-minute ephemeral cache entries. + + - `CacheReadInputTokens int64` + + Total tokens read from prompt cache. + + - `InputTokens int64` + + Total input tokens consumed across all turns. + + - `OutputTokens int64` + + Total output tokens generated across all turns. + +# Events + +## List + +`client.Beta.Sessions.Events.List(ctx, sessionID, params) (*PageCursor[BetaManagedAgentsSessionEventUnion], error)` + +**get** `/v1/sessions/{session_id}/events` + +List Events + +### Parameters + +- `sessionID string` + +- `params BetaSessionEventListParams` + + - `Limit param.Field[int64]` + + Query param: Query parameter for limit + + - `Order param.Field[BetaSessionEventListParamsOrder]` + + Query param: Sort direction for results, ordered by created_at. Defaults to asc (chronological). + + - `const BetaSessionEventListParamsOrderAsc BetaSessionEventListParamsOrder = "asc"` + + - `const BetaSessionEventListParamsOrderDesc BetaSessionEventListParamsOrder = "desc"` + + - `Page param.Field[string]` + + Query param: Opaque pagination cursor from a previous response's next_page. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsSessionEventUnion interface{…}` + + Union type for all event types in a session. + + - `type BetaManagedAgentsUserMessageEvent struct{…}` + + A user message event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsUserMessageEventContentUnion` + + Array of content blocks comprising the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventType` + + - `const BetaManagedAgentsUserMessageEventTypeUserMessage BetaManagedAgentsUserMessageEventType = "user.message"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserInterruptEvent struct{…}` + + An interrupt event that pauses agent execution and returns control to the user. + + - `ID string` + + Unique identifier for this event. + + - `Type BetaManagedAgentsUserInterruptEventType` + + - `const BetaManagedAgentsUserInterruptEventTypeUserInterrupt BetaManagedAgentsUserInterruptEventType = "user.interrupt"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserToolConfirmationEvent struct{…}` + + A tool confirmation event that approves or denies a pending tool execution. + + - `ID string` + + Unique identifier for this event. + + - `Result BetaManagedAgentsUserToolConfirmationEventResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventResultAllow BetaManagedAgentsUserToolConfirmationEventResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventResultDeny BetaManagedAgentsUserToolConfirmationEventResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventType` + + - `const BetaManagedAgentsUserToolConfirmationEventTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserCustomToolResultEvent struct{…}` + + Event sent by the client providing the result of a custom tool execution. + + - `ID string` + + Unique identifier for this event. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventType` + + - `const BetaManagedAgentsUserCustomToolResultEventTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsAgentCustomToolUseEvent struct{…}` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the custom tool being called. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentCustomToolUseEventType` + + - `const BetaManagedAgentsAgentCustomToolUseEventTypeAgentCustomToolUse BetaManagedAgentsAgentCustomToolUseEventType = "agent.custom_tool_use"` + + - `type BetaManagedAgentsAgentMessageEvent struct{…}` + + An agent response event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMessageEventType` + + - `const BetaManagedAgentsAgentMessageEventTypeAgentMessage BetaManagedAgentsAgentMessageEventType = "agent.message"` + + - `type BetaManagedAgentsAgentThinkingEvent struct{…}` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThinkingEventType` + + - `const BetaManagedAgentsAgentThinkingEventTypeAgentThinking BetaManagedAgentsAgentThinkingEventType = "agent.thinking"` + + - `type BetaManagedAgentsAgentMCPToolUseEvent struct{…}` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `MCPServerName string` + + Name of the MCP server providing the tool. + + - `Name string` + + Name of the MCP tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolUseEventType` + + - `const BetaManagedAgentsAgentMCPToolUseEventTypeAgentMCPToolUse BetaManagedAgentsAgentMCPToolUseEventType = "agent.mcp_tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "deny"` + + - `type BetaManagedAgentsAgentMCPToolResultEvent struct{…}` + + Event representing the result of an MCP tool execution. + + - `ID string` + + Unique identifier for this event. + + - `MCPToolUseID string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolResultEventType` + + - `const BetaManagedAgentsAgentMCPToolResultEventTypeAgentMCPToolResult BetaManagedAgentsAgentMCPToolResultEventType = "agent.mcp_tool_result"` + + - `Content []BetaManagedAgentsAgentMCPToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `type BetaManagedAgentsAgentToolUseEvent struct{…}` + + Event emitted when the agent invokes a built-in agent tool. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the agent tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentToolUseEventType` + + - `const BetaManagedAgentsAgentToolUseEventTypeAgentToolUse BetaManagedAgentsAgentToolUseEventType = "agent.tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "deny"` + + - `type BetaManagedAgentsAgentToolResultEvent struct{…}` + + Event representing the result of an agent tool execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `ToolUseID string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `Type BetaManagedAgentsAgentToolResultEventType` + + - `const BetaManagedAgentsAgentToolResultEventTypeAgentToolResult BetaManagedAgentsAgentToolResultEventType = "agent.tool_result"` + + - `Content []BetaManagedAgentsAgentToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `type BetaManagedAgentsAgentThreadContextCompactedEvent struct{…}` + + Indicates that context compaction (summarization) occurred during the session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThreadContextCompactedEventType` + + - `const BetaManagedAgentsAgentThreadContextCompactedEventTypeAgentThreadContextCompacted BetaManagedAgentsAgentThreadContextCompactedEventType = "agent.thread_context_compacted"` + + - `type BetaManagedAgentsSessionErrorEvent struct{…}` + + An error event indicating a problem occurred during session execution. + + - `ID string` + + Unique identifier for this event. + + - `Error BetaManagedAgentsSessionErrorEventErrorUnion` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `type BetaManagedAgentsUnknownError struct{…}` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsUnknownErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsUnknownErrorType` + + - `const BetaManagedAgentsUnknownErrorTypeUnknownError BetaManagedAgentsUnknownErrorType = "unknown_error"` + + - `type BetaManagedAgentsModelOverloadedError struct{…}` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelOverloadedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelOverloadedErrorType` + + - `const BetaManagedAgentsModelOverloadedErrorTypeModelOverloadedError BetaManagedAgentsModelOverloadedErrorType = "model_overloaded_error"` + + - `type BetaManagedAgentsModelRateLimitedError struct{…}` + + The model request was rate-limited. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRateLimitedErrorType` + + - `const BetaManagedAgentsModelRateLimitedErrorTypeModelRateLimitedError BetaManagedAgentsModelRateLimitedErrorType = "model_rate_limited_error"` + + - `type BetaManagedAgentsModelRequestFailedError struct{…}` + + A model request failed for a reason other than overload or rate-limiting. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRequestFailedErrorType` + + - `const BetaManagedAgentsModelRequestFailedErrorTypeModelRequestFailedError BetaManagedAgentsModelRequestFailedErrorType = "model_request_failed_error"` + + - `type BetaManagedAgentsMCPConnectionFailedError struct{…}` + + Failed to connect to an MCP server. + + - `MCPServerName string` + + Name of the MCP server that failed to connect. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPConnectionFailedErrorType` + + - `const BetaManagedAgentsMCPConnectionFailedErrorTypeMCPConnectionFailedError BetaManagedAgentsMCPConnectionFailedErrorType = "mcp_connection_failed_error"` + + - `type BetaManagedAgentsMCPAuthenticationFailedError struct{…}` + + Authentication to an MCP server failed. + + - `MCPServerName string` + + Name of the MCP server that failed authentication. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPAuthenticationFailedErrorType` + + - `const BetaManagedAgentsMCPAuthenticationFailedErrorTypeMCPAuthenticationFailedError BetaManagedAgentsMCPAuthenticationFailedErrorType = "mcp_authentication_failed_error"` + + - `type BetaManagedAgentsBillingError struct{…}` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsBillingErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsBillingErrorType` + + - `const BetaManagedAgentsBillingErrorTypeBillingError BetaManagedAgentsBillingErrorType = "billing_error"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionErrorEventType` + + - `const BetaManagedAgentsSessionErrorEventTypeSessionError BetaManagedAgentsSessionErrorEventType = "session.error"` + + - `type BetaManagedAgentsSessionStatusRescheduledEvent struct{…}` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRescheduledEventType` + + - `const BetaManagedAgentsSessionStatusRescheduledEventTypeSessionStatusRescheduled BetaManagedAgentsSessionStatusRescheduledEventType = "session.status_rescheduled"` + + - `type BetaManagedAgentsSessionStatusRunningEvent struct{…}` + + Indicates the session is actively running and the agent is working. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRunningEventType` + + - `const BetaManagedAgentsSessionStatusRunningEventTypeSessionStatusRunning BetaManagedAgentsSessionStatusRunningEventType = "session.status_running"` + + - `type BetaManagedAgentsSessionStatusIdleEvent struct{…}` + + Indicates the agent has paused and is awaiting user input. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `StopReason BetaManagedAgentsSessionStatusIdleEventStopReasonUnion` + + The agent completed its turn naturally and is ready for the next user message. + + - `type BetaManagedAgentsSessionEndTurn struct{…}` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type BetaManagedAgentsSessionEndTurnType` + + - `const BetaManagedAgentsSessionEndTurnTypeEndTurn BetaManagedAgentsSessionEndTurnType = "end_turn"` + + - `type BetaManagedAgentsSessionRequiresAction struct{…}` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `EventIDs []string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type BetaManagedAgentsSessionRequiresActionType` + + - `const BetaManagedAgentsSessionRequiresActionTypeRequiresAction BetaManagedAgentsSessionRequiresActionType = "requires_action"` + + - `type BetaManagedAgentsSessionRetriesExhausted struct{…}` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type BetaManagedAgentsSessionRetriesExhaustedType` + + - `const BetaManagedAgentsSessionRetriesExhaustedTypeRetriesExhausted BetaManagedAgentsSessionRetriesExhaustedType = "retries_exhausted"` + + - `Type BetaManagedAgentsSessionStatusIdleEventType` + + - `const BetaManagedAgentsSessionStatusIdleEventTypeSessionStatusIdle BetaManagedAgentsSessionStatusIdleEventType = "session.status_idle"` + + - `type BetaManagedAgentsSessionStatusTerminatedEvent struct{…}` + + Indicates the session has terminated, either due to an error or completion. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusTerminatedEventType` + + - `const BetaManagedAgentsSessionStatusTerminatedEventTypeSessionStatusTerminated BetaManagedAgentsSessionStatusTerminatedEventType = "session.status_terminated"` + + - `type BetaManagedAgentsSpanModelRequestStartEvent struct{…}` + + Emitted when a model request is initiated by the agent. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestStartEventType` + + - `const BetaManagedAgentsSpanModelRequestStartEventTypeSpanModelRequestStart BetaManagedAgentsSpanModelRequestStartEventType = "span.model_request_start"` + + - `type BetaManagedAgentsSpanModelRequestEndEvent struct{…}` + + Emitted when a model request completes. + + - `ID string` + + Unique identifier for this event. + + - `IsError bool` + + Whether the model request resulted in an error. + + - `ModelRequestStartID string` + + The id of the corresponding `span.model_request_start` event. + + - `ModelUsage BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `CacheCreationInputTokens int64` + + Tokens used to create prompt cache in this request. + + - `CacheReadInputTokens int64` + + Tokens read from prompt cache in this request. + + - `InputTokens int64` + + Input tokens consumed by this request. + + - `OutputTokens int64` + + Output tokens generated by this request. + + - `Speed BetaManagedAgentsSpanModelUsageSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsSpanModelUsageSpeedStandard BetaManagedAgentsSpanModelUsageSpeed = "standard"` + + - `const BetaManagedAgentsSpanModelUsageSpeedFast BetaManagedAgentsSpanModelUsageSpeed = "fast"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestEndEventType` + + - `const BetaManagedAgentsSpanModelRequestEndEventTypeSpanModelRequestEnd BetaManagedAgentsSpanModelRequestEndEventType = "span.model_request_end"` + + - `type BetaManagedAgentsSessionDeletedEvent struct{…}` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionDeletedEventType` + + - `const BetaManagedAgentsSessionDeletedEventTypeSessionDeleted BetaManagedAgentsSessionDeletedEventType = "session.deleted"` + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Beta.Sessions.Events.List( + context.TODO(), + "sesn_011CZkZAtmR3yMPDzynEDxu7", + anthropic.BetaSessionEventListParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", page) +} +``` + +## Send + +`client.Beta.Sessions.Events.Send(ctx, sessionID, params) (*BetaManagedAgentsSendSessionEvents, error)` + +**post** `/v1/sessions/{session_id}/events` + +Send Events + +### Parameters + +- `sessionID string` + +- `params BetaSessionEventSendParams` + + - `Events param.Field[[]BetaManagedAgentsEventParamsUnionResp]` + + Body param: Events to send to the `session`. + + - `type BetaManagedAgentsUserMessageEventParamsResp struct{…}` + + Parameters for sending a user message to the session. + + - `Content []BetaManagedAgentsUserMessageEventParamsContentUnionResp` + + Array of content blocks for the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventParamsType` + + - `const BetaManagedAgentsUserMessageEventParamsTypeUserMessage BetaManagedAgentsUserMessageEventParamsType = "user.message"` + + - `type BetaManagedAgentsUserInterruptEventParamsResp struct{…}` + + Parameters for sending an interrupt to pause the agent. + + - `Type BetaManagedAgentsUserInterruptEventParamsType` + + - `const BetaManagedAgentsUserInterruptEventParamsTypeUserInterrupt BetaManagedAgentsUserInterruptEventParamsType = "user.interrupt"` + + - `type BetaManagedAgentsUserToolConfirmationEventParamsResp struct{…}` + + Parameters for confirming or denying a tool execution request. + + - `Result BetaManagedAgentsUserToolConfirmationEventParamsResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventParamsResultAllow BetaManagedAgentsUserToolConfirmationEventParamsResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventParamsResultDeny BetaManagedAgentsUserToolConfirmationEventParamsResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventParamsType` + + - `const BetaManagedAgentsUserToolConfirmationEventParamsTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventParamsType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `type BetaManagedAgentsUserCustomToolResultEventParamsResp struct{…}` + + Parameters for providing the result of a custom tool execution. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventParamsType` + + - `const BetaManagedAgentsUserCustomToolResultEventParamsTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventParamsType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventParamsContentUnionResp` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsSendSessionEvents struct{…}` + + Events that were successfully sent to the session. + + - `Data []BetaManagedAgentsSendSessionEventsDataUnion` + + Sent events + + - `type BetaManagedAgentsUserMessageEvent struct{…}` + + A user message event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsUserMessageEventContentUnion` + + Array of content blocks comprising the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventType` + + - `const BetaManagedAgentsUserMessageEventTypeUserMessage BetaManagedAgentsUserMessageEventType = "user.message"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserInterruptEvent struct{…}` + + An interrupt event that pauses agent execution and returns control to the user. + + - `ID string` + + Unique identifier for this event. + + - `Type BetaManagedAgentsUserInterruptEventType` + + - `const BetaManagedAgentsUserInterruptEventTypeUserInterrupt BetaManagedAgentsUserInterruptEventType = "user.interrupt"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserToolConfirmationEvent struct{…}` + + A tool confirmation event that approves or denies a pending tool execution. + + - `ID string` + + Unique identifier for this event. + + - `Result BetaManagedAgentsUserToolConfirmationEventResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventResultAllow BetaManagedAgentsUserToolConfirmationEventResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventResultDeny BetaManagedAgentsUserToolConfirmationEventResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventType` + + - `const BetaManagedAgentsUserToolConfirmationEventTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserCustomToolResultEvent struct{…}` + + Event sent by the client providing the result of a custom tool execution. + + - `ID string` + + Unique identifier for this event. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventType` + + - `const BetaManagedAgentsUserCustomToolResultEventTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsSendSessionEvents, err := client.Beta.Sessions.Events.Send( + context.TODO(), + "sesn_011CZkZAtmR3yMPDzynEDxu7", + anthropic.BetaSessionEventSendParams{ + Events: []anthropic.BetaManagedAgentsEventParamsUnion{anthropic.BetaManagedAgentsEventParamsUnion{ + OfUserMessage: &anthropic.BetaManagedAgentsUserMessageEventParams{ + Content: []anthropic.BetaManagedAgentsUserMessageEventParamsContentUnion{anthropic.BetaManagedAgentsUserMessageEventParamsContentUnion{ + OfText: &anthropic.BetaManagedAgentsTextBlockParam{ + Text: "Where is my order #1234?", + Type: anthropic.BetaManagedAgentsTextBlockTypeText, + }, + }}, + Type: anthropic.BetaManagedAgentsUserMessageEventParamsTypeUserMessage, + }, + }}, + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsSendSessionEvents.Data) +} +``` + +## Stream + +`client.Beta.Sessions.Events.Stream(ctx, sessionID, query) (*BetaManagedAgentsStreamSessionEventsUnion, error)` + +**get** `/v1/sessions/{session_id}/events/stream` + +Stream Events + +### Parameters + +- `sessionID string` + +- `query BetaSessionEventStreamParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsStreamSessionEventsUnion interface{…}` + + Server-sent event in the session stream. + + - `type BetaManagedAgentsUserMessageEvent struct{…}` + + A user message event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsUserMessageEventContentUnion` + + Array of content blocks comprising the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventType` + + - `const BetaManagedAgentsUserMessageEventTypeUserMessage BetaManagedAgentsUserMessageEventType = "user.message"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserInterruptEvent struct{…}` + + An interrupt event that pauses agent execution and returns control to the user. + + - `ID string` + + Unique identifier for this event. + + - `Type BetaManagedAgentsUserInterruptEventType` + + - `const BetaManagedAgentsUserInterruptEventTypeUserInterrupt BetaManagedAgentsUserInterruptEventType = "user.interrupt"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserToolConfirmationEvent struct{…}` + + A tool confirmation event that approves or denies a pending tool execution. + + - `ID string` + + Unique identifier for this event. + + - `Result BetaManagedAgentsUserToolConfirmationEventResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventResultAllow BetaManagedAgentsUserToolConfirmationEventResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventResultDeny BetaManagedAgentsUserToolConfirmationEventResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventType` + + - `const BetaManagedAgentsUserToolConfirmationEventTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserCustomToolResultEvent struct{…}` + + Event sent by the client providing the result of a custom tool execution. + + - `ID string` + + Unique identifier for this event. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventType` + + - `const BetaManagedAgentsUserCustomToolResultEventTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsAgentCustomToolUseEvent struct{…}` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the custom tool being called. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentCustomToolUseEventType` + + - `const BetaManagedAgentsAgentCustomToolUseEventTypeAgentCustomToolUse BetaManagedAgentsAgentCustomToolUseEventType = "agent.custom_tool_use"` + + - `type BetaManagedAgentsAgentMessageEvent struct{…}` + + An agent response event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMessageEventType` + + - `const BetaManagedAgentsAgentMessageEventTypeAgentMessage BetaManagedAgentsAgentMessageEventType = "agent.message"` + + - `type BetaManagedAgentsAgentThinkingEvent struct{…}` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThinkingEventType` + + - `const BetaManagedAgentsAgentThinkingEventTypeAgentThinking BetaManagedAgentsAgentThinkingEventType = "agent.thinking"` + + - `type BetaManagedAgentsAgentMCPToolUseEvent struct{…}` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `MCPServerName string` + + Name of the MCP server providing the tool. + + - `Name string` + + Name of the MCP tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolUseEventType` + + - `const BetaManagedAgentsAgentMCPToolUseEventTypeAgentMCPToolUse BetaManagedAgentsAgentMCPToolUseEventType = "agent.mcp_tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "deny"` + + - `type BetaManagedAgentsAgentMCPToolResultEvent struct{…}` + + Event representing the result of an MCP tool execution. + + - `ID string` + + Unique identifier for this event. + + - `MCPToolUseID string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolResultEventType` + + - `const BetaManagedAgentsAgentMCPToolResultEventTypeAgentMCPToolResult BetaManagedAgentsAgentMCPToolResultEventType = "agent.mcp_tool_result"` + + - `Content []BetaManagedAgentsAgentMCPToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `type BetaManagedAgentsAgentToolUseEvent struct{…}` + + Event emitted when the agent invokes a built-in agent tool. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the agent tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentToolUseEventType` + + - `const BetaManagedAgentsAgentToolUseEventTypeAgentToolUse BetaManagedAgentsAgentToolUseEventType = "agent.tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "deny"` + + - `type BetaManagedAgentsAgentToolResultEvent struct{…}` + + Event representing the result of an agent tool execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `ToolUseID string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `Type BetaManagedAgentsAgentToolResultEventType` + + - `const BetaManagedAgentsAgentToolResultEventTypeAgentToolResult BetaManagedAgentsAgentToolResultEventType = "agent.tool_result"` + + - `Content []BetaManagedAgentsAgentToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `type BetaManagedAgentsAgentThreadContextCompactedEvent struct{…}` + + Indicates that context compaction (summarization) occurred during the session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThreadContextCompactedEventType` + + - `const BetaManagedAgentsAgentThreadContextCompactedEventTypeAgentThreadContextCompacted BetaManagedAgentsAgentThreadContextCompactedEventType = "agent.thread_context_compacted"` + + - `type BetaManagedAgentsSessionErrorEvent struct{…}` + + An error event indicating a problem occurred during session execution. + + - `ID string` + + Unique identifier for this event. + + - `Error BetaManagedAgentsSessionErrorEventErrorUnion` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `type BetaManagedAgentsUnknownError struct{…}` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsUnknownErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsUnknownErrorType` + + - `const BetaManagedAgentsUnknownErrorTypeUnknownError BetaManagedAgentsUnknownErrorType = "unknown_error"` + + - `type BetaManagedAgentsModelOverloadedError struct{…}` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelOverloadedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelOverloadedErrorType` + + - `const BetaManagedAgentsModelOverloadedErrorTypeModelOverloadedError BetaManagedAgentsModelOverloadedErrorType = "model_overloaded_error"` + + - `type BetaManagedAgentsModelRateLimitedError struct{…}` + + The model request was rate-limited. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRateLimitedErrorType` + + - `const BetaManagedAgentsModelRateLimitedErrorTypeModelRateLimitedError BetaManagedAgentsModelRateLimitedErrorType = "model_rate_limited_error"` + + - `type BetaManagedAgentsModelRequestFailedError struct{…}` + + A model request failed for a reason other than overload or rate-limiting. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRequestFailedErrorType` + + - `const BetaManagedAgentsModelRequestFailedErrorTypeModelRequestFailedError BetaManagedAgentsModelRequestFailedErrorType = "model_request_failed_error"` + + - `type BetaManagedAgentsMCPConnectionFailedError struct{…}` + + Failed to connect to an MCP server. + + - `MCPServerName string` + + Name of the MCP server that failed to connect. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPConnectionFailedErrorType` + + - `const BetaManagedAgentsMCPConnectionFailedErrorTypeMCPConnectionFailedError BetaManagedAgentsMCPConnectionFailedErrorType = "mcp_connection_failed_error"` + + - `type BetaManagedAgentsMCPAuthenticationFailedError struct{…}` + + Authentication to an MCP server failed. + + - `MCPServerName string` + + Name of the MCP server that failed authentication. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPAuthenticationFailedErrorType` + + - `const BetaManagedAgentsMCPAuthenticationFailedErrorTypeMCPAuthenticationFailedError BetaManagedAgentsMCPAuthenticationFailedErrorType = "mcp_authentication_failed_error"` + + - `type BetaManagedAgentsBillingError struct{…}` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsBillingErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsBillingErrorType` + + - `const BetaManagedAgentsBillingErrorTypeBillingError BetaManagedAgentsBillingErrorType = "billing_error"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionErrorEventType` + + - `const BetaManagedAgentsSessionErrorEventTypeSessionError BetaManagedAgentsSessionErrorEventType = "session.error"` + + - `type BetaManagedAgentsSessionStatusRescheduledEvent struct{…}` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRescheduledEventType` + + - `const BetaManagedAgentsSessionStatusRescheduledEventTypeSessionStatusRescheduled BetaManagedAgentsSessionStatusRescheduledEventType = "session.status_rescheduled"` + + - `type BetaManagedAgentsSessionStatusRunningEvent struct{…}` + + Indicates the session is actively running and the agent is working. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRunningEventType` + + - `const BetaManagedAgentsSessionStatusRunningEventTypeSessionStatusRunning BetaManagedAgentsSessionStatusRunningEventType = "session.status_running"` + + - `type BetaManagedAgentsSessionStatusIdleEvent struct{…}` + + Indicates the agent has paused and is awaiting user input. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `StopReason BetaManagedAgentsSessionStatusIdleEventStopReasonUnion` + + The agent completed its turn naturally and is ready for the next user message. + + - `type BetaManagedAgentsSessionEndTurn struct{…}` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type BetaManagedAgentsSessionEndTurnType` + + - `const BetaManagedAgentsSessionEndTurnTypeEndTurn BetaManagedAgentsSessionEndTurnType = "end_turn"` + + - `type BetaManagedAgentsSessionRequiresAction struct{…}` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `EventIDs []string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type BetaManagedAgentsSessionRequiresActionType` + + - `const BetaManagedAgentsSessionRequiresActionTypeRequiresAction BetaManagedAgentsSessionRequiresActionType = "requires_action"` + + - `type BetaManagedAgentsSessionRetriesExhausted struct{…}` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type BetaManagedAgentsSessionRetriesExhaustedType` + + - `const BetaManagedAgentsSessionRetriesExhaustedTypeRetriesExhausted BetaManagedAgentsSessionRetriesExhaustedType = "retries_exhausted"` + + - `Type BetaManagedAgentsSessionStatusIdleEventType` + + - `const BetaManagedAgentsSessionStatusIdleEventTypeSessionStatusIdle BetaManagedAgentsSessionStatusIdleEventType = "session.status_idle"` + + - `type BetaManagedAgentsSessionStatusTerminatedEvent struct{…}` + + Indicates the session has terminated, either due to an error or completion. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusTerminatedEventType` + + - `const BetaManagedAgentsSessionStatusTerminatedEventTypeSessionStatusTerminated BetaManagedAgentsSessionStatusTerminatedEventType = "session.status_terminated"` + + - `type BetaManagedAgentsSpanModelRequestStartEvent struct{…}` + + Emitted when a model request is initiated by the agent. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestStartEventType` + + - `const BetaManagedAgentsSpanModelRequestStartEventTypeSpanModelRequestStart BetaManagedAgentsSpanModelRequestStartEventType = "span.model_request_start"` + + - `type BetaManagedAgentsSpanModelRequestEndEvent struct{…}` + + Emitted when a model request completes. + + - `ID string` + + Unique identifier for this event. + + - `IsError bool` + + Whether the model request resulted in an error. + + - `ModelRequestStartID string` + + The id of the corresponding `span.model_request_start` event. + + - `ModelUsage BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `CacheCreationInputTokens int64` + + Tokens used to create prompt cache in this request. + + - `CacheReadInputTokens int64` + + Tokens read from prompt cache in this request. + + - `InputTokens int64` + + Input tokens consumed by this request. + + - `OutputTokens int64` + + Output tokens generated by this request. + + - `Speed BetaManagedAgentsSpanModelUsageSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsSpanModelUsageSpeedStandard BetaManagedAgentsSpanModelUsageSpeed = "standard"` + + - `const BetaManagedAgentsSpanModelUsageSpeedFast BetaManagedAgentsSpanModelUsageSpeed = "fast"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestEndEventType` + + - `const BetaManagedAgentsSpanModelRequestEndEventTypeSpanModelRequestEnd BetaManagedAgentsSpanModelRequestEndEventType = "span.model_request_end"` + + - `type BetaManagedAgentsSessionDeletedEvent struct{…}` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionDeletedEventType` + + - `const BetaManagedAgentsSessionDeletedEventTypeSessionDeleted BetaManagedAgentsSessionDeletedEventType = "session.deleted"` + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + stream := client.Beta.Sessions.Events.StreamEvents( + context.TODO(), + "sesn_011CZkZAtmR3yMPDzynEDxu7", + anthropic.BetaSessionEventStreamParams{ + + }, + ) + for stream.Next() { + fmt.Printf("%+v\n", stream.Current()) + } + err := stream.Err() + if err != nil { + panic(err.Error()) + } +} +``` + +## Domain Types + +### Beta Managed Agents Agent Custom Tool Use Event + +- `type BetaManagedAgentsAgentCustomToolUseEvent struct{…}` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the custom tool being called. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentCustomToolUseEventType` + + - `const BetaManagedAgentsAgentCustomToolUseEventTypeAgentCustomToolUse BetaManagedAgentsAgentCustomToolUseEventType = "agent.custom_tool_use"` + +### Beta Managed Agents Agent MCP Tool Result Event + +- `type BetaManagedAgentsAgentMCPToolResultEvent struct{…}` + + Event representing the result of an MCP tool execution. + + - `ID string` + + Unique identifier for this event. + + - `MCPToolUseID string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolResultEventType` + + - `const BetaManagedAgentsAgentMCPToolResultEventTypeAgentMCPToolResult BetaManagedAgentsAgentMCPToolResultEventType = "agent.mcp_tool_result"` + + - `Content []BetaManagedAgentsAgentMCPToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent MCP Tool Use Event + +- `type BetaManagedAgentsAgentMCPToolUseEvent struct{…}` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `MCPServerName string` + + Name of the MCP server providing the tool. + + - `Name string` + + Name of the MCP tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolUseEventType` + + - `const BetaManagedAgentsAgentMCPToolUseEventTypeAgentMCPToolUse BetaManagedAgentsAgentMCPToolUseEventType = "agent.mcp_tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "deny"` + +### Beta Managed Agents Agent Message Event + +- `type BetaManagedAgentsAgentMessageEvent struct{…}` + + An agent response event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMessageEventType` + + - `const BetaManagedAgentsAgentMessageEventTypeAgentMessage BetaManagedAgentsAgentMessageEventType = "agent.message"` + +### Beta Managed Agents Agent Thinking Event + +- `type BetaManagedAgentsAgentThinkingEvent struct{…}` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThinkingEventType` + + - `const BetaManagedAgentsAgentThinkingEventTypeAgentThinking BetaManagedAgentsAgentThinkingEventType = "agent.thinking"` + +### Beta Managed Agents Agent Thread Context Compacted Event + +- `type BetaManagedAgentsAgentThreadContextCompactedEvent struct{…}` + + Indicates that context compaction (summarization) occurred during the session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThreadContextCompactedEventType` + + - `const BetaManagedAgentsAgentThreadContextCompactedEventTypeAgentThreadContextCompacted BetaManagedAgentsAgentThreadContextCompactedEventType = "agent.thread_context_compacted"` + +### Beta Managed Agents Agent Tool Result Event + +- `type BetaManagedAgentsAgentToolResultEvent struct{…}` + + Event representing the result of an agent tool execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `ToolUseID string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `Type BetaManagedAgentsAgentToolResultEventType` + + - `const BetaManagedAgentsAgentToolResultEventTypeAgentToolResult BetaManagedAgentsAgentToolResultEventType = "agent.tool_result"` + + - `Content []BetaManagedAgentsAgentToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent Tool Use Event + +- `type BetaManagedAgentsAgentToolUseEvent struct{…}` + + Event emitted when the agent invokes a built-in agent tool. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the agent tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentToolUseEventType` + + - `const BetaManagedAgentsAgentToolUseEventTypeAgentToolUse BetaManagedAgentsAgentToolUseEventType = "agent.tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "deny"` + +### Beta Managed Agents Base64 Document Source + +- `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + +### Beta Managed Agents Base64 Image Source + +- `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + +### Beta Managed Agents Billing Error + +- `type BetaManagedAgentsBillingError struct{…}` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsBillingErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsBillingErrorType` + + - `const BetaManagedAgentsBillingErrorTypeBillingError BetaManagedAgentsBillingErrorType = "billing_error"` + +### Beta Managed Agents Document Block + +- `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + +### Beta Managed Agents Event Params + +- `type BetaManagedAgentsEventParamsUnionResp interface{…}` + + Union type for event parameters that can be sent to a session. + + - `type BetaManagedAgentsUserMessageEventParamsResp struct{…}` + + Parameters for sending a user message to the session. + + - `Content []BetaManagedAgentsUserMessageEventParamsContentUnionResp` + + Array of content blocks for the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventParamsType` + + - `const BetaManagedAgentsUserMessageEventParamsTypeUserMessage BetaManagedAgentsUserMessageEventParamsType = "user.message"` + + - `type BetaManagedAgentsUserInterruptEventParamsResp struct{…}` + + Parameters for sending an interrupt to pause the agent. + + - `Type BetaManagedAgentsUserInterruptEventParamsType` + + - `const BetaManagedAgentsUserInterruptEventParamsTypeUserInterrupt BetaManagedAgentsUserInterruptEventParamsType = "user.interrupt"` + + - `type BetaManagedAgentsUserToolConfirmationEventParamsResp struct{…}` + + Parameters for confirming or denying a tool execution request. + + - `Result BetaManagedAgentsUserToolConfirmationEventParamsResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventParamsResultAllow BetaManagedAgentsUserToolConfirmationEventParamsResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventParamsResultDeny BetaManagedAgentsUserToolConfirmationEventParamsResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventParamsType` + + - `const BetaManagedAgentsUserToolConfirmationEventParamsTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventParamsType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `type BetaManagedAgentsUserCustomToolResultEventParamsResp struct{…}` + + Parameters for providing the result of a custom tool execution. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventParamsType` + + - `const BetaManagedAgentsUserCustomToolResultEventParamsTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventParamsType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventParamsContentUnionResp` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents File Document Source + +- `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + +### Beta Managed Agents File Image Source + +- `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + +### Beta Managed Agents Image Block + +- `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + +### Beta Managed Agents MCP Authentication Failed Error + +- `type BetaManagedAgentsMCPAuthenticationFailedError struct{…}` + + Authentication to an MCP server failed. + + - `MCPServerName string` + + Name of the MCP server that failed authentication. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPAuthenticationFailedErrorType` + + - `const BetaManagedAgentsMCPAuthenticationFailedErrorTypeMCPAuthenticationFailedError BetaManagedAgentsMCPAuthenticationFailedErrorType = "mcp_authentication_failed_error"` + +### Beta Managed Agents MCP Connection Failed Error + +- `type BetaManagedAgentsMCPConnectionFailedError struct{…}` + + Failed to connect to an MCP server. + + - `MCPServerName string` + + Name of the MCP server that failed to connect. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPConnectionFailedErrorType` + + - `const BetaManagedAgentsMCPConnectionFailedErrorTypeMCPConnectionFailedError BetaManagedAgentsMCPConnectionFailedErrorType = "mcp_connection_failed_error"` + +### Beta Managed Agents Model Overloaded Error + +- `type BetaManagedAgentsModelOverloadedError struct{…}` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelOverloadedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelOverloadedErrorType` + + - `const BetaManagedAgentsModelOverloadedErrorTypeModelOverloadedError BetaManagedAgentsModelOverloadedErrorType = "model_overloaded_error"` + +### Beta Managed Agents Model Rate Limited Error + +- `type BetaManagedAgentsModelRateLimitedError struct{…}` + + The model request was rate-limited. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRateLimitedErrorType` + + - `const BetaManagedAgentsModelRateLimitedErrorTypeModelRateLimitedError BetaManagedAgentsModelRateLimitedErrorType = "model_rate_limited_error"` + +### Beta Managed Agents Model Request Failed Error + +- `type BetaManagedAgentsModelRequestFailedError struct{…}` + + A model request failed for a reason other than overload or rate-limiting. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRequestFailedErrorType` + + - `const BetaManagedAgentsModelRequestFailedErrorTypeModelRequestFailedError BetaManagedAgentsModelRequestFailedErrorType = "model_request_failed_error"` + +### Beta Managed Agents Plain Text Document Source + +- `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + +### Beta Managed Agents Retry Status Exhausted + +- `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + +### Beta Managed Agents Retry Status Retrying + +- `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + +### Beta Managed Agents Retry Status Terminal + +- `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + +### Beta Managed Agents Send Session Events + +- `type BetaManagedAgentsSendSessionEvents struct{…}` + + Events that were successfully sent to the session. + + - `Data []BetaManagedAgentsSendSessionEventsDataUnion` + + Sent events + + - `type BetaManagedAgentsUserMessageEvent struct{…}` + + A user message event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsUserMessageEventContentUnion` + + Array of content blocks comprising the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventType` + + - `const BetaManagedAgentsUserMessageEventTypeUserMessage BetaManagedAgentsUserMessageEventType = "user.message"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserInterruptEvent struct{…}` + + An interrupt event that pauses agent execution and returns control to the user. + + - `ID string` + + Unique identifier for this event. + + - `Type BetaManagedAgentsUserInterruptEventType` + + - `const BetaManagedAgentsUserInterruptEventTypeUserInterrupt BetaManagedAgentsUserInterruptEventType = "user.interrupt"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserToolConfirmationEvent struct{…}` + + A tool confirmation event that approves or denies a pending tool execution. + + - `ID string` + + Unique identifier for this event. + + - `Result BetaManagedAgentsUserToolConfirmationEventResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventResultAllow BetaManagedAgentsUserToolConfirmationEventResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventResultDeny BetaManagedAgentsUserToolConfirmationEventResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventType` + + - `const BetaManagedAgentsUserToolConfirmationEventTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserCustomToolResultEvent struct{…}` + + Event sent by the client providing the result of a custom tool execution. + + - `ID string` + + Unique identifier for this event. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventType` + + - `const BetaManagedAgentsUserCustomToolResultEventTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents Session Deleted Event + +- `type BetaManagedAgentsSessionDeletedEvent struct{…}` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionDeletedEventType` + + - `const BetaManagedAgentsSessionDeletedEventTypeSessionDeleted BetaManagedAgentsSessionDeletedEventType = "session.deleted"` + +### Beta Managed Agents Session End Turn + +- `type BetaManagedAgentsSessionEndTurn struct{…}` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type BetaManagedAgentsSessionEndTurnType` + + - `const BetaManagedAgentsSessionEndTurnTypeEndTurn BetaManagedAgentsSessionEndTurnType = "end_turn"` + +### Beta Managed Agents Session Error Event + +- `type BetaManagedAgentsSessionErrorEvent struct{…}` + + An error event indicating a problem occurred during session execution. + + - `ID string` + + Unique identifier for this event. + + - `Error BetaManagedAgentsSessionErrorEventErrorUnion` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `type BetaManagedAgentsUnknownError struct{…}` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsUnknownErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsUnknownErrorType` + + - `const BetaManagedAgentsUnknownErrorTypeUnknownError BetaManagedAgentsUnknownErrorType = "unknown_error"` + + - `type BetaManagedAgentsModelOverloadedError struct{…}` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelOverloadedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelOverloadedErrorType` + + - `const BetaManagedAgentsModelOverloadedErrorTypeModelOverloadedError BetaManagedAgentsModelOverloadedErrorType = "model_overloaded_error"` + + - `type BetaManagedAgentsModelRateLimitedError struct{…}` + + The model request was rate-limited. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRateLimitedErrorType` + + - `const BetaManagedAgentsModelRateLimitedErrorTypeModelRateLimitedError BetaManagedAgentsModelRateLimitedErrorType = "model_rate_limited_error"` + + - `type BetaManagedAgentsModelRequestFailedError struct{…}` + + A model request failed for a reason other than overload or rate-limiting. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRequestFailedErrorType` + + - `const BetaManagedAgentsModelRequestFailedErrorTypeModelRequestFailedError BetaManagedAgentsModelRequestFailedErrorType = "model_request_failed_error"` + + - `type BetaManagedAgentsMCPConnectionFailedError struct{…}` + + Failed to connect to an MCP server. + + - `MCPServerName string` + + Name of the MCP server that failed to connect. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPConnectionFailedErrorType` + + - `const BetaManagedAgentsMCPConnectionFailedErrorTypeMCPConnectionFailedError BetaManagedAgentsMCPConnectionFailedErrorType = "mcp_connection_failed_error"` + + - `type BetaManagedAgentsMCPAuthenticationFailedError struct{…}` + + Authentication to an MCP server failed. + + - `MCPServerName string` + + Name of the MCP server that failed authentication. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPAuthenticationFailedErrorType` + + - `const BetaManagedAgentsMCPAuthenticationFailedErrorTypeMCPAuthenticationFailedError BetaManagedAgentsMCPAuthenticationFailedErrorType = "mcp_authentication_failed_error"` + + - `type BetaManagedAgentsBillingError struct{…}` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsBillingErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsBillingErrorType` + + - `const BetaManagedAgentsBillingErrorTypeBillingError BetaManagedAgentsBillingErrorType = "billing_error"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionErrorEventType` + + - `const BetaManagedAgentsSessionErrorEventTypeSessionError BetaManagedAgentsSessionErrorEventType = "session.error"` + +### Beta Managed Agents Session Event + +- `type BetaManagedAgentsSessionEventUnion interface{…}` + + Union type for all event types in a session. + + - `type BetaManagedAgentsUserMessageEvent struct{…}` + + A user message event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsUserMessageEventContentUnion` + + Array of content blocks comprising the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventType` + + - `const BetaManagedAgentsUserMessageEventTypeUserMessage BetaManagedAgentsUserMessageEventType = "user.message"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserInterruptEvent struct{…}` + + An interrupt event that pauses agent execution and returns control to the user. + + - `ID string` + + Unique identifier for this event. + + - `Type BetaManagedAgentsUserInterruptEventType` + + - `const BetaManagedAgentsUserInterruptEventTypeUserInterrupt BetaManagedAgentsUserInterruptEventType = "user.interrupt"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserToolConfirmationEvent struct{…}` + + A tool confirmation event that approves or denies a pending tool execution. + + - `ID string` + + Unique identifier for this event. + + - `Result BetaManagedAgentsUserToolConfirmationEventResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventResultAllow BetaManagedAgentsUserToolConfirmationEventResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventResultDeny BetaManagedAgentsUserToolConfirmationEventResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventType` + + - `const BetaManagedAgentsUserToolConfirmationEventTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserCustomToolResultEvent struct{…}` + + Event sent by the client providing the result of a custom tool execution. + + - `ID string` + + Unique identifier for this event. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventType` + + - `const BetaManagedAgentsUserCustomToolResultEventTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsAgentCustomToolUseEvent struct{…}` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the custom tool being called. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentCustomToolUseEventType` + + - `const BetaManagedAgentsAgentCustomToolUseEventTypeAgentCustomToolUse BetaManagedAgentsAgentCustomToolUseEventType = "agent.custom_tool_use"` + + - `type BetaManagedAgentsAgentMessageEvent struct{…}` + + An agent response event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMessageEventType` + + - `const BetaManagedAgentsAgentMessageEventTypeAgentMessage BetaManagedAgentsAgentMessageEventType = "agent.message"` + + - `type BetaManagedAgentsAgentThinkingEvent struct{…}` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThinkingEventType` + + - `const BetaManagedAgentsAgentThinkingEventTypeAgentThinking BetaManagedAgentsAgentThinkingEventType = "agent.thinking"` + + - `type BetaManagedAgentsAgentMCPToolUseEvent struct{…}` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `MCPServerName string` + + Name of the MCP server providing the tool. + + - `Name string` + + Name of the MCP tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolUseEventType` + + - `const BetaManagedAgentsAgentMCPToolUseEventTypeAgentMCPToolUse BetaManagedAgentsAgentMCPToolUseEventType = "agent.mcp_tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "deny"` + + - `type BetaManagedAgentsAgentMCPToolResultEvent struct{…}` + + Event representing the result of an MCP tool execution. + + - `ID string` + + Unique identifier for this event. + + - `MCPToolUseID string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolResultEventType` + + - `const BetaManagedAgentsAgentMCPToolResultEventTypeAgentMCPToolResult BetaManagedAgentsAgentMCPToolResultEventType = "agent.mcp_tool_result"` + + - `Content []BetaManagedAgentsAgentMCPToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `type BetaManagedAgentsAgentToolUseEvent struct{…}` + + Event emitted when the agent invokes a built-in agent tool. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the agent tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentToolUseEventType` + + - `const BetaManagedAgentsAgentToolUseEventTypeAgentToolUse BetaManagedAgentsAgentToolUseEventType = "agent.tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "deny"` + + - `type BetaManagedAgentsAgentToolResultEvent struct{…}` + + Event representing the result of an agent tool execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `ToolUseID string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `Type BetaManagedAgentsAgentToolResultEventType` + + - `const BetaManagedAgentsAgentToolResultEventTypeAgentToolResult BetaManagedAgentsAgentToolResultEventType = "agent.tool_result"` + + - `Content []BetaManagedAgentsAgentToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `type BetaManagedAgentsAgentThreadContextCompactedEvent struct{…}` + + Indicates that context compaction (summarization) occurred during the session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThreadContextCompactedEventType` + + - `const BetaManagedAgentsAgentThreadContextCompactedEventTypeAgentThreadContextCompacted BetaManagedAgentsAgentThreadContextCompactedEventType = "agent.thread_context_compacted"` + + - `type BetaManagedAgentsSessionErrorEvent struct{…}` + + An error event indicating a problem occurred during session execution. + + - `ID string` + + Unique identifier for this event. + + - `Error BetaManagedAgentsSessionErrorEventErrorUnion` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `type BetaManagedAgentsUnknownError struct{…}` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsUnknownErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsUnknownErrorType` + + - `const BetaManagedAgentsUnknownErrorTypeUnknownError BetaManagedAgentsUnknownErrorType = "unknown_error"` + + - `type BetaManagedAgentsModelOverloadedError struct{…}` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelOverloadedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelOverloadedErrorType` + + - `const BetaManagedAgentsModelOverloadedErrorTypeModelOverloadedError BetaManagedAgentsModelOverloadedErrorType = "model_overloaded_error"` + + - `type BetaManagedAgentsModelRateLimitedError struct{…}` + + The model request was rate-limited. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRateLimitedErrorType` + + - `const BetaManagedAgentsModelRateLimitedErrorTypeModelRateLimitedError BetaManagedAgentsModelRateLimitedErrorType = "model_rate_limited_error"` + + - `type BetaManagedAgentsModelRequestFailedError struct{…}` + + A model request failed for a reason other than overload or rate-limiting. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRequestFailedErrorType` + + - `const BetaManagedAgentsModelRequestFailedErrorTypeModelRequestFailedError BetaManagedAgentsModelRequestFailedErrorType = "model_request_failed_error"` + + - `type BetaManagedAgentsMCPConnectionFailedError struct{…}` + + Failed to connect to an MCP server. + + - `MCPServerName string` + + Name of the MCP server that failed to connect. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPConnectionFailedErrorType` + + - `const BetaManagedAgentsMCPConnectionFailedErrorTypeMCPConnectionFailedError BetaManagedAgentsMCPConnectionFailedErrorType = "mcp_connection_failed_error"` + + - `type BetaManagedAgentsMCPAuthenticationFailedError struct{…}` + + Authentication to an MCP server failed. + + - `MCPServerName string` + + Name of the MCP server that failed authentication. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPAuthenticationFailedErrorType` + + - `const BetaManagedAgentsMCPAuthenticationFailedErrorTypeMCPAuthenticationFailedError BetaManagedAgentsMCPAuthenticationFailedErrorType = "mcp_authentication_failed_error"` + + - `type BetaManagedAgentsBillingError struct{…}` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsBillingErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsBillingErrorType` + + - `const BetaManagedAgentsBillingErrorTypeBillingError BetaManagedAgentsBillingErrorType = "billing_error"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionErrorEventType` + + - `const BetaManagedAgentsSessionErrorEventTypeSessionError BetaManagedAgentsSessionErrorEventType = "session.error"` + + - `type BetaManagedAgentsSessionStatusRescheduledEvent struct{…}` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRescheduledEventType` + + - `const BetaManagedAgentsSessionStatusRescheduledEventTypeSessionStatusRescheduled BetaManagedAgentsSessionStatusRescheduledEventType = "session.status_rescheduled"` + + - `type BetaManagedAgentsSessionStatusRunningEvent struct{…}` + + Indicates the session is actively running and the agent is working. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRunningEventType` + + - `const BetaManagedAgentsSessionStatusRunningEventTypeSessionStatusRunning BetaManagedAgentsSessionStatusRunningEventType = "session.status_running"` + + - `type BetaManagedAgentsSessionStatusIdleEvent struct{…}` + + Indicates the agent has paused and is awaiting user input. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `StopReason BetaManagedAgentsSessionStatusIdleEventStopReasonUnion` + + The agent completed its turn naturally and is ready for the next user message. + + - `type BetaManagedAgentsSessionEndTurn struct{…}` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type BetaManagedAgentsSessionEndTurnType` + + - `const BetaManagedAgentsSessionEndTurnTypeEndTurn BetaManagedAgentsSessionEndTurnType = "end_turn"` + + - `type BetaManagedAgentsSessionRequiresAction struct{…}` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `EventIDs []string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type BetaManagedAgentsSessionRequiresActionType` + + - `const BetaManagedAgentsSessionRequiresActionTypeRequiresAction BetaManagedAgentsSessionRequiresActionType = "requires_action"` + + - `type BetaManagedAgentsSessionRetriesExhausted struct{…}` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type BetaManagedAgentsSessionRetriesExhaustedType` + + - `const BetaManagedAgentsSessionRetriesExhaustedTypeRetriesExhausted BetaManagedAgentsSessionRetriesExhaustedType = "retries_exhausted"` + + - `Type BetaManagedAgentsSessionStatusIdleEventType` + + - `const BetaManagedAgentsSessionStatusIdleEventTypeSessionStatusIdle BetaManagedAgentsSessionStatusIdleEventType = "session.status_idle"` + + - `type BetaManagedAgentsSessionStatusTerminatedEvent struct{…}` + + Indicates the session has terminated, either due to an error or completion. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusTerminatedEventType` + + - `const BetaManagedAgentsSessionStatusTerminatedEventTypeSessionStatusTerminated BetaManagedAgentsSessionStatusTerminatedEventType = "session.status_terminated"` + + - `type BetaManagedAgentsSpanModelRequestStartEvent struct{…}` + + Emitted when a model request is initiated by the agent. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestStartEventType` + + - `const BetaManagedAgentsSpanModelRequestStartEventTypeSpanModelRequestStart BetaManagedAgentsSpanModelRequestStartEventType = "span.model_request_start"` + + - `type BetaManagedAgentsSpanModelRequestEndEvent struct{…}` + + Emitted when a model request completes. + + - `ID string` + + Unique identifier for this event. + + - `IsError bool` + + Whether the model request resulted in an error. + + - `ModelRequestStartID string` + + The id of the corresponding `span.model_request_start` event. + + - `ModelUsage BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `CacheCreationInputTokens int64` + + Tokens used to create prompt cache in this request. + + - `CacheReadInputTokens int64` + + Tokens read from prompt cache in this request. + + - `InputTokens int64` + + Input tokens consumed by this request. + + - `OutputTokens int64` + + Output tokens generated by this request. + + - `Speed BetaManagedAgentsSpanModelUsageSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsSpanModelUsageSpeedStandard BetaManagedAgentsSpanModelUsageSpeed = "standard"` + + - `const BetaManagedAgentsSpanModelUsageSpeedFast BetaManagedAgentsSpanModelUsageSpeed = "fast"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestEndEventType` + + - `const BetaManagedAgentsSpanModelRequestEndEventTypeSpanModelRequestEnd BetaManagedAgentsSpanModelRequestEndEventType = "span.model_request_end"` + + - `type BetaManagedAgentsSessionDeletedEvent struct{…}` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionDeletedEventType` + + - `const BetaManagedAgentsSessionDeletedEventTypeSessionDeleted BetaManagedAgentsSessionDeletedEventType = "session.deleted"` + +### Beta Managed Agents Session Requires Action + +- `type BetaManagedAgentsSessionRequiresAction struct{…}` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `EventIDs []string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type BetaManagedAgentsSessionRequiresActionType` + + - `const BetaManagedAgentsSessionRequiresActionTypeRequiresAction BetaManagedAgentsSessionRequiresActionType = "requires_action"` + +### Beta Managed Agents Session Retries Exhausted + +- `type BetaManagedAgentsSessionRetriesExhausted struct{…}` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type BetaManagedAgentsSessionRetriesExhaustedType` + + - `const BetaManagedAgentsSessionRetriesExhaustedTypeRetriesExhausted BetaManagedAgentsSessionRetriesExhaustedType = "retries_exhausted"` + +### Beta Managed Agents Session Status Idle Event + +- `type BetaManagedAgentsSessionStatusIdleEvent struct{…}` + + Indicates the agent has paused and is awaiting user input. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `StopReason BetaManagedAgentsSessionStatusIdleEventStopReasonUnion` + + The agent completed its turn naturally and is ready for the next user message. + + - `type BetaManagedAgentsSessionEndTurn struct{…}` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type BetaManagedAgentsSessionEndTurnType` + + - `const BetaManagedAgentsSessionEndTurnTypeEndTurn BetaManagedAgentsSessionEndTurnType = "end_turn"` + + - `type BetaManagedAgentsSessionRequiresAction struct{…}` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `EventIDs []string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type BetaManagedAgentsSessionRequiresActionType` + + - `const BetaManagedAgentsSessionRequiresActionTypeRequiresAction BetaManagedAgentsSessionRequiresActionType = "requires_action"` + + - `type BetaManagedAgentsSessionRetriesExhausted struct{…}` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type BetaManagedAgentsSessionRetriesExhaustedType` + + - `const BetaManagedAgentsSessionRetriesExhaustedTypeRetriesExhausted BetaManagedAgentsSessionRetriesExhaustedType = "retries_exhausted"` + + - `Type BetaManagedAgentsSessionStatusIdleEventType` + + - `const BetaManagedAgentsSessionStatusIdleEventTypeSessionStatusIdle BetaManagedAgentsSessionStatusIdleEventType = "session.status_idle"` + +### Beta Managed Agents Session Status Rescheduled Event + +- `type BetaManagedAgentsSessionStatusRescheduledEvent struct{…}` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRescheduledEventType` + + - `const BetaManagedAgentsSessionStatusRescheduledEventTypeSessionStatusRescheduled BetaManagedAgentsSessionStatusRescheduledEventType = "session.status_rescheduled"` + +### Beta Managed Agents Session Status Running Event + +- `type BetaManagedAgentsSessionStatusRunningEvent struct{…}` + + Indicates the session is actively running and the agent is working. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRunningEventType` + + - `const BetaManagedAgentsSessionStatusRunningEventTypeSessionStatusRunning BetaManagedAgentsSessionStatusRunningEventType = "session.status_running"` + +### Beta Managed Agents Session Status Terminated Event + +- `type BetaManagedAgentsSessionStatusTerminatedEvent struct{…}` + + Indicates the session has terminated, either due to an error or completion. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusTerminatedEventType` + + - `const BetaManagedAgentsSessionStatusTerminatedEventTypeSessionStatusTerminated BetaManagedAgentsSessionStatusTerminatedEventType = "session.status_terminated"` + +### Beta Managed Agents Span Model Request End Event + +- `type BetaManagedAgentsSpanModelRequestEndEvent struct{…}` + + Emitted when a model request completes. + + - `ID string` + + Unique identifier for this event. + + - `IsError bool` + + Whether the model request resulted in an error. + + - `ModelRequestStartID string` + + The id of the corresponding `span.model_request_start` event. + + - `ModelUsage BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `CacheCreationInputTokens int64` + + Tokens used to create prompt cache in this request. + + - `CacheReadInputTokens int64` + + Tokens read from prompt cache in this request. + + - `InputTokens int64` + + Input tokens consumed by this request. + + - `OutputTokens int64` + + Output tokens generated by this request. + + - `Speed BetaManagedAgentsSpanModelUsageSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsSpanModelUsageSpeedStandard BetaManagedAgentsSpanModelUsageSpeed = "standard"` + + - `const BetaManagedAgentsSpanModelUsageSpeedFast BetaManagedAgentsSpanModelUsageSpeed = "fast"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestEndEventType` + + - `const BetaManagedAgentsSpanModelRequestEndEventTypeSpanModelRequestEnd BetaManagedAgentsSpanModelRequestEndEventType = "span.model_request_end"` + +### Beta Managed Agents Span Model Request Start Event + +- `type BetaManagedAgentsSpanModelRequestStartEvent struct{…}` + + Emitted when a model request is initiated by the agent. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestStartEventType` + + - `const BetaManagedAgentsSpanModelRequestStartEventTypeSpanModelRequestStart BetaManagedAgentsSpanModelRequestStartEventType = "span.model_request_start"` + +### Beta Managed Agents Span Model Usage + +- `type BetaManagedAgentsSpanModelUsage struct{…}` + + Token usage for a single model request. + + - `CacheCreationInputTokens int64` + + Tokens used to create prompt cache in this request. + + - `CacheReadInputTokens int64` + + Tokens read from prompt cache in this request. + + - `InputTokens int64` + + Input tokens consumed by this request. + + - `OutputTokens int64` + + Output tokens generated by this request. + + - `Speed BetaManagedAgentsSpanModelUsageSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsSpanModelUsageSpeedStandard BetaManagedAgentsSpanModelUsageSpeed = "standard"` + + - `const BetaManagedAgentsSpanModelUsageSpeedFast BetaManagedAgentsSpanModelUsageSpeed = "fast"` + +### Beta Managed Agents Stream Session Events + +- `type BetaManagedAgentsStreamSessionEventsUnion interface{…}` + + Server-sent event in the session stream. + + - `type BetaManagedAgentsUserMessageEvent struct{…}` + + A user message event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsUserMessageEventContentUnion` + + Array of content blocks comprising the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventType` + + - `const BetaManagedAgentsUserMessageEventTypeUserMessage BetaManagedAgentsUserMessageEventType = "user.message"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserInterruptEvent struct{…}` + + An interrupt event that pauses agent execution and returns control to the user. + + - `ID string` + + Unique identifier for this event. + + - `Type BetaManagedAgentsUserInterruptEventType` + + - `const BetaManagedAgentsUserInterruptEventTypeUserInterrupt BetaManagedAgentsUserInterruptEventType = "user.interrupt"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserToolConfirmationEvent struct{…}` + + A tool confirmation event that approves or denies a pending tool execution. + + - `ID string` + + Unique identifier for this event. + + - `Result BetaManagedAgentsUserToolConfirmationEventResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventResultAllow BetaManagedAgentsUserToolConfirmationEventResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventResultDeny BetaManagedAgentsUserToolConfirmationEventResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventType` + + - `const BetaManagedAgentsUserToolConfirmationEventTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserCustomToolResultEvent struct{…}` + + Event sent by the client providing the result of a custom tool execution. + + - `ID string` + + Unique identifier for this event. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventType` + + - `const BetaManagedAgentsUserCustomToolResultEventTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsAgentCustomToolUseEvent struct{…}` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the custom tool being called. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentCustomToolUseEventType` + + - `const BetaManagedAgentsAgentCustomToolUseEventTypeAgentCustomToolUse BetaManagedAgentsAgentCustomToolUseEventType = "agent.custom_tool_use"` + + - `type BetaManagedAgentsAgentMessageEvent struct{…}` + + An agent response event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMessageEventType` + + - `const BetaManagedAgentsAgentMessageEventTypeAgentMessage BetaManagedAgentsAgentMessageEventType = "agent.message"` + + - `type BetaManagedAgentsAgentThinkingEvent struct{…}` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThinkingEventType` + + - `const BetaManagedAgentsAgentThinkingEventTypeAgentThinking BetaManagedAgentsAgentThinkingEventType = "agent.thinking"` + + - `type BetaManagedAgentsAgentMCPToolUseEvent struct{…}` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `MCPServerName string` + + Name of the MCP server providing the tool. + + - `Name string` + + Name of the MCP tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolUseEventType` + + - `const BetaManagedAgentsAgentMCPToolUseEventTypeAgentMCPToolUse BetaManagedAgentsAgentMCPToolUseEventType = "agent.mcp_tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "deny"` + + - `type BetaManagedAgentsAgentMCPToolResultEvent struct{…}` + + Event representing the result of an MCP tool execution. + + - `ID string` + + Unique identifier for this event. + + - `MCPToolUseID string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolResultEventType` + + - `const BetaManagedAgentsAgentMCPToolResultEventTypeAgentMCPToolResult BetaManagedAgentsAgentMCPToolResultEventType = "agent.mcp_tool_result"` + + - `Content []BetaManagedAgentsAgentMCPToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `type BetaManagedAgentsAgentToolUseEvent struct{…}` + + Event emitted when the agent invokes a built-in agent tool. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the agent tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentToolUseEventType` + + - `const BetaManagedAgentsAgentToolUseEventTypeAgentToolUse BetaManagedAgentsAgentToolUseEventType = "agent.tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "deny"` + + - `type BetaManagedAgentsAgentToolResultEvent struct{…}` + + Event representing the result of an agent tool execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `ToolUseID string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `Type BetaManagedAgentsAgentToolResultEventType` + + - `const BetaManagedAgentsAgentToolResultEventTypeAgentToolResult BetaManagedAgentsAgentToolResultEventType = "agent.tool_result"` + + - `Content []BetaManagedAgentsAgentToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `type BetaManagedAgentsAgentThreadContextCompactedEvent struct{…}` + + Indicates that context compaction (summarization) occurred during the session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThreadContextCompactedEventType` + + - `const BetaManagedAgentsAgentThreadContextCompactedEventTypeAgentThreadContextCompacted BetaManagedAgentsAgentThreadContextCompactedEventType = "agent.thread_context_compacted"` + + - `type BetaManagedAgentsSessionErrorEvent struct{…}` + + An error event indicating a problem occurred during session execution. + + - `ID string` + + Unique identifier for this event. + + - `Error BetaManagedAgentsSessionErrorEventErrorUnion` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `type BetaManagedAgentsUnknownError struct{…}` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsUnknownErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsUnknownErrorType` + + - `const BetaManagedAgentsUnknownErrorTypeUnknownError BetaManagedAgentsUnknownErrorType = "unknown_error"` + + - `type BetaManagedAgentsModelOverloadedError struct{…}` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelOverloadedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelOverloadedErrorType` + + - `const BetaManagedAgentsModelOverloadedErrorTypeModelOverloadedError BetaManagedAgentsModelOverloadedErrorType = "model_overloaded_error"` + + - `type BetaManagedAgentsModelRateLimitedError struct{…}` + + The model request was rate-limited. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRateLimitedErrorType` + + - `const BetaManagedAgentsModelRateLimitedErrorTypeModelRateLimitedError BetaManagedAgentsModelRateLimitedErrorType = "model_rate_limited_error"` + + - `type BetaManagedAgentsModelRequestFailedError struct{…}` + + A model request failed for a reason other than overload or rate-limiting. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRequestFailedErrorType` + + - `const BetaManagedAgentsModelRequestFailedErrorTypeModelRequestFailedError BetaManagedAgentsModelRequestFailedErrorType = "model_request_failed_error"` + + - `type BetaManagedAgentsMCPConnectionFailedError struct{…}` + + Failed to connect to an MCP server. + + - `MCPServerName string` + + Name of the MCP server that failed to connect. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPConnectionFailedErrorType` + + - `const BetaManagedAgentsMCPConnectionFailedErrorTypeMCPConnectionFailedError BetaManagedAgentsMCPConnectionFailedErrorType = "mcp_connection_failed_error"` + + - `type BetaManagedAgentsMCPAuthenticationFailedError struct{…}` + + Authentication to an MCP server failed. + + - `MCPServerName string` + + Name of the MCP server that failed authentication. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPAuthenticationFailedErrorType` + + - `const BetaManagedAgentsMCPAuthenticationFailedErrorTypeMCPAuthenticationFailedError BetaManagedAgentsMCPAuthenticationFailedErrorType = "mcp_authentication_failed_error"` + + - `type BetaManagedAgentsBillingError struct{…}` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsBillingErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsBillingErrorType` + + - `const BetaManagedAgentsBillingErrorTypeBillingError BetaManagedAgentsBillingErrorType = "billing_error"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionErrorEventType` + + - `const BetaManagedAgentsSessionErrorEventTypeSessionError BetaManagedAgentsSessionErrorEventType = "session.error"` + + - `type BetaManagedAgentsSessionStatusRescheduledEvent struct{…}` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRescheduledEventType` + + - `const BetaManagedAgentsSessionStatusRescheduledEventTypeSessionStatusRescheduled BetaManagedAgentsSessionStatusRescheduledEventType = "session.status_rescheduled"` + + - `type BetaManagedAgentsSessionStatusRunningEvent struct{…}` + + Indicates the session is actively running and the agent is working. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRunningEventType` + + - `const BetaManagedAgentsSessionStatusRunningEventTypeSessionStatusRunning BetaManagedAgentsSessionStatusRunningEventType = "session.status_running"` + + - `type BetaManagedAgentsSessionStatusIdleEvent struct{…}` + + Indicates the agent has paused and is awaiting user input. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `StopReason BetaManagedAgentsSessionStatusIdleEventStopReasonUnion` + + The agent completed its turn naturally and is ready for the next user message. + + - `type BetaManagedAgentsSessionEndTurn struct{…}` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type BetaManagedAgentsSessionEndTurnType` + + - `const BetaManagedAgentsSessionEndTurnTypeEndTurn BetaManagedAgentsSessionEndTurnType = "end_turn"` + + - `type BetaManagedAgentsSessionRequiresAction struct{…}` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `EventIDs []string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type BetaManagedAgentsSessionRequiresActionType` + + - `const BetaManagedAgentsSessionRequiresActionTypeRequiresAction BetaManagedAgentsSessionRequiresActionType = "requires_action"` + + - `type BetaManagedAgentsSessionRetriesExhausted struct{…}` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type BetaManagedAgentsSessionRetriesExhaustedType` + + - `const BetaManagedAgentsSessionRetriesExhaustedTypeRetriesExhausted BetaManagedAgentsSessionRetriesExhaustedType = "retries_exhausted"` + + - `Type BetaManagedAgentsSessionStatusIdleEventType` + + - `const BetaManagedAgentsSessionStatusIdleEventTypeSessionStatusIdle BetaManagedAgentsSessionStatusIdleEventType = "session.status_idle"` + + - `type BetaManagedAgentsSessionStatusTerminatedEvent struct{…}` + + Indicates the session has terminated, either due to an error or completion. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusTerminatedEventType` + + - `const BetaManagedAgentsSessionStatusTerminatedEventTypeSessionStatusTerminated BetaManagedAgentsSessionStatusTerminatedEventType = "session.status_terminated"` + + - `type BetaManagedAgentsSpanModelRequestStartEvent struct{…}` + + Emitted when a model request is initiated by the agent. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestStartEventType` + + - `const BetaManagedAgentsSpanModelRequestStartEventTypeSpanModelRequestStart BetaManagedAgentsSpanModelRequestStartEventType = "span.model_request_start"` + + - `type BetaManagedAgentsSpanModelRequestEndEvent struct{…}` + + Emitted when a model request completes. + + - `ID string` + + Unique identifier for this event. + + - `IsError bool` + + Whether the model request resulted in an error. + + - `ModelRequestStartID string` + + The id of the corresponding `span.model_request_start` event. + + - `ModelUsage BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `CacheCreationInputTokens int64` + + Tokens used to create prompt cache in this request. + + - `CacheReadInputTokens int64` + + Tokens read from prompt cache in this request. + + - `InputTokens int64` + + Input tokens consumed by this request. + + - `OutputTokens int64` + + Output tokens generated by this request. + + - `Speed BetaManagedAgentsSpanModelUsageSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsSpanModelUsageSpeedStandard BetaManagedAgentsSpanModelUsageSpeed = "standard"` + + - `const BetaManagedAgentsSpanModelUsageSpeedFast BetaManagedAgentsSpanModelUsageSpeed = "fast"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestEndEventType` + + - `const BetaManagedAgentsSpanModelRequestEndEventTypeSpanModelRequestEnd BetaManagedAgentsSpanModelRequestEndEventType = "span.model_request_end"` + + - `type BetaManagedAgentsSessionDeletedEvent struct{…}` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionDeletedEventType` + + - `const BetaManagedAgentsSessionDeletedEventTypeSessionDeleted BetaManagedAgentsSessionDeletedEventType = "session.deleted"` + +### Beta Managed Agents Text Block + +- `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + +### Beta Managed Agents Unknown Error + +- `type BetaManagedAgentsUnknownError struct{…}` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsUnknownErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsUnknownErrorType` + + - `const BetaManagedAgentsUnknownErrorTypeUnknownError BetaManagedAgentsUnknownErrorType = "unknown_error"` + +### Beta Managed Agents URL Document Source + +- `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + +### Beta Managed Agents URL Image Source + +- `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + +### Beta Managed Agents User Custom Tool Result Event + +- `type BetaManagedAgentsUserCustomToolResultEvent struct{…}` + + Event sent by the client providing the result of a custom tool execution. + + - `ID string` + + Unique identifier for this event. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventType` + + - `const BetaManagedAgentsUserCustomToolResultEventTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Custom Tool Result Event Params + +- `type BetaManagedAgentsUserCustomToolResultEventParamsResp struct{…}` + + Parameters for providing the result of a custom tool execution. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventParamsType` + + - `const BetaManagedAgentsUserCustomToolResultEventParamsTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventParamsType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventParamsContentUnionResp` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents User Interrupt Event + +- `type BetaManagedAgentsUserInterruptEvent struct{…}` + + An interrupt event that pauses agent execution and returns control to the user. + + - `ID string` + + Unique identifier for this event. + + - `Type BetaManagedAgentsUserInterruptEventType` + + - `const BetaManagedAgentsUserInterruptEventTypeUserInterrupt BetaManagedAgentsUserInterruptEventType = "user.interrupt"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Interrupt Event Params + +- `type BetaManagedAgentsUserInterruptEventParamsResp struct{…}` + + Parameters for sending an interrupt to pause the agent. + + - `Type BetaManagedAgentsUserInterruptEventParamsType` + + - `const BetaManagedAgentsUserInterruptEventParamsTypeUserInterrupt BetaManagedAgentsUserInterruptEventParamsType = "user.interrupt"` + +### Beta Managed Agents User Message Event + +- `type BetaManagedAgentsUserMessageEvent struct{…}` + + A user message event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsUserMessageEventContentUnion` + + Array of content blocks comprising the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventType` + + - `const BetaManagedAgentsUserMessageEventTypeUserMessage BetaManagedAgentsUserMessageEventType = "user.message"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Message Event Params + +- `type BetaManagedAgentsUserMessageEventParamsResp struct{…}` + + Parameters for sending a user message to the session. + + - `Content []BetaManagedAgentsUserMessageEventParamsContentUnionResp` + + Array of content blocks for the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventParamsType` + + - `const BetaManagedAgentsUserMessageEventParamsTypeUserMessage BetaManagedAgentsUserMessageEventParamsType = "user.message"` + +### Beta Managed Agents User Tool Confirmation Event + +- `type BetaManagedAgentsUserToolConfirmationEvent struct{…}` + + A tool confirmation event that approves or denies a pending tool execution. + + - `ID string` + + Unique identifier for this event. + + - `Result BetaManagedAgentsUserToolConfirmationEventResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventResultAllow BetaManagedAgentsUserToolConfirmationEventResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventResultDeny BetaManagedAgentsUserToolConfirmationEventResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventType` + + - `const BetaManagedAgentsUserToolConfirmationEventTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Tool Confirmation Event Params + +- `type BetaManagedAgentsUserToolConfirmationEventParamsResp struct{…}` + + Parameters for confirming or denying a tool execution request. + + - `Result BetaManagedAgentsUserToolConfirmationEventParamsResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventParamsResultAllow BetaManagedAgentsUserToolConfirmationEventParamsResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventParamsResultDeny BetaManagedAgentsUserToolConfirmationEventParamsResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventParamsType` + + - `const BetaManagedAgentsUserToolConfirmationEventParamsTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventParamsType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + +# Resources + +## Add + +`client.Beta.Sessions.Resources.Add(ctx, sessionID, params) (*BetaManagedAgentsFileResource, error)` + +**post** `/v1/sessions/{session_id}/resources` + +Add Session Resource + +### Parameters + +- `sessionID string` + +- `params BetaSessionResourceAddParams` + + - `BetaManagedAgentsFileResourceParams param.Field[BetaManagedAgentsFileResourceParamsResp]` + + Body param: Mount a file uploaded via the Files API into the session. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsFileResource, err := client.Beta.Sessions.Resources.Add( + context.TODO(), + "sesn_011CZkZAtmR3yMPDzynEDxu7", + anthropic.BetaSessionResourceAddParams{ + BetaManagedAgentsFileResourceParams: anthropic.BetaManagedAgentsFileResourceParams{ + FileID: "file_011CNha8iCJcU1wXNR6q4V8w", + Type: anthropic.BetaManagedAgentsFileResourceParamsTypeFile, + }, + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsFileResource.ID) +} +``` + +## List + +`client.Beta.Sessions.Resources.List(ctx, sessionID, params) (*PageCursor[BetaManagedAgentsSessionResourceUnion], error)` + +**get** `/v1/sessions/{session_id}/resources` + +List Session Resources + +### Parameters + +- `sessionID string` + +- `params BetaSessionResourceListParams` + + - `Limit param.Field[int64]` + + Query param: Maximum number of resources to return per page (max 1000). If omitted, returns all resources. + + - `Page param.Field[string]` + + Query param: Opaque cursor from a previous response's next_page field. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsSessionResourceUnion interface{…}` + + - `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Beta.Sessions.Resources.List( + context.TODO(), + "sesn_011CZkZAtmR3yMPDzynEDxu7", + anthropic.BetaSessionResourceListParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", page) +} +``` + +## Retrieve + +`client.Beta.Sessions.Resources.Get(ctx, resourceID, params) (*BetaSessionResourceGetResponseUnion, error)` + +**get** `/v1/sessions/{session_id}/resources/{resource_id}` + +Get Session Resource + +### Parameters + +- `resourceID string` + +- `params BetaSessionResourceGetParams` + + - `SessionID param.Field[string]` + + Path param: Path parameter session_id + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaSessionResourceGetResponseUnion interface{…}` + + The requested session resource. + + - `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + resource, err := client.Beta.Sessions.Resources.Get( + context.TODO(), + "sesrsc_011CZkZBJq5dWxk9fVLNcPht", + anthropic.BetaSessionResourceGetParams{ + SessionID: "sesn_011CZkZAtmR3yMPDzynEDxu7", + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", resource) +} +``` + +## Update + +`client.Beta.Sessions.Resources.Update(ctx, resourceID, params) (*BetaSessionResourceUpdateResponseUnion, error)` + +**post** `/v1/sessions/{session_id}/resources/{resource_id}` + +Update Session Resource + +### Parameters + +- `resourceID string` + +- `params BetaSessionResourceUpdateParams` + + - `SessionID param.Field[string]` + + Path param: Path parameter session_id + + - `AuthorizationToken param.Field[string]` + + Body param: New authorization token for the resource. Currently only `github_repository` resources support token rotation. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaSessionResourceUpdateResponseUnion interface{…}` + + The updated session resource. + + - `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + resource, err := client.Beta.Sessions.Resources.Update( + context.TODO(), + "sesrsc_011CZkZBJq5dWxk9fVLNcPht", + anthropic.BetaSessionResourceUpdateParams{ + SessionID: "sesn_011CZkZAtmR3yMPDzynEDxu7", + AuthorizationToken: "ghp_exampletoken", + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", resource) +} +``` + +## Delete + +`client.Beta.Sessions.Resources.Delete(ctx, resourceID, params) (*BetaManagedAgentsDeleteSessionResource, error)` + +**delete** `/v1/sessions/{session_id}/resources/{resource_id}` + +Delete Session Resource + +### Parameters + +- `resourceID string` + +- `params BetaSessionResourceDeleteParams` + + - `SessionID param.Field[string]` + + Path param: Path parameter session_id + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsDeleteSessionResource struct{…}` + + Confirmation of resource deletion. + + - `ID string` + + - `Type BetaManagedAgentsDeleteSessionResourceType` + + - `const BetaManagedAgentsDeleteSessionResourceTypeSessionResourceDeleted BetaManagedAgentsDeleteSessionResourceType = "session_resource_deleted"` + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsDeleteSessionResource, err := client.Beta.Sessions.Resources.Delete( + context.TODO(), + "sesrsc_011CZkZBJq5dWxk9fVLNcPht", + anthropic.BetaSessionResourceDeleteParams{ + SessionID: "sesn_011CZkZAtmR3yMPDzynEDxu7", + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsDeleteSessionResource.ID) +} +``` + +## Domain Types + +### Beta Managed Agents Delete Session Resource + +- `type BetaManagedAgentsDeleteSessionResource struct{…}` + + Confirmation of resource deletion. + + - `ID string` + + - `Type BetaManagedAgentsDeleteSessionResourceType` + + - `const BetaManagedAgentsDeleteSessionResourceTypeSessionResourceDeleted BetaManagedAgentsDeleteSessionResourceType = "session_resource_deleted"` + +### Beta Managed Agents File Resource + +- `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents GitHub Repository Resource + +- `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + +### Beta Managed Agents Session Resource + +- `type BetaManagedAgentsSessionResourceUnion interface{…}` + + - `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +# Vaults + +## Create + +`client.Beta.Vaults.New(ctx, params) (*BetaManagedAgentsVault, error)` + +**post** `/v1/vaults` + +Create Vault + +### Parameters + +- `params BetaVaultNewParams` + + - `DisplayName param.Field[string]` + + Body param: Human-readable name for the vault. 1-255 characters. + + - `Metadata param.Field[map[string, string]]` + + Body param: Arbitrary key-value metadata to attach to the vault. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsVault struct{…}` + + A vault that stores credentials for use by agents during sessions. + + - `ID string` + + Unique identifier for the vault. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `DisplayName string` + + Human-readable name for the vault. + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the vault. + + - `Type BetaManagedAgentsVaultType` + + - `const BetaManagedAgentsVaultTypeVault BetaManagedAgentsVaultType = "vault"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsVault, err := client.Beta.Vaults.New(context.TODO(), anthropic.BetaVaultNewParams{ + DisplayName: "Example vault", + }) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsVault.ID) +} +``` + +## List + +`client.Beta.Vaults.List(ctx, params) (*PageCursor[BetaManagedAgentsVault], error)` + +**get** `/v1/vaults` + +List Vaults + +### Parameters + +- `params BetaVaultListParams` + + - `IncludeArchived param.Field[bool]` + + Query param: Whether to include archived vaults in the results. + + - `Limit param.Field[int64]` + + Query param: Maximum number of vaults to return per page. Defaults to 20, maximum 100. + + - `Page param.Field[string]` + + Query param: Opaque pagination token from a previous `list_vaults` response. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsVault struct{…}` + + A vault that stores credentials for use by agents during sessions. + + - `ID string` + + Unique identifier for the vault. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `DisplayName string` + + Human-readable name for the vault. + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the vault. + + - `Type BetaManagedAgentsVaultType` + + - `const BetaManagedAgentsVaultTypeVault BetaManagedAgentsVaultType = "vault"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Beta.Vaults.List(context.TODO(), anthropic.BetaVaultListParams{ + + }) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", page) +} +``` + +## Retrieve + +`client.Beta.Vaults.Get(ctx, vaultID, query) (*BetaManagedAgentsVault, error)` + +**get** `/v1/vaults/{vault_id}` + +Get Vault + +### Parameters + +- `vaultID string` + +- `query BetaVaultGetParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsVault struct{…}` + + A vault that stores credentials for use by agents during sessions. + + - `ID string` + + Unique identifier for the vault. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `DisplayName string` + + Human-readable name for the vault. + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the vault. + + - `Type BetaManagedAgentsVaultType` + + - `const BetaManagedAgentsVaultTypeVault BetaManagedAgentsVaultType = "vault"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsVault, err := client.Beta.Vaults.Get( + context.TODO(), + "vlt_011CZkZDLs7fYzm1hXNPeRjv", + anthropic.BetaVaultGetParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsVault.ID) +} +``` + +## Update + +`client.Beta.Vaults.Update(ctx, vaultID, params) (*BetaManagedAgentsVault, error)` + +**post** `/v1/vaults/{vault_id}` + +Update Vault + +### Parameters + +- `vaultID string` + +- `params BetaVaultUpdateParams` + + - `DisplayName param.Field[string]` + + Body param: Updated human-readable name for the vault. 1-255 characters. + + - `Metadata param.Field[map[string, string]]` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsVault struct{…}` + + A vault that stores credentials for use by agents during sessions. + + - `ID string` + + Unique identifier for the vault. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `DisplayName string` + + Human-readable name for the vault. + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the vault. + + - `Type BetaManagedAgentsVaultType` + + - `const BetaManagedAgentsVaultTypeVault BetaManagedAgentsVaultType = "vault"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsVault, err := client.Beta.Vaults.Update( + context.TODO(), + "vlt_011CZkZDLs7fYzm1hXNPeRjv", + anthropic.BetaVaultUpdateParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsVault.ID) +} +``` + +## Delete + +`client.Beta.Vaults.Delete(ctx, vaultID, body) (*BetaManagedAgentsDeletedVault, error)` + +**delete** `/v1/vaults/{vault_id}` + +Delete Vault + +### Parameters + +- `vaultID string` + +- `body BetaVaultDeleteParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsDeletedVault struct{…}` + + Confirmation of a deleted vault. + + - `ID string` + + Unique identifier of the deleted vault. + + - `Type BetaManagedAgentsDeletedVaultType` + + - `const BetaManagedAgentsDeletedVaultTypeVaultDeleted BetaManagedAgentsDeletedVaultType = "vault_deleted"` + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsDeletedVault, err := client.Beta.Vaults.Delete( + context.TODO(), + "vlt_011CZkZDLs7fYzm1hXNPeRjv", + anthropic.BetaVaultDeleteParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsDeletedVault.ID) +} +``` + +## Archive + +`client.Beta.Vaults.Archive(ctx, vaultID, body) (*BetaManagedAgentsVault, error)` + +**post** `/v1/vaults/{vault_id}/archive` + +Archive Vault + +### Parameters + +- `vaultID string` + +- `body BetaVaultArchiveParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsVault struct{…}` + + A vault that stores credentials for use by agents during sessions. + + - `ID string` + + Unique identifier for the vault. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `DisplayName string` + + Human-readable name for the vault. + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the vault. + + - `Type BetaManagedAgentsVaultType` + + - `const BetaManagedAgentsVaultTypeVault BetaManagedAgentsVaultType = "vault"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsVault, err := client.Beta.Vaults.Archive( + context.TODO(), + "vlt_011CZkZDLs7fYzm1hXNPeRjv", + anthropic.BetaVaultArchiveParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsVault.ID) +} +``` + +## Domain Types + +### Beta Managed Agents Deleted Vault + +- `type BetaManagedAgentsDeletedVault struct{…}` + + Confirmation of a deleted vault. + + - `ID string` + + Unique identifier of the deleted vault. + + - `Type BetaManagedAgentsDeletedVaultType` + + - `const BetaManagedAgentsDeletedVaultTypeVaultDeleted BetaManagedAgentsDeletedVaultType = "vault_deleted"` + +### Beta Managed Agents Vault + +- `type BetaManagedAgentsVault struct{…}` + + A vault that stores credentials for use by agents during sessions. + + - `ID string` + + Unique identifier for the vault. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `DisplayName string` + + Human-readable name for the vault. + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the vault. + + - `Type BetaManagedAgentsVaultType` + + - `const BetaManagedAgentsVaultTypeVault BetaManagedAgentsVaultType = "vault"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +# Credentials + +## Create + +`client.Beta.Vaults.Credentials.New(ctx, vaultID, params) (*BetaManagedAgentsCredential, error)` + +**post** `/v1/vaults/{vault_id}/credentials` + +Create Credential + +### Parameters + +- `vaultID string` + +- `params BetaVaultCredentialNewParams` + + - `Auth param.Field[BetaVaultCredentialNewParamsAuthUnion]` + + Body param: Authentication details for creating a credential. + + - `type BetaManagedAgentsMCPOAuthCreateParamsResp struct{…}` + + Parameters for creating an MCP OAuth credential. + + - `AccessToken string` + + OAuth access token. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsMCPOAuthCreateParamsType` + + - `const BetaManagedAgentsMCPOAuthCreateParamsTypeMCPOAuth BetaManagedAgentsMCPOAuthCreateParamsType = "mcp_oauth"` + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshParamsResp` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `ClientID string` + + OAuth client ID. + + - `RefreshToken string` + + OAuth refresh token. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshParamsTokenEndpointAuthUnionResp` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneParamResp struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneParamType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneParamTypeNone BetaManagedAgentsTokenEndpointAuthNoneParamType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicParamResp struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `ClientSecret string` + + OAuth client secret. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicParamType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicParamTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicParamType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostParamResp struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `ClientSecret string` + + OAuth client secret. + + - `Type BetaManagedAgentsTokenEndpointAuthPostParamType` + + - `const BetaManagedAgentsTokenEndpointAuthPostParamTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostParamType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + + - `type BetaManagedAgentsStaticBearerCreateParamsResp struct{…}` + + Parameters for creating a static bearer token credential. + + - `Token string` + + Static bearer token value. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsStaticBearerCreateParamsType` + + - `const BetaManagedAgentsStaticBearerCreateParamsTypeStaticBearer BetaManagedAgentsStaticBearerCreateParamsType = "static_bearer"` + + - `DisplayName param.Field[string]` + + Body param: Human-readable name for the credential. Up to 255 characters. + + - `Metadata param.Field[map[string, string]]` + + Body param: Arbitrary key-value metadata to attach to the credential. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsCredential struct{…}` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `ID string` + + Unique identifier for the credential. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `Auth BetaManagedAgentsCredentialAuthUnion` + + Authentication details for a credential. + + - `type BetaManagedAgentsMCPOAuthAuthResponse struct{…}` + + OAuth credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsMCPOAuthAuthResponseType` + + - `const BetaManagedAgentsMCPOAuthAuthResponseTypeMCPOAuth BetaManagedAgentsMCPOAuthAuthResponseType = "mcp_oauth"` + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `ClientID string` + + OAuth client ID. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneResponse struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneResponseTypeNone BetaManagedAgentsTokenEndpointAuthNoneResponseType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicResponse struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicResponseTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicResponseType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostResponse struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthPostResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthPostResponseTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostResponseType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + + - `type BetaManagedAgentsStaticBearerAuthResponse struct{…}` + + Static bearer token credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsStaticBearerAuthResponseType` + + - `const BetaManagedAgentsStaticBearerAuthResponseTypeStaticBearer BetaManagedAgentsStaticBearerAuthResponseType = "static_bearer"` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the credential. + + - `Type BetaManagedAgentsCredentialType` + + - `const BetaManagedAgentsCredentialTypeVaultCredential BetaManagedAgentsCredentialType = "vault_credential"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `VaultID string` + + Identifier of the vault this credential belongs to. + + - `DisplayName string` + + Human-readable name for the credential. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsCredential, err := client.Beta.Vaults.Credentials.New( + context.TODO(), + "vlt_011CZkZDLs7fYzm1hXNPeRjv", + anthropic.BetaVaultCredentialNewParams{ + Auth: anthropic.BetaVaultCredentialNewParamsAuthUnion{ + OfStaticBearer: &anthropic.BetaManagedAgentsStaticBearerCreateParams{ + Token: "bearer_exampletoken", + MCPServerURL: "https://example-server.modelcontextprotocol.io/sse", + Type: anthropic.BetaManagedAgentsStaticBearerCreateParamsTypeStaticBearer, + }, + }, + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsCredential.ID) +} +``` + +## List + +`client.Beta.Vaults.Credentials.List(ctx, vaultID, params) (*PageCursor[BetaManagedAgentsCredential], error)` + +**get** `/v1/vaults/{vault_id}/credentials` + +List Credentials + +### Parameters + +- `vaultID string` + +- `params BetaVaultCredentialListParams` + + - `IncludeArchived param.Field[bool]` + + Query param: Whether to include archived credentials in the results. + + - `Limit param.Field[int64]` + + Query param: Maximum number of credentials to return per page. Defaults to 20, maximum 100. + + - `Page param.Field[string]` + + Query param: Opaque pagination token from a previous `list_credentials` response. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsCredential struct{…}` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `ID string` + + Unique identifier for the credential. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `Auth BetaManagedAgentsCredentialAuthUnion` + + Authentication details for a credential. + + - `type BetaManagedAgentsMCPOAuthAuthResponse struct{…}` + + OAuth credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsMCPOAuthAuthResponseType` + + - `const BetaManagedAgentsMCPOAuthAuthResponseTypeMCPOAuth BetaManagedAgentsMCPOAuthAuthResponseType = "mcp_oauth"` + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `ClientID string` + + OAuth client ID. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneResponse struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneResponseTypeNone BetaManagedAgentsTokenEndpointAuthNoneResponseType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicResponse struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicResponseTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicResponseType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostResponse struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthPostResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthPostResponseTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostResponseType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + + - `type BetaManagedAgentsStaticBearerAuthResponse struct{…}` + + Static bearer token credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsStaticBearerAuthResponseType` + + - `const BetaManagedAgentsStaticBearerAuthResponseTypeStaticBearer BetaManagedAgentsStaticBearerAuthResponseType = "static_bearer"` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the credential. + + - `Type BetaManagedAgentsCredentialType` + + - `const BetaManagedAgentsCredentialTypeVaultCredential BetaManagedAgentsCredentialType = "vault_credential"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `VaultID string` + + Identifier of the vault this credential belongs to. + + - `DisplayName string` + + Human-readable name for the credential. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Beta.Vaults.Credentials.List( + context.TODO(), + "vlt_011CZkZDLs7fYzm1hXNPeRjv", + anthropic.BetaVaultCredentialListParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", page) +} +``` + +## Retrieve + +`client.Beta.Vaults.Credentials.Get(ctx, credentialID, params) (*BetaManagedAgentsCredential, error)` + +**get** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Get Credential + +### Parameters + +- `credentialID string` + +- `params BetaVaultCredentialGetParams` + + - `VaultID param.Field[string]` + + Path param: Path parameter vault_id + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsCredential struct{…}` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `ID string` + + Unique identifier for the credential. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `Auth BetaManagedAgentsCredentialAuthUnion` + + Authentication details for a credential. + + - `type BetaManagedAgentsMCPOAuthAuthResponse struct{…}` + + OAuth credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsMCPOAuthAuthResponseType` + + - `const BetaManagedAgentsMCPOAuthAuthResponseTypeMCPOAuth BetaManagedAgentsMCPOAuthAuthResponseType = "mcp_oauth"` + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `ClientID string` + + OAuth client ID. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneResponse struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneResponseTypeNone BetaManagedAgentsTokenEndpointAuthNoneResponseType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicResponse struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicResponseTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicResponseType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostResponse struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthPostResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthPostResponseTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostResponseType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + + - `type BetaManagedAgentsStaticBearerAuthResponse struct{…}` + + Static bearer token credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsStaticBearerAuthResponseType` + + - `const BetaManagedAgentsStaticBearerAuthResponseTypeStaticBearer BetaManagedAgentsStaticBearerAuthResponseType = "static_bearer"` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the credential. + + - `Type BetaManagedAgentsCredentialType` + + - `const BetaManagedAgentsCredentialTypeVaultCredential BetaManagedAgentsCredentialType = "vault_credential"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `VaultID string` + + Identifier of the vault this credential belongs to. + + - `DisplayName string` + + Human-readable name for the credential. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsCredential, err := client.Beta.Vaults.Credentials.Get( + context.TODO(), + "vcrd_011CZkZEMt8gZan2iYOQfSkw", + anthropic.BetaVaultCredentialGetParams{ + VaultID: "vlt_011CZkZDLs7fYzm1hXNPeRjv", + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsCredential.ID) +} +``` + +## Update + +`client.Beta.Vaults.Credentials.Update(ctx, credentialID, params) (*BetaManagedAgentsCredential, error)` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Update Credential + +### Parameters + +- `credentialID string` + +- `params BetaVaultCredentialUpdateParams` + + - `VaultID param.Field[string]` + + Path param: Path parameter vault_id + + - `Auth param.Field[BetaVaultCredentialUpdateParamsAuthUnion]` + + Body param: Updated authentication details for a credential. + + - `type BetaManagedAgentsMCPOAuthUpdateParamsResp struct{…}` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `Type BetaManagedAgentsMCPOAuthUpdateParamsType` + + - `const BetaManagedAgentsMCPOAuthUpdateParamsTypeMCPOAuth BetaManagedAgentsMCPOAuthUpdateParamsType = "mcp_oauth"` + + - `AccessToken string` + + Updated OAuth access token. + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshUpdateParamsResp` + + Parameters for updating OAuth refresh token configuration. + + - `RefreshToken string` + + Updated OAuth refresh token. + + - `Scope string` + + Updated OAuth scope for the refresh request. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshUpdateParamsTokenEndpointAuthUnionResp` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type BetaManagedAgentsTokenEndpointAuthBasicUpdateParamResp struct{…}` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicUpdateParamType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicUpdateParamTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicUpdateParamType = "client_secret_basic"` + + - `ClientSecret string` + + Updated OAuth client secret. + + - `type BetaManagedAgentsTokenEndpointAuthPostUpdateParamResp struct{…}` + + Updated POST body authentication parameters for the token endpoint. + + - `Type BetaManagedAgentsTokenEndpointAuthPostUpdateParamType` + + - `const BetaManagedAgentsTokenEndpointAuthPostUpdateParamTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostUpdateParamType = "client_secret_post"` + + - `ClientSecret string` + + Updated OAuth client secret. + + - `type BetaManagedAgentsStaticBearerUpdateParamsResp struct{…}` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `Type BetaManagedAgentsStaticBearerUpdateParamsType` + + - `const BetaManagedAgentsStaticBearerUpdateParamsTypeStaticBearer BetaManagedAgentsStaticBearerUpdateParamsType = "static_bearer"` + + - `Token string` + + Updated static bearer token value. + + - `DisplayName param.Field[string]` + + Body param: Updated human-readable name for the credential. 1-255 characters. + + - `Metadata param.Field[map[string, string]]` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsCredential struct{…}` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `ID string` + + Unique identifier for the credential. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `Auth BetaManagedAgentsCredentialAuthUnion` + + Authentication details for a credential. + + - `type BetaManagedAgentsMCPOAuthAuthResponse struct{…}` + + OAuth credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsMCPOAuthAuthResponseType` + + - `const BetaManagedAgentsMCPOAuthAuthResponseTypeMCPOAuth BetaManagedAgentsMCPOAuthAuthResponseType = "mcp_oauth"` + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `ClientID string` + + OAuth client ID. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneResponse struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneResponseTypeNone BetaManagedAgentsTokenEndpointAuthNoneResponseType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicResponse struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicResponseTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicResponseType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostResponse struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthPostResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthPostResponseTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostResponseType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + + - `type BetaManagedAgentsStaticBearerAuthResponse struct{…}` + + Static bearer token credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsStaticBearerAuthResponseType` + + - `const BetaManagedAgentsStaticBearerAuthResponseTypeStaticBearer BetaManagedAgentsStaticBearerAuthResponseType = "static_bearer"` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the credential. + + - `Type BetaManagedAgentsCredentialType` + + - `const BetaManagedAgentsCredentialTypeVaultCredential BetaManagedAgentsCredentialType = "vault_credential"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `VaultID string` + + Identifier of the vault this credential belongs to. + + - `DisplayName string` + + Human-readable name for the credential. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsCredential, err := client.Beta.Vaults.Credentials.Update( + context.TODO(), + "vcrd_011CZkZEMt8gZan2iYOQfSkw", + anthropic.BetaVaultCredentialUpdateParams{ + VaultID: "vlt_011CZkZDLs7fYzm1hXNPeRjv", + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsCredential.ID) +} +``` + +## Delete + +`client.Beta.Vaults.Credentials.Delete(ctx, credentialID, params) (*BetaManagedAgentsDeletedCredential, error)` + +**delete** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Delete Credential + +### Parameters + +- `credentialID string` + +- `params BetaVaultCredentialDeleteParams` + + - `VaultID param.Field[string]` + + Path param: Path parameter vault_id + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsDeletedCredential struct{…}` + + Confirmation of a deleted credential. + + - `ID string` + + Unique identifier of the deleted credential. + + - `Type BetaManagedAgentsDeletedCredentialType` + + - `const BetaManagedAgentsDeletedCredentialTypeVaultCredentialDeleted BetaManagedAgentsDeletedCredentialType = "vault_credential_deleted"` + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsDeletedCredential, err := client.Beta.Vaults.Credentials.Delete( + context.TODO(), + "vcrd_011CZkZEMt8gZan2iYOQfSkw", + anthropic.BetaVaultCredentialDeleteParams{ + VaultID: "vlt_011CZkZDLs7fYzm1hXNPeRjv", + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsDeletedCredential.ID) +} +``` + +## Archive + +`client.Beta.Vaults.Credentials.Archive(ctx, credentialID, params) (*BetaManagedAgentsCredential, error)` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}/archive` + +Archive Credential + +### Parameters + +- `credentialID string` + +- `params BetaVaultCredentialArchiveParams` + + - `VaultID param.Field[string]` + + Path param: Path parameter vault_id + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsCredential struct{…}` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `ID string` + + Unique identifier for the credential. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `Auth BetaManagedAgentsCredentialAuthUnion` + + Authentication details for a credential. + + - `type BetaManagedAgentsMCPOAuthAuthResponse struct{…}` + + OAuth credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsMCPOAuthAuthResponseType` + + - `const BetaManagedAgentsMCPOAuthAuthResponseTypeMCPOAuth BetaManagedAgentsMCPOAuthAuthResponseType = "mcp_oauth"` + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `ClientID string` + + OAuth client ID. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneResponse struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneResponseTypeNone BetaManagedAgentsTokenEndpointAuthNoneResponseType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicResponse struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicResponseTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicResponseType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostResponse struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthPostResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthPostResponseTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostResponseType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + + - `type BetaManagedAgentsStaticBearerAuthResponse struct{…}` + + Static bearer token credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsStaticBearerAuthResponseType` + + - `const BetaManagedAgentsStaticBearerAuthResponseTypeStaticBearer BetaManagedAgentsStaticBearerAuthResponseType = "static_bearer"` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the credential. + + - `Type BetaManagedAgentsCredentialType` + + - `const BetaManagedAgentsCredentialTypeVaultCredential BetaManagedAgentsCredentialType = "vault_credential"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `VaultID string` + + Identifier of the vault this credential belongs to. + + - `DisplayName string` + + Human-readable name for the credential. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsCredential, err := client.Beta.Vaults.Credentials.Archive( + context.TODO(), + "vcrd_011CZkZEMt8gZan2iYOQfSkw", + anthropic.BetaVaultCredentialArchiveParams{ + VaultID: "vlt_011CZkZDLs7fYzm1hXNPeRjv", + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsCredential.ID) +} +``` + +## Domain Types + +### Beta Managed Agents Credential + +- `type BetaManagedAgentsCredential struct{…}` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `ID string` + + Unique identifier for the credential. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `Auth BetaManagedAgentsCredentialAuthUnion` + + Authentication details for a credential. + + - `type BetaManagedAgentsMCPOAuthAuthResponse struct{…}` + + OAuth credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsMCPOAuthAuthResponseType` + + - `const BetaManagedAgentsMCPOAuthAuthResponseTypeMCPOAuth BetaManagedAgentsMCPOAuthAuthResponseType = "mcp_oauth"` + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `ClientID string` + + OAuth client ID. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneResponse struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneResponseTypeNone BetaManagedAgentsTokenEndpointAuthNoneResponseType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicResponse struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicResponseTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicResponseType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostResponse struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthPostResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthPostResponseTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostResponseType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + + - `type BetaManagedAgentsStaticBearerAuthResponse struct{…}` + + Static bearer token credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsStaticBearerAuthResponseType` + + - `const BetaManagedAgentsStaticBearerAuthResponseTypeStaticBearer BetaManagedAgentsStaticBearerAuthResponseType = "static_bearer"` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the credential. + + - `Type BetaManagedAgentsCredentialType` + + - `const BetaManagedAgentsCredentialTypeVaultCredential BetaManagedAgentsCredentialType = "vault_credential"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `VaultID string` + + Identifier of the vault this credential belongs to. + + - `DisplayName string` + + Human-readable name for the credential. + +### Beta Managed Agents Deleted Credential + +- `type BetaManagedAgentsDeletedCredential struct{…}` + + Confirmation of a deleted credential. + + - `ID string` + + Unique identifier of the deleted credential. + + - `Type BetaManagedAgentsDeletedCredentialType` + + - `const BetaManagedAgentsDeletedCredentialTypeVaultCredentialDeleted BetaManagedAgentsDeletedCredentialType = "vault_credential_deleted"` + +### Beta Managed Agents MCP OAuth Auth Response + +- `type BetaManagedAgentsMCPOAuthAuthResponse struct{…}` + + OAuth credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsMCPOAuthAuthResponseType` + + - `const BetaManagedAgentsMCPOAuthAuthResponseTypeMCPOAuth BetaManagedAgentsMCPOAuthAuthResponseType = "mcp_oauth"` + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `ClientID string` + + OAuth client ID. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneResponse struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneResponseTypeNone BetaManagedAgentsTokenEndpointAuthNoneResponseType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicResponse struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicResponseTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicResponseType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostResponse struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthPostResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthPostResponseTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostResponseType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Create Params + +- `type BetaManagedAgentsMCPOAuthCreateParamsResp struct{…}` + + Parameters for creating an MCP OAuth credential. + + - `AccessToken string` + + OAuth access token. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsMCPOAuthCreateParamsType` + + - `const BetaManagedAgentsMCPOAuthCreateParamsTypeMCPOAuth BetaManagedAgentsMCPOAuthCreateParamsType = "mcp_oauth"` + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshParamsResp` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `ClientID string` + + OAuth client ID. + + - `RefreshToken string` + + OAuth refresh token. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshParamsTokenEndpointAuthUnionResp` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneParamResp struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneParamType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneParamTypeNone BetaManagedAgentsTokenEndpointAuthNoneParamType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicParamResp struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `ClientSecret string` + + OAuth client secret. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicParamType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicParamTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicParamType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostParamResp struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `ClientSecret string` + + OAuth client secret. + + - `Type BetaManagedAgentsTokenEndpointAuthPostParamType` + + - `const BetaManagedAgentsTokenEndpointAuthPostParamTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostParamType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Params + +- `type BetaManagedAgentsMCPOAuthRefreshParamsResp struct{…}` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `ClientID string` + + OAuth client ID. + + - `RefreshToken string` + + OAuth refresh token. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshParamsTokenEndpointAuthUnionResp` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneParamResp struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneParamType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneParamTypeNone BetaManagedAgentsTokenEndpointAuthNoneParamType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicParamResp struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `ClientSecret string` + + OAuth client secret. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicParamType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicParamTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicParamType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostParamResp struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `ClientSecret string` + + OAuth client secret. + + - `Type BetaManagedAgentsTokenEndpointAuthPostParamType` + + - `const BetaManagedAgentsTokenEndpointAuthPostParamTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostParamType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Response + +- `type BetaManagedAgentsMCPOAuthRefreshResponse struct{…}` + + OAuth refresh token configuration returned in credential responses. + + - `ClientID string` + + OAuth client ID. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneResponse struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneResponseTypeNone BetaManagedAgentsTokenEndpointAuthNoneResponseType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicResponse struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicResponseTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicResponseType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostResponse struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthPostResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthPostResponseTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostResponseType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Update Params + +- `type BetaManagedAgentsMCPOAuthRefreshUpdateParamsResp struct{…}` + + Parameters for updating OAuth refresh token configuration. + + - `RefreshToken string` + + Updated OAuth refresh token. + + - `Scope string` + + Updated OAuth scope for the refresh request. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshUpdateParamsTokenEndpointAuthUnionResp` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type BetaManagedAgentsTokenEndpointAuthBasicUpdateParamResp struct{…}` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicUpdateParamType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicUpdateParamTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicUpdateParamType = "client_secret_basic"` + + - `ClientSecret string` + + Updated OAuth client secret. + + - `type BetaManagedAgentsTokenEndpointAuthPostUpdateParamResp struct{…}` + + Updated POST body authentication parameters for the token endpoint. + + - `Type BetaManagedAgentsTokenEndpointAuthPostUpdateParamType` + + - `const BetaManagedAgentsTokenEndpointAuthPostUpdateParamTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostUpdateParamType = "client_secret_post"` + + - `ClientSecret string` + + Updated OAuth client secret. + +### Beta Managed Agents MCP OAuth Update Params + +- `type BetaManagedAgentsMCPOAuthUpdateParamsResp struct{…}` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `Type BetaManagedAgentsMCPOAuthUpdateParamsType` + + - `const BetaManagedAgentsMCPOAuthUpdateParamsTypeMCPOAuth BetaManagedAgentsMCPOAuthUpdateParamsType = "mcp_oauth"` + + - `AccessToken string` + + Updated OAuth access token. + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshUpdateParamsResp` + + Parameters for updating OAuth refresh token configuration. + + - `RefreshToken string` + + Updated OAuth refresh token. + + - `Scope string` + + Updated OAuth scope for the refresh request. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshUpdateParamsTokenEndpointAuthUnionResp` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type BetaManagedAgentsTokenEndpointAuthBasicUpdateParamResp struct{…}` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicUpdateParamType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicUpdateParamTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicUpdateParamType = "client_secret_basic"` + + - `ClientSecret string` + + Updated OAuth client secret. + + - `type BetaManagedAgentsTokenEndpointAuthPostUpdateParamResp struct{…}` + + Updated POST body authentication parameters for the token endpoint. + + - `Type BetaManagedAgentsTokenEndpointAuthPostUpdateParamType` + + - `const BetaManagedAgentsTokenEndpointAuthPostUpdateParamTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostUpdateParamType = "client_secret_post"` + + - `ClientSecret string` + + Updated OAuth client secret. + +### Beta Managed Agents Static Bearer Auth Response + +- `type BetaManagedAgentsStaticBearerAuthResponse struct{…}` + + Static bearer token credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsStaticBearerAuthResponseType` + + - `const BetaManagedAgentsStaticBearerAuthResponseTypeStaticBearer BetaManagedAgentsStaticBearerAuthResponseType = "static_bearer"` + +### Beta Managed Agents Static Bearer Create Params + +- `type BetaManagedAgentsStaticBearerCreateParamsResp struct{…}` + + Parameters for creating a static bearer token credential. + + - `Token string` + + Static bearer token value. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsStaticBearerCreateParamsType` + + - `const BetaManagedAgentsStaticBearerCreateParamsTypeStaticBearer BetaManagedAgentsStaticBearerCreateParamsType = "static_bearer"` + +### Beta Managed Agents Static Bearer Update Params - - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` +- `type BetaManagedAgentsStaticBearerUpdateParamsResp struct{…}` - - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. - - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + - `Type BetaManagedAgentsStaticBearerUpdateParamsType` - - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + - `const BetaManagedAgentsStaticBearerUpdateParamsTypeStaticBearer BetaManagedAgentsStaticBearerUpdateParamsType = "static_bearer"` - - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + - `Token string` - - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + Updated static bearer token value. - - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` +### Beta Managed Agents Token Endpoint Auth Basic Param - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` +- `type BetaManagedAgentsTokenEndpointAuthBasicParamResp struct{…}` -### Returns + Token endpoint uses HTTP Basic authentication with client credentials. -- `type DeletedFile struct{…}` + - `ClientSecret string` - - `ID string` + OAuth client secret. - ID of the deleted file. + - `Type BetaManagedAgentsTokenEndpointAuthBasicParamType` - - `Type DeletedFileType` + - `const BetaManagedAgentsTokenEndpointAuthBasicParamTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicParamType = "client_secret_basic"` - Deleted object type. +### Beta Managed Agents Token Endpoint Auth Basic Response - For file deletion, this is always `"file_deleted"`. +- `type BetaManagedAgentsTokenEndpointAuthBasicResponse struct{…}` - - `const DeletedFileTypeFileDeleted DeletedFileType = "file_deleted"` + Token endpoint uses HTTP Basic authentication with client credentials. -### Example + - `Type BetaManagedAgentsTokenEndpointAuthBasicResponseType` -```go -package main + - `const BetaManagedAgentsTokenEndpointAuthBasicResponseTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicResponseType = "client_secret_basic"` -import ( - "context" - "fmt" +### Beta Managed Agents Token Endpoint Auth Basic Update Param - "github.com/anthropics/anthropic-sdk-go" - "github.com/anthropics/anthropic-sdk-go/option" -) +- `type BetaManagedAgentsTokenEndpointAuthBasicUpdateParamResp struct{…}` -func main() { - client := anthropic.NewClient( - option.WithAPIKey("my-anthropic-api-key"), - ) - deletedFile, err := client.Beta.Files.Delete( - context.TODO(), - "file_id", - anthropic.BetaFileDeleteParams{ + Updated HTTP Basic authentication parameters for the token endpoint. - }, - ) - if err != nil { - panic(err.Error()) - } - fmt.Printf("%+v\n", deletedFile.ID) -} -``` + - `Type BetaManagedAgentsTokenEndpointAuthBasicUpdateParamType` -## Domain Types + - `const BetaManagedAgentsTokenEndpointAuthBasicUpdateParamTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicUpdateParamType = "client_secret_basic"` -### Deleted File + - `ClientSecret string` -- `type DeletedFile struct{…}` + Updated OAuth client secret. - - `ID string` +### Beta Managed Agents Token Endpoint Auth None Param - ID of the deleted file. +- `type BetaManagedAgentsTokenEndpointAuthNoneParamResp struct{…}` - - `Type DeletedFileType` + Token endpoint requires no client authentication. - Deleted object type. + - `Type BetaManagedAgentsTokenEndpointAuthNoneParamType` - For file deletion, this is always `"file_deleted"`. + - `const BetaManagedAgentsTokenEndpointAuthNoneParamTypeNone BetaManagedAgentsTokenEndpointAuthNoneParamType = "none"` - - `const DeletedFileTypeFileDeleted DeletedFileType = "file_deleted"` +### Beta Managed Agents Token Endpoint Auth None Response -### File Metadata +- `type BetaManagedAgentsTokenEndpointAuthNoneResponse struct{…}` -- `type FileMetadata struct{…}` + Token endpoint requires no client authentication. - - `ID string` + - `Type BetaManagedAgentsTokenEndpointAuthNoneResponseType` - Unique object identifier. + - `const BetaManagedAgentsTokenEndpointAuthNoneResponseTypeNone BetaManagedAgentsTokenEndpointAuthNoneResponseType = "none"` - The format and length of IDs may change over time. +### Beta Managed Agents Token Endpoint Auth Post Param - - `CreatedAt Time` +- `type BetaManagedAgentsTokenEndpointAuthPostParamResp struct{…}` - RFC 3339 datetime string representing when the file was created. + Token endpoint uses POST body authentication with client credentials. - - `Filename string` + - `ClientSecret string` - Original filename of the uploaded file. + OAuth client secret. - - `MimeType string` + - `Type BetaManagedAgentsTokenEndpointAuthPostParamType` - MIME type of the file. + - `const BetaManagedAgentsTokenEndpointAuthPostParamTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostParamType = "client_secret_post"` - - `SizeBytes int64` +### Beta Managed Agents Token Endpoint Auth Post Response - Size of the file in bytes. +- `type BetaManagedAgentsTokenEndpointAuthPostResponse struct{…}` - - `Type File` + Token endpoint uses POST body authentication with client credentials. - Object type. + - `Type BetaManagedAgentsTokenEndpointAuthPostResponseType` - For files, this is always `"file"`. + - `const BetaManagedAgentsTokenEndpointAuthPostResponseTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostResponseType = "client_secret_post"` - - `const FileFile File = "file"` +### Beta Managed Agents Token Endpoint Auth Post Update Param - - `Downloadable bool` +- `type BetaManagedAgentsTokenEndpointAuthPostUpdateParamResp struct{…}` - Whether the file can be downloaded. + Updated POST body authentication parameters for the token endpoint. -# Skills + - `Type BetaManagedAgentsTokenEndpointAuthPostUpdateParamType` -## Create + - `const BetaManagedAgentsTokenEndpointAuthPostUpdateParamTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostUpdateParamType = "client_secret_post"` -`client.Beta.Skills.New(ctx, params) (*BetaSkillNewResponse, error)` + - `ClientSecret string` -**post** `/v1/skills` + Updated OAuth client secret. -Create Skill +# Files -### Parameters +## Upload -- `params BetaSkillNewParams` +`client.Beta.Files.Upload(ctx, params) (*FileMetadata, error)` - - `DisplayTitle param.Field[string]` +**post** `/v1/files` - Body param: Display title for the skill. +Upload File - This is a human-readable label that is not included in the prompt sent to the model. +### Parameters - - `Files param.Field[[]Reader]` +- `params BetaFileUploadParams` - Body param: Files to upload for the skill. + - `File param.Field[Reader]` - All files must be in the same top-level directory and must include a SKILL.md file at the root of that directory. + Body param: The file to upload - `Betas param.Field[[]AnthropicBeta]` @@ -45613,52 +68138,57 @@ Create Skill - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns -- `type BetaSkillNewResponse struct{…}` +- `type FileMetadata struct{…}` - `ID string` - Unique identifier for the skill. + Unique object identifier. The format and length of IDs may change over time. - - `CreatedAt string` + - `CreatedAt Time` - ISO 8601 timestamp of when the skill was created. + RFC 3339 datetime string representing when the file was created. - - `DisplayTitle string` + - `Filename string` - Display title for the skill. + Original filename of the uploaded file. - This is a human-readable label that is not included in the prompt sent to the model. + - `MimeType string` - - `LatestVersion string` + MIME type of the file. - The latest version identifier for the skill. + - `SizeBytes int64` - This represents the most recent version of the skill that has been created. + Size of the file in bytes. - - `Source string` + - `Type File` - Source of the skill. + Object type. - This may be one of the following values: + For files, this is always `"file"`. - * `"custom"`: the skill was created by a user - * `"anthropic"`: the skill was created by Anthropic + - `const FileFile File = "file"` - - `Type string` + - `Downloadable bool` - Object type. + Whether the file can be downloaded. - For Skills, this is always `"skill"`. + - `Scope BetaFileScope` - - `UpdatedAt string` + The scope of this file, indicating the context in which it was created (e.g., a session). - ISO 8601 timestamp of when the skill was last updated. + - `ID string` + + The ID of the scoping resource (e.g., the session ID). + + - `Type Session` + + The type of scope (e.g., `"session"`). + + - `const SessionSession Session = "session"` ### Example @@ -45666,8 +68196,10 @@ Create Skill package main import ( + "bytes" "context" "fmt" + "io" "github.com/anthropics/anthropic-sdk-go" "github.com/anthropics/anthropic-sdk-go/option" @@ -45677,48 +68209,45 @@ func main() { client := anthropic.NewClient( option.WithAPIKey("my-anthropic-api-key"), ) - skill, err := client.Beta.Skills.New(context.TODO(), anthropic.BetaSkillNewParams{ - + fileMetadata, err := client.Beta.Files.Upload(context.TODO(), anthropic.BetaFileUploadParams{ + File: io.Reader(bytes.NewBuffer([]byte("Example data"))), }) if err != nil { panic(err.Error()) } - fmt.Printf("%+v\n", skill.ID) + fmt.Printf("%+v\n", fileMetadata.ID) } ``` ## List -`client.Beta.Skills.List(ctx, params) (*PageCursor[BetaSkillListResponse], error)` +`client.Beta.Files.List(ctx, params) (*Page[FileMetadata], error)` -**get** `/v1/skills` +**get** `/v1/files` -List Skills +List Files ### Parameters -- `params BetaSkillListParams` - - - `Limit param.Field[int64]` +- `params BetaFileListParams` - Query param: Number of results to return per page. + - `AfterID param.Field[string]` - Maximum value is 100. Defaults to 20. + Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object. - - `Page param.Field[string]` + - `BeforeID param.Field[string]` - Query param: Pagination token for fetching a specific page of results. + Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object. - Pass the value from a previous response's `next_page` field to get the next page of results. + - `Limit param.Field[int64]` - - `Source param.Field[string]` + Query param: Number of items to return per page. - Query param: Filter skills by source. + Defaults to `20`. Ranges from `1` to `1000`. - If provided, only skills from the specified source will be returned: + - `ScopeID param.Field[string]` - * `"custom"`: only return user-created skills - * `"anthropic"`: only return Anthropic-created skills + Query param: Filter by scope ID. Only returns files associated with the specified scope (e.g., a session ID). - `Betas param.Field[[]AnthropicBeta]` @@ -45770,52 +68299,57 @@ List Skills - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns -- `type BetaSkillListResponse struct{…}` +- `type FileMetadata struct{…}` - `ID string` - Unique identifier for the skill. + Unique object identifier. The format and length of IDs may change over time. - - `CreatedAt string` + - `CreatedAt Time` - ISO 8601 timestamp of when the skill was created. + RFC 3339 datetime string representing when the file was created. - - `DisplayTitle string` + - `Filename string` - Display title for the skill. + Original filename of the uploaded file. - This is a human-readable label that is not included in the prompt sent to the model. + - `MimeType string` - - `LatestVersion string` + MIME type of the file. - The latest version identifier for the skill. + - `SizeBytes int64` - This represents the most recent version of the skill that has been created. + Size of the file in bytes. - - `Source string` + - `Type File` - Source of the skill. + Object type. - This may be one of the following values: + For files, this is always `"file"`. - * `"custom"`: the skill was created by a user - * `"anthropic"`: the skill was created by Anthropic + - `const FileFile File = "file"` - - `Type string` + - `Downloadable bool` - Object type. + Whether the file can be downloaded. - For Skills, this is always `"skill"`. + - `Scope BetaFileScope` - - `UpdatedAt string` + The scope of this file, indicating the context in which it was created (e.g., a session). - ISO 8601 timestamp of when the skill was last updated. + - `ID string` + + The ID of the scoping resource (e.g., the session ID). + + - `Type Session` + + The type of scope (e.g., `"session"`). + + - `const SessionSession Session = "session"` ### Example @@ -45834,7 +68368,7 @@ func main() { client := anthropic.NewClient( option.WithAPIKey("my-anthropic-api-key"), ) - page, err := client.Beta.Skills.List(context.TODO(), anthropic.BetaSkillListParams{ + page, err := client.Beta.Files.List(context.TODO(), anthropic.BetaFileListParams{ }) if err != nil { @@ -45844,23 +68378,21 @@ func main() { } ``` -## Retrieve +## Download -`client.Beta.Skills.Get(ctx, skillID, query) (*BetaSkillGetResponse, error)` +`client.Beta.Files.Download(ctx, fileID, query) (*Response, error)` -**get** `/v1/skills/{skill_id}` +**get** `/v1/files/{file_id}/content` -Get Skill +Download File ### Parameters -- `skillID string` - - Unique identifier for the skill. +- `fileID string` - The format and length of IDs may change over time. + ID of the File. -- `query BetaSkillGetParams` +- `query BetaFileDownloadParams` - `Betas param.Field[[]AnthropicBeta]` @@ -45912,52 +68444,9 @@ Get Skill - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns -- `type BetaSkillGetResponse struct{…}` - - - `ID string` - - Unique identifier for the skill. - - The format and length of IDs may change over time. - - - `CreatedAt string` - - ISO 8601 timestamp of when the skill was created. - - - `DisplayTitle string` - - Display title for the skill. - - This is a human-readable label that is not included in the prompt sent to the model. - - - `LatestVersion string` - - The latest version identifier for the skill. - - This represents the most recent version of the skill that has been created. - - - `Source string` - - Source of the skill. - - This may be one of the following values: - - * `"custom"`: the skill was created by a user - * `"anthropic"`: the skill was created by Anthropic - - - `Type string` - - Object type. - - For Skills, this is always `"skill"`. - - - `UpdatedAt string` - - ISO 8601 timestamp of when the skill was last updated. +- `type BetaFileDownloadResponse interface{…}` ### Example @@ -45976,37 +68465,35 @@ func main() { client := anthropic.NewClient( option.WithAPIKey("my-anthropic-api-key"), ) - skill, err := client.Beta.Skills.Get( + response, err := client.Beta.Files.Download( context.TODO(), - "skill_id", - anthropic.BetaSkillGetParams{ + "file_id", + anthropic.BetaFileDownloadParams{ }, ) if err != nil { panic(err.Error()) } - fmt.Printf("%+v\n", skill.ID) + fmt.Printf("%+v\n", response) } ``` -## Delete +## Retrieve Metadata -`client.Beta.Skills.Delete(ctx, skillID, body) (*BetaSkillDeleteResponse, error)` +`client.Beta.Files.GetMetadata(ctx, fileID, query) (*FileMetadata, error)` -**delete** `/v1/skills/{skill_id}` +**get** `/v1/files/{file_id}` -Delete Skill +Get File Metadata ### Parameters -- `skillID string` - - Unique identifier for the skill. +- `fileID string` - The format and length of IDs may change over time. + ID of the File. -- `body BetaSkillDeleteParams` +- `query BetaFileGetMetadataParams` - `Betas param.Field[[]AnthropicBeta]` @@ -46058,23 +68545,57 @@ Delete Skill - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns -- `type BetaSkillDeleteResponse struct{…}` +- `type FileMetadata struct{…}` - `ID string` - Unique identifier for the skill. + Unique object identifier. The format and length of IDs may change over time. - - `Type string` + - `CreatedAt Time` - Deleted object type. + RFC 3339 datetime string representing when the file was created. - For Skills, this is always `"skill_deleted"`. + - `Filename string` + + Original filename of the uploaded file. + + - `MimeType string` + + MIME type of the file. + + - `SizeBytes int64` + + Size of the file in bytes. + + - `Type File` + + Object type. + + For files, this is always `"file"`. + + - `const FileFile File = "file"` + + - `Downloadable bool` + + Whether the file can be downloaded. + + - `Scope BetaFileScope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `ID string` + + The ID of the scoping resource (e.g., the session ID). + + - `Type Session` + + The type of scope (e.g., `"session"`). + + - `const SessionSession Session = "session"` ### Example @@ -46093,49 +68614,39 @@ func main() { client := anthropic.NewClient( option.WithAPIKey("my-anthropic-api-key"), ) - skill, err := client.Beta.Skills.Delete( + fileMetadata, err := client.Beta.Files.GetMetadata( context.TODO(), - "skill_id", - anthropic.BetaSkillDeleteParams{ + "file_id", + anthropic.BetaFileGetMetadataParams{ }, ) if err != nil { panic(err.Error()) } - fmt.Printf("%+v\n", skill.ID) + fmt.Printf("%+v\n", fileMetadata.ID) } ``` -# Versions - -## Create +## Delete -`client.Beta.Skills.Versions.New(ctx, skillID, params) (*BetaSkillVersionNewResponse, error)` +`client.Beta.Files.Delete(ctx, fileID, body) (*DeletedFile, error)` -**post** `/v1/skills/{skill_id}/versions` +**delete** `/v1/files/{file_id}` -Create Skill Version +Delete File ### Parameters -- `skillID string` - - Unique identifier for the skill. - - The format and length of IDs may change over time. - -- `params BetaSkillVersionNewParams` - - - `Files param.Field[[]Reader]` +- `fileID string` - Body param: Files to upload for the skill. + ID of the File. - All files must be in the same top-level directory and must include a SKILL.md file at the root of that directory. +- `body BetaFileDeleteParams` - `Betas param.Field[[]AnthropicBeta]` - Header param: Optional header to specify the beta version(s) you want to use. + Optional header to specify the beta version(s) you want to use. - `string` @@ -46183,55 +68694,21 @@ Create Skill Version - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns -- `type BetaSkillVersionNewResponse struct{…}` +- `type DeletedFile struct{…}` - `ID string` - Unique identifier for the skill version. - - The format and length of IDs may change over time. - - - `CreatedAt string` - - ISO 8601 timestamp of when the skill version was created. - - - `Description string` - - Description of the skill version. - - This is extracted from the SKILL.md file in the skill upload. - - - `Directory string` - - Directory name of the skill version. - - This is the top-level directory name that was extracted from the uploaded files. - - - `Name string` - - Human-readable name of the skill version. - - This is extracted from the SKILL.md file in the skill upload. - - - `SkillID string` - - Identifier for the skill that this version belongs to. - - - `Type string` - - Object type. + ID of the deleted file. - For Skill Versions, this is always `"skill_version"`. + - `Type DeletedFileType` - - `Version string` + Deleted object type. - Version identifier for the skill. + For file deletion, this is always `"file_deleted"`. - Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + - `const DeletedFileTypeFileDeleted DeletedFileType = "file_deleted"` ### Example @@ -46250,47 +68727,129 @@ func main() { client := anthropic.NewClient( option.WithAPIKey("my-anthropic-api-key"), ) - version, err := client.Beta.Skills.Versions.New( + deletedFile, err := client.Beta.Files.Delete( context.TODO(), - "skill_id", - anthropic.BetaSkillVersionNewParams{ + "file_id", + anthropic.BetaFileDeleteParams{ }, ) if err != nil { panic(err.Error()) } - fmt.Printf("%+v\n", version.ID) + fmt.Printf("%+v\n", deletedFile.ID) } ``` -## List +## Domain Types -`client.Beta.Skills.Versions.List(ctx, skillID, params) (*PageCursor[BetaSkillVersionListResponse], error)` +### Beta File Scope -**get** `/v1/skills/{skill_id}/versions` +- `type BetaFileScope struct{…}` -List Skill Versions + - `ID string` -### Parameters + The ID of the scoping resource (e.g., the session ID). -- `skillID string` + - `Type Session` - Unique identifier for the skill. + The type of scope (e.g., `"session"`). - The format and length of IDs may change over time. + - `const SessionSession Session = "session"` -- `params BetaSkillVersionListParams` +### Deleted File + +- `type DeletedFile struct{…}` + + - `ID string` + + ID of the deleted file. + + - `Type DeletedFileType` + + Deleted object type. + + For file deletion, this is always `"file_deleted"`. + + - `const DeletedFileTypeFileDeleted DeletedFileType = "file_deleted"` + +### File Metadata + +- `type FileMetadata struct{…}` + + - `ID string` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `CreatedAt Time` + + RFC 3339 datetime string representing when the file was created. + + - `Filename string` + + Original filename of the uploaded file. + + - `MimeType string` + + MIME type of the file. + + - `SizeBytes int64` + + Size of the file in bytes. + + - `Type File` + + Object type. + + For files, this is always `"file"`. + + - `const FileFile File = "file"` + + - `Downloadable bool` + + Whether the file can be downloaded. + + - `Scope BetaFileScope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `ID string` + + The ID of the scoping resource (e.g., the session ID). + + - `Type Session` + + The type of scope (e.g., `"session"`). + + - `const SessionSession Session = "session"` + +# Skills + +## Create + +`client.Beta.Skills.New(ctx, params) (*BetaSkillNewResponse, error)` + +**post** `/v1/skills` + +Create Skill + +### Parameters + +- `params BetaSkillNewParams` + + - `DisplayTitle param.Field[string]` - - `Limit param.Field[int64]` + Body param: Display title for the skill. - Query param: Number of items to return per page. + This is a human-readable label that is not included in the prompt sent to the model. - Defaults to `20`. Ranges from `1` to `1000`. + - `Files param.Field[[]Reader]` - - `Page param.Field[string]` + Body param: Files to upload for the skill. - Query param: Optionally set to the `next_page` token from the previous response. + All files must be in the same top-level directory and must include a SKILL.md file at the root of that directory. - `Betas param.Field[[]AnthropicBeta]` @@ -46342,55 +68901,50 @@ List Skill Versions - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns -- `type BetaSkillVersionListResponse struct{…}` +- `type BetaSkillNewResponse struct{…}` - `ID string` - Unique identifier for the skill version. + Unique identifier for the skill. The format and length of IDs may change over time. - `CreatedAt string` - ISO 8601 timestamp of when the skill version was created. - - - `Description string` + ISO 8601 timestamp of when the skill was created. - Description of the skill version. + - `DisplayTitle string` - This is extracted from the SKILL.md file in the skill upload. + Display title for the skill. - - `Directory string` + This is a human-readable label that is not included in the prompt sent to the model. - Directory name of the skill version. + - `LatestVersion string` - This is the top-level directory name that was extracted from the uploaded files. + The latest version identifier for the skill. - - `Name string` + This represents the most recent version of the skill that has been created. - Human-readable name of the skill version. + - `Source string` - This is extracted from the SKILL.md file in the skill upload. + Source of the skill. - - `SkillID string` + This may be one of the following values: - Identifier for the skill that this version belongs to. + * `"custom"`: the skill was created by a user + * `"anthropic"`: the skill was created by Anthropic - `Type string` Object type. - For Skill Versions, this is always `"skill_version"`. - - - `Version string` + For Skills, this is always `"skill"`. - Version identifier for the skill. + - `UpdatedAt string` - Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + ISO 8601 timestamp of when the skill was last updated. ### Example @@ -46409,43 +68963,48 @@ func main() { client := anthropic.NewClient( option.WithAPIKey("my-anthropic-api-key"), ) - page, err := client.Beta.Skills.Versions.List( - context.TODO(), - "skill_id", - anthropic.BetaSkillVersionListParams{ + skill, err := client.Beta.Skills.New(context.TODO(), anthropic.BetaSkillNewParams{ - }, - ) + }) if err != nil { panic(err.Error()) } - fmt.Printf("%+v\n", page) + fmt.Printf("%+v\n", skill.ID) } ``` -## Retrieve +## List -`client.Beta.Skills.Versions.Get(ctx, version, params) (*BetaSkillVersionGetResponse, error)` +`client.Beta.Skills.List(ctx, params) (*PageCursor[BetaSkillListResponse], error)` -**get** `/v1/skills/{skill_id}/versions/{version}` +**get** `/v1/skills` -Get Skill Version +List Skills ### Parameters -- `version string` +- `params BetaSkillListParams` - Version identifier for the skill. + - `Limit param.Field[int64]` - Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + Query param: Number of results to return per page. -- `params BetaSkillVersionGetParams` + Maximum value is 100. Defaults to 20. - - `SkillID param.Field[string]` + - `Page param.Field[string]` - Path param: Unique identifier for the skill. + Query param: Pagination token for fetching a specific page of results. - The format and length of IDs may change over time. + Pass the value from a previous response's `next_page` field to get the next page of results. + + - `Source param.Field[string]` + + Query param: Filter skills by source. + + If provided, only skills from the specified source will be returned: + + * `"custom"`: only return user-created skills + * `"anthropic"`: only return Anthropic-created skills - `Betas param.Field[[]AnthropicBeta]` @@ -46497,55 +69056,50 @@ Get Skill Version - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns -- `type BetaSkillVersionGetResponse struct{…}` +- `type BetaSkillListResponse struct{…}` - `ID string` - Unique identifier for the skill version. + Unique identifier for the skill. The format and length of IDs may change over time. - `CreatedAt string` - ISO 8601 timestamp of when the skill version was created. - - - `Description string` + ISO 8601 timestamp of when the skill was created. - Description of the skill version. + - `DisplayTitle string` - This is extracted from the SKILL.md file in the skill upload. + Display title for the skill. - - `Directory string` + This is a human-readable label that is not included in the prompt sent to the model. - Directory name of the skill version. + - `LatestVersion string` - This is the top-level directory name that was extracted from the uploaded files. + The latest version identifier for the skill. - - `Name string` + This represents the most recent version of the skill that has been created. - Human-readable name of the skill version. + - `Source string` - This is extracted from the SKILL.md file in the skill upload. + Source of the skill. - - `SkillID string` + This may be one of the following values: - Identifier for the skill that this version belongs to. + * `"custom"`: the skill was created by a user + * `"anthropic"`: the skill was created by Anthropic - `Type string` Object type. - For Skill Versions, this is always `"skill_version"`. - - - `Version string` + For Skills, this is always `"skill"`. - Version identifier for the skill. + - `UpdatedAt string` - Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + ISO 8601 timestamp of when the skill was last updated. ### Example @@ -46564,47 +69118,37 @@ func main() { client := anthropic.NewClient( option.WithAPIKey("my-anthropic-api-key"), ) - version, err := client.Beta.Skills.Versions.Get( - context.TODO(), - "version", - anthropic.BetaSkillVersionGetParams{ - SkillID: "skill_id", - }, - ) + page, err := client.Beta.Skills.List(context.TODO(), anthropic.BetaSkillListParams{ + + }) if err != nil { panic(err.Error()) } - fmt.Printf("%+v\n", version.ID) + fmt.Printf("%+v\n", page) } ``` -## Delete +## Retrieve -`client.Beta.Skills.Versions.Delete(ctx, version, params) (*BetaSkillVersionDeleteResponse, error)` +`client.Beta.Skills.Get(ctx, skillID, query) (*BetaSkillGetResponse, error)` -**delete** `/v1/skills/{skill_id}/versions/{version}` +**get** `/v1/skills/{skill_id}` -Delete Skill Version +Get Skill ### Parameters -- `version string` - - Version identifier for the skill. - - Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). - -- `params BetaSkillVersionDeleteParams` +- `skillID string` - - `SkillID param.Field[string]` + Unique identifier for the skill. - Path param: Unique identifier for the skill. + The format and length of IDs may change over time. - The format and length of IDs may change over time. +- `query BetaSkillGetParams` - `Betas param.Field[[]AnthropicBeta]` - Header param: Optional header to specify the beta version(s) you want to use. + Optional header to specify the beta version(s) you want to use. - `string` @@ -46652,23 +69196,50 @@ Delete Skill Version - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns -- `type BetaSkillVersionDeleteResponse struct{…}` +- `type BetaSkillGetResponse struct{…}` - `ID string` - Version identifier for the skill. + Unique identifier for the skill. - Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + The format and length of IDs may change over time. + + - `CreatedAt string` + + ISO 8601 timestamp of when the skill was created. + + - `DisplayTitle string` + + Display title for the skill. + + This is a human-readable label that is not included in the prompt sent to the model. + + - `LatestVersion string` + + The latest version identifier for the skill. + + This represents the most recent version of the skill that has been created. + + - `Source string` + + Source of the skill. + + This may be one of the following values: + + * `"custom"`: the skill was created by a user + * `"anthropic"`: the skill was created by Anthropic - `Type string` - Deleted object type. + Object type. - For Skill Versions, this is always `"skill_version_deleted"`. + For Skills, this is always `"skill"`. + + - `UpdatedAt string` + + ISO 8601 timestamp of when the skill was last updated. ### Example @@ -46687,45 +69258,41 @@ func main() { client := anthropic.NewClient( option.WithAPIKey("my-anthropic-api-key"), ) - version, err := client.Beta.Skills.Versions.Delete( + skill, err := client.Beta.Skills.Get( context.TODO(), - "version", - anthropic.BetaSkillVersionDeleteParams{ - SkillID: "skill_id", + "skill_id", + anthropic.BetaSkillGetParams{ + }, ) if err != nil { panic(err.Error()) } - fmt.Printf("%+v\n", version.ID) + fmt.Printf("%+v\n", skill.ID) } ``` -# User Profiles - -## Create +## Delete -`client.Beta.UserProfiles.New(ctx, params) (*BetaUserProfile, error)` +`client.Beta.Skills.Delete(ctx, skillID, body) (*BetaSkillDeleteResponse, error)` -**post** `/v1/user_profiles` +**delete** `/v1/skills/{skill_id}` -Create User Profile +Delete Skill ### Parameters -- `params BetaUserProfileNewParams` - - - `ExternalID param.Field[string]` +- `skillID string` - Body param + Unique identifier for the skill. - - `Metadata param.Field[map[string, string]]` + The format and length of IDs may change over time. - Body param: Free-form key-value data to attach to this user profile. Maximum 16 keys, with keys up to 64 characters and values up to 512 characters. Values must be non-empty strings. +- `body BetaSkillDeleteParams` - `Betas param.Field[[]AnthropicBeta]` - Header param: Optional header to specify the beta version(s) you want to use. + Optional header to specify the beta version(s) you want to use. - `string` @@ -46773,31 +69340,21 @@ Create User Profile - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns -- `type BetaUserProfile struct{…}` +- `type BetaSkillDeleteResponse struct{…}` - `ID string` - - `CreatedAt Time` - - A timestamp in RFC 3339 format - - - `Metadata map[string, string]` - - - `TrustGrants map[string, BetaUserProfileTrustGrant]` + Unique identifier for the skill. - - `Status string` + The format and length of IDs may change over time. - `Type string` - - `UpdatedAt Time` - - A timestamp in RFC 3339 format + Deleted object type. - - `ExternalID string` + For Skills, this is always `"skill_deleted"`. ### Example @@ -46816,43 +69373,45 @@ func main() { client := anthropic.NewClient( option.WithAPIKey("my-anthropic-api-key"), ) - betaUserProfile, err := client.Beta.UserProfiles.New(context.TODO(), anthropic.BetaUserProfileNewParams{ + skill, err := client.Beta.Skills.Delete( + context.TODO(), + "skill_id", + anthropic.BetaSkillDeleteParams{ - }) + }, + ) if err != nil { panic(err.Error()) } - fmt.Printf("%+v\n", betaUserProfile.ID) + fmt.Printf("%+v\n", skill.ID) } ``` -## List - -`client.Beta.UserProfiles.List(ctx, params) (*PageCursorV2[BetaUserProfile], error)` +# Versions -**get** `/v1/user_profiles` +## Create -List User Profiles +`client.Beta.Skills.Versions.New(ctx, skillID, params) (*BetaSkillVersionNewResponse, error)` -### Parameters +**post** `/v1/skills/{skill_id}/versions` -- `params BetaUserProfileListParams` +Create Skill Version - - `Limit param.Field[int64]` +### Parameters - Query param: Query parameter for limit +- `skillID string` - - `Order param.Field[BetaUserProfileListParamsOrder]` + Unique identifier for the skill. - Query param: Query parameter for order + The format and length of IDs may change over time. - - `const BetaUserProfileListParamsOrderAsc BetaUserProfileListParamsOrder = "asc"` +- `params BetaSkillVersionNewParams` - - `const BetaUserProfileListParamsOrderDesc BetaUserProfileListParamsOrder = "desc"` + - `Files param.Field[[]Reader]` - - `Page param.Field[string]` + Body param: Files to upload for the skill. - Query param: Query parameter for page + All files must be in the same top-level directory and must include a SKILL.md file at the root of that directory. - `Betas param.Field[[]AnthropicBeta]` @@ -46904,31 +69463,53 @@ List User Profiles - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns -- `type BetaUserProfile struct{…}` +- `type BetaSkillVersionNewResponse struct{…}` - `ID string` - - `CreatedAt Time` + Unique identifier for the skill version. - A timestamp in RFC 3339 format + The format and length of IDs may change over time. - - `Metadata map[string, string]` + - `CreatedAt string` + + ISO 8601 timestamp of when the skill version was created. + + - `Description string` + + Description of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + + - `Directory string` + + Directory name of the skill version. + + This is the top-level directory name that was extracted from the uploaded files. + + - `Name string` + + Human-readable name of the skill version. + + This is extracted from the SKILL.md file in the skill upload. - - `TrustGrants map[string, BetaUserProfileTrustGrant]` + - `SkillID string` - - `Status string` + Identifier for the skill that this version belongs to. - `Type string` - - `UpdatedAt Time` + Object type. - A timestamp in RFC 3339 format + For Skill Versions, this is always `"skill_version"`. + + - `Version string` + + Version identifier for the skill. - - `ExternalID string` + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). ### Example @@ -46947,33 +69528,51 @@ func main() { client := anthropic.NewClient( option.WithAPIKey("my-anthropic-api-key"), ) - page, err := client.Beta.UserProfiles.List(context.TODO(), anthropic.BetaUserProfileListParams{ + version, err := client.Beta.Skills.Versions.New( + context.TODO(), + "skill_id", + anthropic.BetaSkillVersionNewParams{ - }) + }, + ) if err != nil { panic(err.Error()) } - fmt.Printf("%+v\n", page) + fmt.Printf("%+v\n", version.ID) } ``` -## Retrieve +## List -`client.Beta.UserProfiles.Get(ctx, id, query) (*BetaUserProfile, error)` +`client.Beta.Skills.Versions.List(ctx, skillID, params) (*PageCursor[BetaSkillVersionListResponse], error)` -**get** `/v1/user_profiles/{id}` +**get** `/v1/skills/{skill_id}/versions` -Get User Profile +List Skill Versions ### Parameters -- `id string` +- `skillID string` + + Unique identifier for the skill. + + The format and length of IDs may change over time. + +- `params BetaSkillVersionListParams` + + - `Limit param.Field[int64]` + + Query param: Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + + - `Page param.Field[string]` -- `query BetaUserProfileGetParams` + Query param: Optionally set to the `next_page` token from the previous response. - `Betas param.Field[[]AnthropicBeta]` - Optional header to specify the beta version(s) you want to use. + Header param: Optional header to specify the beta version(s) you want to use. - `string` @@ -47021,31 +69620,53 @@ Get User Profile - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns -- `type BetaUserProfile struct{…}` +- `type BetaSkillVersionListResponse struct{…}` - `ID string` - - `CreatedAt Time` + Unique identifier for the skill version. - A timestamp in RFC 3339 format + The format and length of IDs may change over time. - - `Metadata map[string, string]` + - `CreatedAt string` + + ISO 8601 timestamp of when the skill version was created. + + - `Description string` - - `TrustGrants map[string, BetaUserProfileTrustGrant]` + Description of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + + - `Directory string` + + Directory name of the skill version. + + This is the top-level directory name that was extracted from the uploaded files. + + - `Name string` + + Human-readable name of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + + - `SkillID string` - - `Status string` + Identifier for the skill that this version belongs to. - `Type string` - - `UpdatedAt Time` + Object type. - A timestamp in RFC 3339 format + For Skill Versions, this is always `"skill_version"`. + + - `Version string` - - `ExternalID string` + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). ### Example @@ -47064,41 +69685,43 @@ func main() { client := anthropic.NewClient( option.WithAPIKey("my-anthropic-api-key"), ) - betaUserProfile, err := client.Beta.UserProfiles.Get( + page, err := client.Beta.Skills.Versions.List( context.TODO(), - "id", - anthropic.BetaUserProfileGetParams{ + "skill_id", + anthropic.BetaSkillVersionListParams{ }, ) if err != nil { panic(err.Error()) } - fmt.Printf("%+v\n", betaUserProfile.ID) + fmt.Printf("%+v\n", page) } ``` -## Update +## Retrieve -`client.Beta.UserProfiles.Update(ctx, id, params) (*BetaUserProfile, error)` +`client.Beta.Skills.Versions.Get(ctx, version, params) (*BetaSkillVersionGetResponse, error)` -**post** `/v1/user_profiles/{id}` +**get** `/v1/skills/{skill_id}/versions/{version}` -Update User Profile +Get Skill Version ### Parameters -- `id string` +- `version string` + + Version identifier for the skill. -- `params BetaUserProfileUpdateParams` + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). - - `ExternalID param.Field[string]` +- `params BetaSkillVersionGetParams` - Body param + - `SkillID param.Field[string]` - - `Metadata param.Field[map[string, string]]` + Path param: Unique identifier for the skill. - Body param: Key-value pairs to merge into the stored metadata. Keys provided overwrite existing values. To remove a key, set its value to an empty string. Keys not provided are left unchanged. Maximum 16 keys, with keys up to 64 characters and values up to 512 characters. + The format and length of IDs may change over time. - `Betas param.Field[[]AnthropicBeta]` @@ -47150,31 +69773,53 @@ Update User Profile - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns -- `type BetaUserProfile struct{…}` +- `type BetaSkillVersionGetResponse struct{…}` - `ID string` - - `CreatedAt Time` + Unique identifier for the skill version. - A timestamp in RFC 3339 format + The format and length of IDs may change over time. - - `Metadata map[string, string]` + - `CreatedAt string` + + ISO 8601 timestamp of when the skill version was created. + + - `Description string` + + Description of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + + - `Directory string` + + Directory name of the skill version. + + This is the top-level directory name that was extracted from the uploaded files. + + - `Name string` + + Human-readable name of the skill version. + + This is extracted from the SKILL.md file in the skill upload. - - `TrustGrants map[string, BetaUserProfileTrustGrant]` + - `SkillID string` - - `Status string` + Identifier for the skill that this version belongs to. - `Type string` - - `UpdatedAt Time` + Object type. - A timestamp in RFC 3339 format + For Skill Versions, this is always `"skill_version"`. + + - `Version string` + + Version identifier for the skill. - - `ExternalID string` + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). ### Example @@ -47193,37 +69838,47 @@ func main() { client := anthropic.NewClient( option.WithAPIKey("my-anthropic-api-key"), ) - betaUserProfile, err := client.Beta.UserProfiles.Update( + version, err := client.Beta.Skills.Versions.Get( context.TODO(), - "id", - anthropic.BetaUserProfileUpdateParams{ - + "version", + anthropic.BetaSkillVersionGetParams{ + SkillID: "skill_id", }, ) if err != nil { panic(err.Error()) } - fmt.Printf("%+v\n", betaUserProfile.ID) + fmt.Printf("%+v\n", version.ID) } ``` -## Create Enrollment URL +## Delete -`client.Beta.UserProfiles.NewEnrollmentURL(ctx, id, body) (*BetaUserProfileEnrollmentURL, error)` +`client.Beta.Skills.Versions.Delete(ctx, version, params) (*BetaSkillVersionDeleteResponse, error)` -**post** `/v1/user_profiles/{id}/enrollment_url` +**delete** `/v1/skills/{skill_id}/versions/{version}` -Create Enrollment URL +Delete Skill Version ### Parameters -- `id string` +- `version string` + + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + +- `params BetaSkillVersionDeleteParams` + + - `SkillID param.Field[string]` + + Path param: Unique identifier for the skill. -- `body BetaUserProfileNewEnrollmentURLParams` + The format and length of IDs may change over time. - `Betas param.Field[[]AnthropicBeta]` - Optional header to specify the beta version(s) you want to use. + Header param: Optional header to specify the beta version(s) you want to use. - `string` @@ -47271,19 +69926,21 @@ Create Enrollment URL - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns -- `type BetaUserProfileEnrollmentURL struct{…}` +- `type BetaSkillVersionDeleteResponse struct{…}` - - `ExpiresAt Time` + - `ID string` - A timestamp in RFC 3339 format + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). - `Type string` - - `URL string` + Deleted object type. + + For Skill Versions, this is always `"skill_version_deleted"`. ### Example @@ -47302,60 +69959,16 @@ func main() { client := anthropic.NewClient( option.WithAPIKey("my-anthropic-api-key"), ) - betaUserProfileEnrollmentURL, err := client.Beta.UserProfiles.NewEnrollmentURL( + version, err := client.Beta.Skills.Versions.Delete( context.TODO(), - "id", - anthropic.BetaUserProfileNewEnrollmentURLParams{ - + "version", + anthropic.BetaSkillVersionDeleteParams{ + SkillID: "skill_id", }, ) if err != nil { panic(err.Error()) } - fmt.Printf("%+v\n", betaUserProfileEnrollmentURL.ExpiresAt) + fmt.Printf("%+v\n", version.ID) } ``` - -## Domain Types - -### Beta User Profile - -- `type BetaUserProfile struct{…}` - - - `ID string` - - - `CreatedAt Time` - - A timestamp in RFC 3339 format - - - `Metadata map[string, string]` - - - `TrustGrants map[string, BetaUserProfileTrustGrant]` - - - `Status string` - - - `Type string` - - - `UpdatedAt Time` - - A timestamp in RFC 3339 format - - - `ExternalID string` - -### Beta User Profile Enrollment URL - -- `type BetaUserProfileEnrollmentURL struct{…}` - - - `ExpiresAt Time` - - A timestamp in RFC 3339 format - - - `Type string` - - - `URL string` - -### Beta User Profile Trust Grant - -- `type BetaUserProfileTrustGrant struct{…}` - - - `Status string` diff --git a/content/en/api/go/beta/agents.md b/content/en/api/go/beta/agents.md new file mode 100644 index 000000000..f4349d28d --- /dev/null +++ b/content/en/api/go/beta/agents.md @@ -0,0 +1,4324 @@ +# Agents + +## Create + +`client.Beta.Agents.New(ctx, params) (*BetaManagedAgentsAgent, error)` + +**post** `/v1/agents` + +Create Agent + +### Parameters + +- `params BetaAgentNewParams` + + - `Model param.Field[BetaManagedAgentsModelConfigParamsResp]` + + Body param: Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control + + - `type BetaManagedAgentsModelConfigParamsResp struct{…}` + + An object that defines additional configuration control over model use + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigParamsSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigParamsSpeedStandard BetaManagedAgentsModelConfigParamsSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigParamsSpeedFast BetaManagedAgentsModelConfigParamsSpeed = "fast"` + + - `Name param.Field[string]` + + Body param: Human-readable name for the agent. 1-256 characters. + + - `Description param.Field[string]` + + Body param: Description of what the agent does. Up to 2048 characters. + + - `MCPServers param.Field[[]BetaManagedAgentsURLMCPServerParamsResp]` + + Body param: MCP servers this agent connects to. Maximum 20. Names must be unique within the array. + + - `Name string` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `Type BetaManagedAgentsURLMCPServerParamsType` + + - `const BetaManagedAgentsURLMCPServerParamsTypeURL BetaManagedAgentsURLMCPServerParamsType = "url"` + + - `URL string` + + Endpoint URL for the MCP server. + + - `Metadata param.Field[map[string, string]]` + + Body param: Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars. + + - `Skills param.Field[[]BetaManagedAgentsSkillParamsUnionResp]` + + Body param: Skills available to the agent. Maximum 20. + + - `type BetaManagedAgentsAnthropicSkillParamsResp struct{…}` + + An Anthropic-managed skill. + + - `SkillID string` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `Type BetaManagedAgentsAnthropicSkillParamsType` + + - `const BetaManagedAgentsAnthropicSkillParamsTypeAnthropic BetaManagedAgentsAnthropicSkillParamsType = "anthropic"` + + - `Version string` + + Version to pin. Defaults to latest if omitted. + + - `type BetaManagedAgentsCustomSkillParamsResp struct{…}` + + A user-created custom skill. + + - `SkillID string` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `Type BetaManagedAgentsCustomSkillParamsType` + + - `const BetaManagedAgentsCustomSkillParamsTypeCustom BetaManagedAgentsCustomSkillParamsType = "custom"` + + - `Version string` + + Version to pin. Defaults to latest if omitted. + + - `System param.Field[string]` + + Body param: System prompt for the agent. Up to 100,000 characters. + + - `Tools param.Field[[]BetaAgentNewParamsToolUnion]` + + Body param: Tool configurations available to the agent. Maximum of 128 tools across all toolsets allowed. + + - `type BetaManagedAgentsAgentToolset20260401ParamsResp struct{…}` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `Type BetaManagedAgentsAgentToolset20260401ParamsType` + + - `const BetaManagedAgentsAgentToolset20260401ParamsTypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401ParamsType = "agent_toolset_20260401"` + + - `Configs []BetaManagedAgentsAgentToolConfigParamsResp` + + Per-tool configuration overrides. + + - `Name BetaManagedAgentsAgentToolConfigParamsName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigParamsNameBash BetaManagedAgentsAgentToolConfigParamsName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameEdit BetaManagedAgentsAgentToolConfigParamsName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameRead BetaManagedAgentsAgentToolConfigParamsName = "read"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameWrite BetaManagedAgentsAgentToolConfigParamsName = "write"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameGlob BetaManagedAgentsAgentToolConfigParamsName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameGrep BetaManagedAgentsAgentToolConfigParamsName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameWebFetch BetaManagedAgentsAgentToolConfigParamsName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameWebSearch BetaManagedAgentsAgentToolConfigParamsName = "web_search"` + + - `Enabled bool` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfigParamsResp` + + Default configuration for all tools in a toolset. + + - `Enabled bool` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `type BetaManagedAgentsMCPToolsetParamsResp struct{…}` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `MCPServerName string` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `Type BetaManagedAgentsMCPToolsetParamsType` + + - `const BetaManagedAgentsMCPToolsetParamsTypeMCPToolset BetaManagedAgentsMCPToolsetParamsType = "mcp_toolset"` + + - `Configs []BetaManagedAgentsMCPToolConfigParamsResp` + + Per-tool configuration overrides. + + - `Name string` + + Name of the MCP tool to configure. 1-128 characters. + + - `Enabled bool` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfigParamsResp` + + Default configuration for all tools from an MCP server. + + - `Enabled bool` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `type BetaManagedAgentsCustomToolParamsResp struct{…}` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `Description string` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `Type BetaManagedAgentsCustomToolParamsType` + + - `const BetaManagedAgentsCustomToolParamsTypeCustom BetaManagedAgentsCustomToolParamsType = "custom"` + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsAgent struct{…}` + + A Managed Agents `agent`. + + - `ID string` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Metadata map[string, string]` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsAgentType` + + - `const BetaManagedAgentsAgentTypeAgent BetaManagedAgentsAgentType = "agent"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Version int64` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsAgent, err := client.Beta.Agents.New(context.TODO(), anthropic.BetaAgentNewParams{ + Model: anthropic.BetaManagedAgentsModelConfigParams{ + ID: anthropic.BetaManagedAgentsModelClaudeOpus4_6, + }, + Name: "My First Agent", + }) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsAgent.ID) +} +``` + +## List + +`client.Beta.Agents.List(ctx, params) (*PageCursor[BetaManagedAgentsAgent], error)` + +**get** `/v1/agents` + +List Agents + +### Parameters + +- `params BetaAgentListParams` + + - `CreatedAtGte param.Field[Time]` + + Query param: Return agents created at or after this time (inclusive). + + - `CreatedAtLte param.Field[Time]` + + Query param: Return agents created at or before this time (inclusive). + + - `IncludeArchived param.Field[bool]` + + Query param: Include archived agents in results. Defaults to false. + + - `Limit param.Field[int64]` + + Query param: Maximum results per page. Default 20, maximum 100. + + - `Page param.Field[string]` + + Query param: Opaque pagination cursor from a previous response. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsAgent struct{…}` + + A Managed Agents `agent`. + + - `ID string` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Metadata map[string, string]` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsAgentType` + + - `const BetaManagedAgentsAgentTypeAgent BetaManagedAgentsAgentType = "agent"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Version int64` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Beta.Agents.List(context.TODO(), anthropic.BetaAgentListParams{ + + }) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", page) +} +``` + +## Retrieve + +`client.Beta.Agents.Get(ctx, agentID, params) (*BetaManagedAgentsAgent, error)` + +**get** `/v1/agents/{agent_id}` + +Get Agent + +### Parameters + +- `agentID string` + +- `params BetaAgentGetParams` + + - `Version param.Field[int64]` + + Query param: Agent version. Omit for the most recent version. Must be at least 1 if specified. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsAgent struct{…}` + + A Managed Agents `agent`. + + - `ID string` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Metadata map[string, string]` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsAgentType` + + - `const BetaManagedAgentsAgentTypeAgent BetaManagedAgentsAgentType = "agent"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Version int64` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsAgent, err := client.Beta.Agents.Get( + context.TODO(), + "agent_011CZkYpogX7uDKUyvBTophP", + anthropic.BetaAgentGetParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsAgent.ID) +} +``` + +## Update + +`client.Beta.Agents.Update(ctx, agentID, params) (*BetaManagedAgentsAgent, error)` + +**post** `/v1/agents/{agent_id}` + +Update Agent + +### Parameters + +- `agentID string` + +- `params BetaAgentUpdateParams` + + - `Version param.Field[int64]` + + Body param: The agent's current version, used to prevent concurrent overwrites. Obtain this value from a create or retrieve response. The request fails if this does not match the server's current version. + + - `Description param.Field[string]` + + Body param: Description. Up to 2048 characters. Omit to preserve; send empty string or null to clear. + + - `MCPServers param.Field[[]BetaManagedAgentsURLMCPServerParamsResp]` + + Body param: MCP servers. Full replacement. Omit to preserve; send empty array or null to clear. Names must be unique. Maximum 20. + + - `Name string` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `Type BetaManagedAgentsURLMCPServerParamsType` + + - `const BetaManagedAgentsURLMCPServerParamsTypeURL BetaManagedAgentsURLMCPServerParamsType = "url"` + + - `URL string` + + Endpoint URL for the MCP server. + + - `Metadata param.Field[map[string, string]]` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. The stored bag is limited to 16 keys (up to 64 chars each) with values up to 512 chars. + + - `Model param.Field[BetaManagedAgentsModelConfigParamsResp]` + + Body param: Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control. Omit to preserve. Cannot be cleared. + + - `type BetaManagedAgentsModelConfigParamsResp struct{…}` + + An object that defines additional configuration control over model use + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigParamsSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigParamsSpeedStandard BetaManagedAgentsModelConfigParamsSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigParamsSpeedFast BetaManagedAgentsModelConfigParamsSpeed = "fast"` + + - `Name param.Field[string]` + + Body param: Human-readable name. 1-256 characters. Omit to preserve. Cannot be cleared. + + - `Skills param.Field[[]BetaManagedAgentsSkillParamsUnionResp]` + + Body param: Skills. Full replacement. Omit to preserve; send empty array or null to clear. Maximum 20. + + - `type BetaManagedAgentsAnthropicSkillParamsResp struct{…}` + + An Anthropic-managed skill. + + - `SkillID string` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `Type BetaManagedAgentsAnthropicSkillParamsType` + + - `const BetaManagedAgentsAnthropicSkillParamsTypeAnthropic BetaManagedAgentsAnthropicSkillParamsType = "anthropic"` + + - `Version string` + + Version to pin. Defaults to latest if omitted. + + - `type BetaManagedAgentsCustomSkillParamsResp struct{…}` + + A user-created custom skill. + + - `SkillID string` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `Type BetaManagedAgentsCustomSkillParamsType` + + - `const BetaManagedAgentsCustomSkillParamsTypeCustom BetaManagedAgentsCustomSkillParamsType = "custom"` + + - `Version string` + + Version to pin. Defaults to latest if omitted. + + - `System param.Field[string]` + + Body param: System prompt. Up to 100,000 characters. Omit to preserve; send empty string or null to clear. + + - `Tools param.Field[[]BetaAgentUpdateParamsToolUnion]` + + Body param: Tool configurations available to the agent. Full replacement. Omit to preserve; send empty array or null to clear. Maximum of 128 tools across all toolsets allowed. + + - `type BetaManagedAgentsAgentToolset20260401ParamsResp struct{…}` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `Type BetaManagedAgentsAgentToolset20260401ParamsType` + + - `const BetaManagedAgentsAgentToolset20260401ParamsTypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401ParamsType = "agent_toolset_20260401"` + + - `Configs []BetaManagedAgentsAgentToolConfigParamsResp` + + Per-tool configuration overrides. + + - `Name BetaManagedAgentsAgentToolConfigParamsName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigParamsNameBash BetaManagedAgentsAgentToolConfigParamsName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameEdit BetaManagedAgentsAgentToolConfigParamsName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameRead BetaManagedAgentsAgentToolConfigParamsName = "read"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameWrite BetaManagedAgentsAgentToolConfigParamsName = "write"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameGlob BetaManagedAgentsAgentToolConfigParamsName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameGrep BetaManagedAgentsAgentToolConfigParamsName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameWebFetch BetaManagedAgentsAgentToolConfigParamsName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameWebSearch BetaManagedAgentsAgentToolConfigParamsName = "web_search"` + + - `Enabled bool` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfigParamsResp` + + Default configuration for all tools in a toolset. + + - `Enabled bool` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `type BetaManagedAgentsMCPToolsetParamsResp struct{…}` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `MCPServerName string` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `Type BetaManagedAgentsMCPToolsetParamsType` + + - `const BetaManagedAgentsMCPToolsetParamsTypeMCPToolset BetaManagedAgentsMCPToolsetParamsType = "mcp_toolset"` + + - `Configs []BetaManagedAgentsMCPToolConfigParamsResp` + + Per-tool configuration overrides. + + - `Name string` + + Name of the MCP tool to configure. 1-128 characters. + + - `Enabled bool` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfigParamsResp` + + Default configuration for all tools from an MCP server. + + - `Enabled bool` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `type BetaManagedAgentsCustomToolParamsResp struct{…}` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `Description string` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `Type BetaManagedAgentsCustomToolParamsType` + + - `const BetaManagedAgentsCustomToolParamsTypeCustom BetaManagedAgentsCustomToolParamsType = "custom"` + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsAgent struct{…}` + + A Managed Agents `agent`. + + - `ID string` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Metadata map[string, string]` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsAgentType` + + - `const BetaManagedAgentsAgentTypeAgent BetaManagedAgentsAgentType = "agent"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Version int64` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsAgent, err := client.Beta.Agents.Update( + context.TODO(), + "agent_011CZkYpogX7uDKUyvBTophP", + anthropic.BetaAgentUpdateParams{ + Version: 1, + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsAgent.ID) +} +``` + +## Archive + +`client.Beta.Agents.Archive(ctx, agentID, body) (*BetaManagedAgentsAgent, error)` + +**post** `/v1/agents/{agent_id}/archive` + +Archive Agent + +### Parameters + +- `agentID string` + +- `body BetaAgentArchiveParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsAgent struct{…}` + + A Managed Agents `agent`. + + - `ID string` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Metadata map[string, string]` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsAgentType` + + - `const BetaManagedAgentsAgentTypeAgent BetaManagedAgentsAgentType = "agent"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Version int64` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsAgent, err := client.Beta.Agents.Archive( + context.TODO(), + "agent_011CZkYpogX7uDKUyvBTophP", + anthropic.BetaAgentArchiveParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsAgent.ID) +} +``` + +## Domain Types + +### Beta Managed Agents Agent + +- `type BetaManagedAgentsAgent struct{…}` + + A Managed Agents `agent`. + + - `ID string` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Metadata map[string, string]` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsAgentType` + + - `const BetaManagedAgentsAgentTypeAgent BetaManagedAgentsAgentType = "agent"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Version int64` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Beta Managed Agents Agent Tool Config + +- `type BetaManagedAgentsAgentToolConfig struct{…}` + + Configuration for a specific agent tool. + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + +### Beta Managed Agents Agent Tool Config Params + +- `type BetaManagedAgentsAgentToolConfigParamsResp struct{…}` + + Configuration override for a specific tool within a toolset. + + - `Name BetaManagedAgentsAgentToolConfigParamsName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigParamsNameBash BetaManagedAgentsAgentToolConfigParamsName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameEdit BetaManagedAgentsAgentToolConfigParamsName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameRead BetaManagedAgentsAgentToolConfigParamsName = "read"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameWrite BetaManagedAgentsAgentToolConfigParamsName = "write"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameGlob BetaManagedAgentsAgentToolConfigParamsName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameGrep BetaManagedAgentsAgentToolConfigParamsName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameWebFetch BetaManagedAgentsAgentToolConfigParamsName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameWebSearch BetaManagedAgentsAgentToolConfigParamsName = "web_search"` + + - `Enabled bool` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + +### Beta Managed Agents Agent Toolset Default Config + +- `type BetaManagedAgentsAgentToolsetDefaultConfig struct{…}` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + +### Beta Managed Agents Agent Toolset Default Config Params + +- `type BetaManagedAgentsAgentToolsetDefaultConfigParamsResp struct{…}` + + Default configuration for all tools in a toolset. + + - `Enabled bool` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + +### Beta Managed Agents Agent Toolset20260401 + +- `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + +### Beta Managed Agents Agent Toolset20260401 Params + +- `type BetaManagedAgentsAgentToolset20260401ParamsResp struct{…}` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `Type BetaManagedAgentsAgentToolset20260401ParamsType` + + - `const BetaManagedAgentsAgentToolset20260401ParamsTypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401ParamsType = "agent_toolset_20260401"` + + - `Configs []BetaManagedAgentsAgentToolConfigParamsResp` + + Per-tool configuration overrides. + + - `Name BetaManagedAgentsAgentToolConfigParamsName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigParamsNameBash BetaManagedAgentsAgentToolConfigParamsName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameEdit BetaManagedAgentsAgentToolConfigParamsName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameRead BetaManagedAgentsAgentToolConfigParamsName = "read"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameWrite BetaManagedAgentsAgentToolConfigParamsName = "write"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameGlob BetaManagedAgentsAgentToolConfigParamsName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameGrep BetaManagedAgentsAgentToolConfigParamsName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameWebFetch BetaManagedAgentsAgentToolConfigParamsName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameWebSearch BetaManagedAgentsAgentToolConfigParamsName = "web_search"` + + - `Enabled bool` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfigParamsResp` + + Default configuration for all tools in a toolset. + + - `Enabled bool` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + +### Beta Managed Agents Always Allow Policy + +- `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + +### Beta Managed Agents Always Ask Policy + +- `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + +### Beta Managed Agents Anthropic Skill + +- `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + +### Beta Managed Agents Anthropic Skill Params + +- `type BetaManagedAgentsAnthropicSkillParamsResp struct{…}` + + An Anthropic-managed skill. + + - `SkillID string` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `Type BetaManagedAgentsAnthropicSkillParamsType` + + - `const BetaManagedAgentsAnthropicSkillParamsTypeAnthropic BetaManagedAgentsAnthropicSkillParamsType = "anthropic"` + + - `Version string` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents Custom Skill + +- `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + +### Beta Managed Agents Custom Skill Params + +- `type BetaManagedAgentsCustomSkillParamsResp struct{…}` + + A user-created custom skill. + + - `SkillID string` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `Type BetaManagedAgentsCustomSkillParamsType` + + - `const BetaManagedAgentsCustomSkillParamsTypeCustom BetaManagedAgentsCustomSkillParamsType = "custom"` + + - `Version string` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents Custom Tool + +- `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + +### Beta Managed Agents Custom Tool Input Schema + +- `type BetaManagedAgentsCustomToolInputSchema struct{…}` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + +### Beta Managed Agents Custom Tool Params + +- `type BetaManagedAgentsCustomToolParamsResp struct{…}` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `Description string` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `Type BetaManagedAgentsCustomToolParamsType` + + - `const BetaManagedAgentsCustomToolParamsTypeCustom BetaManagedAgentsCustomToolParamsType = "custom"` + +### Beta Managed Agents MCP Server URL Definition + +- `type BetaManagedAgentsMCPServerURLDefinition struct{…}` + + URL-based MCP server connection as returned in API responses. + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + +### Beta Managed Agents MCP Tool Config + +- `type BetaManagedAgentsMCPToolConfig struct{…}` + + Resolved configuration for a specific MCP tool. + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + +### Beta Managed Agents MCP Tool Config Params + +- `type BetaManagedAgentsMCPToolConfigParamsResp struct{…}` + + Configuration override for a specific MCP tool. + + - `Name string` + + Name of the MCP tool to configure. 1-128 characters. + + - `Enabled bool` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + +### Beta Managed Agents MCP Toolset + +- `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + +### Beta Managed Agents MCP Toolset Default Config + +- `type BetaManagedAgentsMCPToolsetDefaultConfig struct{…}` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + +### Beta Managed Agents MCP Toolset Default Config Params + +- `type BetaManagedAgentsMCPToolsetDefaultConfigParamsResp struct{…}` + + Default configuration for all tools from an MCP server. + + - `Enabled bool` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + +### Beta Managed Agents MCP Toolset Params + +- `type BetaManagedAgentsMCPToolsetParamsResp struct{…}` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `MCPServerName string` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `Type BetaManagedAgentsMCPToolsetParamsType` + + - `const BetaManagedAgentsMCPToolsetParamsTypeMCPToolset BetaManagedAgentsMCPToolsetParamsType = "mcp_toolset"` + + - `Configs []BetaManagedAgentsMCPToolConfigParamsResp` + + Per-tool configuration overrides. + + - `Name string` + + Name of the MCP tool to configure. 1-128 characters. + + - `Enabled bool` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfigParamsResp` + + Default configuration for all tools from an MCP server. + + - `Enabled bool` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + +### Beta Managed Agents Model + +- `type BetaManagedAgentsModel interface{…}` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + +### Beta Managed Agents Model Config + +- `type BetaManagedAgentsModelConfig struct{…}` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + +### Beta Managed Agents Model Config Params + +- `type BetaManagedAgentsModelConfigParamsResp struct{…}` + + An object that defines additional configuration control over model use + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigParamsSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigParamsSpeedStandard BetaManagedAgentsModelConfigParamsSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigParamsSpeedFast BetaManagedAgentsModelConfigParamsSpeed = "fast"` + +### Beta Managed Agents Skill Params + +- `type BetaManagedAgentsSkillParamsUnionResp interface{…}` + + Skill to load in the session container. + + - `type BetaManagedAgentsAnthropicSkillParamsResp struct{…}` + + An Anthropic-managed skill. + + - `SkillID string` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `Type BetaManagedAgentsAnthropicSkillParamsType` + + - `const BetaManagedAgentsAnthropicSkillParamsTypeAnthropic BetaManagedAgentsAnthropicSkillParamsType = "anthropic"` + + - `Version string` + + Version to pin. Defaults to latest if omitted. + + - `type BetaManagedAgentsCustomSkillParamsResp struct{…}` + + A user-created custom skill. + + - `SkillID string` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `Type BetaManagedAgentsCustomSkillParamsType` + + - `const BetaManagedAgentsCustomSkillParamsTypeCustom BetaManagedAgentsCustomSkillParamsType = "custom"` + + - `Version string` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents URL MCP Server Params + +- `type BetaManagedAgentsURLMCPServerParamsResp struct{…}` + + URL-based MCP server connection. + + - `Name string` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `Type BetaManagedAgentsURLMCPServerParamsType` + + - `const BetaManagedAgentsURLMCPServerParamsTypeURL BetaManagedAgentsURLMCPServerParamsType = "url"` + + - `URL string` + + Endpoint URL for the MCP server. + +# Versions + +## List + +`client.Beta.Agents.Versions.List(ctx, agentID, params) (*PageCursor[BetaManagedAgentsAgent], error)` + +**get** `/v1/agents/{agent_id}/versions` + +List Agent Versions + +### Parameters + +- `agentID string` + +- `params BetaAgentVersionListParams` + + - `Limit param.Field[int64]` + + Query param: Maximum results per page. Default 20, maximum 100. + + - `Page param.Field[string]` + + Query param: Opaque pagination cursor. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsAgent struct{…}` + + A Managed Agents `agent`. + + - `ID string` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Metadata map[string, string]` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsAgentType` + + - `const BetaManagedAgentsAgentTypeAgent BetaManagedAgentsAgentType = "agent"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Version int64` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Beta.Agents.Versions.List( + context.TODO(), + "agent_011CZkYpogX7uDKUyvBTophP", + anthropic.BetaAgentVersionListParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", page) +} +``` diff --git a/content/en/api/go/beta/agents/archive.md b/content/en/api/go/beta/agents/archive.md new file mode 100644 index 000000000..934a57009 --- /dev/null +++ b/content/en/api/go/beta/agents/archive.md @@ -0,0 +1,392 @@ +## Archive + +`client.Beta.Agents.Archive(ctx, agentID, body) (*BetaManagedAgentsAgent, error)` + +**post** `/v1/agents/{agent_id}/archive` + +Archive Agent + +### Parameters + +- `agentID string` + +- `body BetaAgentArchiveParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsAgent struct{…}` + + A Managed Agents `agent`. + + - `ID string` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Metadata map[string, string]` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsAgentType` + + - `const BetaManagedAgentsAgentTypeAgent BetaManagedAgentsAgentType = "agent"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Version int64` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsAgent, err := client.Beta.Agents.Archive( + context.TODO(), + "agent_011CZkYpogX7uDKUyvBTophP", + anthropic.BetaAgentArchiveParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsAgent.ID) +} +``` diff --git a/content/en/api/go/beta/agents/create.md b/content/en/api/go/beta/agents/create.md new file mode 100644 index 000000000..126958857 --- /dev/null +++ b/content/en/api/go/beta/agents/create.md @@ -0,0 +1,713 @@ +## Create + +`client.Beta.Agents.New(ctx, params) (*BetaManagedAgentsAgent, error)` + +**post** `/v1/agents` + +Create Agent + +### Parameters + +- `params BetaAgentNewParams` + + - `Model param.Field[BetaManagedAgentsModelConfigParamsResp]` + + Body param: Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control + + - `type BetaManagedAgentsModelConfigParamsResp struct{…}` + + An object that defines additional configuration control over model use + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigParamsSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigParamsSpeedStandard BetaManagedAgentsModelConfigParamsSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigParamsSpeedFast BetaManagedAgentsModelConfigParamsSpeed = "fast"` + + - `Name param.Field[string]` + + Body param: Human-readable name for the agent. 1-256 characters. + + - `Description param.Field[string]` + + Body param: Description of what the agent does. Up to 2048 characters. + + - `MCPServers param.Field[[]BetaManagedAgentsURLMCPServerParamsResp]` + + Body param: MCP servers this agent connects to. Maximum 20. Names must be unique within the array. + + - `Name string` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `Type BetaManagedAgentsURLMCPServerParamsType` + + - `const BetaManagedAgentsURLMCPServerParamsTypeURL BetaManagedAgentsURLMCPServerParamsType = "url"` + + - `URL string` + + Endpoint URL for the MCP server. + + - `Metadata param.Field[map[string, string]]` + + Body param: Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars. + + - `Skills param.Field[[]BetaManagedAgentsSkillParamsUnionResp]` + + Body param: Skills available to the agent. Maximum 20. + + - `type BetaManagedAgentsAnthropicSkillParamsResp struct{…}` + + An Anthropic-managed skill. + + - `SkillID string` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `Type BetaManagedAgentsAnthropicSkillParamsType` + + - `const BetaManagedAgentsAnthropicSkillParamsTypeAnthropic BetaManagedAgentsAnthropicSkillParamsType = "anthropic"` + + - `Version string` + + Version to pin. Defaults to latest if omitted. + + - `type BetaManagedAgentsCustomSkillParamsResp struct{…}` + + A user-created custom skill. + + - `SkillID string` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `Type BetaManagedAgentsCustomSkillParamsType` + + - `const BetaManagedAgentsCustomSkillParamsTypeCustom BetaManagedAgentsCustomSkillParamsType = "custom"` + + - `Version string` + + Version to pin. Defaults to latest if omitted. + + - `System param.Field[string]` + + Body param: System prompt for the agent. Up to 100,000 characters. + + - `Tools param.Field[[]BetaAgentNewParamsToolUnion]` + + Body param: Tool configurations available to the agent. Maximum of 128 tools across all toolsets allowed. + + - `type BetaManagedAgentsAgentToolset20260401ParamsResp struct{…}` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `Type BetaManagedAgentsAgentToolset20260401ParamsType` + + - `const BetaManagedAgentsAgentToolset20260401ParamsTypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401ParamsType = "agent_toolset_20260401"` + + - `Configs []BetaManagedAgentsAgentToolConfigParamsResp` + + Per-tool configuration overrides. + + - `Name BetaManagedAgentsAgentToolConfigParamsName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigParamsNameBash BetaManagedAgentsAgentToolConfigParamsName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameEdit BetaManagedAgentsAgentToolConfigParamsName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameRead BetaManagedAgentsAgentToolConfigParamsName = "read"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameWrite BetaManagedAgentsAgentToolConfigParamsName = "write"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameGlob BetaManagedAgentsAgentToolConfigParamsName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameGrep BetaManagedAgentsAgentToolConfigParamsName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameWebFetch BetaManagedAgentsAgentToolConfigParamsName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameWebSearch BetaManagedAgentsAgentToolConfigParamsName = "web_search"` + + - `Enabled bool` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfigParamsResp` + + Default configuration for all tools in a toolset. + + - `Enabled bool` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `type BetaManagedAgentsMCPToolsetParamsResp struct{…}` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `MCPServerName string` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `Type BetaManagedAgentsMCPToolsetParamsType` + + - `const BetaManagedAgentsMCPToolsetParamsTypeMCPToolset BetaManagedAgentsMCPToolsetParamsType = "mcp_toolset"` + + - `Configs []BetaManagedAgentsMCPToolConfigParamsResp` + + Per-tool configuration overrides. + + - `Name string` + + Name of the MCP tool to configure. 1-128 characters. + + - `Enabled bool` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfigParamsResp` + + Default configuration for all tools from an MCP server. + + - `Enabled bool` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `type BetaManagedAgentsCustomToolParamsResp struct{…}` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `Description string` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `Type BetaManagedAgentsCustomToolParamsType` + + - `const BetaManagedAgentsCustomToolParamsTypeCustom BetaManagedAgentsCustomToolParamsType = "custom"` + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsAgent struct{…}` + + A Managed Agents `agent`. + + - `ID string` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Metadata map[string, string]` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsAgentType` + + - `const BetaManagedAgentsAgentTypeAgent BetaManagedAgentsAgentType = "agent"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Version int64` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsAgent, err := client.Beta.Agents.New(context.TODO(), anthropic.BetaAgentNewParams{ + Model: anthropic.BetaManagedAgentsModelConfigParams{ + ID: anthropic.BetaManagedAgentsModelClaudeOpus4_6, + }, + Name: "My First Agent", + }) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsAgent.ID) +} +``` diff --git a/content/en/api/go/beta/agents/list.md b/content/en/api/go/beta/agents/list.md new file mode 100644 index 000000000..f4179ad52 --- /dev/null +++ b/content/en/api/go/beta/agents/list.md @@ -0,0 +1,406 @@ +## List + +`client.Beta.Agents.List(ctx, params) (*PageCursor[BetaManagedAgentsAgent], error)` + +**get** `/v1/agents` + +List Agents + +### Parameters + +- `params BetaAgentListParams` + + - `CreatedAtGte param.Field[Time]` + + Query param: Return agents created at or after this time (inclusive). + + - `CreatedAtLte param.Field[Time]` + + Query param: Return agents created at or before this time (inclusive). + + - `IncludeArchived param.Field[bool]` + + Query param: Include archived agents in results. Defaults to false. + + - `Limit param.Field[int64]` + + Query param: Maximum results per page. Default 20, maximum 100. + + - `Page param.Field[string]` + + Query param: Opaque pagination cursor from a previous response. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsAgent struct{…}` + + A Managed Agents `agent`. + + - `ID string` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Metadata map[string, string]` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsAgentType` + + - `const BetaManagedAgentsAgentTypeAgent BetaManagedAgentsAgentType = "agent"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Version int64` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Beta.Agents.List(context.TODO(), anthropic.BetaAgentListParams{ + + }) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", page) +} +``` diff --git a/content/en/api/go/beta/agents/retrieve.md b/content/en/api/go/beta/agents/retrieve.md new file mode 100644 index 000000000..2545765bf --- /dev/null +++ b/content/en/api/go/beta/agents/retrieve.md @@ -0,0 +1,396 @@ +## Retrieve + +`client.Beta.Agents.Get(ctx, agentID, params) (*BetaManagedAgentsAgent, error)` + +**get** `/v1/agents/{agent_id}` + +Get Agent + +### Parameters + +- `agentID string` + +- `params BetaAgentGetParams` + + - `Version param.Field[int64]` + + Query param: Agent version. Omit for the most recent version. Must be at least 1 if specified. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsAgent struct{…}` + + A Managed Agents `agent`. + + - `ID string` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Metadata map[string, string]` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsAgentType` + + - `const BetaManagedAgentsAgentTypeAgent BetaManagedAgentsAgentType = "agent"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Version int64` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsAgent, err := client.Beta.Agents.Get( + context.TODO(), + "agent_011CZkYpogX7uDKUyvBTophP", + anthropic.BetaAgentGetParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsAgent.ID) +} +``` diff --git a/content/en/api/go/beta/agents/update.md b/content/en/api/go/beta/agents/update.md new file mode 100644 index 000000000..d3d60b703 --- /dev/null +++ b/content/en/api/go/beta/agents/update.md @@ -0,0 +1,720 @@ +## Update + +`client.Beta.Agents.Update(ctx, agentID, params) (*BetaManagedAgentsAgent, error)` + +**post** `/v1/agents/{agent_id}` + +Update Agent + +### Parameters + +- `agentID string` + +- `params BetaAgentUpdateParams` + + - `Version param.Field[int64]` + + Body param: The agent's current version, used to prevent concurrent overwrites. Obtain this value from a create or retrieve response. The request fails if this does not match the server's current version. + + - `Description param.Field[string]` + + Body param: Description. Up to 2048 characters. Omit to preserve; send empty string or null to clear. + + - `MCPServers param.Field[[]BetaManagedAgentsURLMCPServerParamsResp]` + + Body param: MCP servers. Full replacement. Omit to preserve; send empty array or null to clear. Names must be unique. Maximum 20. + + - `Name string` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `Type BetaManagedAgentsURLMCPServerParamsType` + + - `const BetaManagedAgentsURLMCPServerParamsTypeURL BetaManagedAgentsURLMCPServerParamsType = "url"` + + - `URL string` + + Endpoint URL for the MCP server. + + - `Metadata param.Field[map[string, string]]` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. The stored bag is limited to 16 keys (up to 64 chars each) with values up to 512 chars. + + - `Model param.Field[BetaManagedAgentsModelConfigParamsResp]` + + Body param: Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control. Omit to preserve. Cannot be cleared. + + - `type BetaManagedAgentsModelConfigParamsResp struct{…}` + + An object that defines additional configuration control over model use + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigParamsSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigParamsSpeedStandard BetaManagedAgentsModelConfigParamsSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigParamsSpeedFast BetaManagedAgentsModelConfigParamsSpeed = "fast"` + + - `Name param.Field[string]` + + Body param: Human-readable name. 1-256 characters. Omit to preserve. Cannot be cleared. + + - `Skills param.Field[[]BetaManagedAgentsSkillParamsUnionResp]` + + Body param: Skills. Full replacement. Omit to preserve; send empty array or null to clear. Maximum 20. + + - `type BetaManagedAgentsAnthropicSkillParamsResp struct{…}` + + An Anthropic-managed skill. + + - `SkillID string` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `Type BetaManagedAgentsAnthropicSkillParamsType` + + - `const BetaManagedAgentsAnthropicSkillParamsTypeAnthropic BetaManagedAgentsAnthropicSkillParamsType = "anthropic"` + + - `Version string` + + Version to pin. Defaults to latest if omitted. + + - `type BetaManagedAgentsCustomSkillParamsResp struct{…}` + + A user-created custom skill. + + - `SkillID string` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `Type BetaManagedAgentsCustomSkillParamsType` + + - `const BetaManagedAgentsCustomSkillParamsTypeCustom BetaManagedAgentsCustomSkillParamsType = "custom"` + + - `Version string` + + Version to pin. Defaults to latest if omitted. + + - `System param.Field[string]` + + Body param: System prompt. Up to 100,000 characters. Omit to preserve; send empty string or null to clear. + + - `Tools param.Field[[]BetaAgentUpdateParamsToolUnion]` + + Body param: Tool configurations available to the agent. Full replacement. Omit to preserve; send empty array or null to clear. Maximum of 128 tools across all toolsets allowed. + + - `type BetaManagedAgentsAgentToolset20260401ParamsResp struct{…}` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `Type BetaManagedAgentsAgentToolset20260401ParamsType` + + - `const BetaManagedAgentsAgentToolset20260401ParamsTypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401ParamsType = "agent_toolset_20260401"` + + - `Configs []BetaManagedAgentsAgentToolConfigParamsResp` + + Per-tool configuration overrides. + + - `Name BetaManagedAgentsAgentToolConfigParamsName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigParamsNameBash BetaManagedAgentsAgentToolConfigParamsName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameEdit BetaManagedAgentsAgentToolConfigParamsName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameRead BetaManagedAgentsAgentToolConfigParamsName = "read"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameWrite BetaManagedAgentsAgentToolConfigParamsName = "write"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameGlob BetaManagedAgentsAgentToolConfigParamsName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameGrep BetaManagedAgentsAgentToolConfigParamsName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameWebFetch BetaManagedAgentsAgentToolConfigParamsName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigParamsNameWebSearch BetaManagedAgentsAgentToolConfigParamsName = "web_search"` + + - `Enabled bool` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfigParamsResp` + + Default configuration for all tools in a toolset. + + - `Enabled bool` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `type BetaManagedAgentsMCPToolsetParamsResp struct{…}` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `MCPServerName string` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `Type BetaManagedAgentsMCPToolsetParamsType` + + - `const BetaManagedAgentsMCPToolsetParamsTypeMCPToolset BetaManagedAgentsMCPToolsetParamsType = "mcp_toolset"` + + - `Configs []BetaManagedAgentsMCPToolConfigParamsResp` + + Per-tool configuration overrides. + + - `Name string` + + Name of the MCP tool to configure. 1-128 characters. + + - `Enabled bool` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfigParamsResp` + + Default configuration for all tools from an MCP server. + + - `Enabled bool` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigParamsPermissionPolicyUnionResp` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `type BetaManagedAgentsCustomToolParamsResp struct{…}` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `Description string` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `Type BetaManagedAgentsCustomToolParamsType` + + - `const BetaManagedAgentsCustomToolParamsTypeCustom BetaManagedAgentsCustomToolParamsType = "custom"` + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsAgent struct{…}` + + A Managed Agents `agent`. + + - `ID string` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Metadata map[string, string]` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsAgentType` + + - `const BetaManagedAgentsAgentTypeAgent BetaManagedAgentsAgentType = "agent"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Version int64` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsAgent, err := client.Beta.Agents.Update( + context.TODO(), + "agent_011CZkYpogX7uDKUyvBTophP", + anthropic.BetaAgentUpdateParams{ + Version: 1, + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsAgent.ID) +} +``` diff --git a/content/en/api/go/beta/agents/versions.md b/content/en/api/go/beta/agents/versions.md new file mode 100644 index 000000000..11d87b4ab --- /dev/null +++ b/content/en/api/go/beta/agents/versions.md @@ -0,0 +1,402 @@ +# Versions + +## List + +`client.Beta.Agents.Versions.List(ctx, agentID, params) (*PageCursor[BetaManagedAgentsAgent], error)` + +**get** `/v1/agents/{agent_id}/versions` + +List Agent Versions + +### Parameters + +- `agentID string` + +- `params BetaAgentVersionListParams` + + - `Limit param.Field[int64]` + + Query param: Maximum results per page. Default 20, maximum 100. + + - `Page param.Field[string]` + + Query param: Opaque pagination cursor. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsAgent struct{…}` + + A Managed Agents `agent`. + + - `ID string` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Metadata map[string, string]` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsAgentType` + + - `const BetaManagedAgentsAgentTypeAgent BetaManagedAgentsAgentType = "agent"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Version int64` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Beta.Agents.Versions.List( + context.TODO(), + "agent_011CZkYpogX7uDKUyvBTophP", + anthropic.BetaAgentVersionListParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", page) +} +``` diff --git a/content/en/api/go/beta/agents/versions/list.md b/content/en/api/go/beta/agents/versions/list.md new file mode 100644 index 000000000..b8af24043 --- /dev/null +++ b/content/en/api/go/beta/agents/versions/list.md @@ -0,0 +1,400 @@ +## List + +`client.Beta.Agents.Versions.List(ctx, agentID, params) (*PageCursor[BetaManagedAgentsAgent], error)` + +**get** `/v1/agents/{agent_id}/versions` + +List Agent Versions + +### Parameters + +- `agentID string` + +- `params BetaAgentVersionListParams` + + - `Limit param.Field[int64]` + + Query param: Maximum results per page. Default 20, maximum 100. + + - `Page param.Field[string]` + + Query param: Opaque pagination cursor. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsAgent struct{…}` + + A Managed Agents `agent`. + + - `ID string` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Metadata map[string, string]` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsAgentType` + + - `const BetaManagedAgentsAgentTypeAgent BetaManagedAgentsAgentType = "agent"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Version int64` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Beta.Agents.Versions.List( + context.TODO(), + "agent_011CZkYpogX7uDKUyvBTophP", + anthropic.BetaAgentVersionListParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", page) +} +``` diff --git a/content/en/api/go/beta/environments.md b/content/en/api/go/beta/environments.md new file mode 100644 index 000000000..ceef51481 --- /dev/null +++ b/content/en/api/go/beta/environments.md @@ -0,0 +1,1672 @@ +# Environments + +## Create + +`client.Beta.Environments.New(ctx, params) (*BetaEnvironment, error)` + +**post** `/v1/environments` + +Create a new environment with the specified configuration. + +### Parameters + +- `params BetaEnvironmentNewParams` + + - `Name param.Field[string]` + + Body param: Human-readable name for the environment + + - `Config param.Field[BetaCloudConfigParamsResp]` + + Body param: Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `Description param.Field[string]` + + Body param: Optional description of the environment + + - `Metadata param.Field[map[string, string]]` + + Body param: User-provided metadata key-value pairs + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaEnvironment struct{…}` + + Unified Environment resource for both cloud and BYOC environments. + + - `ID string` + + Environment identifier (e.g., 'env_...') + + - `ArchivedAt string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `Config BetaCloudConfig` + + `cloud` environment configuration. + + - `Networking BetaCloudConfigNetworkingUnion` + + Network configuration policy. + + - `type BetaUnrestrictedNetwork struct{…}` + + Unrestricted network access. + + - `Type Unrestricted` + + Network policy type + + - `const UnrestrictedUnrestricted Unrestricted = "unrestricted"` + + - `type BetaLimitedNetwork struct{…}` + + Limited network access. + + - `AllowMCPServers bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `AllowPackageManagers bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `AllowedHosts []string` + + Specifies domains the container can reach. + + - `Type Limited` + + Network policy type + + - `const LimitedLimited Limited = "limited"` + + - `Packages BetaPackages` + + Package manager configuration. + + - `Apt []string` + + Ubuntu/Debian packages to install + + - `Cargo []string` + + Rust packages to install + + - `Gem []string` + + Ruby packages to install + + - `Go []string` + + Go packages to install + + - `Npm []string` + + Node.js packages to install + + - `Pip []string` + + Python packages to install + + - `Type BetaPackagesType` + + Package configuration type + + - `const BetaPackagesTypePackages BetaPackagesType = "packages"` + + - `Type Cloud` + + Environment type + + - `const CloudCloud Cloud = "cloud"` + + - `CreatedAt string` + + RFC 3339 timestamp when environment was created + + - `Description string` + + User-provided description for the environment + + - `Metadata map[string, string]` + + User-provided metadata key-value pairs + + - `Name string` + + Human-readable name for the environment + + - `Type Environment` + + The type of object (always 'environment') + + - `const EnvironmentEnvironment Environment = "environment"` + + - `UpdatedAt string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaEnvironment, err := client.Beta.Environments.New(context.TODO(), anthropic.BetaEnvironmentNewParams{ + Name: "python-data-analysis", + }) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaEnvironment.ID) +} +``` + +## List + +`client.Beta.Environments.List(ctx, params) (*PageCursor[BetaEnvironment], error)` + +**get** `/v1/environments` + +List environments with pagination support. + +### Parameters + +- `params BetaEnvironmentListParams` + + - `IncludeArchived param.Field[bool]` + + Query param: Include archived environments in the response + + - `Limit param.Field[int64]` + + Query param: Maximum number of environments to return + + - `Page param.Field[string]` + + Query param: Opaque cursor from previous response for pagination. Pass the `next_page` value from the previous response. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaEnvironment struct{…}` + + Unified Environment resource for both cloud and BYOC environments. + + - `ID string` + + Environment identifier (e.g., 'env_...') + + - `ArchivedAt string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `Config BetaCloudConfig` + + `cloud` environment configuration. + + - `Networking BetaCloudConfigNetworkingUnion` + + Network configuration policy. + + - `type BetaUnrestrictedNetwork struct{…}` + + Unrestricted network access. + + - `Type Unrestricted` + + Network policy type + + - `const UnrestrictedUnrestricted Unrestricted = "unrestricted"` + + - `type BetaLimitedNetwork struct{…}` + + Limited network access. + + - `AllowMCPServers bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `AllowPackageManagers bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `AllowedHosts []string` + + Specifies domains the container can reach. + + - `Type Limited` + + Network policy type + + - `const LimitedLimited Limited = "limited"` + + - `Packages BetaPackages` + + Package manager configuration. + + - `Apt []string` + + Ubuntu/Debian packages to install + + - `Cargo []string` + + Rust packages to install + + - `Gem []string` + + Ruby packages to install + + - `Go []string` + + Go packages to install + + - `Npm []string` + + Node.js packages to install + + - `Pip []string` + + Python packages to install + + - `Type BetaPackagesType` + + Package configuration type + + - `const BetaPackagesTypePackages BetaPackagesType = "packages"` + + - `Type Cloud` + + Environment type + + - `const CloudCloud Cloud = "cloud"` + + - `CreatedAt string` + + RFC 3339 timestamp when environment was created + + - `Description string` + + User-provided description for the environment + + - `Metadata map[string, string]` + + User-provided metadata key-value pairs + + - `Name string` + + Human-readable name for the environment + + - `Type Environment` + + The type of object (always 'environment') + + - `const EnvironmentEnvironment Environment = "environment"` + + - `UpdatedAt string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Beta.Environments.List(context.TODO(), anthropic.BetaEnvironmentListParams{ + + }) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", page) +} +``` + +## Retrieve + +`client.Beta.Environments.Get(ctx, environmentID, query) (*BetaEnvironment, error)` + +**get** `/v1/environments/{environment_id}` + +Retrieve a specific environment by ID. + +### Parameters + +- `environmentID string` + +- `query BetaEnvironmentGetParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaEnvironment struct{…}` + + Unified Environment resource for both cloud and BYOC environments. + + - `ID string` + + Environment identifier (e.g., 'env_...') + + - `ArchivedAt string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `Config BetaCloudConfig` + + `cloud` environment configuration. + + - `Networking BetaCloudConfigNetworkingUnion` + + Network configuration policy. + + - `type BetaUnrestrictedNetwork struct{…}` + + Unrestricted network access. + + - `Type Unrestricted` + + Network policy type + + - `const UnrestrictedUnrestricted Unrestricted = "unrestricted"` + + - `type BetaLimitedNetwork struct{…}` + + Limited network access. + + - `AllowMCPServers bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `AllowPackageManagers bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `AllowedHosts []string` + + Specifies domains the container can reach. + + - `Type Limited` + + Network policy type + + - `const LimitedLimited Limited = "limited"` + + - `Packages BetaPackages` + + Package manager configuration. + + - `Apt []string` + + Ubuntu/Debian packages to install + + - `Cargo []string` + + Rust packages to install + + - `Gem []string` + + Ruby packages to install + + - `Go []string` + + Go packages to install + + - `Npm []string` + + Node.js packages to install + + - `Pip []string` + + Python packages to install + + - `Type BetaPackagesType` + + Package configuration type + + - `const BetaPackagesTypePackages BetaPackagesType = "packages"` + + - `Type Cloud` + + Environment type + + - `const CloudCloud Cloud = "cloud"` + + - `CreatedAt string` + + RFC 3339 timestamp when environment was created + + - `Description string` + + User-provided description for the environment + + - `Metadata map[string, string]` + + User-provided metadata key-value pairs + + - `Name string` + + Human-readable name for the environment + + - `Type Environment` + + The type of object (always 'environment') + + - `const EnvironmentEnvironment Environment = "environment"` + + - `UpdatedAt string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaEnvironment, err := client.Beta.Environments.Get( + context.TODO(), + "env_011CZkZ9X2dpNyB7HsEFoRfW", + anthropic.BetaEnvironmentGetParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaEnvironment.ID) +} +``` + +## Update + +`client.Beta.Environments.Update(ctx, environmentID, params) (*BetaEnvironment, error)` + +**post** `/v1/environments/{environment_id}` + +Update an existing environment's configuration. + +### Parameters + +- `environmentID string` + +- `params BetaEnvironmentUpdateParams` + + - `Config param.Field[BetaCloudConfigParamsResp]` + + Body param: Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `Description param.Field[string]` + + Body param: Updated description of the environment + + - `Metadata param.Field[map[string, string]]` + + Body param: User-provided metadata key-value pairs. Set a value to null or empty string to delete the key. + + - `Name param.Field[string]` + + Body param: Updated name for the environment + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaEnvironment struct{…}` + + Unified Environment resource for both cloud and BYOC environments. + + - `ID string` + + Environment identifier (e.g., 'env_...') + + - `ArchivedAt string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `Config BetaCloudConfig` + + `cloud` environment configuration. + + - `Networking BetaCloudConfigNetworkingUnion` + + Network configuration policy. + + - `type BetaUnrestrictedNetwork struct{…}` + + Unrestricted network access. + + - `Type Unrestricted` + + Network policy type + + - `const UnrestrictedUnrestricted Unrestricted = "unrestricted"` + + - `type BetaLimitedNetwork struct{…}` + + Limited network access. + + - `AllowMCPServers bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `AllowPackageManagers bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `AllowedHosts []string` + + Specifies domains the container can reach. + + - `Type Limited` + + Network policy type + + - `const LimitedLimited Limited = "limited"` + + - `Packages BetaPackages` + + Package manager configuration. + + - `Apt []string` + + Ubuntu/Debian packages to install + + - `Cargo []string` + + Rust packages to install + + - `Gem []string` + + Ruby packages to install + + - `Go []string` + + Go packages to install + + - `Npm []string` + + Node.js packages to install + + - `Pip []string` + + Python packages to install + + - `Type BetaPackagesType` + + Package configuration type + + - `const BetaPackagesTypePackages BetaPackagesType = "packages"` + + - `Type Cloud` + + Environment type + + - `const CloudCloud Cloud = "cloud"` + + - `CreatedAt string` + + RFC 3339 timestamp when environment was created + + - `Description string` + + User-provided description for the environment + + - `Metadata map[string, string]` + + User-provided metadata key-value pairs + + - `Name string` + + Human-readable name for the environment + + - `Type Environment` + + The type of object (always 'environment') + + - `const EnvironmentEnvironment Environment = "environment"` + + - `UpdatedAt string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaEnvironment, err := client.Beta.Environments.Update( + context.TODO(), + "env_011CZkZ9X2dpNyB7HsEFoRfW", + anthropic.BetaEnvironmentUpdateParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaEnvironment.ID) +} +``` + +## Delete + +`client.Beta.Environments.Delete(ctx, environmentID, body) (*BetaEnvironmentDeleteResponse, error)` + +**delete** `/v1/environments/{environment_id}` + +Delete an environment by ID. Returns a confirmation of the deletion. + +### Parameters + +- `environmentID string` + +- `body BetaEnvironmentDeleteParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaEnvironmentDeleteResponse struct{…}` + + Response after deleting an environment. + + - `ID string` + + Environment identifier + + - `Type EnvironmentDeleted` + + The type of response + + - `const EnvironmentDeletedEnvironmentDeleted EnvironmentDeleted = "environment_deleted"` + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaEnvironmentDeleteResponse, err := client.Beta.Environments.Delete( + context.TODO(), + "env_011CZkZ9X2dpNyB7HsEFoRfW", + anthropic.BetaEnvironmentDeleteParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaEnvironmentDeleteResponse.ID) +} +``` + +## Archive + +`client.Beta.Environments.Archive(ctx, environmentID, body) (*BetaEnvironment, error)` + +**post** `/v1/environments/{environment_id}/archive` + +Archive an environment by ID. Archived environments cannot be used to create new sessions. + +### Parameters + +- `environmentID string` + +- `body BetaEnvironmentArchiveParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaEnvironment struct{…}` + + Unified Environment resource for both cloud and BYOC environments. + + - `ID string` + + Environment identifier (e.g., 'env_...') + + - `ArchivedAt string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `Config BetaCloudConfig` + + `cloud` environment configuration. + + - `Networking BetaCloudConfigNetworkingUnion` + + Network configuration policy. + + - `type BetaUnrestrictedNetwork struct{…}` + + Unrestricted network access. + + - `Type Unrestricted` + + Network policy type + + - `const UnrestrictedUnrestricted Unrestricted = "unrestricted"` + + - `type BetaLimitedNetwork struct{…}` + + Limited network access. + + - `AllowMCPServers bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `AllowPackageManagers bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `AllowedHosts []string` + + Specifies domains the container can reach. + + - `Type Limited` + + Network policy type + + - `const LimitedLimited Limited = "limited"` + + - `Packages BetaPackages` + + Package manager configuration. + + - `Apt []string` + + Ubuntu/Debian packages to install + + - `Cargo []string` + + Rust packages to install + + - `Gem []string` + + Ruby packages to install + + - `Go []string` + + Go packages to install + + - `Npm []string` + + Node.js packages to install + + - `Pip []string` + + Python packages to install + + - `Type BetaPackagesType` + + Package configuration type + + - `const BetaPackagesTypePackages BetaPackagesType = "packages"` + + - `Type Cloud` + + Environment type + + - `const CloudCloud Cloud = "cloud"` + + - `CreatedAt string` + + RFC 3339 timestamp when environment was created + + - `Description string` + + User-provided description for the environment + + - `Metadata map[string, string]` + + User-provided metadata key-value pairs + + - `Name string` + + Human-readable name for the environment + + - `Type Environment` + + The type of object (always 'environment') + + - `const EnvironmentEnvironment Environment = "environment"` + + - `UpdatedAt string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaEnvironment, err := client.Beta.Environments.Archive( + context.TODO(), + "env_011CZkZ9X2dpNyB7HsEFoRfW", + anthropic.BetaEnvironmentArchiveParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaEnvironment.ID) +} +``` + +## Domain Types + +### Beta Cloud Config + +- `type BetaCloudConfig struct{…}` + + `cloud` environment configuration. + + - `Networking BetaCloudConfigNetworkingUnion` + + Network configuration policy. + + - `type BetaUnrestrictedNetwork struct{…}` + + Unrestricted network access. + + - `Type Unrestricted` + + Network policy type + + - `const UnrestrictedUnrestricted Unrestricted = "unrestricted"` + + - `type BetaLimitedNetwork struct{…}` + + Limited network access. + + - `AllowMCPServers bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `AllowPackageManagers bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `AllowedHosts []string` + + Specifies domains the container can reach. + + - `Type Limited` + + Network policy type + + - `const LimitedLimited Limited = "limited"` + + - `Packages BetaPackages` + + Package manager configuration. + + - `Apt []string` + + Ubuntu/Debian packages to install + + - `Cargo []string` + + Rust packages to install + + - `Gem []string` + + Ruby packages to install + + - `Go []string` + + Go packages to install + + - `Npm []string` + + Node.js packages to install + + - `Pip []string` + + Python packages to install + + - `Type BetaPackagesType` + + Package configuration type + + - `const BetaPackagesTypePackages BetaPackagesType = "packages"` + + - `Type Cloud` + + Environment type + + - `const CloudCloud Cloud = "cloud"` + +### Beta Cloud Config Params + +- `type BetaCloudConfigParamsResp struct{…}` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `Type Cloud` + + Environment type + + - `const CloudCloud Cloud = "cloud"` + + - `Networking BetaCloudConfigParamsNetworkingUnionResp` + + Network configuration policy. Omit on update to preserve the existing value. + + - `type BetaUnrestrictedNetwork struct{…}` + + Unrestricted network access. + + - `Type Unrestricted` + + Network policy type + + - `const UnrestrictedUnrestricted Unrestricted = "unrestricted"` + + - `type BetaLimitedNetworkParamsResp struct{…}` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `Type Limited` + + Network policy type + + - `const LimitedLimited Limited = "limited"` + + - `AllowMCPServers bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `AllowPackageManagers bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `AllowedHosts []string` + + Specifies domains the container can reach. + + - `Packages BetaPackagesParamsResp` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `Apt []string` + + Ubuntu/Debian packages to install + + - `Cargo []string` + + Rust packages to install + + - `Gem []string` + + Ruby packages to install + + - `Go []string` + + Go packages to install + + - `Npm []string` + + Node.js packages to install + + - `Pip []string` + + Python packages to install + + - `Type BetaPackagesParamsType` + + Package configuration type + + - `const BetaPackagesParamsTypePackages BetaPackagesParamsType = "packages"` + +### Beta Environment + +- `type BetaEnvironment struct{…}` + + Unified Environment resource for both cloud and BYOC environments. + + - `ID string` + + Environment identifier (e.g., 'env_...') + + - `ArchivedAt string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `Config BetaCloudConfig` + + `cloud` environment configuration. + + - `Networking BetaCloudConfigNetworkingUnion` + + Network configuration policy. + + - `type BetaUnrestrictedNetwork struct{…}` + + Unrestricted network access. + + - `Type Unrestricted` + + Network policy type + + - `const UnrestrictedUnrestricted Unrestricted = "unrestricted"` + + - `type BetaLimitedNetwork struct{…}` + + Limited network access. + + - `AllowMCPServers bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `AllowPackageManagers bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `AllowedHosts []string` + + Specifies domains the container can reach. + + - `Type Limited` + + Network policy type + + - `const LimitedLimited Limited = "limited"` + + - `Packages BetaPackages` + + Package manager configuration. + + - `Apt []string` + + Ubuntu/Debian packages to install + + - `Cargo []string` + + Rust packages to install + + - `Gem []string` + + Ruby packages to install + + - `Go []string` + + Go packages to install + + - `Npm []string` + + Node.js packages to install + + - `Pip []string` + + Python packages to install + + - `Type BetaPackagesType` + + Package configuration type + + - `const BetaPackagesTypePackages BetaPackagesType = "packages"` + + - `Type Cloud` + + Environment type + + - `const CloudCloud Cloud = "cloud"` + + - `CreatedAt string` + + RFC 3339 timestamp when environment was created + + - `Description string` + + User-provided description for the environment + + - `Metadata map[string, string]` + + User-provided metadata key-value pairs + + - `Name string` + + Human-readable name for the environment + + - `Type Environment` + + The type of object (always 'environment') + + - `const EnvironmentEnvironment Environment = "environment"` + + - `UpdatedAt string` + + RFC 3339 timestamp when environment was last updated + +### Beta Environment Delete Response + +- `type BetaEnvironmentDeleteResponse struct{…}` + + Response after deleting an environment. + + - `ID string` + + Environment identifier + + - `Type EnvironmentDeleted` + + The type of response + + - `const EnvironmentDeletedEnvironmentDeleted EnvironmentDeleted = "environment_deleted"` + +### Beta Limited Network + +- `type BetaLimitedNetwork struct{…}` + + Limited network access. + + - `AllowMCPServers bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `AllowPackageManagers bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `AllowedHosts []string` + + Specifies domains the container can reach. + + - `Type Limited` + + Network policy type + + - `const LimitedLimited Limited = "limited"` + +### Beta Limited Network Params + +- `type BetaLimitedNetworkParamsResp struct{…}` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `Type Limited` + + Network policy type + + - `const LimitedLimited Limited = "limited"` + + - `AllowMCPServers bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `AllowPackageManagers bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `AllowedHosts []string` + + Specifies domains the container can reach. + +### Beta Packages + +- `type BetaPackages struct{…}` + + Packages (and their versions) available in this environment. + + - `Apt []string` + + Ubuntu/Debian packages to install + + - `Cargo []string` + + Rust packages to install + + - `Gem []string` + + Ruby packages to install + + - `Go []string` + + Go packages to install + + - `Npm []string` + + Node.js packages to install + + - `Pip []string` + + Python packages to install + + - `Type BetaPackagesType` + + Package configuration type + + - `const BetaPackagesTypePackages BetaPackagesType = "packages"` + +### Beta Packages Params + +- `type BetaPackagesParamsResp struct{…}` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `Apt []string` + + Ubuntu/Debian packages to install + + - `Cargo []string` + + Rust packages to install + + - `Gem []string` + + Ruby packages to install + + - `Go []string` + + Go packages to install + + - `Npm []string` + + Node.js packages to install + + - `Pip []string` + + Python packages to install + + - `Type BetaPackagesParamsType` + + Package configuration type + + - `const BetaPackagesParamsTypePackages BetaPackagesParamsType = "packages"` + +### Beta Unrestricted Network + +- `type BetaUnrestrictedNetwork struct{…}` + + Unrestricted network access. + + - `Type Unrestricted` + + Network policy type + + - `const UnrestrictedUnrestricted Unrestricted = "unrestricted"` diff --git a/content/en/api/go/beta/environments/archive.md b/content/en/api/go/beta/environments/archive.md new file mode 100644 index 000000000..abcc9caa8 --- /dev/null +++ b/content/en/api/go/beta/environments/archive.md @@ -0,0 +1,214 @@ +## Archive + +`client.Beta.Environments.Archive(ctx, environmentID, body) (*BetaEnvironment, error)` + +**post** `/v1/environments/{environment_id}/archive` + +Archive an environment by ID. Archived environments cannot be used to create new sessions. + +### Parameters + +- `environmentID string` + +- `body BetaEnvironmentArchiveParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaEnvironment struct{…}` + + Unified Environment resource for both cloud and BYOC environments. + + - `ID string` + + Environment identifier (e.g., 'env_...') + + - `ArchivedAt string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `Config BetaCloudConfig` + + `cloud` environment configuration. + + - `Networking BetaCloudConfigNetworkingUnion` + + Network configuration policy. + + - `type BetaUnrestrictedNetwork struct{…}` + + Unrestricted network access. + + - `Type Unrestricted` + + Network policy type + + - `const UnrestrictedUnrestricted Unrestricted = "unrestricted"` + + - `type BetaLimitedNetwork struct{…}` + + Limited network access. + + - `AllowMCPServers bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `AllowPackageManagers bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `AllowedHosts []string` + + Specifies domains the container can reach. + + - `Type Limited` + + Network policy type + + - `const LimitedLimited Limited = "limited"` + + - `Packages BetaPackages` + + Package manager configuration. + + - `Apt []string` + + Ubuntu/Debian packages to install + + - `Cargo []string` + + Rust packages to install + + - `Gem []string` + + Ruby packages to install + + - `Go []string` + + Go packages to install + + - `Npm []string` + + Node.js packages to install + + - `Pip []string` + + Python packages to install + + - `Type BetaPackagesType` + + Package configuration type + + - `const BetaPackagesTypePackages BetaPackagesType = "packages"` + + - `Type Cloud` + + Environment type + + - `const CloudCloud Cloud = "cloud"` + + - `CreatedAt string` + + RFC 3339 timestamp when environment was created + + - `Description string` + + User-provided description for the environment + + - `Metadata map[string, string]` + + User-provided metadata key-value pairs + + - `Name string` + + Human-readable name for the environment + + - `Type Environment` + + The type of object (always 'environment') + + - `const EnvironmentEnvironment Environment = "environment"` + + - `UpdatedAt string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaEnvironment, err := client.Beta.Environments.Archive( + context.TODO(), + "env_011CZkZ9X2dpNyB7HsEFoRfW", + anthropic.BetaEnvironmentArchiveParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaEnvironment.ID) +} +``` diff --git a/content/en/api/go/beta/environments/create.md b/content/en/api/go/beta/environments/create.md new file mode 100644 index 000000000..fe9e2f3fe --- /dev/null +++ b/content/en/api/go/beta/environments/create.md @@ -0,0 +1,227 @@ +## Create + +`client.Beta.Environments.New(ctx, params) (*BetaEnvironment, error)` + +**post** `/v1/environments` + +Create a new environment with the specified configuration. + +### Parameters + +- `params BetaEnvironmentNewParams` + + - `Name param.Field[string]` + + Body param: Human-readable name for the environment + + - `Config param.Field[BetaCloudConfigParamsResp]` + + Body param: Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `Description param.Field[string]` + + Body param: Optional description of the environment + + - `Metadata param.Field[map[string, string]]` + + Body param: User-provided metadata key-value pairs + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaEnvironment struct{…}` + + Unified Environment resource for both cloud and BYOC environments. + + - `ID string` + + Environment identifier (e.g., 'env_...') + + - `ArchivedAt string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `Config BetaCloudConfig` + + `cloud` environment configuration. + + - `Networking BetaCloudConfigNetworkingUnion` + + Network configuration policy. + + - `type BetaUnrestrictedNetwork struct{…}` + + Unrestricted network access. + + - `Type Unrestricted` + + Network policy type + + - `const UnrestrictedUnrestricted Unrestricted = "unrestricted"` + + - `type BetaLimitedNetwork struct{…}` + + Limited network access. + + - `AllowMCPServers bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `AllowPackageManagers bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `AllowedHosts []string` + + Specifies domains the container can reach. + + - `Type Limited` + + Network policy type + + - `const LimitedLimited Limited = "limited"` + + - `Packages BetaPackages` + + Package manager configuration. + + - `Apt []string` + + Ubuntu/Debian packages to install + + - `Cargo []string` + + Rust packages to install + + - `Gem []string` + + Ruby packages to install + + - `Go []string` + + Go packages to install + + - `Npm []string` + + Node.js packages to install + + - `Pip []string` + + Python packages to install + + - `Type BetaPackagesType` + + Package configuration type + + - `const BetaPackagesTypePackages BetaPackagesType = "packages"` + + - `Type Cloud` + + Environment type + + - `const CloudCloud Cloud = "cloud"` + + - `CreatedAt string` + + RFC 3339 timestamp when environment was created + + - `Description string` + + User-provided description for the environment + + - `Metadata map[string, string]` + + User-provided metadata key-value pairs + + - `Name string` + + Human-readable name for the environment + + - `Type Environment` + + The type of object (always 'environment') + + - `const EnvironmentEnvironment Environment = "environment"` + + - `UpdatedAt string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaEnvironment, err := client.Beta.Environments.New(context.TODO(), anthropic.BetaEnvironmentNewParams{ + Name: "python-data-analysis", + }) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaEnvironment.ID) +} +``` diff --git a/content/en/api/go/beta/environments/delete.md b/content/en/api/go/beta/environments/delete.md new file mode 100644 index 000000000..abf66b1ad --- /dev/null +++ b/content/en/api/go/beta/environments/delete.md @@ -0,0 +1,110 @@ +## Delete + +`client.Beta.Environments.Delete(ctx, environmentID, body) (*BetaEnvironmentDeleteResponse, error)` + +**delete** `/v1/environments/{environment_id}` + +Delete an environment by ID. Returns a confirmation of the deletion. + +### Parameters + +- `environmentID string` + +- `body BetaEnvironmentDeleteParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaEnvironmentDeleteResponse struct{…}` + + Response after deleting an environment. + + - `ID string` + + Environment identifier + + - `Type EnvironmentDeleted` + + The type of response + + - `const EnvironmentDeletedEnvironmentDeleted EnvironmentDeleted = "environment_deleted"` + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaEnvironmentDeleteResponse, err := client.Beta.Environments.Delete( + context.TODO(), + "env_011CZkZ9X2dpNyB7HsEFoRfW", + anthropic.BetaEnvironmentDeleteParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaEnvironmentDeleteResponse.ID) +} +``` diff --git a/content/en/api/go/beta/environments/list.md b/content/en/api/go/beta/environments/list.md new file mode 100644 index 000000000..4bb75063e --- /dev/null +++ b/content/en/api/go/beta/environments/list.md @@ -0,0 +1,220 @@ +## List + +`client.Beta.Environments.List(ctx, params) (*PageCursor[BetaEnvironment], error)` + +**get** `/v1/environments` + +List environments with pagination support. + +### Parameters + +- `params BetaEnvironmentListParams` + + - `IncludeArchived param.Field[bool]` + + Query param: Include archived environments in the response + + - `Limit param.Field[int64]` + + Query param: Maximum number of environments to return + + - `Page param.Field[string]` + + Query param: Opaque cursor from previous response for pagination. Pass the `next_page` value from the previous response. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaEnvironment struct{…}` + + Unified Environment resource for both cloud and BYOC environments. + + - `ID string` + + Environment identifier (e.g., 'env_...') + + - `ArchivedAt string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `Config BetaCloudConfig` + + `cloud` environment configuration. + + - `Networking BetaCloudConfigNetworkingUnion` + + Network configuration policy. + + - `type BetaUnrestrictedNetwork struct{…}` + + Unrestricted network access. + + - `Type Unrestricted` + + Network policy type + + - `const UnrestrictedUnrestricted Unrestricted = "unrestricted"` + + - `type BetaLimitedNetwork struct{…}` + + Limited network access. + + - `AllowMCPServers bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `AllowPackageManagers bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `AllowedHosts []string` + + Specifies domains the container can reach. + + - `Type Limited` + + Network policy type + + - `const LimitedLimited Limited = "limited"` + + - `Packages BetaPackages` + + Package manager configuration. + + - `Apt []string` + + Ubuntu/Debian packages to install + + - `Cargo []string` + + Rust packages to install + + - `Gem []string` + + Ruby packages to install + + - `Go []string` + + Go packages to install + + - `Npm []string` + + Node.js packages to install + + - `Pip []string` + + Python packages to install + + - `Type BetaPackagesType` + + Package configuration type + + - `const BetaPackagesTypePackages BetaPackagesType = "packages"` + + - `Type Cloud` + + Environment type + + - `const CloudCloud Cloud = "cloud"` + + - `CreatedAt string` + + RFC 3339 timestamp when environment was created + + - `Description string` + + User-provided description for the environment + + - `Metadata map[string, string]` + + User-provided metadata key-value pairs + + - `Name string` + + Human-readable name for the environment + + - `Type Environment` + + The type of object (always 'environment') + + - `const EnvironmentEnvironment Environment = "environment"` + + - `UpdatedAt string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Beta.Environments.List(context.TODO(), anthropic.BetaEnvironmentListParams{ + + }) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", page) +} +``` diff --git a/content/en/api/go/beta/environments/retrieve.md b/content/en/api/go/beta/environments/retrieve.md new file mode 100644 index 000000000..d9a4073c1 --- /dev/null +++ b/content/en/api/go/beta/environments/retrieve.md @@ -0,0 +1,214 @@ +## Retrieve + +`client.Beta.Environments.Get(ctx, environmentID, query) (*BetaEnvironment, error)` + +**get** `/v1/environments/{environment_id}` + +Retrieve a specific environment by ID. + +### Parameters + +- `environmentID string` + +- `query BetaEnvironmentGetParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaEnvironment struct{…}` + + Unified Environment resource for both cloud and BYOC environments. + + - `ID string` + + Environment identifier (e.g., 'env_...') + + - `ArchivedAt string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `Config BetaCloudConfig` + + `cloud` environment configuration. + + - `Networking BetaCloudConfigNetworkingUnion` + + Network configuration policy. + + - `type BetaUnrestrictedNetwork struct{…}` + + Unrestricted network access. + + - `Type Unrestricted` + + Network policy type + + - `const UnrestrictedUnrestricted Unrestricted = "unrestricted"` + + - `type BetaLimitedNetwork struct{…}` + + Limited network access. + + - `AllowMCPServers bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `AllowPackageManagers bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `AllowedHosts []string` + + Specifies domains the container can reach. + + - `Type Limited` + + Network policy type + + - `const LimitedLimited Limited = "limited"` + + - `Packages BetaPackages` + + Package manager configuration. + + - `Apt []string` + + Ubuntu/Debian packages to install + + - `Cargo []string` + + Rust packages to install + + - `Gem []string` + + Ruby packages to install + + - `Go []string` + + Go packages to install + + - `Npm []string` + + Node.js packages to install + + - `Pip []string` + + Python packages to install + + - `Type BetaPackagesType` + + Package configuration type + + - `const BetaPackagesTypePackages BetaPackagesType = "packages"` + + - `Type Cloud` + + Environment type + + - `const CloudCloud Cloud = "cloud"` + + - `CreatedAt string` + + RFC 3339 timestamp when environment was created + + - `Description string` + + User-provided description for the environment + + - `Metadata map[string, string]` + + User-provided metadata key-value pairs + + - `Name string` + + Human-readable name for the environment + + - `Type Environment` + + The type of object (always 'environment') + + - `const EnvironmentEnvironment Environment = "environment"` + + - `UpdatedAt string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaEnvironment, err := client.Beta.Environments.Get( + context.TODO(), + "env_011CZkZ9X2dpNyB7HsEFoRfW", + anthropic.BetaEnvironmentGetParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaEnvironment.ID) +} +``` diff --git a/content/en/api/go/beta/environments/update.md b/content/en/api/go/beta/environments/update.md new file mode 100644 index 000000000..498866702 --- /dev/null +++ b/content/en/api/go/beta/environments/update.md @@ -0,0 +1,233 @@ +## Update + +`client.Beta.Environments.Update(ctx, environmentID, params) (*BetaEnvironment, error)` + +**post** `/v1/environments/{environment_id}` + +Update an existing environment's configuration. + +### Parameters + +- `environmentID string` + +- `params BetaEnvironmentUpdateParams` + + - `Config param.Field[BetaCloudConfigParamsResp]` + + Body param: Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `Description param.Field[string]` + + Body param: Updated description of the environment + + - `Metadata param.Field[map[string, string]]` + + Body param: User-provided metadata key-value pairs. Set a value to null or empty string to delete the key. + + - `Name param.Field[string]` + + Body param: Updated name for the environment + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaEnvironment struct{…}` + + Unified Environment resource for both cloud and BYOC environments. + + - `ID string` + + Environment identifier (e.g., 'env_...') + + - `ArchivedAt string` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `Config BetaCloudConfig` + + `cloud` environment configuration. + + - `Networking BetaCloudConfigNetworkingUnion` + + Network configuration policy. + + - `type BetaUnrestrictedNetwork struct{…}` + + Unrestricted network access. + + - `Type Unrestricted` + + Network policy type + + - `const UnrestrictedUnrestricted Unrestricted = "unrestricted"` + + - `type BetaLimitedNetwork struct{…}` + + Limited network access. + + - `AllowMCPServers bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `AllowPackageManagers bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `AllowedHosts []string` + + Specifies domains the container can reach. + + - `Type Limited` + + Network policy type + + - `const LimitedLimited Limited = "limited"` + + - `Packages BetaPackages` + + Package manager configuration. + + - `Apt []string` + + Ubuntu/Debian packages to install + + - `Cargo []string` + + Rust packages to install + + - `Gem []string` + + Ruby packages to install + + - `Go []string` + + Go packages to install + + - `Npm []string` + + Node.js packages to install + + - `Pip []string` + + Python packages to install + + - `Type BetaPackagesType` + + Package configuration type + + - `const BetaPackagesTypePackages BetaPackagesType = "packages"` + + - `Type Cloud` + + Environment type + + - `const CloudCloud Cloud = "cloud"` + + - `CreatedAt string` + + RFC 3339 timestamp when environment was created + + - `Description string` + + User-provided description for the environment + + - `Metadata map[string, string]` + + User-provided metadata key-value pairs + + - `Name string` + + Human-readable name for the environment + + - `Type Environment` + + The type of object (always 'environment') + + - `const EnvironmentEnvironment Environment = "environment"` + + - `UpdatedAt string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaEnvironment, err := client.Beta.Environments.Update( + context.TODO(), + "env_011CZkZ9X2dpNyB7HsEFoRfW", + anthropic.BetaEnvironmentUpdateParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaEnvironment.ID) +} +``` diff --git a/content/en/api/go/beta/files.md b/content/en/api/go/beta/files.md index 43ad241f9..5169c3bde 100644 --- a/content/en/api/go/beta/files.md +++ b/content/en/api/go/beta/files.md @@ -66,8 +66,6 @@ Upload File - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type FileMetadata struct{…}` @@ -106,6 +104,20 @@ Upload File Whether the file can be downloaded. + - `Scope BetaFileScope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `ID string` + + The ID of the scoping resource (e.g., the session ID). + + - `Type Session` + + The type of scope (e.g., `"session"`). + + - `const SessionSession Session = "session"` + ### Example ```go @@ -161,6 +173,10 @@ List Files Defaults to `20`. Ranges from `1` to `1000`. + - `ScopeID param.Field[string]` + + Query param: Filter by scope ID. Only returns files associated with the specified scope (e.g., a session ID). + - `Betas param.Field[[]AnthropicBeta]` Header param: Optional header to specify the beta version(s) you want to use. @@ -211,8 +227,6 @@ List Files - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type FileMetadata struct{…}` @@ -251,6 +265,20 @@ List Files Whether the file can be downloaded. + - `Scope BetaFileScope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `ID string` + + The ID of the scoping resource (e.g., the session ID). + + - `Type Session` + + The type of scope (e.g., `"session"`). + + - `const SessionSession Session = "session"` + ### Example ```go @@ -344,8 +372,6 @@ Download File - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaFileDownloadResponse interface{…}` @@ -447,8 +473,6 @@ Get File Metadata - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type FileMetadata struct{…}` @@ -487,6 +511,20 @@ Get File Metadata Whether the file can be downloaded. + - `Scope BetaFileScope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `ID string` + + The ID of the scoping resource (e.g., the session ID). + + - `Type Session` + + The type of scope (e.g., `"session"`). + + - `const SessionSession Session = "session"` + ### Example ```go @@ -584,8 +622,6 @@ Delete File - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type DeletedFile struct{…}` @@ -635,6 +671,20 @@ func main() { ## Domain Types +### Beta File Scope + +- `type BetaFileScope struct{…}` + + - `ID string` + + The ID of the scoping resource (e.g., the session ID). + + - `Type Session` + + The type of scope (e.g., `"session"`). + + - `const SessionSession Session = "session"` + ### Deleted File - `type DeletedFile struct{…}` @@ -688,3 +738,17 @@ func main() { - `Downloadable bool` Whether the file can be downloaded. + + - `Scope BetaFileScope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `ID string` + + The ID of the scoping resource (e.g., the session ID). + + - `Type Session` + + The type of scope (e.g., `"session"`). + + - `const SessionSession Session = "session"` diff --git a/content/en/api/go/beta/files/delete.md b/content/en/api/go/beta/files/delete.md index fa30d0218..66e3b998e 100644 --- a/content/en/api/go/beta/files/delete.md +++ b/content/en/api/go/beta/files/delete.md @@ -64,8 +64,6 @@ Delete File - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type DeletedFile struct{…}` diff --git a/content/en/api/go/beta/files/download.md b/content/en/api/go/beta/files/download.md index bed6d1295..696f1f3f0 100644 --- a/content/en/api/go/beta/files/download.md +++ b/content/en/api/go/beta/files/download.md @@ -64,8 +64,6 @@ Download File - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaFileDownloadResponse interface{…}` diff --git a/content/en/api/go/beta/files/list.md b/content/en/api/go/beta/files/list.md index 4d5e2250e..3d9a5ec92 100644 --- a/content/en/api/go/beta/files/list.md +++ b/content/en/api/go/beta/files/list.md @@ -24,6 +24,10 @@ List Files Defaults to `20`. Ranges from `1` to `1000`. + - `ScopeID param.Field[string]` + + Query param: Filter by scope ID. Only returns files associated with the specified scope (e.g., a session ID). + - `Betas param.Field[[]AnthropicBeta]` Header param: Optional header to specify the beta version(s) you want to use. @@ -74,8 +78,6 @@ List Files - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type FileMetadata struct{…}` @@ -114,6 +116,20 @@ List Files Whether the file can be downloaded. + - `Scope BetaFileScope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `ID string` + + The ID of the scoping resource (e.g., the session ID). + + - `Type Session` + + The type of scope (e.g., `"session"`). + + - `const SessionSession Session = "session"` + ### Example ```go diff --git a/content/en/api/go/beta/files/retrieve_metadata.md b/content/en/api/go/beta/files/retrieve_metadata.md index 3d71ea0a3..71a2d9021 100644 --- a/content/en/api/go/beta/files/retrieve_metadata.md +++ b/content/en/api/go/beta/files/retrieve_metadata.md @@ -64,8 +64,6 @@ Get File Metadata - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type FileMetadata struct{…}` @@ -104,6 +102,20 @@ Get File Metadata Whether the file can be downloaded. + - `Scope BetaFileScope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `ID string` + + The ID of the scoping resource (e.g., the session ID). + + - `Type Session` + + The type of scope (e.g., `"session"`). + + - `const SessionSession Session = "session"` + ### Example ```go diff --git a/content/en/api/go/beta/files/upload.md b/content/en/api/go/beta/files/upload.md index e7886123e..db299a53a 100644 --- a/content/en/api/go/beta/files/upload.md +++ b/content/en/api/go/beta/files/upload.md @@ -64,8 +64,6 @@ Upload File - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type FileMetadata struct{…}` @@ -104,6 +102,20 @@ Upload File Whether the file can be downloaded. + - `Scope BetaFileScope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `ID string` + + The ID of the scoping resource (e.g., the session ID). + + - `Type Session` + + The type of scope (e.g., `"session"`). + + - `const SessionSession Session = "session"` + ### Example ```go diff --git a/content/en/api/go/beta/messages.md b/content/en/api/go/beta/messages.md index bfaa98b05..59bcbf86b 100644 --- a/content/en/api/go/beta/messages.md +++ b/content/en/api/go/beta/messages.md @@ -4331,10 +4331,6 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en Recommended for advanced use cases only. You usually only need to use `temperature`. - - `UserProfileID param.Field[string]` - - Body param: The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `Betas param.Field[[]AnthropicBeta]` Header param: Optional header to specify the beta version(s) you want to use. @@ -4385,8 +4381,6 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaMessage struct{…}` @@ -5316,9 +5310,13 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -9940,8 +9938,6 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaMessageTokensCount struct{…}` @@ -9984,7 +9980,7 @@ func main() { }}, Role: anthropic.BetaMessageParamRoleUser, }}, - Model: anthropic.ModelClaudeOpus4_6, + Model: anthropic.ModelClaudeMythosPreview, }) if err != nil { panic(err.Error()) @@ -17182,9 +17178,13 @@ func main() { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -22522,9 +22522,13 @@ func main() { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -23766,9 +23770,13 @@ func main() { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -34902,9 +34910,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -36971,10 +36983,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Recommended for advanced use cases only. You usually only need to use `temperature`. - - `UserProfileID string` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `Betas param.Field[[]AnthropicBeta]` Header param: Optional header to specify the beta version(s) you want to use. @@ -37025,8 +37033,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaMessageBatch struct{…}` @@ -37226,8 +37232,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaMessageBatch struct{…}` @@ -37427,8 +37431,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaMessageBatch struct{…}` @@ -37616,8 +37618,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaMessageBatch struct{…}` @@ -37809,8 +37809,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaDeletedMessageBatch struct{…}` @@ -37928,8 +37926,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaMessageBatchIndividualResponse struct{…}` @@ -38877,9 +38873,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -40475,9 +40475,13 @@ func main() { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -41847,9 +41851,13 @@ func main() { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -43181,9 +43189,13 @@ func main() { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` diff --git a/content/en/api/go/beta/messages/batches.md b/content/en/api/go/beta/messages/batches.md index 4df802bbe..0b9c7ea1a 100644 --- a/content/en/api/go/beta/messages/batches.md +++ b/content/en/api/go/beta/messages/batches.md @@ -2619,9 +2619,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -4688,10 +4692,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Recommended for advanced use cases only. You usually only need to use `temperature`. - - `UserProfileID string` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `Betas param.Field[[]AnthropicBeta]` Header param: Optional header to specify the beta version(s) you want to use. @@ -4742,8 +4742,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaMessageBatch struct{…}` @@ -4943,8 +4941,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaMessageBatch struct{…}` @@ -5144,8 +5140,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaMessageBatch struct{…}` @@ -5333,8 +5327,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaMessageBatch struct{…}` @@ -5526,8 +5518,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaDeletedMessageBatch struct{…}` @@ -5645,8 +5635,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaMessageBatchIndividualResponse struct{…}` @@ -6594,9 +6582,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -8192,9 +8184,13 @@ func main() { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -9564,9 +9560,13 @@ func main() { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -10898,9 +10898,13 @@ func main() { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` diff --git a/content/en/api/go/beta/messages/batches/cancel.md b/content/en/api/go/beta/messages/batches/cancel.md index 2501ff86e..911a03c5b 100644 --- a/content/en/api/go/beta/messages/batches/cancel.md +++ b/content/en/api/go/beta/messages/batches/cancel.md @@ -68,8 +68,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaMessageBatch struct{…}` diff --git a/content/en/api/go/beta/messages/batches/create.md b/content/en/api/go/beta/messages/batches/create.md index f0d53bb45..abf7f6e16 100644 --- a/content/en/api/go/beta/messages/batches/create.md +++ b/content/en/api/go/beta/messages/batches/create.md @@ -2617,9 +2617,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -4686,10 +4690,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Recommended for advanced use cases only. You usually only need to use `temperature`. - - `UserProfileID string` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `Betas param.Field[[]AnthropicBeta]` Header param: Optional header to specify the beta version(s) you want to use. @@ -4740,8 +4740,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaMessageBatch struct{…}` diff --git a/content/en/api/go/beta/messages/batches/delete.md b/content/en/api/go/beta/messages/batches/delete.md index 5ed4a2d2e..7ef05abdc 100644 --- a/content/en/api/go/beta/messages/batches/delete.md +++ b/content/en/api/go/beta/messages/batches/delete.md @@ -68,8 +68,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaDeletedMessageBatch struct{…}` diff --git a/content/en/api/go/beta/messages/batches/list.md b/content/en/api/go/beta/messages/batches/list.md index 645e402a0..60fdf6abf 100644 --- a/content/en/api/go/beta/messages/batches/list.md +++ b/content/en/api/go/beta/messages/batches/list.md @@ -76,8 +76,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaMessageBatch struct{…}` diff --git a/content/en/api/go/beta/messages/batches/results.md b/content/en/api/go/beta/messages/batches/results.md index 238d86746..9036935ca 100644 --- a/content/en/api/go/beta/messages/batches/results.md +++ b/content/en/api/go/beta/messages/batches/results.md @@ -68,8 +68,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaMessageBatchIndividualResponse struct{…}` @@ -1017,9 +1015,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` diff --git a/content/en/api/go/beta/messages/batches/retrieve.md b/content/en/api/go/beta/messages/batches/retrieve.md index e88f7a42d..8c3882e78 100644 --- a/content/en/api/go/beta/messages/batches/retrieve.md +++ b/content/en/api/go/beta/messages/batches/retrieve.md @@ -66,8 +66,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaMessageBatch struct{…}` diff --git a/content/en/api/go/beta/messages/count_tokens.md b/content/en/api/go/beta/messages/count_tokens.md index c68362934..da413ab49 100644 --- a/content/en/api/go/beta/messages/count_tokens.md +++ b/content/en/api/go/beta/messages/count_tokens.md @@ -4287,8 +4287,6 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaMessageTokensCount struct{…}` @@ -4331,7 +4329,7 @@ func main() { }}, Role: anthropic.BetaMessageParamRoleUser, }}, - Model: anthropic.ModelClaudeOpus4_6, + Model: anthropic.ModelClaudeMythosPreview, }) if err != nil { panic(err.Error()) diff --git a/content/en/api/go/beta/messages/create.md b/content/en/api/go/beta/messages/create.md index e8778c7aa..07350992b 100644 --- a/content/en/api/go/beta/messages/create.md +++ b/content/en/api/go/beta/messages/create.md @@ -4329,10 +4329,6 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en Recommended for advanced use cases only. You usually only need to use `temperature`. - - `UserProfileID param.Field[string]` - - Body param: The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `Betas param.Field[[]AnthropicBeta]` Header param: Optional header to specify the beta version(s) you want to use. @@ -4383,8 +4379,6 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaMessage struct{…}` @@ -5314,9 +5308,13 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` diff --git a/content/en/api/go/beta/models.md b/content/en/api/go/beta/models.md index d8956f5a7..df8b69a8d 100644 --- a/content/en/api/go/beta/models.md +++ b/content/en/api/go/beta/models.md @@ -78,8 +78,6 @@ The Models API response can be used to determine which models are available for - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaModelInfo struct{…}` @@ -359,8 +357,6 @@ The Models API response can be used to determine information about a specific mo - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaModelInfo struct{…}` diff --git a/content/en/api/go/beta/models/list.md b/content/en/api/go/beta/models/list.md index c5a5b8051..b18b485e6 100644 --- a/content/en/api/go/beta/models/list.md +++ b/content/en/api/go/beta/models/list.md @@ -76,8 +76,6 @@ The Models API response can be used to determine which models are available for - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaModelInfo struct{…}` diff --git a/content/en/api/go/beta/models/retrieve.md b/content/en/api/go/beta/models/retrieve.md index f438e496a..37d330f85 100644 --- a/content/en/api/go/beta/models/retrieve.md +++ b/content/en/api/go/beta/models/retrieve.md @@ -66,8 +66,6 @@ The Models API response can be used to determine information about a specific mo - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaModelInfo struct{…}` diff --git a/content/en/api/go/beta/sessions.md b/content/en/api/go/beta/sessions.md new file mode 100644 index 000000000..0f30461db --- /dev/null +++ b/content/en/api/go/beta/sessions.md @@ -0,0 +1,14363 @@ +# Sessions + +## Create + +`client.Beta.Sessions.New(ctx, params) (*BetaManagedAgentsSession, error)` + +**post** `/v1/sessions` + +Create Session + +### Parameters + +- `params BetaSessionNewParams` + + - `Agent param.Field[BetaSessionNewParamsAgentUnion]` + + Body param: Agent identifier. Accepts the `agent` ID string, which pins the latest version for the session, or an `agent` object with both id and version specified. + + - `string` + + - `type BetaManagedAgentsAgentParamsResp struct{…}` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `ID string` + + The `agent` ID. + + - `Type BetaManagedAgentsAgentParamsType` + + - `const BetaManagedAgentsAgentParamsTypeAgent BetaManagedAgentsAgentParamsType = "agent"` + + - `Version int64` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + + - `EnvironmentID param.Field[string]` + + Body param: ID of the `environment` defining the container configuration for this session. + + - `Metadata param.Field[map[string, string]]` + + Body param: Arbitrary key-value metadata attached to the session. + + - `Resources param.Field[[]BetaSessionNewParamsResourceUnion]` + + Body param: Resources (e.g. repositories, files) to mount into the session's container. + + - `type BetaManagedAgentsGitHubRepositoryResourceParamsResp struct{…}` + + Mount a GitHub repository into the session's container. + + - `AuthorizationToken string` + + GitHub authorization token used to clone the repository. + + - `Type BetaManagedAgentsGitHubRepositoryResourceParamsType` + + - `const BetaManagedAgentsGitHubRepositoryResourceParamsTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceParamsType = "github_repository"` + + - `URL string` + + Github URL of the repository + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceParamsCheckoutUnionResp` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `MountPath string` + + Mount path in the container. Defaults to `/workspace/`. + + - `type BetaManagedAgentsFileResourceParamsResp struct{…}` + + Mount a file uploaded via the Files API into the session. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileResourceParamsType` + + - `const BetaManagedAgentsFileResourceParamsTypeFile BetaManagedAgentsFileResourceParamsType = "file"` + + - `MountPath string` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + + - `Title param.Field[string]` + + Body param: Human-readable session title. + + - `VaultIDs param.Field[[]string]` + + Body param: Vault IDs for stored credentials the agent can use during the session. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsSession struct{…}` + + A Managed Agents `session`. + + - `ID string` + + - `Agent BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `ID string` + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsSessionAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsSessionAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsSessionAgentType` + + - `const BetaManagedAgentsSessionAgentTypeAgent BetaManagedAgentsSessionAgentType = "agent"` + + - `Version int64` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `EnvironmentID string` + + - `Metadata map[string, string]` + + - `Resources []BetaManagedAgentsSessionResourceUnion` + + - `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Stats BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `ActiveSeconds float64` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `DurationSeconds float64` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `Status BetaManagedAgentsSessionStatus` + + SessionStatus enum + + - `const BetaManagedAgentsSessionStatusRescheduling BetaManagedAgentsSessionStatus = "rescheduling"` + + - `const BetaManagedAgentsSessionStatusRunning BetaManagedAgentsSessionStatus = "running"` + + - `const BetaManagedAgentsSessionStatusIdle BetaManagedAgentsSessionStatus = "idle"` + + - `const BetaManagedAgentsSessionStatusTerminated BetaManagedAgentsSessionStatus = "terminated"` + + - `Title string` + + - `Type BetaManagedAgentsSessionType` + + - `const BetaManagedAgentsSessionTypeSession BetaManagedAgentsSessionType = "session"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Usage BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `CacheCreation BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Ephemeral1hInputTokens int64` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Ephemeral5mInputTokens int64` + + Tokens used to create 5-minute ephemeral cache entries. + + - `CacheReadInputTokens int64` + + Total tokens read from prompt cache. + + - `InputTokens int64` + + Total input tokens consumed across all turns. + + - `OutputTokens int64` + + Total output tokens generated across all turns. + + - `VaultIDs []string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsSession, err := client.Beta.Sessions.New(context.TODO(), anthropic.BetaSessionNewParams{ + Agent: anthropic.BetaSessionNewParamsAgentUnion{ + OfString: anthropic.String("agent_011CZkYpogX7uDKUyvBTophP"), + }, + EnvironmentID: "env_011CZkZ9X2dpNyB7HsEFoRfW", + }) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsSession.ID) +} +``` + +## List + +`client.Beta.Sessions.List(ctx, params) (*PageCursor[BetaManagedAgentsSession], error)` + +**get** `/v1/sessions` + +List Sessions + +### Parameters + +- `params BetaSessionListParams` + + - `AgentID param.Field[string]` + + Query param: Filter sessions created with this agent ID. + + - `AgentVersion param.Field[int64]` + + Query param: Filter by agent version. Only applies when agent_id is also set. + + - `CreatedAtGt param.Field[Time]` + + Query param: Return sessions created after this time (exclusive). + + - `CreatedAtGte param.Field[Time]` + + Query param: Return sessions created at or after this time (inclusive). + + - `CreatedAtLt param.Field[Time]` + + Query param: Return sessions created before this time (exclusive). + + - `CreatedAtLte param.Field[Time]` + + Query param: Return sessions created at or before this time (inclusive). + + - `IncludeArchived param.Field[bool]` + + Query param: When true, includes archived sessions. Default: false (exclude archived). + + - `Limit param.Field[int64]` + + Query param: Maximum number of results to return. + + - `Order param.Field[BetaSessionListParamsOrder]` + + Query param: Sort direction for results, ordered by created_at. Defaults to desc (newest first). + + - `const BetaSessionListParamsOrderAsc BetaSessionListParamsOrder = "asc"` + + - `const BetaSessionListParamsOrderDesc BetaSessionListParamsOrder = "desc"` + + - `Page param.Field[string]` + + Query param: Opaque pagination cursor from a previous response's next_page. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsSession struct{…}` + + A Managed Agents `session`. + + - `ID string` + + - `Agent BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `ID string` + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsSessionAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsSessionAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsSessionAgentType` + + - `const BetaManagedAgentsSessionAgentTypeAgent BetaManagedAgentsSessionAgentType = "agent"` + + - `Version int64` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `EnvironmentID string` + + - `Metadata map[string, string]` + + - `Resources []BetaManagedAgentsSessionResourceUnion` + + - `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Stats BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `ActiveSeconds float64` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `DurationSeconds float64` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `Status BetaManagedAgentsSessionStatus` + + SessionStatus enum + + - `const BetaManagedAgentsSessionStatusRescheduling BetaManagedAgentsSessionStatus = "rescheduling"` + + - `const BetaManagedAgentsSessionStatusRunning BetaManagedAgentsSessionStatus = "running"` + + - `const BetaManagedAgentsSessionStatusIdle BetaManagedAgentsSessionStatus = "idle"` + + - `const BetaManagedAgentsSessionStatusTerminated BetaManagedAgentsSessionStatus = "terminated"` + + - `Title string` + + - `Type BetaManagedAgentsSessionType` + + - `const BetaManagedAgentsSessionTypeSession BetaManagedAgentsSessionType = "session"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Usage BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `CacheCreation BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Ephemeral1hInputTokens int64` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Ephemeral5mInputTokens int64` + + Tokens used to create 5-minute ephemeral cache entries. + + - `CacheReadInputTokens int64` + + Total tokens read from prompt cache. + + - `InputTokens int64` + + Total input tokens consumed across all turns. + + - `OutputTokens int64` + + Total output tokens generated across all turns. + + - `VaultIDs []string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Beta.Sessions.List(context.TODO(), anthropic.BetaSessionListParams{ + + }) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", page) +} +``` + +## Retrieve + +`client.Beta.Sessions.Get(ctx, sessionID, query) (*BetaManagedAgentsSession, error)` + +**get** `/v1/sessions/{session_id}` + +Get Session + +### Parameters + +- `sessionID string` + +- `query BetaSessionGetParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsSession struct{…}` + + A Managed Agents `session`. + + - `ID string` + + - `Agent BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `ID string` + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsSessionAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsSessionAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsSessionAgentType` + + - `const BetaManagedAgentsSessionAgentTypeAgent BetaManagedAgentsSessionAgentType = "agent"` + + - `Version int64` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `EnvironmentID string` + + - `Metadata map[string, string]` + + - `Resources []BetaManagedAgentsSessionResourceUnion` + + - `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Stats BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `ActiveSeconds float64` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `DurationSeconds float64` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `Status BetaManagedAgentsSessionStatus` + + SessionStatus enum + + - `const BetaManagedAgentsSessionStatusRescheduling BetaManagedAgentsSessionStatus = "rescheduling"` + + - `const BetaManagedAgentsSessionStatusRunning BetaManagedAgentsSessionStatus = "running"` + + - `const BetaManagedAgentsSessionStatusIdle BetaManagedAgentsSessionStatus = "idle"` + + - `const BetaManagedAgentsSessionStatusTerminated BetaManagedAgentsSessionStatus = "terminated"` + + - `Title string` + + - `Type BetaManagedAgentsSessionType` + + - `const BetaManagedAgentsSessionTypeSession BetaManagedAgentsSessionType = "session"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Usage BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `CacheCreation BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Ephemeral1hInputTokens int64` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Ephemeral5mInputTokens int64` + + Tokens used to create 5-minute ephemeral cache entries. + + - `CacheReadInputTokens int64` + + Total tokens read from prompt cache. + + - `InputTokens int64` + + Total input tokens consumed across all turns. + + - `OutputTokens int64` + + Total output tokens generated across all turns. + + - `VaultIDs []string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsSession, err := client.Beta.Sessions.Get( + context.TODO(), + "sesn_011CZkZAtmR3yMPDzynEDxu7", + anthropic.BetaSessionGetParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsSession.ID) +} +``` + +## Update + +`client.Beta.Sessions.Update(ctx, sessionID, params) (*BetaManagedAgentsSession, error)` + +**post** `/v1/sessions/{session_id}` + +Update Session + +### Parameters + +- `sessionID string` + +- `params BetaSessionUpdateParams` + + - `Metadata param.Field[map[string, string]]` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. + + - `Title param.Field[string]` + + Body param: Human-readable session title. + + - `VaultIDs param.Field[[]string]` + + Body param: Vault IDs (`vlt_*`) to attach to the session. Not yet supported; requests setting this field are rejected. Reserved for future use. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsSession struct{…}` + + A Managed Agents `session`. + + - `ID string` + + - `Agent BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `ID string` + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsSessionAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsSessionAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsSessionAgentType` + + - `const BetaManagedAgentsSessionAgentTypeAgent BetaManagedAgentsSessionAgentType = "agent"` + + - `Version int64` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `EnvironmentID string` + + - `Metadata map[string, string]` + + - `Resources []BetaManagedAgentsSessionResourceUnion` + + - `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Stats BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `ActiveSeconds float64` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `DurationSeconds float64` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `Status BetaManagedAgentsSessionStatus` + + SessionStatus enum + + - `const BetaManagedAgentsSessionStatusRescheduling BetaManagedAgentsSessionStatus = "rescheduling"` + + - `const BetaManagedAgentsSessionStatusRunning BetaManagedAgentsSessionStatus = "running"` + + - `const BetaManagedAgentsSessionStatusIdle BetaManagedAgentsSessionStatus = "idle"` + + - `const BetaManagedAgentsSessionStatusTerminated BetaManagedAgentsSessionStatus = "terminated"` + + - `Title string` + + - `Type BetaManagedAgentsSessionType` + + - `const BetaManagedAgentsSessionTypeSession BetaManagedAgentsSessionType = "session"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Usage BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `CacheCreation BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Ephemeral1hInputTokens int64` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Ephemeral5mInputTokens int64` + + Tokens used to create 5-minute ephemeral cache entries. + + - `CacheReadInputTokens int64` + + Total tokens read from prompt cache. + + - `InputTokens int64` + + Total input tokens consumed across all turns. + + - `OutputTokens int64` + + Total output tokens generated across all turns. + + - `VaultIDs []string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsSession, err := client.Beta.Sessions.Update( + context.TODO(), + "sesn_011CZkZAtmR3yMPDzynEDxu7", + anthropic.BetaSessionUpdateParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsSession.ID) +} +``` + +## Delete + +`client.Beta.Sessions.Delete(ctx, sessionID, body) (*BetaManagedAgentsDeletedSession, error)` + +**delete** `/v1/sessions/{session_id}` + +Delete Session + +### Parameters + +- `sessionID string` + +- `body BetaSessionDeleteParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsDeletedSession struct{…}` + + Confirmation that a `session` has been permanently deleted. + + - `ID string` + + - `Type BetaManagedAgentsDeletedSessionType` + + - `const BetaManagedAgentsDeletedSessionTypeSessionDeleted BetaManagedAgentsDeletedSessionType = "session_deleted"` + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsDeletedSession, err := client.Beta.Sessions.Delete( + context.TODO(), + "sesn_011CZkZAtmR3yMPDzynEDxu7", + anthropic.BetaSessionDeleteParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsDeletedSession.ID) +} +``` + +## Archive + +`client.Beta.Sessions.Archive(ctx, sessionID, body) (*BetaManagedAgentsSession, error)` + +**post** `/v1/sessions/{session_id}/archive` + +Archive Session + +### Parameters + +- `sessionID string` + +- `body BetaSessionArchiveParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsSession struct{…}` + + A Managed Agents `session`. + + - `ID string` + + - `Agent BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `ID string` + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsSessionAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsSessionAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsSessionAgentType` + + - `const BetaManagedAgentsSessionAgentTypeAgent BetaManagedAgentsSessionAgentType = "agent"` + + - `Version int64` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `EnvironmentID string` + + - `Metadata map[string, string]` + + - `Resources []BetaManagedAgentsSessionResourceUnion` + + - `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Stats BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `ActiveSeconds float64` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `DurationSeconds float64` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `Status BetaManagedAgentsSessionStatus` + + SessionStatus enum + + - `const BetaManagedAgentsSessionStatusRescheduling BetaManagedAgentsSessionStatus = "rescheduling"` + + - `const BetaManagedAgentsSessionStatusRunning BetaManagedAgentsSessionStatus = "running"` + + - `const BetaManagedAgentsSessionStatusIdle BetaManagedAgentsSessionStatus = "idle"` + + - `const BetaManagedAgentsSessionStatusTerminated BetaManagedAgentsSessionStatus = "terminated"` + + - `Title string` + + - `Type BetaManagedAgentsSessionType` + + - `const BetaManagedAgentsSessionTypeSession BetaManagedAgentsSessionType = "session"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Usage BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `CacheCreation BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Ephemeral1hInputTokens int64` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Ephemeral5mInputTokens int64` + + Tokens used to create 5-minute ephemeral cache entries. + + - `CacheReadInputTokens int64` + + Total tokens read from prompt cache. + + - `InputTokens int64` + + Total input tokens consumed across all turns. + + - `OutputTokens int64` + + Total output tokens generated across all turns. + + - `VaultIDs []string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsSession, err := client.Beta.Sessions.Archive( + context.TODO(), + "sesn_011CZkZAtmR3yMPDzynEDxu7", + anthropic.BetaSessionArchiveParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsSession.ID) +} +``` + +## Domain Types + +### Beta Managed Agents Agent Params + +- `type BetaManagedAgentsAgentParamsResp struct{…}` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `ID string` + + The `agent` ID. + + - `Type BetaManagedAgentsAgentParamsType` + + - `const BetaManagedAgentsAgentParamsTypeAgent BetaManagedAgentsAgentParamsType = "agent"` + + - `Version int64` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + +### Beta Managed Agents Branch Checkout + +- `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + +### Beta Managed Agents Cache Creation Usage + +- `type BetaManagedAgentsCacheCreationUsage struct{…}` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Ephemeral1hInputTokens int64` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Ephemeral5mInputTokens int64` + + Tokens used to create 5-minute ephemeral cache entries. + +### Beta Managed Agents Commit Checkout + +- `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + +### Beta Managed Agents Deleted Session + +- `type BetaManagedAgentsDeletedSession struct{…}` + + Confirmation that a `session` has been permanently deleted. + + - `ID string` + + - `Type BetaManagedAgentsDeletedSessionType` + + - `const BetaManagedAgentsDeletedSessionTypeSessionDeleted BetaManagedAgentsDeletedSessionType = "session_deleted"` + +### Beta Managed Agents File Resource Params + +- `type BetaManagedAgentsFileResourceParamsResp struct{…}` + + Mount a file uploaded via the Files API into the session. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileResourceParamsType` + + - `const BetaManagedAgentsFileResourceParamsTypeFile BetaManagedAgentsFileResourceParamsType = "file"` + + - `MountPath string` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +### Beta Managed Agents GitHub Repository Resource Params + +- `type BetaManagedAgentsGitHubRepositoryResourceParamsResp struct{…}` + + Mount a GitHub repository into the session's container. + + - `AuthorizationToken string` + + GitHub authorization token used to clone the repository. + + - `Type BetaManagedAgentsGitHubRepositoryResourceParamsType` + + - `const BetaManagedAgentsGitHubRepositoryResourceParamsTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceParamsType = "github_repository"` + + - `URL string` + + Github URL of the repository + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceParamsCheckoutUnionResp` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `MountPath string` + + Mount path in the container. Defaults to `/workspace/`. + +### Beta Managed Agents Session + +- `type BetaManagedAgentsSession struct{…}` + + A Managed Agents `session`. + + - `ID string` + + - `Agent BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `ID string` + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsSessionAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsSessionAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsSessionAgentType` + + - `const BetaManagedAgentsSessionAgentTypeAgent BetaManagedAgentsSessionAgentType = "agent"` + + - `Version int64` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `EnvironmentID string` + + - `Metadata map[string, string]` + + - `Resources []BetaManagedAgentsSessionResourceUnion` + + - `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Stats BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `ActiveSeconds float64` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `DurationSeconds float64` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `Status BetaManagedAgentsSessionStatus` + + SessionStatus enum + + - `const BetaManagedAgentsSessionStatusRescheduling BetaManagedAgentsSessionStatus = "rescheduling"` + + - `const BetaManagedAgentsSessionStatusRunning BetaManagedAgentsSessionStatus = "running"` + + - `const BetaManagedAgentsSessionStatusIdle BetaManagedAgentsSessionStatus = "idle"` + + - `const BetaManagedAgentsSessionStatusTerminated BetaManagedAgentsSessionStatus = "terminated"` + + - `Title string` + + - `Type BetaManagedAgentsSessionType` + + - `const BetaManagedAgentsSessionTypeSession BetaManagedAgentsSessionType = "session"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Usage BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `CacheCreation BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Ephemeral1hInputTokens int64` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Ephemeral5mInputTokens int64` + + Tokens used to create 5-minute ephemeral cache entries. + + - `CacheReadInputTokens int64` + + Total tokens read from prompt cache. + + - `InputTokens int64` + + Total input tokens consumed across all turns. + + - `OutputTokens int64` + + Total output tokens generated across all turns. + + - `VaultIDs []string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Beta Managed Agents Session Agent + +- `type BetaManagedAgentsSessionAgent struct{…}` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `ID string` + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsSessionAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsSessionAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsSessionAgentType` + + - `const BetaManagedAgentsSessionAgentTypeAgent BetaManagedAgentsSessionAgentType = "agent"` + + - `Version int64` + +### Beta Managed Agents Session Stats + +- `type BetaManagedAgentsSessionStats struct{…}` + + Timing statistics for a session. + + - `ActiveSeconds float64` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `DurationSeconds float64` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + +### Beta Managed Agents Session Usage + +- `type BetaManagedAgentsSessionUsage struct{…}` + + Cumulative token usage for a session across all turns. + + - `CacheCreation BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Ephemeral1hInputTokens int64` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Ephemeral5mInputTokens int64` + + Tokens used to create 5-minute ephemeral cache entries. + + - `CacheReadInputTokens int64` + + Total tokens read from prompt cache. + + - `InputTokens int64` + + Total input tokens consumed across all turns. + + - `OutputTokens int64` + + Total output tokens generated across all turns. + +# Events + +## List + +`client.Beta.Sessions.Events.List(ctx, sessionID, params) (*PageCursor[BetaManagedAgentsSessionEventUnion], error)` + +**get** `/v1/sessions/{session_id}/events` + +List Events + +### Parameters + +- `sessionID string` + +- `params BetaSessionEventListParams` + + - `Limit param.Field[int64]` + + Query param: Query parameter for limit + + - `Order param.Field[BetaSessionEventListParamsOrder]` + + Query param: Sort direction for results, ordered by created_at. Defaults to asc (chronological). + + - `const BetaSessionEventListParamsOrderAsc BetaSessionEventListParamsOrder = "asc"` + + - `const BetaSessionEventListParamsOrderDesc BetaSessionEventListParamsOrder = "desc"` + + - `Page param.Field[string]` + + Query param: Opaque pagination cursor from a previous response's next_page. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsSessionEventUnion interface{…}` + + Union type for all event types in a session. + + - `type BetaManagedAgentsUserMessageEvent struct{…}` + + A user message event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsUserMessageEventContentUnion` + + Array of content blocks comprising the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventType` + + - `const BetaManagedAgentsUserMessageEventTypeUserMessage BetaManagedAgentsUserMessageEventType = "user.message"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserInterruptEvent struct{…}` + + An interrupt event that pauses agent execution and returns control to the user. + + - `ID string` + + Unique identifier for this event. + + - `Type BetaManagedAgentsUserInterruptEventType` + + - `const BetaManagedAgentsUserInterruptEventTypeUserInterrupt BetaManagedAgentsUserInterruptEventType = "user.interrupt"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserToolConfirmationEvent struct{…}` + + A tool confirmation event that approves or denies a pending tool execution. + + - `ID string` + + Unique identifier for this event. + + - `Result BetaManagedAgentsUserToolConfirmationEventResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventResultAllow BetaManagedAgentsUserToolConfirmationEventResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventResultDeny BetaManagedAgentsUserToolConfirmationEventResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventType` + + - `const BetaManagedAgentsUserToolConfirmationEventTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserCustomToolResultEvent struct{…}` + + Event sent by the client providing the result of a custom tool execution. + + - `ID string` + + Unique identifier for this event. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventType` + + - `const BetaManagedAgentsUserCustomToolResultEventTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsAgentCustomToolUseEvent struct{…}` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the custom tool being called. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentCustomToolUseEventType` + + - `const BetaManagedAgentsAgentCustomToolUseEventTypeAgentCustomToolUse BetaManagedAgentsAgentCustomToolUseEventType = "agent.custom_tool_use"` + + - `type BetaManagedAgentsAgentMessageEvent struct{…}` + + An agent response event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMessageEventType` + + - `const BetaManagedAgentsAgentMessageEventTypeAgentMessage BetaManagedAgentsAgentMessageEventType = "agent.message"` + + - `type BetaManagedAgentsAgentThinkingEvent struct{…}` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThinkingEventType` + + - `const BetaManagedAgentsAgentThinkingEventTypeAgentThinking BetaManagedAgentsAgentThinkingEventType = "agent.thinking"` + + - `type BetaManagedAgentsAgentMCPToolUseEvent struct{…}` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `MCPServerName string` + + Name of the MCP server providing the tool. + + - `Name string` + + Name of the MCP tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolUseEventType` + + - `const BetaManagedAgentsAgentMCPToolUseEventTypeAgentMCPToolUse BetaManagedAgentsAgentMCPToolUseEventType = "agent.mcp_tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "deny"` + + - `type BetaManagedAgentsAgentMCPToolResultEvent struct{…}` + + Event representing the result of an MCP tool execution. + + - `ID string` + + Unique identifier for this event. + + - `MCPToolUseID string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolResultEventType` + + - `const BetaManagedAgentsAgentMCPToolResultEventTypeAgentMCPToolResult BetaManagedAgentsAgentMCPToolResultEventType = "agent.mcp_tool_result"` + + - `Content []BetaManagedAgentsAgentMCPToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `type BetaManagedAgentsAgentToolUseEvent struct{…}` + + Event emitted when the agent invokes a built-in agent tool. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the agent tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentToolUseEventType` + + - `const BetaManagedAgentsAgentToolUseEventTypeAgentToolUse BetaManagedAgentsAgentToolUseEventType = "agent.tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "deny"` + + - `type BetaManagedAgentsAgentToolResultEvent struct{…}` + + Event representing the result of an agent tool execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `ToolUseID string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `Type BetaManagedAgentsAgentToolResultEventType` + + - `const BetaManagedAgentsAgentToolResultEventTypeAgentToolResult BetaManagedAgentsAgentToolResultEventType = "agent.tool_result"` + + - `Content []BetaManagedAgentsAgentToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `type BetaManagedAgentsAgentThreadContextCompactedEvent struct{…}` + + Indicates that context compaction (summarization) occurred during the session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThreadContextCompactedEventType` + + - `const BetaManagedAgentsAgentThreadContextCompactedEventTypeAgentThreadContextCompacted BetaManagedAgentsAgentThreadContextCompactedEventType = "agent.thread_context_compacted"` + + - `type BetaManagedAgentsSessionErrorEvent struct{…}` + + An error event indicating a problem occurred during session execution. + + - `ID string` + + Unique identifier for this event. + + - `Error BetaManagedAgentsSessionErrorEventErrorUnion` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `type BetaManagedAgentsUnknownError struct{…}` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsUnknownErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsUnknownErrorType` + + - `const BetaManagedAgentsUnknownErrorTypeUnknownError BetaManagedAgentsUnknownErrorType = "unknown_error"` + + - `type BetaManagedAgentsModelOverloadedError struct{…}` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelOverloadedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelOverloadedErrorType` + + - `const BetaManagedAgentsModelOverloadedErrorTypeModelOverloadedError BetaManagedAgentsModelOverloadedErrorType = "model_overloaded_error"` + + - `type BetaManagedAgentsModelRateLimitedError struct{…}` + + The model request was rate-limited. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRateLimitedErrorType` + + - `const BetaManagedAgentsModelRateLimitedErrorTypeModelRateLimitedError BetaManagedAgentsModelRateLimitedErrorType = "model_rate_limited_error"` + + - `type BetaManagedAgentsModelRequestFailedError struct{…}` + + A model request failed for a reason other than overload or rate-limiting. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRequestFailedErrorType` + + - `const BetaManagedAgentsModelRequestFailedErrorTypeModelRequestFailedError BetaManagedAgentsModelRequestFailedErrorType = "model_request_failed_error"` + + - `type BetaManagedAgentsMCPConnectionFailedError struct{…}` + + Failed to connect to an MCP server. + + - `MCPServerName string` + + Name of the MCP server that failed to connect. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPConnectionFailedErrorType` + + - `const BetaManagedAgentsMCPConnectionFailedErrorTypeMCPConnectionFailedError BetaManagedAgentsMCPConnectionFailedErrorType = "mcp_connection_failed_error"` + + - `type BetaManagedAgentsMCPAuthenticationFailedError struct{…}` + + Authentication to an MCP server failed. + + - `MCPServerName string` + + Name of the MCP server that failed authentication. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPAuthenticationFailedErrorType` + + - `const BetaManagedAgentsMCPAuthenticationFailedErrorTypeMCPAuthenticationFailedError BetaManagedAgentsMCPAuthenticationFailedErrorType = "mcp_authentication_failed_error"` + + - `type BetaManagedAgentsBillingError struct{…}` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsBillingErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsBillingErrorType` + + - `const BetaManagedAgentsBillingErrorTypeBillingError BetaManagedAgentsBillingErrorType = "billing_error"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionErrorEventType` + + - `const BetaManagedAgentsSessionErrorEventTypeSessionError BetaManagedAgentsSessionErrorEventType = "session.error"` + + - `type BetaManagedAgentsSessionStatusRescheduledEvent struct{…}` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRescheduledEventType` + + - `const BetaManagedAgentsSessionStatusRescheduledEventTypeSessionStatusRescheduled BetaManagedAgentsSessionStatusRescheduledEventType = "session.status_rescheduled"` + + - `type BetaManagedAgentsSessionStatusRunningEvent struct{…}` + + Indicates the session is actively running and the agent is working. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRunningEventType` + + - `const BetaManagedAgentsSessionStatusRunningEventTypeSessionStatusRunning BetaManagedAgentsSessionStatusRunningEventType = "session.status_running"` + + - `type BetaManagedAgentsSessionStatusIdleEvent struct{…}` + + Indicates the agent has paused and is awaiting user input. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `StopReason BetaManagedAgentsSessionStatusIdleEventStopReasonUnion` + + The agent completed its turn naturally and is ready for the next user message. + + - `type BetaManagedAgentsSessionEndTurn struct{…}` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type BetaManagedAgentsSessionEndTurnType` + + - `const BetaManagedAgentsSessionEndTurnTypeEndTurn BetaManagedAgentsSessionEndTurnType = "end_turn"` + + - `type BetaManagedAgentsSessionRequiresAction struct{…}` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `EventIDs []string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type BetaManagedAgentsSessionRequiresActionType` + + - `const BetaManagedAgentsSessionRequiresActionTypeRequiresAction BetaManagedAgentsSessionRequiresActionType = "requires_action"` + + - `type BetaManagedAgentsSessionRetriesExhausted struct{…}` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type BetaManagedAgentsSessionRetriesExhaustedType` + + - `const BetaManagedAgentsSessionRetriesExhaustedTypeRetriesExhausted BetaManagedAgentsSessionRetriesExhaustedType = "retries_exhausted"` + + - `Type BetaManagedAgentsSessionStatusIdleEventType` + + - `const BetaManagedAgentsSessionStatusIdleEventTypeSessionStatusIdle BetaManagedAgentsSessionStatusIdleEventType = "session.status_idle"` + + - `type BetaManagedAgentsSessionStatusTerminatedEvent struct{…}` + + Indicates the session has terminated, either due to an error or completion. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusTerminatedEventType` + + - `const BetaManagedAgentsSessionStatusTerminatedEventTypeSessionStatusTerminated BetaManagedAgentsSessionStatusTerminatedEventType = "session.status_terminated"` + + - `type BetaManagedAgentsSpanModelRequestStartEvent struct{…}` + + Emitted when a model request is initiated by the agent. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestStartEventType` + + - `const BetaManagedAgentsSpanModelRequestStartEventTypeSpanModelRequestStart BetaManagedAgentsSpanModelRequestStartEventType = "span.model_request_start"` + + - `type BetaManagedAgentsSpanModelRequestEndEvent struct{…}` + + Emitted when a model request completes. + + - `ID string` + + Unique identifier for this event. + + - `IsError bool` + + Whether the model request resulted in an error. + + - `ModelRequestStartID string` + + The id of the corresponding `span.model_request_start` event. + + - `ModelUsage BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `CacheCreationInputTokens int64` + + Tokens used to create prompt cache in this request. + + - `CacheReadInputTokens int64` + + Tokens read from prompt cache in this request. + + - `InputTokens int64` + + Input tokens consumed by this request. + + - `OutputTokens int64` + + Output tokens generated by this request. + + - `Speed BetaManagedAgentsSpanModelUsageSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsSpanModelUsageSpeedStandard BetaManagedAgentsSpanModelUsageSpeed = "standard"` + + - `const BetaManagedAgentsSpanModelUsageSpeedFast BetaManagedAgentsSpanModelUsageSpeed = "fast"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestEndEventType` + + - `const BetaManagedAgentsSpanModelRequestEndEventTypeSpanModelRequestEnd BetaManagedAgentsSpanModelRequestEndEventType = "span.model_request_end"` + + - `type BetaManagedAgentsSessionDeletedEvent struct{…}` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionDeletedEventType` + + - `const BetaManagedAgentsSessionDeletedEventTypeSessionDeleted BetaManagedAgentsSessionDeletedEventType = "session.deleted"` + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Beta.Sessions.Events.List( + context.TODO(), + "sesn_011CZkZAtmR3yMPDzynEDxu7", + anthropic.BetaSessionEventListParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", page) +} +``` + +## Send + +`client.Beta.Sessions.Events.Send(ctx, sessionID, params) (*BetaManagedAgentsSendSessionEvents, error)` + +**post** `/v1/sessions/{session_id}/events` + +Send Events + +### Parameters + +- `sessionID string` + +- `params BetaSessionEventSendParams` + + - `Events param.Field[[]BetaManagedAgentsEventParamsUnionResp]` + + Body param: Events to send to the `session`. + + - `type BetaManagedAgentsUserMessageEventParamsResp struct{…}` + + Parameters for sending a user message to the session. + + - `Content []BetaManagedAgentsUserMessageEventParamsContentUnionResp` + + Array of content blocks for the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventParamsType` + + - `const BetaManagedAgentsUserMessageEventParamsTypeUserMessage BetaManagedAgentsUserMessageEventParamsType = "user.message"` + + - `type BetaManagedAgentsUserInterruptEventParamsResp struct{…}` + + Parameters for sending an interrupt to pause the agent. + + - `Type BetaManagedAgentsUserInterruptEventParamsType` + + - `const BetaManagedAgentsUserInterruptEventParamsTypeUserInterrupt BetaManagedAgentsUserInterruptEventParamsType = "user.interrupt"` + + - `type BetaManagedAgentsUserToolConfirmationEventParamsResp struct{…}` + + Parameters for confirming or denying a tool execution request. + + - `Result BetaManagedAgentsUserToolConfirmationEventParamsResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventParamsResultAllow BetaManagedAgentsUserToolConfirmationEventParamsResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventParamsResultDeny BetaManagedAgentsUserToolConfirmationEventParamsResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventParamsType` + + - `const BetaManagedAgentsUserToolConfirmationEventParamsTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventParamsType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `type BetaManagedAgentsUserCustomToolResultEventParamsResp struct{…}` + + Parameters for providing the result of a custom tool execution. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventParamsType` + + - `const BetaManagedAgentsUserCustomToolResultEventParamsTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventParamsType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventParamsContentUnionResp` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsSendSessionEvents struct{…}` + + Events that were successfully sent to the session. + + - `Data []BetaManagedAgentsSendSessionEventsDataUnion` + + Sent events + + - `type BetaManagedAgentsUserMessageEvent struct{…}` + + A user message event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsUserMessageEventContentUnion` + + Array of content blocks comprising the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventType` + + - `const BetaManagedAgentsUserMessageEventTypeUserMessage BetaManagedAgentsUserMessageEventType = "user.message"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserInterruptEvent struct{…}` + + An interrupt event that pauses agent execution and returns control to the user. + + - `ID string` + + Unique identifier for this event. + + - `Type BetaManagedAgentsUserInterruptEventType` + + - `const BetaManagedAgentsUserInterruptEventTypeUserInterrupt BetaManagedAgentsUserInterruptEventType = "user.interrupt"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserToolConfirmationEvent struct{…}` + + A tool confirmation event that approves or denies a pending tool execution. + + - `ID string` + + Unique identifier for this event. + + - `Result BetaManagedAgentsUserToolConfirmationEventResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventResultAllow BetaManagedAgentsUserToolConfirmationEventResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventResultDeny BetaManagedAgentsUserToolConfirmationEventResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventType` + + - `const BetaManagedAgentsUserToolConfirmationEventTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserCustomToolResultEvent struct{…}` + + Event sent by the client providing the result of a custom tool execution. + + - `ID string` + + Unique identifier for this event. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventType` + + - `const BetaManagedAgentsUserCustomToolResultEventTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsSendSessionEvents, err := client.Beta.Sessions.Events.Send( + context.TODO(), + "sesn_011CZkZAtmR3yMPDzynEDxu7", + anthropic.BetaSessionEventSendParams{ + Events: []anthropic.BetaManagedAgentsEventParamsUnion{anthropic.BetaManagedAgentsEventParamsUnion{ + OfUserMessage: &anthropic.BetaManagedAgentsUserMessageEventParams{ + Content: []anthropic.BetaManagedAgentsUserMessageEventParamsContentUnion{anthropic.BetaManagedAgentsUserMessageEventParamsContentUnion{ + OfText: &anthropic.BetaManagedAgentsTextBlockParam{ + Text: "Where is my order #1234?", + Type: anthropic.BetaManagedAgentsTextBlockTypeText, + }, + }}, + Type: anthropic.BetaManagedAgentsUserMessageEventParamsTypeUserMessage, + }, + }}, + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsSendSessionEvents.Data) +} +``` + +## Stream + +`client.Beta.Sessions.Events.Stream(ctx, sessionID, query) (*BetaManagedAgentsStreamSessionEventsUnion, error)` + +**get** `/v1/sessions/{session_id}/events/stream` + +Stream Events + +### Parameters + +- `sessionID string` + +- `query BetaSessionEventStreamParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsStreamSessionEventsUnion interface{…}` + + Server-sent event in the session stream. + + - `type BetaManagedAgentsUserMessageEvent struct{…}` + + A user message event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsUserMessageEventContentUnion` + + Array of content blocks comprising the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventType` + + - `const BetaManagedAgentsUserMessageEventTypeUserMessage BetaManagedAgentsUserMessageEventType = "user.message"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserInterruptEvent struct{…}` + + An interrupt event that pauses agent execution and returns control to the user. + + - `ID string` + + Unique identifier for this event. + + - `Type BetaManagedAgentsUserInterruptEventType` + + - `const BetaManagedAgentsUserInterruptEventTypeUserInterrupt BetaManagedAgentsUserInterruptEventType = "user.interrupt"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserToolConfirmationEvent struct{…}` + + A tool confirmation event that approves or denies a pending tool execution. + + - `ID string` + + Unique identifier for this event. + + - `Result BetaManagedAgentsUserToolConfirmationEventResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventResultAllow BetaManagedAgentsUserToolConfirmationEventResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventResultDeny BetaManagedAgentsUserToolConfirmationEventResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventType` + + - `const BetaManagedAgentsUserToolConfirmationEventTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserCustomToolResultEvent struct{…}` + + Event sent by the client providing the result of a custom tool execution. + + - `ID string` + + Unique identifier for this event. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventType` + + - `const BetaManagedAgentsUserCustomToolResultEventTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsAgentCustomToolUseEvent struct{…}` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the custom tool being called. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentCustomToolUseEventType` + + - `const BetaManagedAgentsAgentCustomToolUseEventTypeAgentCustomToolUse BetaManagedAgentsAgentCustomToolUseEventType = "agent.custom_tool_use"` + + - `type BetaManagedAgentsAgentMessageEvent struct{…}` + + An agent response event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMessageEventType` + + - `const BetaManagedAgentsAgentMessageEventTypeAgentMessage BetaManagedAgentsAgentMessageEventType = "agent.message"` + + - `type BetaManagedAgentsAgentThinkingEvent struct{…}` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThinkingEventType` + + - `const BetaManagedAgentsAgentThinkingEventTypeAgentThinking BetaManagedAgentsAgentThinkingEventType = "agent.thinking"` + + - `type BetaManagedAgentsAgentMCPToolUseEvent struct{…}` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `MCPServerName string` + + Name of the MCP server providing the tool. + + - `Name string` + + Name of the MCP tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolUseEventType` + + - `const BetaManagedAgentsAgentMCPToolUseEventTypeAgentMCPToolUse BetaManagedAgentsAgentMCPToolUseEventType = "agent.mcp_tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "deny"` + + - `type BetaManagedAgentsAgentMCPToolResultEvent struct{…}` + + Event representing the result of an MCP tool execution. + + - `ID string` + + Unique identifier for this event. + + - `MCPToolUseID string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolResultEventType` + + - `const BetaManagedAgentsAgentMCPToolResultEventTypeAgentMCPToolResult BetaManagedAgentsAgentMCPToolResultEventType = "agent.mcp_tool_result"` + + - `Content []BetaManagedAgentsAgentMCPToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `type BetaManagedAgentsAgentToolUseEvent struct{…}` + + Event emitted when the agent invokes a built-in agent tool. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the agent tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentToolUseEventType` + + - `const BetaManagedAgentsAgentToolUseEventTypeAgentToolUse BetaManagedAgentsAgentToolUseEventType = "agent.tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "deny"` + + - `type BetaManagedAgentsAgentToolResultEvent struct{…}` + + Event representing the result of an agent tool execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `ToolUseID string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `Type BetaManagedAgentsAgentToolResultEventType` + + - `const BetaManagedAgentsAgentToolResultEventTypeAgentToolResult BetaManagedAgentsAgentToolResultEventType = "agent.tool_result"` + + - `Content []BetaManagedAgentsAgentToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `type BetaManagedAgentsAgentThreadContextCompactedEvent struct{…}` + + Indicates that context compaction (summarization) occurred during the session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThreadContextCompactedEventType` + + - `const BetaManagedAgentsAgentThreadContextCompactedEventTypeAgentThreadContextCompacted BetaManagedAgentsAgentThreadContextCompactedEventType = "agent.thread_context_compacted"` + + - `type BetaManagedAgentsSessionErrorEvent struct{…}` + + An error event indicating a problem occurred during session execution. + + - `ID string` + + Unique identifier for this event. + + - `Error BetaManagedAgentsSessionErrorEventErrorUnion` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `type BetaManagedAgentsUnknownError struct{…}` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsUnknownErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsUnknownErrorType` + + - `const BetaManagedAgentsUnknownErrorTypeUnknownError BetaManagedAgentsUnknownErrorType = "unknown_error"` + + - `type BetaManagedAgentsModelOverloadedError struct{…}` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelOverloadedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelOverloadedErrorType` + + - `const BetaManagedAgentsModelOverloadedErrorTypeModelOverloadedError BetaManagedAgentsModelOverloadedErrorType = "model_overloaded_error"` + + - `type BetaManagedAgentsModelRateLimitedError struct{…}` + + The model request was rate-limited. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRateLimitedErrorType` + + - `const BetaManagedAgentsModelRateLimitedErrorTypeModelRateLimitedError BetaManagedAgentsModelRateLimitedErrorType = "model_rate_limited_error"` + + - `type BetaManagedAgentsModelRequestFailedError struct{…}` + + A model request failed for a reason other than overload or rate-limiting. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRequestFailedErrorType` + + - `const BetaManagedAgentsModelRequestFailedErrorTypeModelRequestFailedError BetaManagedAgentsModelRequestFailedErrorType = "model_request_failed_error"` + + - `type BetaManagedAgentsMCPConnectionFailedError struct{…}` + + Failed to connect to an MCP server. + + - `MCPServerName string` + + Name of the MCP server that failed to connect. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPConnectionFailedErrorType` + + - `const BetaManagedAgentsMCPConnectionFailedErrorTypeMCPConnectionFailedError BetaManagedAgentsMCPConnectionFailedErrorType = "mcp_connection_failed_error"` + + - `type BetaManagedAgentsMCPAuthenticationFailedError struct{…}` + + Authentication to an MCP server failed. + + - `MCPServerName string` + + Name of the MCP server that failed authentication. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPAuthenticationFailedErrorType` + + - `const BetaManagedAgentsMCPAuthenticationFailedErrorTypeMCPAuthenticationFailedError BetaManagedAgentsMCPAuthenticationFailedErrorType = "mcp_authentication_failed_error"` + + - `type BetaManagedAgentsBillingError struct{…}` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsBillingErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsBillingErrorType` + + - `const BetaManagedAgentsBillingErrorTypeBillingError BetaManagedAgentsBillingErrorType = "billing_error"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionErrorEventType` + + - `const BetaManagedAgentsSessionErrorEventTypeSessionError BetaManagedAgentsSessionErrorEventType = "session.error"` + + - `type BetaManagedAgentsSessionStatusRescheduledEvent struct{…}` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRescheduledEventType` + + - `const BetaManagedAgentsSessionStatusRescheduledEventTypeSessionStatusRescheduled BetaManagedAgentsSessionStatusRescheduledEventType = "session.status_rescheduled"` + + - `type BetaManagedAgentsSessionStatusRunningEvent struct{…}` + + Indicates the session is actively running and the agent is working. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRunningEventType` + + - `const BetaManagedAgentsSessionStatusRunningEventTypeSessionStatusRunning BetaManagedAgentsSessionStatusRunningEventType = "session.status_running"` + + - `type BetaManagedAgentsSessionStatusIdleEvent struct{…}` + + Indicates the agent has paused and is awaiting user input. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `StopReason BetaManagedAgentsSessionStatusIdleEventStopReasonUnion` + + The agent completed its turn naturally and is ready for the next user message. + + - `type BetaManagedAgentsSessionEndTurn struct{…}` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type BetaManagedAgentsSessionEndTurnType` + + - `const BetaManagedAgentsSessionEndTurnTypeEndTurn BetaManagedAgentsSessionEndTurnType = "end_turn"` + + - `type BetaManagedAgentsSessionRequiresAction struct{…}` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `EventIDs []string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type BetaManagedAgentsSessionRequiresActionType` + + - `const BetaManagedAgentsSessionRequiresActionTypeRequiresAction BetaManagedAgentsSessionRequiresActionType = "requires_action"` + + - `type BetaManagedAgentsSessionRetriesExhausted struct{…}` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type BetaManagedAgentsSessionRetriesExhaustedType` + + - `const BetaManagedAgentsSessionRetriesExhaustedTypeRetriesExhausted BetaManagedAgentsSessionRetriesExhaustedType = "retries_exhausted"` + + - `Type BetaManagedAgentsSessionStatusIdleEventType` + + - `const BetaManagedAgentsSessionStatusIdleEventTypeSessionStatusIdle BetaManagedAgentsSessionStatusIdleEventType = "session.status_idle"` + + - `type BetaManagedAgentsSessionStatusTerminatedEvent struct{…}` + + Indicates the session has terminated, either due to an error or completion. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusTerminatedEventType` + + - `const BetaManagedAgentsSessionStatusTerminatedEventTypeSessionStatusTerminated BetaManagedAgentsSessionStatusTerminatedEventType = "session.status_terminated"` + + - `type BetaManagedAgentsSpanModelRequestStartEvent struct{…}` + + Emitted when a model request is initiated by the agent. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestStartEventType` + + - `const BetaManagedAgentsSpanModelRequestStartEventTypeSpanModelRequestStart BetaManagedAgentsSpanModelRequestStartEventType = "span.model_request_start"` + + - `type BetaManagedAgentsSpanModelRequestEndEvent struct{…}` + + Emitted when a model request completes. + + - `ID string` + + Unique identifier for this event. + + - `IsError bool` + + Whether the model request resulted in an error. + + - `ModelRequestStartID string` + + The id of the corresponding `span.model_request_start` event. + + - `ModelUsage BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `CacheCreationInputTokens int64` + + Tokens used to create prompt cache in this request. + + - `CacheReadInputTokens int64` + + Tokens read from prompt cache in this request. + + - `InputTokens int64` + + Input tokens consumed by this request. + + - `OutputTokens int64` + + Output tokens generated by this request. + + - `Speed BetaManagedAgentsSpanModelUsageSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsSpanModelUsageSpeedStandard BetaManagedAgentsSpanModelUsageSpeed = "standard"` + + - `const BetaManagedAgentsSpanModelUsageSpeedFast BetaManagedAgentsSpanModelUsageSpeed = "fast"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestEndEventType` + + - `const BetaManagedAgentsSpanModelRequestEndEventTypeSpanModelRequestEnd BetaManagedAgentsSpanModelRequestEndEventType = "span.model_request_end"` + + - `type BetaManagedAgentsSessionDeletedEvent struct{…}` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionDeletedEventType` + + - `const BetaManagedAgentsSessionDeletedEventTypeSessionDeleted BetaManagedAgentsSessionDeletedEventType = "session.deleted"` + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + stream := client.Beta.Sessions.Events.StreamEvents( + context.TODO(), + "sesn_011CZkZAtmR3yMPDzynEDxu7", + anthropic.BetaSessionEventStreamParams{ + + }, + ) + for stream.Next() { + fmt.Printf("%+v\n", stream.Current()) + } + err := stream.Err() + if err != nil { + panic(err.Error()) + } +} +``` + +## Domain Types + +### Beta Managed Agents Agent Custom Tool Use Event + +- `type BetaManagedAgentsAgentCustomToolUseEvent struct{…}` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the custom tool being called. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentCustomToolUseEventType` + + - `const BetaManagedAgentsAgentCustomToolUseEventTypeAgentCustomToolUse BetaManagedAgentsAgentCustomToolUseEventType = "agent.custom_tool_use"` + +### Beta Managed Agents Agent MCP Tool Result Event + +- `type BetaManagedAgentsAgentMCPToolResultEvent struct{…}` + + Event representing the result of an MCP tool execution. + + - `ID string` + + Unique identifier for this event. + + - `MCPToolUseID string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolResultEventType` + + - `const BetaManagedAgentsAgentMCPToolResultEventTypeAgentMCPToolResult BetaManagedAgentsAgentMCPToolResultEventType = "agent.mcp_tool_result"` + + - `Content []BetaManagedAgentsAgentMCPToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent MCP Tool Use Event + +- `type BetaManagedAgentsAgentMCPToolUseEvent struct{…}` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `MCPServerName string` + + Name of the MCP server providing the tool. + + - `Name string` + + Name of the MCP tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolUseEventType` + + - `const BetaManagedAgentsAgentMCPToolUseEventTypeAgentMCPToolUse BetaManagedAgentsAgentMCPToolUseEventType = "agent.mcp_tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "deny"` + +### Beta Managed Agents Agent Message Event + +- `type BetaManagedAgentsAgentMessageEvent struct{…}` + + An agent response event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMessageEventType` + + - `const BetaManagedAgentsAgentMessageEventTypeAgentMessage BetaManagedAgentsAgentMessageEventType = "agent.message"` + +### Beta Managed Agents Agent Thinking Event + +- `type BetaManagedAgentsAgentThinkingEvent struct{…}` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThinkingEventType` + + - `const BetaManagedAgentsAgentThinkingEventTypeAgentThinking BetaManagedAgentsAgentThinkingEventType = "agent.thinking"` + +### Beta Managed Agents Agent Thread Context Compacted Event + +- `type BetaManagedAgentsAgentThreadContextCompactedEvent struct{…}` + + Indicates that context compaction (summarization) occurred during the session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThreadContextCompactedEventType` + + - `const BetaManagedAgentsAgentThreadContextCompactedEventTypeAgentThreadContextCompacted BetaManagedAgentsAgentThreadContextCompactedEventType = "agent.thread_context_compacted"` + +### Beta Managed Agents Agent Tool Result Event + +- `type BetaManagedAgentsAgentToolResultEvent struct{…}` + + Event representing the result of an agent tool execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `ToolUseID string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `Type BetaManagedAgentsAgentToolResultEventType` + + - `const BetaManagedAgentsAgentToolResultEventTypeAgentToolResult BetaManagedAgentsAgentToolResultEventType = "agent.tool_result"` + + - `Content []BetaManagedAgentsAgentToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent Tool Use Event + +- `type BetaManagedAgentsAgentToolUseEvent struct{…}` + + Event emitted when the agent invokes a built-in agent tool. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the agent tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentToolUseEventType` + + - `const BetaManagedAgentsAgentToolUseEventTypeAgentToolUse BetaManagedAgentsAgentToolUseEventType = "agent.tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "deny"` + +### Beta Managed Agents Base64 Document Source + +- `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + +### Beta Managed Agents Base64 Image Source + +- `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + +### Beta Managed Agents Billing Error + +- `type BetaManagedAgentsBillingError struct{…}` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsBillingErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsBillingErrorType` + + - `const BetaManagedAgentsBillingErrorTypeBillingError BetaManagedAgentsBillingErrorType = "billing_error"` + +### Beta Managed Agents Document Block + +- `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + +### Beta Managed Agents Event Params + +- `type BetaManagedAgentsEventParamsUnionResp interface{…}` + + Union type for event parameters that can be sent to a session. + + - `type BetaManagedAgentsUserMessageEventParamsResp struct{…}` + + Parameters for sending a user message to the session. + + - `Content []BetaManagedAgentsUserMessageEventParamsContentUnionResp` + + Array of content blocks for the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventParamsType` + + - `const BetaManagedAgentsUserMessageEventParamsTypeUserMessage BetaManagedAgentsUserMessageEventParamsType = "user.message"` + + - `type BetaManagedAgentsUserInterruptEventParamsResp struct{…}` + + Parameters for sending an interrupt to pause the agent. + + - `Type BetaManagedAgentsUserInterruptEventParamsType` + + - `const BetaManagedAgentsUserInterruptEventParamsTypeUserInterrupt BetaManagedAgentsUserInterruptEventParamsType = "user.interrupt"` + + - `type BetaManagedAgentsUserToolConfirmationEventParamsResp struct{…}` + + Parameters for confirming or denying a tool execution request. + + - `Result BetaManagedAgentsUserToolConfirmationEventParamsResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventParamsResultAllow BetaManagedAgentsUserToolConfirmationEventParamsResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventParamsResultDeny BetaManagedAgentsUserToolConfirmationEventParamsResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventParamsType` + + - `const BetaManagedAgentsUserToolConfirmationEventParamsTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventParamsType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `type BetaManagedAgentsUserCustomToolResultEventParamsResp struct{…}` + + Parameters for providing the result of a custom tool execution. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventParamsType` + + - `const BetaManagedAgentsUserCustomToolResultEventParamsTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventParamsType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventParamsContentUnionResp` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents File Document Source + +- `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + +### Beta Managed Agents File Image Source + +- `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + +### Beta Managed Agents Image Block + +- `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + +### Beta Managed Agents MCP Authentication Failed Error + +- `type BetaManagedAgentsMCPAuthenticationFailedError struct{…}` + + Authentication to an MCP server failed. + + - `MCPServerName string` + + Name of the MCP server that failed authentication. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPAuthenticationFailedErrorType` + + - `const BetaManagedAgentsMCPAuthenticationFailedErrorTypeMCPAuthenticationFailedError BetaManagedAgentsMCPAuthenticationFailedErrorType = "mcp_authentication_failed_error"` + +### Beta Managed Agents MCP Connection Failed Error + +- `type BetaManagedAgentsMCPConnectionFailedError struct{…}` + + Failed to connect to an MCP server. + + - `MCPServerName string` + + Name of the MCP server that failed to connect. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPConnectionFailedErrorType` + + - `const BetaManagedAgentsMCPConnectionFailedErrorTypeMCPConnectionFailedError BetaManagedAgentsMCPConnectionFailedErrorType = "mcp_connection_failed_error"` + +### Beta Managed Agents Model Overloaded Error + +- `type BetaManagedAgentsModelOverloadedError struct{…}` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelOverloadedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelOverloadedErrorType` + + - `const BetaManagedAgentsModelOverloadedErrorTypeModelOverloadedError BetaManagedAgentsModelOverloadedErrorType = "model_overloaded_error"` + +### Beta Managed Agents Model Rate Limited Error + +- `type BetaManagedAgentsModelRateLimitedError struct{…}` + + The model request was rate-limited. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRateLimitedErrorType` + + - `const BetaManagedAgentsModelRateLimitedErrorTypeModelRateLimitedError BetaManagedAgentsModelRateLimitedErrorType = "model_rate_limited_error"` + +### Beta Managed Agents Model Request Failed Error + +- `type BetaManagedAgentsModelRequestFailedError struct{…}` + + A model request failed for a reason other than overload or rate-limiting. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRequestFailedErrorType` + + - `const BetaManagedAgentsModelRequestFailedErrorTypeModelRequestFailedError BetaManagedAgentsModelRequestFailedErrorType = "model_request_failed_error"` + +### Beta Managed Agents Plain Text Document Source + +- `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + +### Beta Managed Agents Retry Status Exhausted + +- `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + +### Beta Managed Agents Retry Status Retrying + +- `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + +### Beta Managed Agents Retry Status Terminal + +- `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + +### Beta Managed Agents Send Session Events + +- `type BetaManagedAgentsSendSessionEvents struct{…}` + + Events that were successfully sent to the session. + + - `Data []BetaManagedAgentsSendSessionEventsDataUnion` + + Sent events + + - `type BetaManagedAgentsUserMessageEvent struct{…}` + + A user message event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsUserMessageEventContentUnion` + + Array of content blocks comprising the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventType` + + - `const BetaManagedAgentsUserMessageEventTypeUserMessage BetaManagedAgentsUserMessageEventType = "user.message"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserInterruptEvent struct{…}` + + An interrupt event that pauses agent execution and returns control to the user. + + - `ID string` + + Unique identifier for this event. + + - `Type BetaManagedAgentsUserInterruptEventType` + + - `const BetaManagedAgentsUserInterruptEventTypeUserInterrupt BetaManagedAgentsUserInterruptEventType = "user.interrupt"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserToolConfirmationEvent struct{…}` + + A tool confirmation event that approves or denies a pending tool execution. + + - `ID string` + + Unique identifier for this event. + + - `Result BetaManagedAgentsUserToolConfirmationEventResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventResultAllow BetaManagedAgentsUserToolConfirmationEventResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventResultDeny BetaManagedAgentsUserToolConfirmationEventResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventType` + + - `const BetaManagedAgentsUserToolConfirmationEventTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserCustomToolResultEvent struct{…}` + + Event sent by the client providing the result of a custom tool execution. + + - `ID string` + + Unique identifier for this event. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventType` + + - `const BetaManagedAgentsUserCustomToolResultEventTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents Session Deleted Event + +- `type BetaManagedAgentsSessionDeletedEvent struct{…}` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionDeletedEventType` + + - `const BetaManagedAgentsSessionDeletedEventTypeSessionDeleted BetaManagedAgentsSessionDeletedEventType = "session.deleted"` + +### Beta Managed Agents Session End Turn + +- `type BetaManagedAgentsSessionEndTurn struct{…}` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type BetaManagedAgentsSessionEndTurnType` + + - `const BetaManagedAgentsSessionEndTurnTypeEndTurn BetaManagedAgentsSessionEndTurnType = "end_turn"` + +### Beta Managed Agents Session Error Event + +- `type BetaManagedAgentsSessionErrorEvent struct{…}` + + An error event indicating a problem occurred during session execution. + + - `ID string` + + Unique identifier for this event. + + - `Error BetaManagedAgentsSessionErrorEventErrorUnion` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `type BetaManagedAgentsUnknownError struct{…}` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsUnknownErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsUnknownErrorType` + + - `const BetaManagedAgentsUnknownErrorTypeUnknownError BetaManagedAgentsUnknownErrorType = "unknown_error"` + + - `type BetaManagedAgentsModelOverloadedError struct{…}` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelOverloadedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelOverloadedErrorType` + + - `const BetaManagedAgentsModelOverloadedErrorTypeModelOverloadedError BetaManagedAgentsModelOverloadedErrorType = "model_overloaded_error"` + + - `type BetaManagedAgentsModelRateLimitedError struct{…}` + + The model request was rate-limited. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRateLimitedErrorType` + + - `const BetaManagedAgentsModelRateLimitedErrorTypeModelRateLimitedError BetaManagedAgentsModelRateLimitedErrorType = "model_rate_limited_error"` + + - `type BetaManagedAgentsModelRequestFailedError struct{…}` + + A model request failed for a reason other than overload or rate-limiting. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRequestFailedErrorType` + + - `const BetaManagedAgentsModelRequestFailedErrorTypeModelRequestFailedError BetaManagedAgentsModelRequestFailedErrorType = "model_request_failed_error"` + + - `type BetaManagedAgentsMCPConnectionFailedError struct{…}` + + Failed to connect to an MCP server. + + - `MCPServerName string` + + Name of the MCP server that failed to connect. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPConnectionFailedErrorType` + + - `const BetaManagedAgentsMCPConnectionFailedErrorTypeMCPConnectionFailedError BetaManagedAgentsMCPConnectionFailedErrorType = "mcp_connection_failed_error"` + + - `type BetaManagedAgentsMCPAuthenticationFailedError struct{…}` + + Authentication to an MCP server failed. + + - `MCPServerName string` + + Name of the MCP server that failed authentication. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPAuthenticationFailedErrorType` + + - `const BetaManagedAgentsMCPAuthenticationFailedErrorTypeMCPAuthenticationFailedError BetaManagedAgentsMCPAuthenticationFailedErrorType = "mcp_authentication_failed_error"` + + - `type BetaManagedAgentsBillingError struct{…}` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsBillingErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsBillingErrorType` + + - `const BetaManagedAgentsBillingErrorTypeBillingError BetaManagedAgentsBillingErrorType = "billing_error"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionErrorEventType` + + - `const BetaManagedAgentsSessionErrorEventTypeSessionError BetaManagedAgentsSessionErrorEventType = "session.error"` + +### Beta Managed Agents Session Event + +- `type BetaManagedAgentsSessionEventUnion interface{…}` + + Union type for all event types in a session. + + - `type BetaManagedAgentsUserMessageEvent struct{…}` + + A user message event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsUserMessageEventContentUnion` + + Array of content blocks comprising the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventType` + + - `const BetaManagedAgentsUserMessageEventTypeUserMessage BetaManagedAgentsUserMessageEventType = "user.message"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserInterruptEvent struct{…}` + + An interrupt event that pauses agent execution and returns control to the user. + + - `ID string` + + Unique identifier for this event. + + - `Type BetaManagedAgentsUserInterruptEventType` + + - `const BetaManagedAgentsUserInterruptEventTypeUserInterrupt BetaManagedAgentsUserInterruptEventType = "user.interrupt"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserToolConfirmationEvent struct{…}` + + A tool confirmation event that approves or denies a pending tool execution. + + - `ID string` + + Unique identifier for this event. + + - `Result BetaManagedAgentsUserToolConfirmationEventResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventResultAllow BetaManagedAgentsUserToolConfirmationEventResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventResultDeny BetaManagedAgentsUserToolConfirmationEventResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventType` + + - `const BetaManagedAgentsUserToolConfirmationEventTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserCustomToolResultEvent struct{…}` + + Event sent by the client providing the result of a custom tool execution. + + - `ID string` + + Unique identifier for this event. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventType` + + - `const BetaManagedAgentsUserCustomToolResultEventTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsAgentCustomToolUseEvent struct{…}` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the custom tool being called. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentCustomToolUseEventType` + + - `const BetaManagedAgentsAgentCustomToolUseEventTypeAgentCustomToolUse BetaManagedAgentsAgentCustomToolUseEventType = "agent.custom_tool_use"` + + - `type BetaManagedAgentsAgentMessageEvent struct{…}` + + An agent response event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMessageEventType` + + - `const BetaManagedAgentsAgentMessageEventTypeAgentMessage BetaManagedAgentsAgentMessageEventType = "agent.message"` + + - `type BetaManagedAgentsAgentThinkingEvent struct{…}` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThinkingEventType` + + - `const BetaManagedAgentsAgentThinkingEventTypeAgentThinking BetaManagedAgentsAgentThinkingEventType = "agent.thinking"` + + - `type BetaManagedAgentsAgentMCPToolUseEvent struct{…}` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `MCPServerName string` + + Name of the MCP server providing the tool. + + - `Name string` + + Name of the MCP tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolUseEventType` + + - `const BetaManagedAgentsAgentMCPToolUseEventTypeAgentMCPToolUse BetaManagedAgentsAgentMCPToolUseEventType = "agent.mcp_tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "deny"` + + - `type BetaManagedAgentsAgentMCPToolResultEvent struct{…}` + + Event representing the result of an MCP tool execution. + + - `ID string` + + Unique identifier for this event. + + - `MCPToolUseID string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolResultEventType` + + - `const BetaManagedAgentsAgentMCPToolResultEventTypeAgentMCPToolResult BetaManagedAgentsAgentMCPToolResultEventType = "agent.mcp_tool_result"` + + - `Content []BetaManagedAgentsAgentMCPToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `type BetaManagedAgentsAgentToolUseEvent struct{…}` + + Event emitted when the agent invokes a built-in agent tool. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the agent tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentToolUseEventType` + + - `const BetaManagedAgentsAgentToolUseEventTypeAgentToolUse BetaManagedAgentsAgentToolUseEventType = "agent.tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "deny"` + + - `type BetaManagedAgentsAgentToolResultEvent struct{…}` + + Event representing the result of an agent tool execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `ToolUseID string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `Type BetaManagedAgentsAgentToolResultEventType` + + - `const BetaManagedAgentsAgentToolResultEventTypeAgentToolResult BetaManagedAgentsAgentToolResultEventType = "agent.tool_result"` + + - `Content []BetaManagedAgentsAgentToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `type BetaManagedAgentsAgentThreadContextCompactedEvent struct{…}` + + Indicates that context compaction (summarization) occurred during the session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThreadContextCompactedEventType` + + - `const BetaManagedAgentsAgentThreadContextCompactedEventTypeAgentThreadContextCompacted BetaManagedAgentsAgentThreadContextCompactedEventType = "agent.thread_context_compacted"` + + - `type BetaManagedAgentsSessionErrorEvent struct{…}` + + An error event indicating a problem occurred during session execution. + + - `ID string` + + Unique identifier for this event. + + - `Error BetaManagedAgentsSessionErrorEventErrorUnion` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `type BetaManagedAgentsUnknownError struct{…}` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsUnknownErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsUnknownErrorType` + + - `const BetaManagedAgentsUnknownErrorTypeUnknownError BetaManagedAgentsUnknownErrorType = "unknown_error"` + + - `type BetaManagedAgentsModelOverloadedError struct{…}` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelOverloadedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelOverloadedErrorType` + + - `const BetaManagedAgentsModelOverloadedErrorTypeModelOverloadedError BetaManagedAgentsModelOverloadedErrorType = "model_overloaded_error"` + + - `type BetaManagedAgentsModelRateLimitedError struct{…}` + + The model request was rate-limited. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRateLimitedErrorType` + + - `const BetaManagedAgentsModelRateLimitedErrorTypeModelRateLimitedError BetaManagedAgentsModelRateLimitedErrorType = "model_rate_limited_error"` + + - `type BetaManagedAgentsModelRequestFailedError struct{…}` + + A model request failed for a reason other than overload or rate-limiting. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRequestFailedErrorType` + + - `const BetaManagedAgentsModelRequestFailedErrorTypeModelRequestFailedError BetaManagedAgentsModelRequestFailedErrorType = "model_request_failed_error"` + + - `type BetaManagedAgentsMCPConnectionFailedError struct{…}` + + Failed to connect to an MCP server. + + - `MCPServerName string` + + Name of the MCP server that failed to connect. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPConnectionFailedErrorType` + + - `const BetaManagedAgentsMCPConnectionFailedErrorTypeMCPConnectionFailedError BetaManagedAgentsMCPConnectionFailedErrorType = "mcp_connection_failed_error"` + + - `type BetaManagedAgentsMCPAuthenticationFailedError struct{…}` + + Authentication to an MCP server failed. + + - `MCPServerName string` + + Name of the MCP server that failed authentication. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPAuthenticationFailedErrorType` + + - `const BetaManagedAgentsMCPAuthenticationFailedErrorTypeMCPAuthenticationFailedError BetaManagedAgentsMCPAuthenticationFailedErrorType = "mcp_authentication_failed_error"` + + - `type BetaManagedAgentsBillingError struct{…}` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsBillingErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsBillingErrorType` + + - `const BetaManagedAgentsBillingErrorTypeBillingError BetaManagedAgentsBillingErrorType = "billing_error"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionErrorEventType` + + - `const BetaManagedAgentsSessionErrorEventTypeSessionError BetaManagedAgentsSessionErrorEventType = "session.error"` + + - `type BetaManagedAgentsSessionStatusRescheduledEvent struct{…}` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRescheduledEventType` + + - `const BetaManagedAgentsSessionStatusRescheduledEventTypeSessionStatusRescheduled BetaManagedAgentsSessionStatusRescheduledEventType = "session.status_rescheduled"` + + - `type BetaManagedAgentsSessionStatusRunningEvent struct{…}` + + Indicates the session is actively running and the agent is working. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRunningEventType` + + - `const BetaManagedAgentsSessionStatusRunningEventTypeSessionStatusRunning BetaManagedAgentsSessionStatusRunningEventType = "session.status_running"` + + - `type BetaManagedAgentsSessionStatusIdleEvent struct{…}` + + Indicates the agent has paused and is awaiting user input. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `StopReason BetaManagedAgentsSessionStatusIdleEventStopReasonUnion` + + The agent completed its turn naturally and is ready for the next user message. + + - `type BetaManagedAgentsSessionEndTurn struct{…}` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type BetaManagedAgentsSessionEndTurnType` + + - `const BetaManagedAgentsSessionEndTurnTypeEndTurn BetaManagedAgentsSessionEndTurnType = "end_turn"` + + - `type BetaManagedAgentsSessionRequiresAction struct{…}` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `EventIDs []string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type BetaManagedAgentsSessionRequiresActionType` + + - `const BetaManagedAgentsSessionRequiresActionTypeRequiresAction BetaManagedAgentsSessionRequiresActionType = "requires_action"` + + - `type BetaManagedAgentsSessionRetriesExhausted struct{…}` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type BetaManagedAgentsSessionRetriesExhaustedType` + + - `const BetaManagedAgentsSessionRetriesExhaustedTypeRetriesExhausted BetaManagedAgentsSessionRetriesExhaustedType = "retries_exhausted"` + + - `Type BetaManagedAgentsSessionStatusIdleEventType` + + - `const BetaManagedAgentsSessionStatusIdleEventTypeSessionStatusIdle BetaManagedAgentsSessionStatusIdleEventType = "session.status_idle"` + + - `type BetaManagedAgentsSessionStatusTerminatedEvent struct{…}` + + Indicates the session has terminated, either due to an error or completion. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusTerminatedEventType` + + - `const BetaManagedAgentsSessionStatusTerminatedEventTypeSessionStatusTerminated BetaManagedAgentsSessionStatusTerminatedEventType = "session.status_terminated"` + + - `type BetaManagedAgentsSpanModelRequestStartEvent struct{…}` + + Emitted when a model request is initiated by the agent. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestStartEventType` + + - `const BetaManagedAgentsSpanModelRequestStartEventTypeSpanModelRequestStart BetaManagedAgentsSpanModelRequestStartEventType = "span.model_request_start"` + + - `type BetaManagedAgentsSpanModelRequestEndEvent struct{…}` + + Emitted when a model request completes. + + - `ID string` + + Unique identifier for this event. + + - `IsError bool` + + Whether the model request resulted in an error. + + - `ModelRequestStartID string` + + The id of the corresponding `span.model_request_start` event. + + - `ModelUsage BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `CacheCreationInputTokens int64` + + Tokens used to create prompt cache in this request. + + - `CacheReadInputTokens int64` + + Tokens read from prompt cache in this request. + + - `InputTokens int64` + + Input tokens consumed by this request. + + - `OutputTokens int64` + + Output tokens generated by this request. + + - `Speed BetaManagedAgentsSpanModelUsageSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsSpanModelUsageSpeedStandard BetaManagedAgentsSpanModelUsageSpeed = "standard"` + + - `const BetaManagedAgentsSpanModelUsageSpeedFast BetaManagedAgentsSpanModelUsageSpeed = "fast"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestEndEventType` + + - `const BetaManagedAgentsSpanModelRequestEndEventTypeSpanModelRequestEnd BetaManagedAgentsSpanModelRequestEndEventType = "span.model_request_end"` + + - `type BetaManagedAgentsSessionDeletedEvent struct{…}` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionDeletedEventType` + + - `const BetaManagedAgentsSessionDeletedEventTypeSessionDeleted BetaManagedAgentsSessionDeletedEventType = "session.deleted"` + +### Beta Managed Agents Session Requires Action + +- `type BetaManagedAgentsSessionRequiresAction struct{…}` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `EventIDs []string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type BetaManagedAgentsSessionRequiresActionType` + + - `const BetaManagedAgentsSessionRequiresActionTypeRequiresAction BetaManagedAgentsSessionRequiresActionType = "requires_action"` + +### Beta Managed Agents Session Retries Exhausted + +- `type BetaManagedAgentsSessionRetriesExhausted struct{…}` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type BetaManagedAgentsSessionRetriesExhaustedType` + + - `const BetaManagedAgentsSessionRetriesExhaustedTypeRetriesExhausted BetaManagedAgentsSessionRetriesExhaustedType = "retries_exhausted"` + +### Beta Managed Agents Session Status Idle Event + +- `type BetaManagedAgentsSessionStatusIdleEvent struct{…}` + + Indicates the agent has paused and is awaiting user input. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `StopReason BetaManagedAgentsSessionStatusIdleEventStopReasonUnion` + + The agent completed its turn naturally and is ready for the next user message. + + - `type BetaManagedAgentsSessionEndTurn struct{…}` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type BetaManagedAgentsSessionEndTurnType` + + - `const BetaManagedAgentsSessionEndTurnTypeEndTurn BetaManagedAgentsSessionEndTurnType = "end_turn"` + + - `type BetaManagedAgentsSessionRequiresAction struct{…}` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `EventIDs []string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type BetaManagedAgentsSessionRequiresActionType` + + - `const BetaManagedAgentsSessionRequiresActionTypeRequiresAction BetaManagedAgentsSessionRequiresActionType = "requires_action"` + + - `type BetaManagedAgentsSessionRetriesExhausted struct{…}` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type BetaManagedAgentsSessionRetriesExhaustedType` + + - `const BetaManagedAgentsSessionRetriesExhaustedTypeRetriesExhausted BetaManagedAgentsSessionRetriesExhaustedType = "retries_exhausted"` + + - `Type BetaManagedAgentsSessionStatusIdleEventType` + + - `const BetaManagedAgentsSessionStatusIdleEventTypeSessionStatusIdle BetaManagedAgentsSessionStatusIdleEventType = "session.status_idle"` + +### Beta Managed Agents Session Status Rescheduled Event + +- `type BetaManagedAgentsSessionStatusRescheduledEvent struct{…}` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRescheduledEventType` + + - `const BetaManagedAgentsSessionStatusRescheduledEventTypeSessionStatusRescheduled BetaManagedAgentsSessionStatusRescheduledEventType = "session.status_rescheduled"` + +### Beta Managed Agents Session Status Running Event + +- `type BetaManagedAgentsSessionStatusRunningEvent struct{…}` + + Indicates the session is actively running and the agent is working. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRunningEventType` + + - `const BetaManagedAgentsSessionStatusRunningEventTypeSessionStatusRunning BetaManagedAgentsSessionStatusRunningEventType = "session.status_running"` + +### Beta Managed Agents Session Status Terminated Event + +- `type BetaManagedAgentsSessionStatusTerminatedEvent struct{…}` + + Indicates the session has terminated, either due to an error or completion. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusTerminatedEventType` + + - `const BetaManagedAgentsSessionStatusTerminatedEventTypeSessionStatusTerminated BetaManagedAgentsSessionStatusTerminatedEventType = "session.status_terminated"` + +### Beta Managed Agents Span Model Request End Event + +- `type BetaManagedAgentsSpanModelRequestEndEvent struct{…}` + + Emitted when a model request completes. + + - `ID string` + + Unique identifier for this event. + + - `IsError bool` + + Whether the model request resulted in an error. + + - `ModelRequestStartID string` + + The id of the corresponding `span.model_request_start` event. + + - `ModelUsage BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `CacheCreationInputTokens int64` + + Tokens used to create prompt cache in this request. + + - `CacheReadInputTokens int64` + + Tokens read from prompt cache in this request. + + - `InputTokens int64` + + Input tokens consumed by this request. + + - `OutputTokens int64` + + Output tokens generated by this request. + + - `Speed BetaManagedAgentsSpanModelUsageSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsSpanModelUsageSpeedStandard BetaManagedAgentsSpanModelUsageSpeed = "standard"` + + - `const BetaManagedAgentsSpanModelUsageSpeedFast BetaManagedAgentsSpanModelUsageSpeed = "fast"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestEndEventType` + + - `const BetaManagedAgentsSpanModelRequestEndEventTypeSpanModelRequestEnd BetaManagedAgentsSpanModelRequestEndEventType = "span.model_request_end"` + +### Beta Managed Agents Span Model Request Start Event + +- `type BetaManagedAgentsSpanModelRequestStartEvent struct{…}` + + Emitted when a model request is initiated by the agent. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestStartEventType` + + - `const BetaManagedAgentsSpanModelRequestStartEventTypeSpanModelRequestStart BetaManagedAgentsSpanModelRequestStartEventType = "span.model_request_start"` + +### Beta Managed Agents Span Model Usage + +- `type BetaManagedAgentsSpanModelUsage struct{…}` + + Token usage for a single model request. + + - `CacheCreationInputTokens int64` + + Tokens used to create prompt cache in this request. + + - `CacheReadInputTokens int64` + + Tokens read from prompt cache in this request. + + - `InputTokens int64` + + Input tokens consumed by this request. + + - `OutputTokens int64` + + Output tokens generated by this request. + + - `Speed BetaManagedAgentsSpanModelUsageSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsSpanModelUsageSpeedStandard BetaManagedAgentsSpanModelUsageSpeed = "standard"` + + - `const BetaManagedAgentsSpanModelUsageSpeedFast BetaManagedAgentsSpanModelUsageSpeed = "fast"` + +### Beta Managed Agents Stream Session Events + +- `type BetaManagedAgentsStreamSessionEventsUnion interface{…}` + + Server-sent event in the session stream. + + - `type BetaManagedAgentsUserMessageEvent struct{…}` + + A user message event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsUserMessageEventContentUnion` + + Array of content blocks comprising the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventType` + + - `const BetaManagedAgentsUserMessageEventTypeUserMessage BetaManagedAgentsUserMessageEventType = "user.message"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserInterruptEvent struct{…}` + + An interrupt event that pauses agent execution and returns control to the user. + + - `ID string` + + Unique identifier for this event. + + - `Type BetaManagedAgentsUserInterruptEventType` + + - `const BetaManagedAgentsUserInterruptEventTypeUserInterrupt BetaManagedAgentsUserInterruptEventType = "user.interrupt"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserToolConfirmationEvent struct{…}` + + A tool confirmation event that approves or denies a pending tool execution. + + - `ID string` + + Unique identifier for this event. + + - `Result BetaManagedAgentsUserToolConfirmationEventResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventResultAllow BetaManagedAgentsUserToolConfirmationEventResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventResultDeny BetaManagedAgentsUserToolConfirmationEventResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventType` + + - `const BetaManagedAgentsUserToolConfirmationEventTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserCustomToolResultEvent struct{…}` + + Event sent by the client providing the result of a custom tool execution. + + - `ID string` + + Unique identifier for this event. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventType` + + - `const BetaManagedAgentsUserCustomToolResultEventTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsAgentCustomToolUseEvent struct{…}` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the custom tool being called. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentCustomToolUseEventType` + + - `const BetaManagedAgentsAgentCustomToolUseEventTypeAgentCustomToolUse BetaManagedAgentsAgentCustomToolUseEventType = "agent.custom_tool_use"` + + - `type BetaManagedAgentsAgentMessageEvent struct{…}` + + An agent response event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMessageEventType` + + - `const BetaManagedAgentsAgentMessageEventTypeAgentMessage BetaManagedAgentsAgentMessageEventType = "agent.message"` + + - `type BetaManagedAgentsAgentThinkingEvent struct{…}` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThinkingEventType` + + - `const BetaManagedAgentsAgentThinkingEventTypeAgentThinking BetaManagedAgentsAgentThinkingEventType = "agent.thinking"` + + - `type BetaManagedAgentsAgentMCPToolUseEvent struct{…}` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `MCPServerName string` + + Name of the MCP server providing the tool. + + - `Name string` + + Name of the MCP tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolUseEventType` + + - `const BetaManagedAgentsAgentMCPToolUseEventTypeAgentMCPToolUse BetaManagedAgentsAgentMCPToolUseEventType = "agent.mcp_tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "deny"` + + - `type BetaManagedAgentsAgentMCPToolResultEvent struct{…}` + + Event representing the result of an MCP tool execution. + + - `ID string` + + Unique identifier for this event. + + - `MCPToolUseID string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolResultEventType` + + - `const BetaManagedAgentsAgentMCPToolResultEventTypeAgentMCPToolResult BetaManagedAgentsAgentMCPToolResultEventType = "agent.mcp_tool_result"` + + - `Content []BetaManagedAgentsAgentMCPToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `type BetaManagedAgentsAgentToolUseEvent struct{…}` + + Event emitted when the agent invokes a built-in agent tool. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the agent tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentToolUseEventType` + + - `const BetaManagedAgentsAgentToolUseEventTypeAgentToolUse BetaManagedAgentsAgentToolUseEventType = "agent.tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "deny"` + + - `type BetaManagedAgentsAgentToolResultEvent struct{…}` + + Event representing the result of an agent tool execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `ToolUseID string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `Type BetaManagedAgentsAgentToolResultEventType` + + - `const BetaManagedAgentsAgentToolResultEventTypeAgentToolResult BetaManagedAgentsAgentToolResultEventType = "agent.tool_result"` + + - `Content []BetaManagedAgentsAgentToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `type BetaManagedAgentsAgentThreadContextCompactedEvent struct{…}` + + Indicates that context compaction (summarization) occurred during the session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThreadContextCompactedEventType` + + - `const BetaManagedAgentsAgentThreadContextCompactedEventTypeAgentThreadContextCompacted BetaManagedAgentsAgentThreadContextCompactedEventType = "agent.thread_context_compacted"` + + - `type BetaManagedAgentsSessionErrorEvent struct{…}` + + An error event indicating a problem occurred during session execution. + + - `ID string` + + Unique identifier for this event. + + - `Error BetaManagedAgentsSessionErrorEventErrorUnion` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `type BetaManagedAgentsUnknownError struct{…}` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsUnknownErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsUnknownErrorType` + + - `const BetaManagedAgentsUnknownErrorTypeUnknownError BetaManagedAgentsUnknownErrorType = "unknown_error"` + + - `type BetaManagedAgentsModelOverloadedError struct{…}` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelOverloadedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelOverloadedErrorType` + + - `const BetaManagedAgentsModelOverloadedErrorTypeModelOverloadedError BetaManagedAgentsModelOverloadedErrorType = "model_overloaded_error"` + + - `type BetaManagedAgentsModelRateLimitedError struct{…}` + + The model request was rate-limited. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRateLimitedErrorType` + + - `const BetaManagedAgentsModelRateLimitedErrorTypeModelRateLimitedError BetaManagedAgentsModelRateLimitedErrorType = "model_rate_limited_error"` + + - `type BetaManagedAgentsModelRequestFailedError struct{…}` + + A model request failed for a reason other than overload or rate-limiting. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRequestFailedErrorType` + + - `const BetaManagedAgentsModelRequestFailedErrorTypeModelRequestFailedError BetaManagedAgentsModelRequestFailedErrorType = "model_request_failed_error"` + + - `type BetaManagedAgentsMCPConnectionFailedError struct{…}` + + Failed to connect to an MCP server. + + - `MCPServerName string` + + Name of the MCP server that failed to connect. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPConnectionFailedErrorType` + + - `const BetaManagedAgentsMCPConnectionFailedErrorTypeMCPConnectionFailedError BetaManagedAgentsMCPConnectionFailedErrorType = "mcp_connection_failed_error"` + + - `type BetaManagedAgentsMCPAuthenticationFailedError struct{…}` + + Authentication to an MCP server failed. + + - `MCPServerName string` + + Name of the MCP server that failed authentication. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPAuthenticationFailedErrorType` + + - `const BetaManagedAgentsMCPAuthenticationFailedErrorTypeMCPAuthenticationFailedError BetaManagedAgentsMCPAuthenticationFailedErrorType = "mcp_authentication_failed_error"` + + - `type BetaManagedAgentsBillingError struct{…}` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsBillingErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsBillingErrorType` + + - `const BetaManagedAgentsBillingErrorTypeBillingError BetaManagedAgentsBillingErrorType = "billing_error"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionErrorEventType` + + - `const BetaManagedAgentsSessionErrorEventTypeSessionError BetaManagedAgentsSessionErrorEventType = "session.error"` + + - `type BetaManagedAgentsSessionStatusRescheduledEvent struct{…}` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRescheduledEventType` + + - `const BetaManagedAgentsSessionStatusRescheduledEventTypeSessionStatusRescheduled BetaManagedAgentsSessionStatusRescheduledEventType = "session.status_rescheduled"` + + - `type BetaManagedAgentsSessionStatusRunningEvent struct{…}` + + Indicates the session is actively running and the agent is working. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRunningEventType` + + - `const BetaManagedAgentsSessionStatusRunningEventTypeSessionStatusRunning BetaManagedAgentsSessionStatusRunningEventType = "session.status_running"` + + - `type BetaManagedAgentsSessionStatusIdleEvent struct{…}` + + Indicates the agent has paused and is awaiting user input. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `StopReason BetaManagedAgentsSessionStatusIdleEventStopReasonUnion` + + The agent completed its turn naturally and is ready for the next user message. + + - `type BetaManagedAgentsSessionEndTurn struct{…}` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type BetaManagedAgentsSessionEndTurnType` + + - `const BetaManagedAgentsSessionEndTurnTypeEndTurn BetaManagedAgentsSessionEndTurnType = "end_turn"` + + - `type BetaManagedAgentsSessionRequiresAction struct{…}` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `EventIDs []string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type BetaManagedAgentsSessionRequiresActionType` + + - `const BetaManagedAgentsSessionRequiresActionTypeRequiresAction BetaManagedAgentsSessionRequiresActionType = "requires_action"` + + - `type BetaManagedAgentsSessionRetriesExhausted struct{…}` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type BetaManagedAgentsSessionRetriesExhaustedType` + + - `const BetaManagedAgentsSessionRetriesExhaustedTypeRetriesExhausted BetaManagedAgentsSessionRetriesExhaustedType = "retries_exhausted"` + + - `Type BetaManagedAgentsSessionStatusIdleEventType` + + - `const BetaManagedAgentsSessionStatusIdleEventTypeSessionStatusIdle BetaManagedAgentsSessionStatusIdleEventType = "session.status_idle"` + + - `type BetaManagedAgentsSessionStatusTerminatedEvent struct{…}` + + Indicates the session has terminated, either due to an error or completion. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusTerminatedEventType` + + - `const BetaManagedAgentsSessionStatusTerminatedEventTypeSessionStatusTerminated BetaManagedAgentsSessionStatusTerminatedEventType = "session.status_terminated"` + + - `type BetaManagedAgentsSpanModelRequestStartEvent struct{…}` + + Emitted when a model request is initiated by the agent. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestStartEventType` + + - `const BetaManagedAgentsSpanModelRequestStartEventTypeSpanModelRequestStart BetaManagedAgentsSpanModelRequestStartEventType = "span.model_request_start"` + + - `type BetaManagedAgentsSpanModelRequestEndEvent struct{…}` + + Emitted when a model request completes. + + - `ID string` + + Unique identifier for this event. + + - `IsError bool` + + Whether the model request resulted in an error. + + - `ModelRequestStartID string` + + The id of the corresponding `span.model_request_start` event. + + - `ModelUsage BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `CacheCreationInputTokens int64` + + Tokens used to create prompt cache in this request. + + - `CacheReadInputTokens int64` + + Tokens read from prompt cache in this request. + + - `InputTokens int64` + + Input tokens consumed by this request. + + - `OutputTokens int64` + + Output tokens generated by this request. + + - `Speed BetaManagedAgentsSpanModelUsageSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsSpanModelUsageSpeedStandard BetaManagedAgentsSpanModelUsageSpeed = "standard"` + + - `const BetaManagedAgentsSpanModelUsageSpeedFast BetaManagedAgentsSpanModelUsageSpeed = "fast"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestEndEventType` + + - `const BetaManagedAgentsSpanModelRequestEndEventTypeSpanModelRequestEnd BetaManagedAgentsSpanModelRequestEndEventType = "span.model_request_end"` + + - `type BetaManagedAgentsSessionDeletedEvent struct{…}` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionDeletedEventType` + + - `const BetaManagedAgentsSessionDeletedEventTypeSessionDeleted BetaManagedAgentsSessionDeletedEventType = "session.deleted"` + +### Beta Managed Agents Text Block + +- `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + +### Beta Managed Agents Unknown Error + +- `type BetaManagedAgentsUnknownError struct{…}` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsUnknownErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsUnknownErrorType` + + - `const BetaManagedAgentsUnknownErrorTypeUnknownError BetaManagedAgentsUnknownErrorType = "unknown_error"` + +### Beta Managed Agents URL Document Source + +- `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + +### Beta Managed Agents URL Image Source + +- `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + +### Beta Managed Agents User Custom Tool Result Event + +- `type BetaManagedAgentsUserCustomToolResultEvent struct{…}` + + Event sent by the client providing the result of a custom tool execution. + + - `ID string` + + Unique identifier for this event. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventType` + + - `const BetaManagedAgentsUserCustomToolResultEventTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Custom Tool Result Event Params + +- `type BetaManagedAgentsUserCustomToolResultEventParamsResp struct{…}` + + Parameters for providing the result of a custom tool execution. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventParamsType` + + - `const BetaManagedAgentsUserCustomToolResultEventParamsTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventParamsType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventParamsContentUnionResp` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents User Interrupt Event + +- `type BetaManagedAgentsUserInterruptEvent struct{…}` + + An interrupt event that pauses agent execution and returns control to the user. + + - `ID string` + + Unique identifier for this event. + + - `Type BetaManagedAgentsUserInterruptEventType` + + - `const BetaManagedAgentsUserInterruptEventTypeUserInterrupt BetaManagedAgentsUserInterruptEventType = "user.interrupt"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Interrupt Event Params + +- `type BetaManagedAgentsUserInterruptEventParamsResp struct{…}` + + Parameters for sending an interrupt to pause the agent. + + - `Type BetaManagedAgentsUserInterruptEventParamsType` + + - `const BetaManagedAgentsUserInterruptEventParamsTypeUserInterrupt BetaManagedAgentsUserInterruptEventParamsType = "user.interrupt"` + +### Beta Managed Agents User Message Event + +- `type BetaManagedAgentsUserMessageEvent struct{…}` + + A user message event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsUserMessageEventContentUnion` + + Array of content blocks comprising the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventType` + + - `const BetaManagedAgentsUserMessageEventTypeUserMessage BetaManagedAgentsUserMessageEventType = "user.message"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Message Event Params + +- `type BetaManagedAgentsUserMessageEventParamsResp struct{…}` + + Parameters for sending a user message to the session. + + - `Content []BetaManagedAgentsUserMessageEventParamsContentUnionResp` + + Array of content blocks for the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventParamsType` + + - `const BetaManagedAgentsUserMessageEventParamsTypeUserMessage BetaManagedAgentsUserMessageEventParamsType = "user.message"` + +### Beta Managed Agents User Tool Confirmation Event + +- `type BetaManagedAgentsUserToolConfirmationEvent struct{…}` + + A tool confirmation event that approves or denies a pending tool execution. + + - `ID string` + + Unique identifier for this event. + + - `Result BetaManagedAgentsUserToolConfirmationEventResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventResultAllow BetaManagedAgentsUserToolConfirmationEventResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventResultDeny BetaManagedAgentsUserToolConfirmationEventResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventType` + + - `const BetaManagedAgentsUserToolConfirmationEventTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Tool Confirmation Event Params + +- `type BetaManagedAgentsUserToolConfirmationEventParamsResp struct{…}` + + Parameters for confirming or denying a tool execution request. + + - `Result BetaManagedAgentsUserToolConfirmationEventParamsResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventParamsResultAllow BetaManagedAgentsUserToolConfirmationEventParamsResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventParamsResultDeny BetaManagedAgentsUserToolConfirmationEventParamsResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventParamsType` + + - `const BetaManagedAgentsUserToolConfirmationEventParamsTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventParamsType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + +# Resources + +## Add + +`client.Beta.Sessions.Resources.Add(ctx, sessionID, params) (*BetaManagedAgentsFileResource, error)` + +**post** `/v1/sessions/{session_id}/resources` + +Add Session Resource + +### Parameters + +- `sessionID string` + +- `params BetaSessionResourceAddParams` + + - `BetaManagedAgentsFileResourceParams param.Field[BetaManagedAgentsFileResourceParamsResp]` + + Body param: Mount a file uploaded via the Files API into the session. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsFileResource, err := client.Beta.Sessions.Resources.Add( + context.TODO(), + "sesn_011CZkZAtmR3yMPDzynEDxu7", + anthropic.BetaSessionResourceAddParams{ + BetaManagedAgentsFileResourceParams: anthropic.BetaManagedAgentsFileResourceParams{ + FileID: "file_011CNha8iCJcU1wXNR6q4V8w", + Type: anthropic.BetaManagedAgentsFileResourceParamsTypeFile, + }, + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsFileResource.ID) +} +``` + +## List + +`client.Beta.Sessions.Resources.List(ctx, sessionID, params) (*PageCursor[BetaManagedAgentsSessionResourceUnion], error)` + +**get** `/v1/sessions/{session_id}/resources` + +List Session Resources + +### Parameters + +- `sessionID string` + +- `params BetaSessionResourceListParams` + + - `Limit param.Field[int64]` + + Query param: Maximum number of resources to return per page (max 1000). If omitted, returns all resources. + + - `Page param.Field[string]` + + Query param: Opaque cursor from a previous response's next_page field. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsSessionResourceUnion interface{…}` + + - `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Beta.Sessions.Resources.List( + context.TODO(), + "sesn_011CZkZAtmR3yMPDzynEDxu7", + anthropic.BetaSessionResourceListParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", page) +} +``` + +## Retrieve + +`client.Beta.Sessions.Resources.Get(ctx, resourceID, params) (*BetaSessionResourceGetResponseUnion, error)` + +**get** `/v1/sessions/{session_id}/resources/{resource_id}` + +Get Session Resource + +### Parameters + +- `resourceID string` + +- `params BetaSessionResourceGetParams` + + - `SessionID param.Field[string]` + + Path param: Path parameter session_id + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaSessionResourceGetResponseUnion interface{…}` + + The requested session resource. + + - `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + resource, err := client.Beta.Sessions.Resources.Get( + context.TODO(), + "sesrsc_011CZkZBJq5dWxk9fVLNcPht", + anthropic.BetaSessionResourceGetParams{ + SessionID: "sesn_011CZkZAtmR3yMPDzynEDxu7", + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", resource) +} +``` + +## Update + +`client.Beta.Sessions.Resources.Update(ctx, resourceID, params) (*BetaSessionResourceUpdateResponseUnion, error)` + +**post** `/v1/sessions/{session_id}/resources/{resource_id}` + +Update Session Resource + +### Parameters + +- `resourceID string` + +- `params BetaSessionResourceUpdateParams` + + - `SessionID param.Field[string]` + + Path param: Path parameter session_id + + - `AuthorizationToken param.Field[string]` + + Body param: New authorization token for the resource. Currently only `github_repository` resources support token rotation. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaSessionResourceUpdateResponseUnion interface{…}` + + The updated session resource. + + - `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + resource, err := client.Beta.Sessions.Resources.Update( + context.TODO(), + "sesrsc_011CZkZBJq5dWxk9fVLNcPht", + anthropic.BetaSessionResourceUpdateParams{ + SessionID: "sesn_011CZkZAtmR3yMPDzynEDxu7", + AuthorizationToken: "ghp_exampletoken", + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", resource) +} +``` + +## Delete + +`client.Beta.Sessions.Resources.Delete(ctx, resourceID, params) (*BetaManagedAgentsDeleteSessionResource, error)` + +**delete** `/v1/sessions/{session_id}/resources/{resource_id}` + +Delete Session Resource + +### Parameters + +- `resourceID string` + +- `params BetaSessionResourceDeleteParams` + + - `SessionID param.Field[string]` + + Path param: Path parameter session_id + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsDeleteSessionResource struct{…}` + + Confirmation of resource deletion. + + - `ID string` + + - `Type BetaManagedAgentsDeleteSessionResourceType` + + - `const BetaManagedAgentsDeleteSessionResourceTypeSessionResourceDeleted BetaManagedAgentsDeleteSessionResourceType = "session_resource_deleted"` + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsDeleteSessionResource, err := client.Beta.Sessions.Resources.Delete( + context.TODO(), + "sesrsc_011CZkZBJq5dWxk9fVLNcPht", + anthropic.BetaSessionResourceDeleteParams{ + SessionID: "sesn_011CZkZAtmR3yMPDzynEDxu7", + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsDeleteSessionResource.ID) +} +``` + +## Domain Types + +### Beta Managed Agents Delete Session Resource + +- `type BetaManagedAgentsDeleteSessionResource struct{…}` + + Confirmation of resource deletion. + + - `ID string` + + - `Type BetaManagedAgentsDeleteSessionResourceType` + + - `const BetaManagedAgentsDeleteSessionResourceTypeSessionResourceDeleted BetaManagedAgentsDeleteSessionResourceType = "session_resource_deleted"` + +### Beta Managed Agents File Resource + +- `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents GitHub Repository Resource + +- `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + +### Beta Managed Agents Session Resource + +- `type BetaManagedAgentsSessionResourceUnion interface{…}` + + - `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format diff --git a/content/en/api/go/beta/sessions/archive.md b/content/en/api/go/beta/sessions/archive.md new file mode 100644 index 000000000..3b308877a --- /dev/null +++ b/content/en/api/go/beta/sessions/archive.md @@ -0,0 +1,524 @@ +## Archive + +`client.Beta.Sessions.Archive(ctx, sessionID, body) (*BetaManagedAgentsSession, error)` + +**post** `/v1/sessions/{session_id}/archive` + +Archive Session + +### Parameters + +- `sessionID string` + +- `body BetaSessionArchiveParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsSession struct{…}` + + A Managed Agents `session`. + + - `ID string` + + - `Agent BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `ID string` + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsSessionAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsSessionAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsSessionAgentType` + + - `const BetaManagedAgentsSessionAgentTypeAgent BetaManagedAgentsSessionAgentType = "agent"` + + - `Version int64` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `EnvironmentID string` + + - `Metadata map[string, string]` + + - `Resources []BetaManagedAgentsSessionResourceUnion` + + - `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Stats BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `ActiveSeconds float64` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `DurationSeconds float64` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `Status BetaManagedAgentsSessionStatus` + + SessionStatus enum + + - `const BetaManagedAgentsSessionStatusRescheduling BetaManagedAgentsSessionStatus = "rescheduling"` + + - `const BetaManagedAgentsSessionStatusRunning BetaManagedAgentsSessionStatus = "running"` + + - `const BetaManagedAgentsSessionStatusIdle BetaManagedAgentsSessionStatus = "idle"` + + - `const BetaManagedAgentsSessionStatusTerminated BetaManagedAgentsSessionStatus = "terminated"` + + - `Title string` + + - `Type BetaManagedAgentsSessionType` + + - `const BetaManagedAgentsSessionTypeSession BetaManagedAgentsSessionType = "session"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Usage BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `CacheCreation BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Ephemeral1hInputTokens int64` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Ephemeral5mInputTokens int64` + + Tokens used to create 5-minute ephemeral cache entries. + + - `CacheReadInputTokens int64` + + Total tokens read from prompt cache. + + - `InputTokens int64` + + Total input tokens consumed across all turns. + + - `OutputTokens int64` + + Total output tokens generated across all turns. + + - `VaultIDs []string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsSession, err := client.Beta.Sessions.Archive( + context.TODO(), + "sesn_011CZkZAtmR3yMPDzynEDxu7", + anthropic.BetaSessionArchiveParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsSession.ID) +} +``` diff --git a/content/en/api/go/beta/sessions/create.md b/content/en/api/go/beta/sessions/create.md new file mode 100644 index 000000000..5ad2df8ec --- /dev/null +++ b/content/en/api/go/beta/sessions/create.md @@ -0,0 +1,623 @@ +## Create + +`client.Beta.Sessions.New(ctx, params) (*BetaManagedAgentsSession, error)` + +**post** `/v1/sessions` + +Create Session + +### Parameters + +- `params BetaSessionNewParams` + + - `Agent param.Field[BetaSessionNewParamsAgentUnion]` + + Body param: Agent identifier. Accepts the `agent` ID string, which pins the latest version for the session, or an `agent` object with both id and version specified. + + - `string` + + - `type BetaManagedAgentsAgentParamsResp struct{…}` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `ID string` + + The `agent` ID. + + - `Type BetaManagedAgentsAgentParamsType` + + - `const BetaManagedAgentsAgentParamsTypeAgent BetaManagedAgentsAgentParamsType = "agent"` + + - `Version int64` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + + - `EnvironmentID param.Field[string]` + + Body param: ID of the `environment` defining the container configuration for this session. + + - `Metadata param.Field[map[string, string]]` + + Body param: Arbitrary key-value metadata attached to the session. + + - `Resources param.Field[[]BetaSessionNewParamsResourceUnion]` + + Body param: Resources (e.g. repositories, files) to mount into the session's container. + + - `type BetaManagedAgentsGitHubRepositoryResourceParamsResp struct{…}` + + Mount a GitHub repository into the session's container. + + - `AuthorizationToken string` + + GitHub authorization token used to clone the repository. + + - `Type BetaManagedAgentsGitHubRepositoryResourceParamsType` + + - `const BetaManagedAgentsGitHubRepositoryResourceParamsTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceParamsType = "github_repository"` + + - `URL string` + + Github URL of the repository + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceParamsCheckoutUnionResp` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `MountPath string` + + Mount path in the container. Defaults to `/workspace/`. + + - `type BetaManagedAgentsFileResourceParamsResp struct{…}` + + Mount a file uploaded via the Files API into the session. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileResourceParamsType` + + - `const BetaManagedAgentsFileResourceParamsTypeFile BetaManagedAgentsFileResourceParamsType = "file"` + + - `MountPath string` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + + - `Title param.Field[string]` + + Body param: Human-readable session title. + + - `VaultIDs param.Field[[]string]` + + Body param: Vault IDs for stored credentials the agent can use during the session. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsSession struct{…}` + + A Managed Agents `session`. + + - `ID string` + + - `Agent BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `ID string` + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsSessionAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsSessionAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsSessionAgentType` + + - `const BetaManagedAgentsSessionAgentTypeAgent BetaManagedAgentsSessionAgentType = "agent"` + + - `Version int64` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `EnvironmentID string` + + - `Metadata map[string, string]` + + - `Resources []BetaManagedAgentsSessionResourceUnion` + + - `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Stats BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `ActiveSeconds float64` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `DurationSeconds float64` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `Status BetaManagedAgentsSessionStatus` + + SessionStatus enum + + - `const BetaManagedAgentsSessionStatusRescheduling BetaManagedAgentsSessionStatus = "rescheduling"` + + - `const BetaManagedAgentsSessionStatusRunning BetaManagedAgentsSessionStatus = "running"` + + - `const BetaManagedAgentsSessionStatusIdle BetaManagedAgentsSessionStatus = "idle"` + + - `const BetaManagedAgentsSessionStatusTerminated BetaManagedAgentsSessionStatus = "terminated"` + + - `Title string` + + - `Type BetaManagedAgentsSessionType` + + - `const BetaManagedAgentsSessionTypeSession BetaManagedAgentsSessionType = "session"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Usage BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `CacheCreation BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Ephemeral1hInputTokens int64` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Ephemeral5mInputTokens int64` + + Tokens used to create 5-minute ephemeral cache entries. + + - `CacheReadInputTokens int64` + + Total tokens read from prompt cache. + + - `InputTokens int64` + + Total input tokens consumed across all turns. + + - `OutputTokens int64` + + Total output tokens generated across all turns. + + - `VaultIDs []string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsSession, err := client.Beta.Sessions.New(context.TODO(), anthropic.BetaSessionNewParams{ + Agent: anthropic.BetaSessionNewParamsAgentUnion{ + OfString: anthropic.String("agent_011CZkYpogX7uDKUyvBTophP"), + }, + EnvironmentID: "env_011CZkZ9X2dpNyB7HsEFoRfW", + }) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsSession.ID) +} +``` diff --git a/content/en/api/go/beta/sessions/delete.md b/content/en/api/go/beta/sessions/delete.md new file mode 100644 index 000000000..d56e0fce3 --- /dev/null +++ b/content/en/api/go/beta/sessions/delete.md @@ -0,0 +1,106 @@ +## Delete + +`client.Beta.Sessions.Delete(ctx, sessionID, body) (*BetaManagedAgentsDeletedSession, error)` + +**delete** `/v1/sessions/{session_id}` + +Delete Session + +### Parameters + +- `sessionID string` + +- `body BetaSessionDeleteParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsDeletedSession struct{…}` + + Confirmation that a `session` has been permanently deleted. + + - `ID string` + + - `Type BetaManagedAgentsDeletedSessionType` + + - `const BetaManagedAgentsDeletedSessionTypeSessionDeleted BetaManagedAgentsDeletedSessionType = "session_deleted"` + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsDeletedSession, err := client.Beta.Sessions.Delete( + context.TODO(), + "sesn_011CZkZAtmR3yMPDzynEDxu7", + anthropic.BetaSessionDeleteParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsDeletedSession.ID) +} +``` diff --git a/content/en/api/go/beta/sessions/events.md b/content/en/api/go/beta/sessions/events.md new file mode 100644 index 000000000..59ec09a54 --- /dev/null +++ b/content/en/api/go/beta/sessions/events.md @@ -0,0 +1,9699 @@ +# Events + +## List + +`client.Beta.Sessions.Events.List(ctx, sessionID, params) (*PageCursor[BetaManagedAgentsSessionEventUnion], error)` + +**get** `/v1/sessions/{session_id}/events` + +List Events + +### Parameters + +- `sessionID string` + +- `params BetaSessionEventListParams` + + - `Limit param.Field[int64]` + + Query param: Query parameter for limit + + - `Order param.Field[BetaSessionEventListParamsOrder]` + + Query param: Sort direction for results, ordered by created_at. Defaults to asc (chronological). + + - `const BetaSessionEventListParamsOrderAsc BetaSessionEventListParamsOrder = "asc"` + + - `const BetaSessionEventListParamsOrderDesc BetaSessionEventListParamsOrder = "desc"` + + - `Page param.Field[string]` + + Query param: Opaque pagination cursor from a previous response's next_page. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsSessionEventUnion interface{…}` + + Union type for all event types in a session. + + - `type BetaManagedAgentsUserMessageEvent struct{…}` + + A user message event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsUserMessageEventContentUnion` + + Array of content blocks comprising the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventType` + + - `const BetaManagedAgentsUserMessageEventTypeUserMessage BetaManagedAgentsUserMessageEventType = "user.message"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserInterruptEvent struct{…}` + + An interrupt event that pauses agent execution and returns control to the user. + + - `ID string` + + Unique identifier for this event. + + - `Type BetaManagedAgentsUserInterruptEventType` + + - `const BetaManagedAgentsUserInterruptEventTypeUserInterrupt BetaManagedAgentsUserInterruptEventType = "user.interrupt"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserToolConfirmationEvent struct{…}` + + A tool confirmation event that approves or denies a pending tool execution. + + - `ID string` + + Unique identifier for this event. + + - `Result BetaManagedAgentsUserToolConfirmationEventResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventResultAllow BetaManagedAgentsUserToolConfirmationEventResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventResultDeny BetaManagedAgentsUserToolConfirmationEventResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventType` + + - `const BetaManagedAgentsUserToolConfirmationEventTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserCustomToolResultEvent struct{…}` + + Event sent by the client providing the result of a custom tool execution. + + - `ID string` + + Unique identifier for this event. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventType` + + - `const BetaManagedAgentsUserCustomToolResultEventTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsAgentCustomToolUseEvent struct{…}` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the custom tool being called. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentCustomToolUseEventType` + + - `const BetaManagedAgentsAgentCustomToolUseEventTypeAgentCustomToolUse BetaManagedAgentsAgentCustomToolUseEventType = "agent.custom_tool_use"` + + - `type BetaManagedAgentsAgentMessageEvent struct{…}` + + An agent response event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMessageEventType` + + - `const BetaManagedAgentsAgentMessageEventTypeAgentMessage BetaManagedAgentsAgentMessageEventType = "agent.message"` + + - `type BetaManagedAgentsAgentThinkingEvent struct{…}` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThinkingEventType` + + - `const BetaManagedAgentsAgentThinkingEventTypeAgentThinking BetaManagedAgentsAgentThinkingEventType = "agent.thinking"` + + - `type BetaManagedAgentsAgentMCPToolUseEvent struct{…}` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `MCPServerName string` + + Name of the MCP server providing the tool. + + - `Name string` + + Name of the MCP tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolUseEventType` + + - `const BetaManagedAgentsAgentMCPToolUseEventTypeAgentMCPToolUse BetaManagedAgentsAgentMCPToolUseEventType = "agent.mcp_tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "deny"` + + - `type BetaManagedAgentsAgentMCPToolResultEvent struct{…}` + + Event representing the result of an MCP tool execution. + + - `ID string` + + Unique identifier for this event. + + - `MCPToolUseID string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolResultEventType` + + - `const BetaManagedAgentsAgentMCPToolResultEventTypeAgentMCPToolResult BetaManagedAgentsAgentMCPToolResultEventType = "agent.mcp_tool_result"` + + - `Content []BetaManagedAgentsAgentMCPToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `type BetaManagedAgentsAgentToolUseEvent struct{…}` + + Event emitted when the agent invokes a built-in agent tool. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the agent tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentToolUseEventType` + + - `const BetaManagedAgentsAgentToolUseEventTypeAgentToolUse BetaManagedAgentsAgentToolUseEventType = "agent.tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "deny"` + + - `type BetaManagedAgentsAgentToolResultEvent struct{…}` + + Event representing the result of an agent tool execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `ToolUseID string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `Type BetaManagedAgentsAgentToolResultEventType` + + - `const BetaManagedAgentsAgentToolResultEventTypeAgentToolResult BetaManagedAgentsAgentToolResultEventType = "agent.tool_result"` + + - `Content []BetaManagedAgentsAgentToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `type BetaManagedAgentsAgentThreadContextCompactedEvent struct{…}` + + Indicates that context compaction (summarization) occurred during the session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThreadContextCompactedEventType` + + - `const BetaManagedAgentsAgentThreadContextCompactedEventTypeAgentThreadContextCompacted BetaManagedAgentsAgentThreadContextCompactedEventType = "agent.thread_context_compacted"` + + - `type BetaManagedAgentsSessionErrorEvent struct{…}` + + An error event indicating a problem occurred during session execution. + + - `ID string` + + Unique identifier for this event. + + - `Error BetaManagedAgentsSessionErrorEventErrorUnion` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `type BetaManagedAgentsUnknownError struct{…}` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsUnknownErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsUnknownErrorType` + + - `const BetaManagedAgentsUnknownErrorTypeUnknownError BetaManagedAgentsUnknownErrorType = "unknown_error"` + + - `type BetaManagedAgentsModelOverloadedError struct{…}` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelOverloadedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelOverloadedErrorType` + + - `const BetaManagedAgentsModelOverloadedErrorTypeModelOverloadedError BetaManagedAgentsModelOverloadedErrorType = "model_overloaded_error"` + + - `type BetaManagedAgentsModelRateLimitedError struct{…}` + + The model request was rate-limited. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRateLimitedErrorType` + + - `const BetaManagedAgentsModelRateLimitedErrorTypeModelRateLimitedError BetaManagedAgentsModelRateLimitedErrorType = "model_rate_limited_error"` + + - `type BetaManagedAgentsModelRequestFailedError struct{…}` + + A model request failed for a reason other than overload or rate-limiting. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRequestFailedErrorType` + + - `const BetaManagedAgentsModelRequestFailedErrorTypeModelRequestFailedError BetaManagedAgentsModelRequestFailedErrorType = "model_request_failed_error"` + + - `type BetaManagedAgentsMCPConnectionFailedError struct{…}` + + Failed to connect to an MCP server. + + - `MCPServerName string` + + Name of the MCP server that failed to connect. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPConnectionFailedErrorType` + + - `const BetaManagedAgentsMCPConnectionFailedErrorTypeMCPConnectionFailedError BetaManagedAgentsMCPConnectionFailedErrorType = "mcp_connection_failed_error"` + + - `type BetaManagedAgentsMCPAuthenticationFailedError struct{…}` + + Authentication to an MCP server failed. + + - `MCPServerName string` + + Name of the MCP server that failed authentication. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPAuthenticationFailedErrorType` + + - `const BetaManagedAgentsMCPAuthenticationFailedErrorTypeMCPAuthenticationFailedError BetaManagedAgentsMCPAuthenticationFailedErrorType = "mcp_authentication_failed_error"` + + - `type BetaManagedAgentsBillingError struct{…}` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsBillingErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsBillingErrorType` + + - `const BetaManagedAgentsBillingErrorTypeBillingError BetaManagedAgentsBillingErrorType = "billing_error"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionErrorEventType` + + - `const BetaManagedAgentsSessionErrorEventTypeSessionError BetaManagedAgentsSessionErrorEventType = "session.error"` + + - `type BetaManagedAgentsSessionStatusRescheduledEvent struct{…}` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRescheduledEventType` + + - `const BetaManagedAgentsSessionStatusRescheduledEventTypeSessionStatusRescheduled BetaManagedAgentsSessionStatusRescheduledEventType = "session.status_rescheduled"` + + - `type BetaManagedAgentsSessionStatusRunningEvent struct{…}` + + Indicates the session is actively running and the agent is working. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRunningEventType` + + - `const BetaManagedAgentsSessionStatusRunningEventTypeSessionStatusRunning BetaManagedAgentsSessionStatusRunningEventType = "session.status_running"` + + - `type BetaManagedAgentsSessionStatusIdleEvent struct{…}` + + Indicates the agent has paused and is awaiting user input. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `StopReason BetaManagedAgentsSessionStatusIdleEventStopReasonUnion` + + The agent completed its turn naturally and is ready for the next user message. + + - `type BetaManagedAgentsSessionEndTurn struct{…}` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type BetaManagedAgentsSessionEndTurnType` + + - `const BetaManagedAgentsSessionEndTurnTypeEndTurn BetaManagedAgentsSessionEndTurnType = "end_turn"` + + - `type BetaManagedAgentsSessionRequiresAction struct{…}` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `EventIDs []string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type BetaManagedAgentsSessionRequiresActionType` + + - `const BetaManagedAgentsSessionRequiresActionTypeRequiresAction BetaManagedAgentsSessionRequiresActionType = "requires_action"` + + - `type BetaManagedAgentsSessionRetriesExhausted struct{…}` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type BetaManagedAgentsSessionRetriesExhaustedType` + + - `const BetaManagedAgentsSessionRetriesExhaustedTypeRetriesExhausted BetaManagedAgentsSessionRetriesExhaustedType = "retries_exhausted"` + + - `Type BetaManagedAgentsSessionStatusIdleEventType` + + - `const BetaManagedAgentsSessionStatusIdleEventTypeSessionStatusIdle BetaManagedAgentsSessionStatusIdleEventType = "session.status_idle"` + + - `type BetaManagedAgentsSessionStatusTerminatedEvent struct{…}` + + Indicates the session has terminated, either due to an error or completion. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusTerminatedEventType` + + - `const BetaManagedAgentsSessionStatusTerminatedEventTypeSessionStatusTerminated BetaManagedAgentsSessionStatusTerminatedEventType = "session.status_terminated"` + + - `type BetaManagedAgentsSpanModelRequestStartEvent struct{…}` + + Emitted when a model request is initiated by the agent. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestStartEventType` + + - `const BetaManagedAgentsSpanModelRequestStartEventTypeSpanModelRequestStart BetaManagedAgentsSpanModelRequestStartEventType = "span.model_request_start"` + + - `type BetaManagedAgentsSpanModelRequestEndEvent struct{…}` + + Emitted when a model request completes. + + - `ID string` + + Unique identifier for this event. + + - `IsError bool` + + Whether the model request resulted in an error. + + - `ModelRequestStartID string` + + The id of the corresponding `span.model_request_start` event. + + - `ModelUsage BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `CacheCreationInputTokens int64` + + Tokens used to create prompt cache in this request. + + - `CacheReadInputTokens int64` + + Tokens read from prompt cache in this request. + + - `InputTokens int64` + + Input tokens consumed by this request. + + - `OutputTokens int64` + + Output tokens generated by this request. + + - `Speed BetaManagedAgentsSpanModelUsageSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsSpanModelUsageSpeedStandard BetaManagedAgentsSpanModelUsageSpeed = "standard"` + + - `const BetaManagedAgentsSpanModelUsageSpeedFast BetaManagedAgentsSpanModelUsageSpeed = "fast"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestEndEventType` + + - `const BetaManagedAgentsSpanModelRequestEndEventTypeSpanModelRequestEnd BetaManagedAgentsSpanModelRequestEndEventType = "span.model_request_end"` + + - `type BetaManagedAgentsSessionDeletedEvent struct{…}` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionDeletedEventType` + + - `const BetaManagedAgentsSessionDeletedEventTypeSessionDeleted BetaManagedAgentsSessionDeletedEventType = "session.deleted"` + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Beta.Sessions.Events.List( + context.TODO(), + "sesn_011CZkZAtmR3yMPDzynEDxu7", + anthropic.BetaSessionEventListParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", page) +} +``` + +## Send + +`client.Beta.Sessions.Events.Send(ctx, sessionID, params) (*BetaManagedAgentsSendSessionEvents, error)` + +**post** `/v1/sessions/{session_id}/events` + +Send Events + +### Parameters + +- `sessionID string` + +- `params BetaSessionEventSendParams` + + - `Events param.Field[[]BetaManagedAgentsEventParamsUnionResp]` + + Body param: Events to send to the `session`. + + - `type BetaManagedAgentsUserMessageEventParamsResp struct{…}` + + Parameters for sending a user message to the session. + + - `Content []BetaManagedAgentsUserMessageEventParamsContentUnionResp` + + Array of content blocks for the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventParamsType` + + - `const BetaManagedAgentsUserMessageEventParamsTypeUserMessage BetaManagedAgentsUserMessageEventParamsType = "user.message"` + + - `type BetaManagedAgentsUserInterruptEventParamsResp struct{…}` + + Parameters for sending an interrupt to pause the agent. + + - `Type BetaManagedAgentsUserInterruptEventParamsType` + + - `const BetaManagedAgentsUserInterruptEventParamsTypeUserInterrupt BetaManagedAgentsUserInterruptEventParamsType = "user.interrupt"` + + - `type BetaManagedAgentsUserToolConfirmationEventParamsResp struct{…}` + + Parameters for confirming or denying a tool execution request. + + - `Result BetaManagedAgentsUserToolConfirmationEventParamsResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventParamsResultAllow BetaManagedAgentsUserToolConfirmationEventParamsResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventParamsResultDeny BetaManagedAgentsUserToolConfirmationEventParamsResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventParamsType` + + - `const BetaManagedAgentsUserToolConfirmationEventParamsTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventParamsType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `type BetaManagedAgentsUserCustomToolResultEventParamsResp struct{…}` + + Parameters for providing the result of a custom tool execution. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventParamsType` + + - `const BetaManagedAgentsUserCustomToolResultEventParamsTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventParamsType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventParamsContentUnionResp` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsSendSessionEvents struct{…}` + + Events that were successfully sent to the session. + + - `Data []BetaManagedAgentsSendSessionEventsDataUnion` + + Sent events + + - `type BetaManagedAgentsUserMessageEvent struct{…}` + + A user message event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsUserMessageEventContentUnion` + + Array of content blocks comprising the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventType` + + - `const BetaManagedAgentsUserMessageEventTypeUserMessage BetaManagedAgentsUserMessageEventType = "user.message"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserInterruptEvent struct{…}` + + An interrupt event that pauses agent execution and returns control to the user. + + - `ID string` + + Unique identifier for this event. + + - `Type BetaManagedAgentsUserInterruptEventType` + + - `const BetaManagedAgentsUserInterruptEventTypeUserInterrupt BetaManagedAgentsUserInterruptEventType = "user.interrupt"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserToolConfirmationEvent struct{…}` + + A tool confirmation event that approves or denies a pending tool execution. + + - `ID string` + + Unique identifier for this event. + + - `Result BetaManagedAgentsUserToolConfirmationEventResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventResultAllow BetaManagedAgentsUserToolConfirmationEventResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventResultDeny BetaManagedAgentsUserToolConfirmationEventResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventType` + + - `const BetaManagedAgentsUserToolConfirmationEventTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserCustomToolResultEvent struct{…}` + + Event sent by the client providing the result of a custom tool execution. + + - `ID string` + + Unique identifier for this event. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventType` + + - `const BetaManagedAgentsUserCustomToolResultEventTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsSendSessionEvents, err := client.Beta.Sessions.Events.Send( + context.TODO(), + "sesn_011CZkZAtmR3yMPDzynEDxu7", + anthropic.BetaSessionEventSendParams{ + Events: []anthropic.BetaManagedAgentsEventParamsUnion{anthropic.BetaManagedAgentsEventParamsUnion{ + OfUserMessage: &anthropic.BetaManagedAgentsUserMessageEventParams{ + Content: []anthropic.BetaManagedAgentsUserMessageEventParamsContentUnion{anthropic.BetaManagedAgentsUserMessageEventParamsContentUnion{ + OfText: &anthropic.BetaManagedAgentsTextBlockParam{ + Text: "Where is my order #1234?", + Type: anthropic.BetaManagedAgentsTextBlockTypeText, + }, + }}, + Type: anthropic.BetaManagedAgentsUserMessageEventParamsTypeUserMessage, + }, + }}, + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsSendSessionEvents.Data) +} +``` + +## Stream + +`client.Beta.Sessions.Events.Stream(ctx, sessionID, query) (*BetaManagedAgentsStreamSessionEventsUnion, error)` + +**get** `/v1/sessions/{session_id}/events/stream` + +Stream Events + +### Parameters + +- `sessionID string` + +- `query BetaSessionEventStreamParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsStreamSessionEventsUnion interface{…}` + + Server-sent event in the session stream. + + - `type BetaManagedAgentsUserMessageEvent struct{…}` + + A user message event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsUserMessageEventContentUnion` + + Array of content blocks comprising the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventType` + + - `const BetaManagedAgentsUserMessageEventTypeUserMessage BetaManagedAgentsUserMessageEventType = "user.message"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserInterruptEvent struct{…}` + + An interrupt event that pauses agent execution and returns control to the user. + + - `ID string` + + Unique identifier for this event. + + - `Type BetaManagedAgentsUserInterruptEventType` + + - `const BetaManagedAgentsUserInterruptEventTypeUserInterrupt BetaManagedAgentsUserInterruptEventType = "user.interrupt"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserToolConfirmationEvent struct{…}` + + A tool confirmation event that approves or denies a pending tool execution. + + - `ID string` + + Unique identifier for this event. + + - `Result BetaManagedAgentsUserToolConfirmationEventResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventResultAllow BetaManagedAgentsUserToolConfirmationEventResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventResultDeny BetaManagedAgentsUserToolConfirmationEventResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventType` + + - `const BetaManagedAgentsUserToolConfirmationEventTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserCustomToolResultEvent struct{…}` + + Event sent by the client providing the result of a custom tool execution. + + - `ID string` + + Unique identifier for this event. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventType` + + - `const BetaManagedAgentsUserCustomToolResultEventTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsAgentCustomToolUseEvent struct{…}` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the custom tool being called. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentCustomToolUseEventType` + + - `const BetaManagedAgentsAgentCustomToolUseEventTypeAgentCustomToolUse BetaManagedAgentsAgentCustomToolUseEventType = "agent.custom_tool_use"` + + - `type BetaManagedAgentsAgentMessageEvent struct{…}` + + An agent response event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMessageEventType` + + - `const BetaManagedAgentsAgentMessageEventTypeAgentMessage BetaManagedAgentsAgentMessageEventType = "agent.message"` + + - `type BetaManagedAgentsAgentThinkingEvent struct{…}` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThinkingEventType` + + - `const BetaManagedAgentsAgentThinkingEventTypeAgentThinking BetaManagedAgentsAgentThinkingEventType = "agent.thinking"` + + - `type BetaManagedAgentsAgentMCPToolUseEvent struct{…}` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `MCPServerName string` + + Name of the MCP server providing the tool. + + - `Name string` + + Name of the MCP tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolUseEventType` + + - `const BetaManagedAgentsAgentMCPToolUseEventTypeAgentMCPToolUse BetaManagedAgentsAgentMCPToolUseEventType = "agent.mcp_tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "deny"` + + - `type BetaManagedAgentsAgentMCPToolResultEvent struct{…}` + + Event representing the result of an MCP tool execution. + + - `ID string` + + Unique identifier for this event. + + - `MCPToolUseID string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolResultEventType` + + - `const BetaManagedAgentsAgentMCPToolResultEventTypeAgentMCPToolResult BetaManagedAgentsAgentMCPToolResultEventType = "agent.mcp_tool_result"` + + - `Content []BetaManagedAgentsAgentMCPToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `type BetaManagedAgentsAgentToolUseEvent struct{…}` + + Event emitted when the agent invokes a built-in agent tool. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the agent tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentToolUseEventType` + + - `const BetaManagedAgentsAgentToolUseEventTypeAgentToolUse BetaManagedAgentsAgentToolUseEventType = "agent.tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "deny"` + + - `type BetaManagedAgentsAgentToolResultEvent struct{…}` + + Event representing the result of an agent tool execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `ToolUseID string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `Type BetaManagedAgentsAgentToolResultEventType` + + - `const BetaManagedAgentsAgentToolResultEventTypeAgentToolResult BetaManagedAgentsAgentToolResultEventType = "agent.tool_result"` + + - `Content []BetaManagedAgentsAgentToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `type BetaManagedAgentsAgentThreadContextCompactedEvent struct{…}` + + Indicates that context compaction (summarization) occurred during the session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThreadContextCompactedEventType` + + - `const BetaManagedAgentsAgentThreadContextCompactedEventTypeAgentThreadContextCompacted BetaManagedAgentsAgentThreadContextCompactedEventType = "agent.thread_context_compacted"` + + - `type BetaManagedAgentsSessionErrorEvent struct{…}` + + An error event indicating a problem occurred during session execution. + + - `ID string` + + Unique identifier for this event. + + - `Error BetaManagedAgentsSessionErrorEventErrorUnion` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `type BetaManagedAgentsUnknownError struct{…}` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsUnknownErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsUnknownErrorType` + + - `const BetaManagedAgentsUnknownErrorTypeUnknownError BetaManagedAgentsUnknownErrorType = "unknown_error"` + + - `type BetaManagedAgentsModelOverloadedError struct{…}` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelOverloadedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelOverloadedErrorType` + + - `const BetaManagedAgentsModelOverloadedErrorTypeModelOverloadedError BetaManagedAgentsModelOverloadedErrorType = "model_overloaded_error"` + + - `type BetaManagedAgentsModelRateLimitedError struct{…}` + + The model request was rate-limited. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRateLimitedErrorType` + + - `const BetaManagedAgentsModelRateLimitedErrorTypeModelRateLimitedError BetaManagedAgentsModelRateLimitedErrorType = "model_rate_limited_error"` + + - `type BetaManagedAgentsModelRequestFailedError struct{…}` + + A model request failed for a reason other than overload or rate-limiting. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRequestFailedErrorType` + + - `const BetaManagedAgentsModelRequestFailedErrorTypeModelRequestFailedError BetaManagedAgentsModelRequestFailedErrorType = "model_request_failed_error"` + + - `type BetaManagedAgentsMCPConnectionFailedError struct{…}` + + Failed to connect to an MCP server. + + - `MCPServerName string` + + Name of the MCP server that failed to connect. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPConnectionFailedErrorType` + + - `const BetaManagedAgentsMCPConnectionFailedErrorTypeMCPConnectionFailedError BetaManagedAgentsMCPConnectionFailedErrorType = "mcp_connection_failed_error"` + + - `type BetaManagedAgentsMCPAuthenticationFailedError struct{…}` + + Authentication to an MCP server failed. + + - `MCPServerName string` + + Name of the MCP server that failed authentication. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPAuthenticationFailedErrorType` + + - `const BetaManagedAgentsMCPAuthenticationFailedErrorTypeMCPAuthenticationFailedError BetaManagedAgentsMCPAuthenticationFailedErrorType = "mcp_authentication_failed_error"` + + - `type BetaManagedAgentsBillingError struct{…}` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsBillingErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsBillingErrorType` + + - `const BetaManagedAgentsBillingErrorTypeBillingError BetaManagedAgentsBillingErrorType = "billing_error"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionErrorEventType` + + - `const BetaManagedAgentsSessionErrorEventTypeSessionError BetaManagedAgentsSessionErrorEventType = "session.error"` + + - `type BetaManagedAgentsSessionStatusRescheduledEvent struct{…}` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRescheduledEventType` + + - `const BetaManagedAgentsSessionStatusRescheduledEventTypeSessionStatusRescheduled BetaManagedAgentsSessionStatusRescheduledEventType = "session.status_rescheduled"` + + - `type BetaManagedAgentsSessionStatusRunningEvent struct{…}` + + Indicates the session is actively running and the agent is working. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRunningEventType` + + - `const BetaManagedAgentsSessionStatusRunningEventTypeSessionStatusRunning BetaManagedAgentsSessionStatusRunningEventType = "session.status_running"` + + - `type BetaManagedAgentsSessionStatusIdleEvent struct{…}` + + Indicates the agent has paused and is awaiting user input. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `StopReason BetaManagedAgentsSessionStatusIdleEventStopReasonUnion` + + The agent completed its turn naturally and is ready for the next user message. + + - `type BetaManagedAgentsSessionEndTurn struct{…}` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type BetaManagedAgentsSessionEndTurnType` + + - `const BetaManagedAgentsSessionEndTurnTypeEndTurn BetaManagedAgentsSessionEndTurnType = "end_turn"` + + - `type BetaManagedAgentsSessionRequiresAction struct{…}` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `EventIDs []string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type BetaManagedAgentsSessionRequiresActionType` + + - `const BetaManagedAgentsSessionRequiresActionTypeRequiresAction BetaManagedAgentsSessionRequiresActionType = "requires_action"` + + - `type BetaManagedAgentsSessionRetriesExhausted struct{…}` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type BetaManagedAgentsSessionRetriesExhaustedType` + + - `const BetaManagedAgentsSessionRetriesExhaustedTypeRetriesExhausted BetaManagedAgentsSessionRetriesExhaustedType = "retries_exhausted"` + + - `Type BetaManagedAgentsSessionStatusIdleEventType` + + - `const BetaManagedAgentsSessionStatusIdleEventTypeSessionStatusIdle BetaManagedAgentsSessionStatusIdleEventType = "session.status_idle"` + + - `type BetaManagedAgentsSessionStatusTerminatedEvent struct{…}` + + Indicates the session has terminated, either due to an error or completion. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusTerminatedEventType` + + - `const BetaManagedAgentsSessionStatusTerminatedEventTypeSessionStatusTerminated BetaManagedAgentsSessionStatusTerminatedEventType = "session.status_terminated"` + + - `type BetaManagedAgentsSpanModelRequestStartEvent struct{…}` + + Emitted when a model request is initiated by the agent. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestStartEventType` + + - `const BetaManagedAgentsSpanModelRequestStartEventTypeSpanModelRequestStart BetaManagedAgentsSpanModelRequestStartEventType = "span.model_request_start"` + + - `type BetaManagedAgentsSpanModelRequestEndEvent struct{…}` + + Emitted when a model request completes. + + - `ID string` + + Unique identifier for this event. + + - `IsError bool` + + Whether the model request resulted in an error. + + - `ModelRequestStartID string` + + The id of the corresponding `span.model_request_start` event. + + - `ModelUsage BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `CacheCreationInputTokens int64` + + Tokens used to create prompt cache in this request. + + - `CacheReadInputTokens int64` + + Tokens read from prompt cache in this request. + + - `InputTokens int64` + + Input tokens consumed by this request. + + - `OutputTokens int64` + + Output tokens generated by this request. + + - `Speed BetaManagedAgentsSpanModelUsageSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsSpanModelUsageSpeedStandard BetaManagedAgentsSpanModelUsageSpeed = "standard"` + + - `const BetaManagedAgentsSpanModelUsageSpeedFast BetaManagedAgentsSpanModelUsageSpeed = "fast"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestEndEventType` + + - `const BetaManagedAgentsSpanModelRequestEndEventTypeSpanModelRequestEnd BetaManagedAgentsSpanModelRequestEndEventType = "span.model_request_end"` + + - `type BetaManagedAgentsSessionDeletedEvent struct{…}` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionDeletedEventType` + + - `const BetaManagedAgentsSessionDeletedEventTypeSessionDeleted BetaManagedAgentsSessionDeletedEventType = "session.deleted"` + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + stream := client.Beta.Sessions.Events.StreamEvents( + context.TODO(), + "sesn_011CZkZAtmR3yMPDzynEDxu7", + anthropic.BetaSessionEventStreamParams{ + + }, + ) + for stream.Next() { + fmt.Printf("%+v\n", stream.Current()) + } + err := stream.Err() + if err != nil { + panic(err.Error()) + } +} +``` + +## Domain Types + +### Beta Managed Agents Agent Custom Tool Use Event + +- `type BetaManagedAgentsAgentCustomToolUseEvent struct{…}` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the custom tool being called. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentCustomToolUseEventType` + + - `const BetaManagedAgentsAgentCustomToolUseEventTypeAgentCustomToolUse BetaManagedAgentsAgentCustomToolUseEventType = "agent.custom_tool_use"` + +### Beta Managed Agents Agent MCP Tool Result Event + +- `type BetaManagedAgentsAgentMCPToolResultEvent struct{…}` + + Event representing the result of an MCP tool execution. + + - `ID string` + + Unique identifier for this event. + + - `MCPToolUseID string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolResultEventType` + + - `const BetaManagedAgentsAgentMCPToolResultEventTypeAgentMCPToolResult BetaManagedAgentsAgentMCPToolResultEventType = "agent.mcp_tool_result"` + + - `Content []BetaManagedAgentsAgentMCPToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent MCP Tool Use Event + +- `type BetaManagedAgentsAgentMCPToolUseEvent struct{…}` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `MCPServerName string` + + Name of the MCP server providing the tool. + + - `Name string` + + Name of the MCP tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolUseEventType` + + - `const BetaManagedAgentsAgentMCPToolUseEventTypeAgentMCPToolUse BetaManagedAgentsAgentMCPToolUseEventType = "agent.mcp_tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "deny"` + +### Beta Managed Agents Agent Message Event + +- `type BetaManagedAgentsAgentMessageEvent struct{…}` + + An agent response event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMessageEventType` + + - `const BetaManagedAgentsAgentMessageEventTypeAgentMessage BetaManagedAgentsAgentMessageEventType = "agent.message"` + +### Beta Managed Agents Agent Thinking Event + +- `type BetaManagedAgentsAgentThinkingEvent struct{…}` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThinkingEventType` + + - `const BetaManagedAgentsAgentThinkingEventTypeAgentThinking BetaManagedAgentsAgentThinkingEventType = "agent.thinking"` + +### Beta Managed Agents Agent Thread Context Compacted Event + +- `type BetaManagedAgentsAgentThreadContextCompactedEvent struct{…}` + + Indicates that context compaction (summarization) occurred during the session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThreadContextCompactedEventType` + + - `const BetaManagedAgentsAgentThreadContextCompactedEventTypeAgentThreadContextCompacted BetaManagedAgentsAgentThreadContextCompactedEventType = "agent.thread_context_compacted"` + +### Beta Managed Agents Agent Tool Result Event + +- `type BetaManagedAgentsAgentToolResultEvent struct{…}` + + Event representing the result of an agent tool execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `ToolUseID string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `Type BetaManagedAgentsAgentToolResultEventType` + + - `const BetaManagedAgentsAgentToolResultEventTypeAgentToolResult BetaManagedAgentsAgentToolResultEventType = "agent.tool_result"` + + - `Content []BetaManagedAgentsAgentToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent Tool Use Event + +- `type BetaManagedAgentsAgentToolUseEvent struct{…}` + + Event emitted when the agent invokes a built-in agent tool. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the agent tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentToolUseEventType` + + - `const BetaManagedAgentsAgentToolUseEventTypeAgentToolUse BetaManagedAgentsAgentToolUseEventType = "agent.tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "deny"` + +### Beta Managed Agents Base64 Document Source + +- `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + +### Beta Managed Agents Base64 Image Source + +- `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + +### Beta Managed Agents Billing Error + +- `type BetaManagedAgentsBillingError struct{…}` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsBillingErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsBillingErrorType` + + - `const BetaManagedAgentsBillingErrorTypeBillingError BetaManagedAgentsBillingErrorType = "billing_error"` + +### Beta Managed Agents Document Block + +- `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + +### Beta Managed Agents Event Params + +- `type BetaManagedAgentsEventParamsUnionResp interface{…}` + + Union type for event parameters that can be sent to a session. + + - `type BetaManagedAgentsUserMessageEventParamsResp struct{…}` + + Parameters for sending a user message to the session. + + - `Content []BetaManagedAgentsUserMessageEventParamsContentUnionResp` + + Array of content blocks for the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventParamsType` + + - `const BetaManagedAgentsUserMessageEventParamsTypeUserMessage BetaManagedAgentsUserMessageEventParamsType = "user.message"` + + - `type BetaManagedAgentsUserInterruptEventParamsResp struct{…}` + + Parameters for sending an interrupt to pause the agent. + + - `Type BetaManagedAgentsUserInterruptEventParamsType` + + - `const BetaManagedAgentsUserInterruptEventParamsTypeUserInterrupt BetaManagedAgentsUserInterruptEventParamsType = "user.interrupt"` + + - `type BetaManagedAgentsUserToolConfirmationEventParamsResp struct{…}` + + Parameters for confirming or denying a tool execution request. + + - `Result BetaManagedAgentsUserToolConfirmationEventParamsResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventParamsResultAllow BetaManagedAgentsUserToolConfirmationEventParamsResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventParamsResultDeny BetaManagedAgentsUserToolConfirmationEventParamsResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventParamsType` + + - `const BetaManagedAgentsUserToolConfirmationEventParamsTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventParamsType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `type BetaManagedAgentsUserCustomToolResultEventParamsResp struct{…}` + + Parameters for providing the result of a custom tool execution. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventParamsType` + + - `const BetaManagedAgentsUserCustomToolResultEventParamsTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventParamsType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventParamsContentUnionResp` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents File Document Source + +- `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + +### Beta Managed Agents File Image Source + +- `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + +### Beta Managed Agents Image Block + +- `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + +### Beta Managed Agents MCP Authentication Failed Error + +- `type BetaManagedAgentsMCPAuthenticationFailedError struct{…}` + + Authentication to an MCP server failed. + + - `MCPServerName string` + + Name of the MCP server that failed authentication. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPAuthenticationFailedErrorType` + + - `const BetaManagedAgentsMCPAuthenticationFailedErrorTypeMCPAuthenticationFailedError BetaManagedAgentsMCPAuthenticationFailedErrorType = "mcp_authentication_failed_error"` + +### Beta Managed Agents MCP Connection Failed Error + +- `type BetaManagedAgentsMCPConnectionFailedError struct{…}` + + Failed to connect to an MCP server. + + - `MCPServerName string` + + Name of the MCP server that failed to connect. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPConnectionFailedErrorType` + + - `const BetaManagedAgentsMCPConnectionFailedErrorTypeMCPConnectionFailedError BetaManagedAgentsMCPConnectionFailedErrorType = "mcp_connection_failed_error"` + +### Beta Managed Agents Model Overloaded Error + +- `type BetaManagedAgentsModelOverloadedError struct{…}` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelOverloadedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelOverloadedErrorType` + + - `const BetaManagedAgentsModelOverloadedErrorTypeModelOverloadedError BetaManagedAgentsModelOverloadedErrorType = "model_overloaded_error"` + +### Beta Managed Agents Model Rate Limited Error + +- `type BetaManagedAgentsModelRateLimitedError struct{…}` + + The model request was rate-limited. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRateLimitedErrorType` + + - `const BetaManagedAgentsModelRateLimitedErrorTypeModelRateLimitedError BetaManagedAgentsModelRateLimitedErrorType = "model_rate_limited_error"` + +### Beta Managed Agents Model Request Failed Error + +- `type BetaManagedAgentsModelRequestFailedError struct{…}` + + A model request failed for a reason other than overload or rate-limiting. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRequestFailedErrorType` + + - `const BetaManagedAgentsModelRequestFailedErrorTypeModelRequestFailedError BetaManagedAgentsModelRequestFailedErrorType = "model_request_failed_error"` + +### Beta Managed Agents Plain Text Document Source + +- `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + +### Beta Managed Agents Retry Status Exhausted + +- `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + +### Beta Managed Agents Retry Status Retrying + +- `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + +### Beta Managed Agents Retry Status Terminal + +- `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + +### Beta Managed Agents Send Session Events + +- `type BetaManagedAgentsSendSessionEvents struct{…}` + + Events that were successfully sent to the session. + + - `Data []BetaManagedAgentsSendSessionEventsDataUnion` + + Sent events + + - `type BetaManagedAgentsUserMessageEvent struct{…}` + + A user message event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsUserMessageEventContentUnion` + + Array of content blocks comprising the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventType` + + - `const BetaManagedAgentsUserMessageEventTypeUserMessage BetaManagedAgentsUserMessageEventType = "user.message"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserInterruptEvent struct{…}` + + An interrupt event that pauses agent execution and returns control to the user. + + - `ID string` + + Unique identifier for this event. + + - `Type BetaManagedAgentsUserInterruptEventType` + + - `const BetaManagedAgentsUserInterruptEventTypeUserInterrupt BetaManagedAgentsUserInterruptEventType = "user.interrupt"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserToolConfirmationEvent struct{…}` + + A tool confirmation event that approves or denies a pending tool execution. + + - `ID string` + + Unique identifier for this event. + + - `Result BetaManagedAgentsUserToolConfirmationEventResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventResultAllow BetaManagedAgentsUserToolConfirmationEventResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventResultDeny BetaManagedAgentsUserToolConfirmationEventResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventType` + + - `const BetaManagedAgentsUserToolConfirmationEventTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserCustomToolResultEvent struct{…}` + + Event sent by the client providing the result of a custom tool execution. + + - `ID string` + + Unique identifier for this event. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventType` + + - `const BetaManagedAgentsUserCustomToolResultEventTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents Session Deleted Event + +- `type BetaManagedAgentsSessionDeletedEvent struct{…}` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionDeletedEventType` + + - `const BetaManagedAgentsSessionDeletedEventTypeSessionDeleted BetaManagedAgentsSessionDeletedEventType = "session.deleted"` + +### Beta Managed Agents Session End Turn + +- `type BetaManagedAgentsSessionEndTurn struct{…}` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type BetaManagedAgentsSessionEndTurnType` + + - `const BetaManagedAgentsSessionEndTurnTypeEndTurn BetaManagedAgentsSessionEndTurnType = "end_turn"` + +### Beta Managed Agents Session Error Event + +- `type BetaManagedAgentsSessionErrorEvent struct{…}` + + An error event indicating a problem occurred during session execution. + + - `ID string` + + Unique identifier for this event. + + - `Error BetaManagedAgentsSessionErrorEventErrorUnion` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `type BetaManagedAgentsUnknownError struct{…}` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsUnknownErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsUnknownErrorType` + + - `const BetaManagedAgentsUnknownErrorTypeUnknownError BetaManagedAgentsUnknownErrorType = "unknown_error"` + + - `type BetaManagedAgentsModelOverloadedError struct{…}` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelOverloadedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelOverloadedErrorType` + + - `const BetaManagedAgentsModelOverloadedErrorTypeModelOverloadedError BetaManagedAgentsModelOverloadedErrorType = "model_overloaded_error"` + + - `type BetaManagedAgentsModelRateLimitedError struct{…}` + + The model request was rate-limited. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRateLimitedErrorType` + + - `const BetaManagedAgentsModelRateLimitedErrorTypeModelRateLimitedError BetaManagedAgentsModelRateLimitedErrorType = "model_rate_limited_error"` + + - `type BetaManagedAgentsModelRequestFailedError struct{…}` + + A model request failed for a reason other than overload or rate-limiting. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRequestFailedErrorType` + + - `const BetaManagedAgentsModelRequestFailedErrorTypeModelRequestFailedError BetaManagedAgentsModelRequestFailedErrorType = "model_request_failed_error"` + + - `type BetaManagedAgentsMCPConnectionFailedError struct{…}` + + Failed to connect to an MCP server. + + - `MCPServerName string` + + Name of the MCP server that failed to connect. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPConnectionFailedErrorType` + + - `const BetaManagedAgentsMCPConnectionFailedErrorTypeMCPConnectionFailedError BetaManagedAgentsMCPConnectionFailedErrorType = "mcp_connection_failed_error"` + + - `type BetaManagedAgentsMCPAuthenticationFailedError struct{…}` + + Authentication to an MCP server failed. + + - `MCPServerName string` + + Name of the MCP server that failed authentication. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPAuthenticationFailedErrorType` + + - `const BetaManagedAgentsMCPAuthenticationFailedErrorTypeMCPAuthenticationFailedError BetaManagedAgentsMCPAuthenticationFailedErrorType = "mcp_authentication_failed_error"` + + - `type BetaManagedAgentsBillingError struct{…}` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsBillingErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsBillingErrorType` + + - `const BetaManagedAgentsBillingErrorTypeBillingError BetaManagedAgentsBillingErrorType = "billing_error"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionErrorEventType` + + - `const BetaManagedAgentsSessionErrorEventTypeSessionError BetaManagedAgentsSessionErrorEventType = "session.error"` + +### Beta Managed Agents Session Event + +- `type BetaManagedAgentsSessionEventUnion interface{…}` + + Union type for all event types in a session. + + - `type BetaManagedAgentsUserMessageEvent struct{…}` + + A user message event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsUserMessageEventContentUnion` + + Array of content blocks comprising the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventType` + + - `const BetaManagedAgentsUserMessageEventTypeUserMessage BetaManagedAgentsUserMessageEventType = "user.message"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserInterruptEvent struct{…}` + + An interrupt event that pauses agent execution and returns control to the user. + + - `ID string` + + Unique identifier for this event. + + - `Type BetaManagedAgentsUserInterruptEventType` + + - `const BetaManagedAgentsUserInterruptEventTypeUserInterrupt BetaManagedAgentsUserInterruptEventType = "user.interrupt"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserToolConfirmationEvent struct{…}` + + A tool confirmation event that approves or denies a pending tool execution. + + - `ID string` + + Unique identifier for this event. + + - `Result BetaManagedAgentsUserToolConfirmationEventResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventResultAllow BetaManagedAgentsUserToolConfirmationEventResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventResultDeny BetaManagedAgentsUserToolConfirmationEventResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventType` + + - `const BetaManagedAgentsUserToolConfirmationEventTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserCustomToolResultEvent struct{…}` + + Event sent by the client providing the result of a custom tool execution. + + - `ID string` + + Unique identifier for this event. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventType` + + - `const BetaManagedAgentsUserCustomToolResultEventTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsAgentCustomToolUseEvent struct{…}` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the custom tool being called. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentCustomToolUseEventType` + + - `const BetaManagedAgentsAgentCustomToolUseEventTypeAgentCustomToolUse BetaManagedAgentsAgentCustomToolUseEventType = "agent.custom_tool_use"` + + - `type BetaManagedAgentsAgentMessageEvent struct{…}` + + An agent response event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMessageEventType` + + - `const BetaManagedAgentsAgentMessageEventTypeAgentMessage BetaManagedAgentsAgentMessageEventType = "agent.message"` + + - `type BetaManagedAgentsAgentThinkingEvent struct{…}` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThinkingEventType` + + - `const BetaManagedAgentsAgentThinkingEventTypeAgentThinking BetaManagedAgentsAgentThinkingEventType = "agent.thinking"` + + - `type BetaManagedAgentsAgentMCPToolUseEvent struct{…}` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `MCPServerName string` + + Name of the MCP server providing the tool. + + - `Name string` + + Name of the MCP tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolUseEventType` + + - `const BetaManagedAgentsAgentMCPToolUseEventTypeAgentMCPToolUse BetaManagedAgentsAgentMCPToolUseEventType = "agent.mcp_tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "deny"` + + - `type BetaManagedAgentsAgentMCPToolResultEvent struct{…}` + + Event representing the result of an MCP tool execution. + + - `ID string` + + Unique identifier for this event. + + - `MCPToolUseID string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolResultEventType` + + - `const BetaManagedAgentsAgentMCPToolResultEventTypeAgentMCPToolResult BetaManagedAgentsAgentMCPToolResultEventType = "agent.mcp_tool_result"` + + - `Content []BetaManagedAgentsAgentMCPToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `type BetaManagedAgentsAgentToolUseEvent struct{…}` + + Event emitted when the agent invokes a built-in agent tool. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the agent tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentToolUseEventType` + + - `const BetaManagedAgentsAgentToolUseEventTypeAgentToolUse BetaManagedAgentsAgentToolUseEventType = "agent.tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "deny"` + + - `type BetaManagedAgentsAgentToolResultEvent struct{…}` + + Event representing the result of an agent tool execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `ToolUseID string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `Type BetaManagedAgentsAgentToolResultEventType` + + - `const BetaManagedAgentsAgentToolResultEventTypeAgentToolResult BetaManagedAgentsAgentToolResultEventType = "agent.tool_result"` + + - `Content []BetaManagedAgentsAgentToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `type BetaManagedAgentsAgentThreadContextCompactedEvent struct{…}` + + Indicates that context compaction (summarization) occurred during the session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThreadContextCompactedEventType` + + - `const BetaManagedAgentsAgentThreadContextCompactedEventTypeAgentThreadContextCompacted BetaManagedAgentsAgentThreadContextCompactedEventType = "agent.thread_context_compacted"` + + - `type BetaManagedAgentsSessionErrorEvent struct{…}` + + An error event indicating a problem occurred during session execution. + + - `ID string` + + Unique identifier for this event. + + - `Error BetaManagedAgentsSessionErrorEventErrorUnion` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `type BetaManagedAgentsUnknownError struct{…}` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsUnknownErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsUnknownErrorType` + + - `const BetaManagedAgentsUnknownErrorTypeUnknownError BetaManagedAgentsUnknownErrorType = "unknown_error"` + + - `type BetaManagedAgentsModelOverloadedError struct{…}` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelOverloadedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelOverloadedErrorType` + + - `const BetaManagedAgentsModelOverloadedErrorTypeModelOverloadedError BetaManagedAgentsModelOverloadedErrorType = "model_overloaded_error"` + + - `type BetaManagedAgentsModelRateLimitedError struct{…}` + + The model request was rate-limited. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRateLimitedErrorType` + + - `const BetaManagedAgentsModelRateLimitedErrorTypeModelRateLimitedError BetaManagedAgentsModelRateLimitedErrorType = "model_rate_limited_error"` + + - `type BetaManagedAgentsModelRequestFailedError struct{…}` + + A model request failed for a reason other than overload or rate-limiting. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRequestFailedErrorType` + + - `const BetaManagedAgentsModelRequestFailedErrorTypeModelRequestFailedError BetaManagedAgentsModelRequestFailedErrorType = "model_request_failed_error"` + + - `type BetaManagedAgentsMCPConnectionFailedError struct{…}` + + Failed to connect to an MCP server. + + - `MCPServerName string` + + Name of the MCP server that failed to connect. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPConnectionFailedErrorType` + + - `const BetaManagedAgentsMCPConnectionFailedErrorTypeMCPConnectionFailedError BetaManagedAgentsMCPConnectionFailedErrorType = "mcp_connection_failed_error"` + + - `type BetaManagedAgentsMCPAuthenticationFailedError struct{…}` + + Authentication to an MCP server failed. + + - `MCPServerName string` + + Name of the MCP server that failed authentication. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPAuthenticationFailedErrorType` + + - `const BetaManagedAgentsMCPAuthenticationFailedErrorTypeMCPAuthenticationFailedError BetaManagedAgentsMCPAuthenticationFailedErrorType = "mcp_authentication_failed_error"` + + - `type BetaManagedAgentsBillingError struct{…}` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsBillingErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsBillingErrorType` + + - `const BetaManagedAgentsBillingErrorTypeBillingError BetaManagedAgentsBillingErrorType = "billing_error"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionErrorEventType` + + - `const BetaManagedAgentsSessionErrorEventTypeSessionError BetaManagedAgentsSessionErrorEventType = "session.error"` + + - `type BetaManagedAgentsSessionStatusRescheduledEvent struct{…}` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRescheduledEventType` + + - `const BetaManagedAgentsSessionStatusRescheduledEventTypeSessionStatusRescheduled BetaManagedAgentsSessionStatusRescheduledEventType = "session.status_rescheduled"` + + - `type BetaManagedAgentsSessionStatusRunningEvent struct{…}` + + Indicates the session is actively running and the agent is working. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRunningEventType` + + - `const BetaManagedAgentsSessionStatusRunningEventTypeSessionStatusRunning BetaManagedAgentsSessionStatusRunningEventType = "session.status_running"` + + - `type BetaManagedAgentsSessionStatusIdleEvent struct{…}` + + Indicates the agent has paused and is awaiting user input. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `StopReason BetaManagedAgentsSessionStatusIdleEventStopReasonUnion` + + The agent completed its turn naturally and is ready for the next user message. + + - `type BetaManagedAgentsSessionEndTurn struct{…}` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type BetaManagedAgentsSessionEndTurnType` + + - `const BetaManagedAgentsSessionEndTurnTypeEndTurn BetaManagedAgentsSessionEndTurnType = "end_turn"` + + - `type BetaManagedAgentsSessionRequiresAction struct{…}` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `EventIDs []string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type BetaManagedAgentsSessionRequiresActionType` + + - `const BetaManagedAgentsSessionRequiresActionTypeRequiresAction BetaManagedAgentsSessionRequiresActionType = "requires_action"` + + - `type BetaManagedAgentsSessionRetriesExhausted struct{…}` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type BetaManagedAgentsSessionRetriesExhaustedType` + + - `const BetaManagedAgentsSessionRetriesExhaustedTypeRetriesExhausted BetaManagedAgentsSessionRetriesExhaustedType = "retries_exhausted"` + + - `Type BetaManagedAgentsSessionStatusIdleEventType` + + - `const BetaManagedAgentsSessionStatusIdleEventTypeSessionStatusIdle BetaManagedAgentsSessionStatusIdleEventType = "session.status_idle"` + + - `type BetaManagedAgentsSessionStatusTerminatedEvent struct{…}` + + Indicates the session has terminated, either due to an error or completion. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusTerminatedEventType` + + - `const BetaManagedAgentsSessionStatusTerminatedEventTypeSessionStatusTerminated BetaManagedAgentsSessionStatusTerminatedEventType = "session.status_terminated"` + + - `type BetaManagedAgentsSpanModelRequestStartEvent struct{…}` + + Emitted when a model request is initiated by the agent. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestStartEventType` + + - `const BetaManagedAgentsSpanModelRequestStartEventTypeSpanModelRequestStart BetaManagedAgentsSpanModelRequestStartEventType = "span.model_request_start"` + + - `type BetaManagedAgentsSpanModelRequestEndEvent struct{…}` + + Emitted when a model request completes. + + - `ID string` + + Unique identifier for this event. + + - `IsError bool` + + Whether the model request resulted in an error. + + - `ModelRequestStartID string` + + The id of the corresponding `span.model_request_start` event. + + - `ModelUsage BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `CacheCreationInputTokens int64` + + Tokens used to create prompt cache in this request. + + - `CacheReadInputTokens int64` + + Tokens read from prompt cache in this request. + + - `InputTokens int64` + + Input tokens consumed by this request. + + - `OutputTokens int64` + + Output tokens generated by this request. + + - `Speed BetaManagedAgentsSpanModelUsageSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsSpanModelUsageSpeedStandard BetaManagedAgentsSpanModelUsageSpeed = "standard"` + + - `const BetaManagedAgentsSpanModelUsageSpeedFast BetaManagedAgentsSpanModelUsageSpeed = "fast"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestEndEventType` + + - `const BetaManagedAgentsSpanModelRequestEndEventTypeSpanModelRequestEnd BetaManagedAgentsSpanModelRequestEndEventType = "span.model_request_end"` + + - `type BetaManagedAgentsSessionDeletedEvent struct{…}` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionDeletedEventType` + + - `const BetaManagedAgentsSessionDeletedEventTypeSessionDeleted BetaManagedAgentsSessionDeletedEventType = "session.deleted"` + +### Beta Managed Agents Session Requires Action + +- `type BetaManagedAgentsSessionRequiresAction struct{…}` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `EventIDs []string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type BetaManagedAgentsSessionRequiresActionType` + + - `const BetaManagedAgentsSessionRequiresActionTypeRequiresAction BetaManagedAgentsSessionRequiresActionType = "requires_action"` + +### Beta Managed Agents Session Retries Exhausted + +- `type BetaManagedAgentsSessionRetriesExhausted struct{…}` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type BetaManagedAgentsSessionRetriesExhaustedType` + + - `const BetaManagedAgentsSessionRetriesExhaustedTypeRetriesExhausted BetaManagedAgentsSessionRetriesExhaustedType = "retries_exhausted"` + +### Beta Managed Agents Session Status Idle Event + +- `type BetaManagedAgentsSessionStatusIdleEvent struct{…}` + + Indicates the agent has paused and is awaiting user input. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `StopReason BetaManagedAgentsSessionStatusIdleEventStopReasonUnion` + + The agent completed its turn naturally and is ready for the next user message. + + - `type BetaManagedAgentsSessionEndTurn struct{…}` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type BetaManagedAgentsSessionEndTurnType` + + - `const BetaManagedAgentsSessionEndTurnTypeEndTurn BetaManagedAgentsSessionEndTurnType = "end_turn"` + + - `type BetaManagedAgentsSessionRequiresAction struct{…}` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `EventIDs []string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type BetaManagedAgentsSessionRequiresActionType` + + - `const BetaManagedAgentsSessionRequiresActionTypeRequiresAction BetaManagedAgentsSessionRequiresActionType = "requires_action"` + + - `type BetaManagedAgentsSessionRetriesExhausted struct{…}` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type BetaManagedAgentsSessionRetriesExhaustedType` + + - `const BetaManagedAgentsSessionRetriesExhaustedTypeRetriesExhausted BetaManagedAgentsSessionRetriesExhaustedType = "retries_exhausted"` + + - `Type BetaManagedAgentsSessionStatusIdleEventType` + + - `const BetaManagedAgentsSessionStatusIdleEventTypeSessionStatusIdle BetaManagedAgentsSessionStatusIdleEventType = "session.status_idle"` + +### Beta Managed Agents Session Status Rescheduled Event + +- `type BetaManagedAgentsSessionStatusRescheduledEvent struct{…}` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRescheduledEventType` + + - `const BetaManagedAgentsSessionStatusRescheduledEventTypeSessionStatusRescheduled BetaManagedAgentsSessionStatusRescheduledEventType = "session.status_rescheduled"` + +### Beta Managed Agents Session Status Running Event + +- `type BetaManagedAgentsSessionStatusRunningEvent struct{…}` + + Indicates the session is actively running and the agent is working. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRunningEventType` + + - `const BetaManagedAgentsSessionStatusRunningEventTypeSessionStatusRunning BetaManagedAgentsSessionStatusRunningEventType = "session.status_running"` + +### Beta Managed Agents Session Status Terminated Event + +- `type BetaManagedAgentsSessionStatusTerminatedEvent struct{…}` + + Indicates the session has terminated, either due to an error or completion. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusTerminatedEventType` + + - `const BetaManagedAgentsSessionStatusTerminatedEventTypeSessionStatusTerminated BetaManagedAgentsSessionStatusTerminatedEventType = "session.status_terminated"` + +### Beta Managed Agents Span Model Request End Event + +- `type BetaManagedAgentsSpanModelRequestEndEvent struct{…}` + + Emitted when a model request completes. + + - `ID string` + + Unique identifier for this event. + + - `IsError bool` + + Whether the model request resulted in an error. + + - `ModelRequestStartID string` + + The id of the corresponding `span.model_request_start` event. + + - `ModelUsage BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `CacheCreationInputTokens int64` + + Tokens used to create prompt cache in this request. + + - `CacheReadInputTokens int64` + + Tokens read from prompt cache in this request. + + - `InputTokens int64` + + Input tokens consumed by this request. + + - `OutputTokens int64` + + Output tokens generated by this request. + + - `Speed BetaManagedAgentsSpanModelUsageSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsSpanModelUsageSpeedStandard BetaManagedAgentsSpanModelUsageSpeed = "standard"` + + - `const BetaManagedAgentsSpanModelUsageSpeedFast BetaManagedAgentsSpanModelUsageSpeed = "fast"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestEndEventType` + + - `const BetaManagedAgentsSpanModelRequestEndEventTypeSpanModelRequestEnd BetaManagedAgentsSpanModelRequestEndEventType = "span.model_request_end"` + +### Beta Managed Agents Span Model Request Start Event + +- `type BetaManagedAgentsSpanModelRequestStartEvent struct{…}` + + Emitted when a model request is initiated by the agent. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestStartEventType` + + - `const BetaManagedAgentsSpanModelRequestStartEventTypeSpanModelRequestStart BetaManagedAgentsSpanModelRequestStartEventType = "span.model_request_start"` + +### Beta Managed Agents Span Model Usage + +- `type BetaManagedAgentsSpanModelUsage struct{…}` + + Token usage for a single model request. + + - `CacheCreationInputTokens int64` + + Tokens used to create prompt cache in this request. + + - `CacheReadInputTokens int64` + + Tokens read from prompt cache in this request. + + - `InputTokens int64` + + Input tokens consumed by this request. + + - `OutputTokens int64` + + Output tokens generated by this request. + + - `Speed BetaManagedAgentsSpanModelUsageSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsSpanModelUsageSpeedStandard BetaManagedAgentsSpanModelUsageSpeed = "standard"` + + - `const BetaManagedAgentsSpanModelUsageSpeedFast BetaManagedAgentsSpanModelUsageSpeed = "fast"` + +### Beta Managed Agents Stream Session Events + +- `type BetaManagedAgentsStreamSessionEventsUnion interface{…}` + + Server-sent event in the session stream. + + - `type BetaManagedAgentsUserMessageEvent struct{…}` + + A user message event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsUserMessageEventContentUnion` + + Array of content blocks comprising the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventType` + + - `const BetaManagedAgentsUserMessageEventTypeUserMessage BetaManagedAgentsUserMessageEventType = "user.message"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserInterruptEvent struct{…}` + + An interrupt event that pauses agent execution and returns control to the user. + + - `ID string` + + Unique identifier for this event. + + - `Type BetaManagedAgentsUserInterruptEventType` + + - `const BetaManagedAgentsUserInterruptEventTypeUserInterrupt BetaManagedAgentsUserInterruptEventType = "user.interrupt"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserToolConfirmationEvent struct{…}` + + A tool confirmation event that approves or denies a pending tool execution. + + - `ID string` + + Unique identifier for this event. + + - `Result BetaManagedAgentsUserToolConfirmationEventResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventResultAllow BetaManagedAgentsUserToolConfirmationEventResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventResultDeny BetaManagedAgentsUserToolConfirmationEventResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventType` + + - `const BetaManagedAgentsUserToolConfirmationEventTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserCustomToolResultEvent struct{…}` + + Event sent by the client providing the result of a custom tool execution. + + - `ID string` + + Unique identifier for this event. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventType` + + - `const BetaManagedAgentsUserCustomToolResultEventTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsAgentCustomToolUseEvent struct{…}` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the custom tool being called. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentCustomToolUseEventType` + + - `const BetaManagedAgentsAgentCustomToolUseEventTypeAgentCustomToolUse BetaManagedAgentsAgentCustomToolUseEventType = "agent.custom_tool_use"` + + - `type BetaManagedAgentsAgentMessageEvent struct{…}` + + An agent response event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMessageEventType` + + - `const BetaManagedAgentsAgentMessageEventTypeAgentMessage BetaManagedAgentsAgentMessageEventType = "agent.message"` + + - `type BetaManagedAgentsAgentThinkingEvent struct{…}` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThinkingEventType` + + - `const BetaManagedAgentsAgentThinkingEventTypeAgentThinking BetaManagedAgentsAgentThinkingEventType = "agent.thinking"` + + - `type BetaManagedAgentsAgentMCPToolUseEvent struct{…}` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `MCPServerName string` + + Name of the MCP server providing the tool. + + - `Name string` + + Name of the MCP tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolUseEventType` + + - `const BetaManagedAgentsAgentMCPToolUseEventTypeAgentMCPToolUse BetaManagedAgentsAgentMCPToolUseEventType = "agent.mcp_tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "deny"` + + - `type BetaManagedAgentsAgentMCPToolResultEvent struct{…}` + + Event representing the result of an MCP tool execution. + + - `ID string` + + Unique identifier for this event. + + - `MCPToolUseID string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolResultEventType` + + - `const BetaManagedAgentsAgentMCPToolResultEventTypeAgentMCPToolResult BetaManagedAgentsAgentMCPToolResultEventType = "agent.mcp_tool_result"` + + - `Content []BetaManagedAgentsAgentMCPToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `type BetaManagedAgentsAgentToolUseEvent struct{…}` + + Event emitted when the agent invokes a built-in agent tool. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the agent tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentToolUseEventType` + + - `const BetaManagedAgentsAgentToolUseEventTypeAgentToolUse BetaManagedAgentsAgentToolUseEventType = "agent.tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "deny"` + + - `type BetaManagedAgentsAgentToolResultEvent struct{…}` + + Event representing the result of an agent tool execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `ToolUseID string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `Type BetaManagedAgentsAgentToolResultEventType` + + - `const BetaManagedAgentsAgentToolResultEventTypeAgentToolResult BetaManagedAgentsAgentToolResultEventType = "agent.tool_result"` + + - `Content []BetaManagedAgentsAgentToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `type BetaManagedAgentsAgentThreadContextCompactedEvent struct{…}` + + Indicates that context compaction (summarization) occurred during the session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThreadContextCompactedEventType` + + - `const BetaManagedAgentsAgentThreadContextCompactedEventTypeAgentThreadContextCompacted BetaManagedAgentsAgentThreadContextCompactedEventType = "agent.thread_context_compacted"` + + - `type BetaManagedAgentsSessionErrorEvent struct{…}` + + An error event indicating a problem occurred during session execution. + + - `ID string` + + Unique identifier for this event. + + - `Error BetaManagedAgentsSessionErrorEventErrorUnion` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `type BetaManagedAgentsUnknownError struct{…}` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsUnknownErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsUnknownErrorType` + + - `const BetaManagedAgentsUnknownErrorTypeUnknownError BetaManagedAgentsUnknownErrorType = "unknown_error"` + + - `type BetaManagedAgentsModelOverloadedError struct{…}` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelOverloadedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelOverloadedErrorType` + + - `const BetaManagedAgentsModelOverloadedErrorTypeModelOverloadedError BetaManagedAgentsModelOverloadedErrorType = "model_overloaded_error"` + + - `type BetaManagedAgentsModelRateLimitedError struct{…}` + + The model request was rate-limited. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRateLimitedErrorType` + + - `const BetaManagedAgentsModelRateLimitedErrorTypeModelRateLimitedError BetaManagedAgentsModelRateLimitedErrorType = "model_rate_limited_error"` + + - `type BetaManagedAgentsModelRequestFailedError struct{…}` + + A model request failed for a reason other than overload or rate-limiting. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRequestFailedErrorType` + + - `const BetaManagedAgentsModelRequestFailedErrorTypeModelRequestFailedError BetaManagedAgentsModelRequestFailedErrorType = "model_request_failed_error"` + + - `type BetaManagedAgentsMCPConnectionFailedError struct{…}` + + Failed to connect to an MCP server. + + - `MCPServerName string` + + Name of the MCP server that failed to connect. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPConnectionFailedErrorType` + + - `const BetaManagedAgentsMCPConnectionFailedErrorTypeMCPConnectionFailedError BetaManagedAgentsMCPConnectionFailedErrorType = "mcp_connection_failed_error"` + + - `type BetaManagedAgentsMCPAuthenticationFailedError struct{…}` + + Authentication to an MCP server failed. + + - `MCPServerName string` + + Name of the MCP server that failed authentication. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPAuthenticationFailedErrorType` + + - `const BetaManagedAgentsMCPAuthenticationFailedErrorTypeMCPAuthenticationFailedError BetaManagedAgentsMCPAuthenticationFailedErrorType = "mcp_authentication_failed_error"` + + - `type BetaManagedAgentsBillingError struct{…}` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsBillingErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsBillingErrorType` + + - `const BetaManagedAgentsBillingErrorTypeBillingError BetaManagedAgentsBillingErrorType = "billing_error"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionErrorEventType` + + - `const BetaManagedAgentsSessionErrorEventTypeSessionError BetaManagedAgentsSessionErrorEventType = "session.error"` + + - `type BetaManagedAgentsSessionStatusRescheduledEvent struct{…}` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRescheduledEventType` + + - `const BetaManagedAgentsSessionStatusRescheduledEventTypeSessionStatusRescheduled BetaManagedAgentsSessionStatusRescheduledEventType = "session.status_rescheduled"` + + - `type BetaManagedAgentsSessionStatusRunningEvent struct{…}` + + Indicates the session is actively running and the agent is working. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRunningEventType` + + - `const BetaManagedAgentsSessionStatusRunningEventTypeSessionStatusRunning BetaManagedAgentsSessionStatusRunningEventType = "session.status_running"` + + - `type BetaManagedAgentsSessionStatusIdleEvent struct{…}` + + Indicates the agent has paused and is awaiting user input. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `StopReason BetaManagedAgentsSessionStatusIdleEventStopReasonUnion` + + The agent completed its turn naturally and is ready for the next user message. + + - `type BetaManagedAgentsSessionEndTurn struct{…}` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type BetaManagedAgentsSessionEndTurnType` + + - `const BetaManagedAgentsSessionEndTurnTypeEndTurn BetaManagedAgentsSessionEndTurnType = "end_turn"` + + - `type BetaManagedAgentsSessionRequiresAction struct{…}` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `EventIDs []string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type BetaManagedAgentsSessionRequiresActionType` + + - `const BetaManagedAgentsSessionRequiresActionTypeRequiresAction BetaManagedAgentsSessionRequiresActionType = "requires_action"` + + - `type BetaManagedAgentsSessionRetriesExhausted struct{…}` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type BetaManagedAgentsSessionRetriesExhaustedType` + + - `const BetaManagedAgentsSessionRetriesExhaustedTypeRetriesExhausted BetaManagedAgentsSessionRetriesExhaustedType = "retries_exhausted"` + + - `Type BetaManagedAgentsSessionStatusIdleEventType` + + - `const BetaManagedAgentsSessionStatusIdleEventTypeSessionStatusIdle BetaManagedAgentsSessionStatusIdleEventType = "session.status_idle"` + + - `type BetaManagedAgentsSessionStatusTerminatedEvent struct{…}` + + Indicates the session has terminated, either due to an error or completion. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusTerminatedEventType` + + - `const BetaManagedAgentsSessionStatusTerminatedEventTypeSessionStatusTerminated BetaManagedAgentsSessionStatusTerminatedEventType = "session.status_terminated"` + + - `type BetaManagedAgentsSpanModelRequestStartEvent struct{…}` + + Emitted when a model request is initiated by the agent. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestStartEventType` + + - `const BetaManagedAgentsSpanModelRequestStartEventTypeSpanModelRequestStart BetaManagedAgentsSpanModelRequestStartEventType = "span.model_request_start"` + + - `type BetaManagedAgentsSpanModelRequestEndEvent struct{…}` + + Emitted when a model request completes. + + - `ID string` + + Unique identifier for this event. + + - `IsError bool` + + Whether the model request resulted in an error. + + - `ModelRequestStartID string` + + The id of the corresponding `span.model_request_start` event. + + - `ModelUsage BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `CacheCreationInputTokens int64` + + Tokens used to create prompt cache in this request. + + - `CacheReadInputTokens int64` + + Tokens read from prompt cache in this request. + + - `InputTokens int64` + + Input tokens consumed by this request. + + - `OutputTokens int64` + + Output tokens generated by this request. + + - `Speed BetaManagedAgentsSpanModelUsageSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsSpanModelUsageSpeedStandard BetaManagedAgentsSpanModelUsageSpeed = "standard"` + + - `const BetaManagedAgentsSpanModelUsageSpeedFast BetaManagedAgentsSpanModelUsageSpeed = "fast"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestEndEventType` + + - `const BetaManagedAgentsSpanModelRequestEndEventTypeSpanModelRequestEnd BetaManagedAgentsSpanModelRequestEndEventType = "span.model_request_end"` + + - `type BetaManagedAgentsSessionDeletedEvent struct{…}` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionDeletedEventType` + + - `const BetaManagedAgentsSessionDeletedEventTypeSessionDeleted BetaManagedAgentsSessionDeletedEventType = "session.deleted"` + +### Beta Managed Agents Text Block + +- `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + +### Beta Managed Agents Unknown Error + +- `type BetaManagedAgentsUnknownError struct{…}` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsUnknownErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsUnknownErrorType` + + - `const BetaManagedAgentsUnknownErrorTypeUnknownError BetaManagedAgentsUnknownErrorType = "unknown_error"` + +### Beta Managed Agents URL Document Source + +- `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + +### Beta Managed Agents URL Image Source + +- `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + +### Beta Managed Agents User Custom Tool Result Event + +- `type BetaManagedAgentsUserCustomToolResultEvent struct{…}` + + Event sent by the client providing the result of a custom tool execution. + + - `ID string` + + Unique identifier for this event. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventType` + + - `const BetaManagedAgentsUserCustomToolResultEventTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Custom Tool Result Event Params + +- `type BetaManagedAgentsUserCustomToolResultEventParamsResp struct{…}` + + Parameters for providing the result of a custom tool execution. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventParamsType` + + - `const BetaManagedAgentsUserCustomToolResultEventParamsTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventParamsType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventParamsContentUnionResp` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents User Interrupt Event + +- `type BetaManagedAgentsUserInterruptEvent struct{…}` + + An interrupt event that pauses agent execution and returns control to the user. + + - `ID string` + + Unique identifier for this event. + + - `Type BetaManagedAgentsUserInterruptEventType` + + - `const BetaManagedAgentsUserInterruptEventTypeUserInterrupt BetaManagedAgentsUserInterruptEventType = "user.interrupt"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Interrupt Event Params + +- `type BetaManagedAgentsUserInterruptEventParamsResp struct{…}` + + Parameters for sending an interrupt to pause the agent. + + - `Type BetaManagedAgentsUserInterruptEventParamsType` + + - `const BetaManagedAgentsUserInterruptEventParamsTypeUserInterrupt BetaManagedAgentsUserInterruptEventParamsType = "user.interrupt"` + +### Beta Managed Agents User Message Event + +- `type BetaManagedAgentsUserMessageEvent struct{…}` + + A user message event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsUserMessageEventContentUnion` + + Array of content blocks comprising the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventType` + + - `const BetaManagedAgentsUserMessageEventTypeUserMessage BetaManagedAgentsUserMessageEventType = "user.message"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Message Event Params + +- `type BetaManagedAgentsUserMessageEventParamsResp struct{…}` + + Parameters for sending a user message to the session. + + - `Content []BetaManagedAgentsUserMessageEventParamsContentUnionResp` + + Array of content blocks for the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventParamsType` + + - `const BetaManagedAgentsUserMessageEventParamsTypeUserMessage BetaManagedAgentsUserMessageEventParamsType = "user.message"` + +### Beta Managed Agents User Tool Confirmation Event + +- `type BetaManagedAgentsUserToolConfirmationEvent struct{…}` + + A tool confirmation event that approves or denies a pending tool execution. + + - `ID string` + + Unique identifier for this event. + + - `Result BetaManagedAgentsUserToolConfirmationEventResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventResultAllow BetaManagedAgentsUserToolConfirmationEventResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventResultDeny BetaManagedAgentsUserToolConfirmationEventResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventType` + + - `const BetaManagedAgentsUserToolConfirmationEventTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Tool Confirmation Event Params + +- `type BetaManagedAgentsUserToolConfirmationEventParamsResp struct{…}` + + Parameters for confirming or denying a tool execution request. + + - `Result BetaManagedAgentsUserToolConfirmationEventParamsResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventParamsResultAllow BetaManagedAgentsUserToolConfirmationEventParamsResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventParamsResultDeny BetaManagedAgentsUserToolConfirmationEventParamsResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventParamsType` + + - `const BetaManagedAgentsUserToolConfirmationEventParamsTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventParamsType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. diff --git a/content/en/api/go/beta/sessions/events/list.md b/content/en/api/go/beta/sessions/events/list.md new file mode 100644 index 000000000..22dae4ded --- /dev/null +++ b/content/en/api/go/beta/sessions/events/list.md @@ -0,0 +1,1480 @@ +## List + +`client.Beta.Sessions.Events.List(ctx, sessionID, params) (*PageCursor[BetaManagedAgentsSessionEventUnion], error)` + +**get** `/v1/sessions/{session_id}/events` + +List Events + +### Parameters + +- `sessionID string` + +- `params BetaSessionEventListParams` + + - `Limit param.Field[int64]` + + Query param: Query parameter for limit + + - `Order param.Field[BetaSessionEventListParamsOrder]` + + Query param: Sort direction for results, ordered by created_at. Defaults to asc (chronological). + + - `const BetaSessionEventListParamsOrderAsc BetaSessionEventListParamsOrder = "asc"` + + - `const BetaSessionEventListParamsOrderDesc BetaSessionEventListParamsOrder = "desc"` + + - `Page param.Field[string]` + + Query param: Opaque pagination cursor from a previous response's next_page. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsSessionEventUnion interface{…}` + + Union type for all event types in a session. + + - `type BetaManagedAgentsUserMessageEvent struct{…}` + + A user message event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsUserMessageEventContentUnion` + + Array of content blocks comprising the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventType` + + - `const BetaManagedAgentsUserMessageEventTypeUserMessage BetaManagedAgentsUserMessageEventType = "user.message"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserInterruptEvent struct{…}` + + An interrupt event that pauses agent execution and returns control to the user. + + - `ID string` + + Unique identifier for this event. + + - `Type BetaManagedAgentsUserInterruptEventType` + + - `const BetaManagedAgentsUserInterruptEventTypeUserInterrupt BetaManagedAgentsUserInterruptEventType = "user.interrupt"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserToolConfirmationEvent struct{…}` + + A tool confirmation event that approves or denies a pending tool execution. + + - `ID string` + + Unique identifier for this event. + + - `Result BetaManagedAgentsUserToolConfirmationEventResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventResultAllow BetaManagedAgentsUserToolConfirmationEventResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventResultDeny BetaManagedAgentsUserToolConfirmationEventResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventType` + + - `const BetaManagedAgentsUserToolConfirmationEventTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserCustomToolResultEvent struct{…}` + + Event sent by the client providing the result of a custom tool execution. + + - `ID string` + + Unique identifier for this event. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventType` + + - `const BetaManagedAgentsUserCustomToolResultEventTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsAgentCustomToolUseEvent struct{…}` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the custom tool being called. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentCustomToolUseEventType` + + - `const BetaManagedAgentsAgentCustomToolUseEventTypeAgentCustomToolUse BetaManagedAgentsAgentCustomToolUseEventType = "agent.custom_tool_use"` + + - `type BetaManagedAgentsAgentMessageEvent struct{…}` + + An agent response event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMessageEventType` + + - `const BetaManagedAgentsAgentMessageEventTypeAgentMessage BetaManagedAgentsAgentMessageEventType = "agent.message"` + + - `type BetaManagedAgentsAgentThinkingEvent struct{…}` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThinkingEventType` + + - `const BetaManagedAgentsAgentThinkingEventTypeAgentThinking BetaManagedAgentsAgentThinkingEventType = "agent.thinking"` + + - `type BetaManagedAgentsAgentMCPToolUseEvent struct{…}` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `MCPServerName string` + + Name of the MCP server providing the tool. + + - `Name string` + + Name of the MCP tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolUseEventType` + + - `const BetaManagedAgentsAgentMCPToolUseEventTypeAgentMCPToolUse BetaManagedAgentsAgentMCPToolUseEventType = "agent.mcp_tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "deny"` + + - `type BetaManagedAgentsAgentMCPToolResultEvent struct{…}` + + Event representing the result of an MCP tool execution. + + - `ID string` + + Unique identifier for this event. + + - `MCPToolUseID string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolResultEventType` + + - `const BetaManagedAgentsAgentMCPToolResultEventTypeAgentMCPToolResult BetaManagedAgentsAgentMCPToolResultEventType = "agent.mcp_tool_result"` + + - `Content []BetaManagedAgentsAgentMCPToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `type BetaManagedAgentsAgentToolUseEvent struct{…}` + + Event emitted when the agent invokes a built-in agent tool. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the agent tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentToolUseEventType` + + - `const BetaManagedAgentsAgentToolUseEventTypeAgentToolUse BetaManagedAgentsAgentToolUseEventType = "agent.tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "deny"` + + - `type BetaManagedAgentsAgentToolResultEvent struct{…}` + + Event representing the result of an agent tool execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `ToolUseID string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `Type BetaManagedAgentsAgentToolResultEventType` + + - `const BetaManagedAgentsAgentToolResultEventTypeAgentToolResult BetaManagedAgentsAgentToolResultEventType = "agent.tool_result"` + + - `Content []BetaManagedAgentsAgentToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `type BetaManagedAgentsAgentThreadContextCompactedEvent struct{…}` + + Indicates that context compaction (summarization) occurred during the session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThreadContextCompactedEventType` + + - `const BetaManagedAgentsAgentThreadContextCompactedEventTypeAgentThreadContextCompacted BetaManagedAgentsAgentThreadContextCompactedEventType = "agent.thread_context_compacted"` + + - `type BetaManagedAgentsSessionErrorEvent struct{…}` + + An error event indicating a problem occurred during session execution. + + - `ID string` + + Unique identifier for this event. + + - `Error BetaManagedAgentsSessionErrorEventErrorUnion` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `type BetaManagedAgentsUnknownError struct{…}` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsUnknownErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsUnknownErrorType` + + - `const BetaManagedAgentsUnknownErrorTypeUnknownError BetaManagedAgentsUnknownErrorType = "unknown_error"` + + - `type BetaManagedAgentsModelOverloadedError struct{…}` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelOverloadedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelOverloadedErrorType` + + - `const BetaManagedAgentsModelOverloadedErrorTypeModelOverloadedError BetaManagedAgentsModelOverloadedErrorType = "model_overloaded_error"` + + - `type BetaManagedAgentsModelRateLimitedError struct{…}` + + The model request was rate-limited. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRateLimitedErrorType` + + - `const BetaManagedAgentsModelRateLimitedErrorTypeModelRateLimitedError BetaManagedAgentsModelRateLimitedErrorType = "model_rate_limited_error"` + + - `type BetaManagedAgentsModelRequestFailedError struct{…}` + + A model request failed for a reason other than overload or rate-limiting. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRequestFailedErrorType` + + - `const BetaManagedAgentsModelRequestFailedErrorTypeModelRequestFailedError BetaManagedAgentsModelRequestFailedErrorType = "model_request_failed_error"` + + - `type BetaManagedAgentsMCPConnectionFailedError struct{…}` + + Failed to connect to an MCP server. + + - `MCPServerName string` + + Name of the MCP server that failed to connect. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPConnectionFailedErrorType` + + - `const BetaManagedAgentsMCPConnectionFailedErrorTypeMCPConnectionFailedError BetaManagedAgentsMCPConnectionFailedErrorType = "mcp_connection_failed_error"` + + - `type BetaManagedAgentsMCPAuthenticationFailedError struct{…}` + + Authentication to an MCP server failed. + + - `MCPServerName string` + + Name of the MCP server that failed authentication. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPAuthenticationFailedErrorType` + + - `const BetaManagedAgentsMCPAuthenticationFailedErrorTypeMCPAuthenticationFailedError BetaManagedAgentsMCPAuthenticationFailedErrorType = "mcp_authentication_failed_error"` + + - `type BetaManagedAgentsBillingError struct{…}` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsBillingErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsBillingErrorType` + + - `const BetaManagedAgentsBillingErrorTypeBillingError BetaManagedAgentsBillingErrorType = "billing_error"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionErrorEventType` + + - `const BetaManagedAgentsSessionErrorEventTypeSessionError BetaManagedAgentsSessionErrorEventType = "session.error"` + + - `type BetaManagedAgentsSessionStatusRescheduledEvent struct{…}` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRescheduledEventType` + + - `const BetaManagedAgentsSessionStatusRescheduledEventTypeSessionStatusRescheduled BetaManagedAgentsSessionStatusRescheduledEventType = "session.status_rescheduled"` + + - `type BetaManagedAgentsSessionStatusRunningEvent struct{…}` + + Indicates the session is actively running and the agent is working. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRunningEventType` + + - `const BetaManagedAgentsSessionStatusRunningEventTypeSessionStatusRunning BetaManagedAgentsSessionStatusRunningEventType = "session.status_running"` + + - `type BetaManagedAgentsSessionStatusIdleEvent struct{…}` + + Indicates the agent has paused and is awaiting user input. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `StopReason BetaManagedAgentsSessionStatusIdleEventStopReasonUnion` + + The agent completed its turn naturally and is ready for the next user message. + + - `type BetaManagedAgentsSessionEndTurn struct{…}` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type BetaManagedAgentsSessionEndTurnType` + + - `const BetaManagedAgentsSessionEndTurnTypeEndTurn BetaManagedAgentsSessionEndTurnType = "end_turn"` + + - `type BetaManagedAgentsSessionRequiresAction struct{…}` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `EventIDs []string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type BetaManagedAgentsSessionRequiresActionType` + + - `const BetaManagedAgentsSessionRequiresActionTypeRequiresAction BetaManagedAgentsSessionRequiresActionType = "requires_action"` + + - `type BetaManagedAgentsSessionRetriesExhausted struct{…}` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type BetaManagedAgentsSessionRetriesExhaustedType` + + - `const BetaManagedAgentsSessionRetriesExhaustedTypeRetriesExhausted BetaManagedAgentsSessionRetriesExhaustedType = "retries_exhausted"` + + - `Type BetaManagedAgentsSessionStatusIdleEventType` + + - `const BetaManagedAgentsSessionStatusIdleEventTypeSessionStatusIdle BetaManagedAgentsSessionStatusIdleEventType = "session.status_idle"` + + - `type BetaManagedAgentsSessionStatusTerminatedEvent struct{…}` + + Indicates the session has terminated, either due to an error or completion. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusTerminatedEventType` + + - `const BetaManagedAgentsSessionStatusTerminatedEventTypeSessionStatusTerminated BetaManagedAgentsSessionStatusTerminatedEventType = "session.status_terminated"` + + - `type BetaManagedAgentsSpanModelRequestStartEvent struct{…}` + + Emitted when a model request is initiated by the agent. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestStartEventType` + + - `const BetaManagedAgentsSpanModelRequestStartEventTypeSpanModelRequestStart BetaManagedAgentsSpanModelRequestStartEventType = "span.model_request_start"` + + - `type BetaManagedAgentsSpanModelRequestEndEvent struct{…}` + + Emitted when a model request completes. + + - `ID string` + + Unique identifier for this event. + + - `IsError bool` + + Whether the model request resulted in an error. + + - `ModelRequestStartID string` + + The id of the corresponding `span.model_request_start` event. + + - `ModelUsage BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `CacheCreationInputTokens int64` + + Tokens used to create prompt cache in this request. + + - `CacheReadInputTokens int64` + + Tokens read from prompt cache in this request. + + - `InputTokens int64` + + Input tokens consumed by this request. + + - `OutputTokens int64` + + Output tokens generated by this request. + + - `Speed BetaManagedAgentsSpanModelUsageSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsSpanModelUsageSpeedStandard BetaManagedAgentsSpanModelUsageSpeed = "standard"` + + - `const BetaManagedAgentsSpanModelUsageSpeedFast BetaManagedAgentsSpanModelUsageSpeed = "fast"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestEndEventType` + + - `const BetaManagedAgentsSpanModelRequestEndEventTypeSpanModelRequestEnd BetaManagedAgentsSpanModelRequestEndEventType = "span.model_request_end"` + + - `type BetaManagedAgentsSessionDeletedEvent struct{…}` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionDeletedEventType` + + - `const BetaManagedAgentsSessionDeletedEventTypeSessionDeleted BetaManagedAgentsSessionDeletedEventType = "session.deleted"` + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Beta.Sessions.Events.List( + context.TODO(), + "sesn_011CZkZAtmR3yMPDzynEDxu7", + anthropic.BetaSessionEventListParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", page) +} +``` diff --git a/content/en/api/go/beta/sessions/events/send.md b/content/en/api/go/beta/sessions/events/send.md new file mode 100644 index 000000000..f55c562fc --- /dev/null +++ b/content/en/api/go/beta/sessions/events/send.md @@ -0,0 +1,846 @@ +## Send + +`client.Beta.Sessions.Events.Send(ctx, sessionID, params) (*BetaManagedAgentsSendSessionEvents, error)` + +**post** `/v1/sessions/{session_id}/events` + +Send Events + +### Parameters + +- `sessionID string` + +- `params BetaSessionEventSendParams` + + - `Events param.Field[[]BetaManagedAgentsEventParamsUnionResp]` + + Body param: Events to send to the `session`. + + - `type BetaManagedAgentsUserMessageEventParamsResp struct{…}` + + Parameters for sending a user message to the session. + + - `Content []BetaManagedAgentsUserMessageEventParamsContentUnionResp` + + Array of content blocks for the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventParamsType` + + - `const BetaManagedAgentsUserMessageEventParamsTypeUserMessage BetaManagedAgentsUserMessageEventParamsType = "user.message"` + + - `type BetaManagedAgentsUserInterruptEventParamsResp struct{…}` + + Parameters for sending an interrupt to pause the agent. + + - `Type BetaManagedAgentsUserInterruptEventParamsType` + + - `const BetaManagedAgentsUserInterruptEventParamsTypeUserInterrupt BetaManagedAgentsUserInterruptEventParamsType = "user.interrupt"` + + - `type BetaManagedAgentsUserToolConfirmationEventParamsResp struct{…}` + + Parameters for confirming or denying a tool execution request. + + - `Result BetaManagedAgentsUserToolConfirmationEventParamsResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventParamsResultAllow BetaManagedAgentsUserToolConfirmationEventParamsResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventParamsResultDeny BetaManagedAgentsUserToolConfirmationEventParamsResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventParamsType` + + - `const BetaManagedAgentsUserToolConfirmationEventParamsTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventParamsType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `type BetaManagedAgentsUserCustomToolResultEventParamsResp struct{…}` + + Parameters for providing the result of a custom tool execution. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventParamsType` + + - `const BetaManagedAgentsUserCustomToolResultEventParamsTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventParamsType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventParamsContentUnionResp` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsSendSessionEvents struct{…}` + + Events that were successfully sent to the session. + + - `Data []BetaManagedAgentsSendSessionEventsDataUnion` + + Sent events + + - `type BetaManagedAgentsUserMessageEvent struct{…}` + + A user message event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsUserMessageEventContentUnion` + + Array of content blocks comprising the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventType` + + - `const BetaManagedAgentsUserMessageEventTypeUserMessage BetaManagedAgentsUserMessageEventType = "user.message"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserInterruptEvent struct{…}` + + An interrupt event that pauses agent execution and returns control to the user. + + - `ID string` + + Unique identifier for this event. + + - `Type BetaManagedAgentsUserInterruptEventType` + + - `const BetaManagedAgentsUserInterruptEventTypeUserInterrupt BetaManagedAgentsUserInterruptEventType = "user.interrupt"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserToolConfirmationEvent struct{…}` + + A tool confirmation event that approves or denies a pending tool execution. + + - `ID string` + + Unique identifier for this event. + + - `Result BetaManagedAgentsUserToolConfirmationEventResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventResultAllow BetaManagedAgentsUserToolConfirmationEventResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventResultDeny BetaManagedAgentsUserToolConfirmationEventResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventType` + + - `const BetaManagedAgentsUserToolConfirmationEventTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserCustomToolResultEvent struct{…}` + + Event sent by the client providing the result of a custom tool execution. + + - `ID string` + + Unique identifier for this event. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventType` + + - `const BetaManagedAgentsUserCustomToolResultEventTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsSendSessionEvents, err := client.Beta.Sessions.Events.Send( + context.TODO(), + "sesn_011CZkZAtmR3yMPDzynEDxu7", + anthropic.BetaSessionEventSendParams{ + Events: []anthropic.BetaManagedAgentsEventParamsUnion{anthropic.BetaManagedAgentsEventParamsUnion{ + OfUserMessage: &anthropic.BetaManagedAgentsUserMessageEventParams{ + Content: []anthropic.BetaManagedAgentsUserMessageEventParamsContentUnion{anthropic.BetaManagedAgentsUserMessageEventParamsContentUnion{ + OfText: &anthropic.BetaManagedAgentsTextBlockParam{ + Text: "Where is my order #1234?", + Type: anthropic.BetaManagedAgentsTextBlockTypeText, + }, + }}, + Type: anthropic.BetaManagedAgentsUserMessageEventParamsTypeUserMessage, + }, + }}, + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsSendSessionEvents.Data) +} +``` diff --git a/content/en/api/go/beta/sessions/events/stream.md b/content/en/api/go/beta/sessions/events/stream.md new file mode 100644 index 000000000..1a62060a2 --- /dev/null +++ b/content/en/api/go/beta/sessions/events/stream.md @@ -0,0 +1,1467 @@ +## Stream + +`client.Beta.Sessions.Events.Stream(ctx, sessionID, query) (*BetaManagedAgentsStreamSessionEventsUnion, error)` + +**get** `/v1/sessions/{session_id}/events/stream` + +Stream Events + +### Parameters + +- `sessionID string` + +- `query BetaSessionEventStreamParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsStreamSessionEventsUnion interface{…}` + + Server-sent event in the session stream. + + - `type BetaManagedAgentsUserMessageEvent struct{…}` + + A user message event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsUserMessageEventContentUnion` + + Array of content blocks comprising the user message. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `Type BetaManagedAgentsUserMessageEventType` + + - `const BetaManagedAgentsUserMessageEventTypeUserMessage BetaManagedAgentsUserMessageEventType = "user.message"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserInterruptEvent struct{…}` + + An interrupt event that pauses agent execution and returns control to the user. + + - `ID string` + + Unique identifier for this event. + + - `Type BetaManagedAgentsUserInterruptEventType` + + - `const BetaManagedAgentsUserInterruptEventTypeUserInterrupt BetaManagedAgentsUserInterruptEventType = "user.interrupt"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserToolConfirmationEvent struct{…}` + + A tool confirmation event that approves or denies a pending tool execution. + + - `ID string` + + Unique identifier for this event. + + - `Result BetaManagedAgentsUserToolConfirmationEventResult` + + UserToolConfirmationResult enum + + - `const BetaManagedAgentsUserToolConfirmationEventResultAllow BetaManagedAgentsUserToolConfirmationEventResult = "allow"` + + - `const BetaManagedAgentsUserToolConfirmationEventResultDeny BetaManagedAgentsUserToolConfirmationEventResult = "deny"` + + - `ToolUseID string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserToolConfirmationEventType` + + - `const BetaManagedAgentsUserToolConfirmationEventTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventType = "user.tool_confirmation"` + + - `DenyMessage string` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsUserCustomToolResultEvent struct{…}` + + Event sent by the client providing the result of a custom tool execution. + + - `ID string` + + Unique identifier for this event. + + - `CustomToolUseID string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type BetaManagedAgentsUserCustomToolResultEventType` + + - `const BetaManagedAgentsUserCustomToolResultEventTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventType = "user.custom_tool_result"` + + - `Content []BetaManagedAgentsUserCustomToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `type BetaManagedAgentsAgentCustomToolUseEvent struct{…}` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the custom tool being called. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentCustomToolUseEventType` + + - `const BetaManagedAgentsAgentCustomToolUseEventTypeAgentCustomToolUse BetaManagedAgentsAgentCustomToolUseEventType = "agent.custom_tool_use"` + + - `type BetaManagedAgentsAgentMessageEvent struct{…}` + + An agent response event in the session conversation. + + - `ID string` + + Unique identifier for this event. + + - `Content []BetaManagedAgentsTextBlock` + + Array of text blocks comprising the agent response. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMessageEventType` + + - `const BetaManagedAgentsAgentMessageEventTypeAgentMessage BetaManagedAgentsAgentMessageEventType = "agent.message"` + + - `type BetaManagedAgentsAgentThinkingEvent struct{…}` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThinkingEventType` + + - `const BetaManagedAgentsAgentThinkingEventTypeAgentThinking BetaManagedAgentsAgentThinkingEventType = "agent.thinking"` + + - `type BetaManagedAgentsAgentMCPToolUseEvent struct{…}` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `MCPServerName string` + + Name of the MCP server providing the tool. + + - `Name string` + + Name of the MCP tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolUseEventType` + + - `const BetaManagedAgentsAgentMCPToolUseEventTypeAgentMCPToolUse BetaManagedAgentsAgentMCPToolUseEventType = "agent.mcp_tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "deny"` + + - `type BetaManagedAgentsAgentMCPToolResultEvent struct{…}` + + Event representing the result of an MCP tool execution. + + - `ID string` + + Unique identifier for this event. + + - `MCPToolUseID string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentMCPToolResultEventType` + + - `const BetaManagedAgentsAgentMCPToolResultEventTypeAgentMCPToolResult BetaManagedAgentsAgentMCPToolResultEventType = "agent.mcp_tool_result"` + + - `Content []BetaManagedAgentsAgentMCPToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `type BetaManagedAgentsAgentToolUseEvent struct{…}` + + Event emitted when the agent invokes a built-in agent tool. + + - `ID string` + + Unique identifier for this event. + + - `Input map[string, any]` + + Input parameters for the tool call. + + - `Name string` + + Name of the agent tool being used. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentToolUseEventType` + + - `const BetaManagedAgentsAgentToolUseEventTypeAgentToolUse BetaManagedAgentsAgentToolUseEventType = "agent.tool_use"` + + - `EvaluatedPermission BetaManagedAgentsAgentToolUseEventEvaluatedPermission` + + AgentEvaluatedPermission enum + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "allow"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "ask"` + + - `const BetaManagedAgentsAgentToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "deny"` + + - `type BetaManagedAgentsAgentToolResultEvent struct{…}` + + Event representing the result of an agent tool execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `ToolUseID string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `Type BetaManagedAgentsAgentToolResultEventType` + + - `const BetaManagedAgentsAgentToolResultEventTypeAgentToolResult BetaManagedAgentsAgentToolResultEventType = "agent.tool_result"` + + - `Content []BetaManagedAgentsAgentToolResultEventContentUnion` + + The result content returned by the tool. + + - `type BetaManagedAgentsTextBlock struct{…}` + + Regular text content. + + - `Text string` + + The text content. + + - `Type BetaManagedAgentsTextBlockType` + + - `const BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"` + + - `type BetaManagedAgentsImageBlock struct{…}` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source BetaManagedAgentsImageBlockSourceUnion` + + Union type for image source variants. + + - `type BetaManagedAgentsBase64ImageSource struct{…}` + + Base64-encoded image data. + + - `Data string` + + Base64-encoded image data. + + - `MediaType string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type BetaManagedAgentsBase64ImageSourceType` + + - `const BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"` + + - `type BetaManagedAgentsURLImageSource struct{…}` + + Image referenced by URL. + + - `Type BetaManagedAgentsURLImageSourceType` + + - `const BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"` + + - `URL string` + + URL of the image to fetch. + + - `type BetaManagedAgentsFileImageSource struct{…}` + + Image referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileImageSourceType` + + - `const BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"` + + - `Type BetaManagedAgentsImageBlockType` + + - `const BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"` + + - `type BetaManagedAgentsDocumentBlock struct{…}` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source BetaManagedAgentsDocumentBlockSourceUnion` + + Union type for document source variants. + + - `type BetaManagedAgentsBase64DocumentSource struct{…}` + + Base64-encoded document data. + + - `Data string` + + Base64-encoded document data. + + - `MediaType string` + + MIME type of the document (e.g., "application/pdf"). + + - `Type BetaManagedAgentsBase64DocumentSourceType` + + - `const BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"` + + - `type BetaManagedAgentsPlainTextDocumentSource struct{…}` + + Plain text document content. + + - `Data string` + + The plain text content. + + - `MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType` + + MIME type of the text content. Must be "text/plain". + + - `const BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"` + + - `Type BetaManagedAgentsPlainTextDocumentSourceType` + + - `const BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"` + + - `type BetaManagedAgentsURLDocumentSource struct{…}` + + Document referenced by URL. + + - `Type BetaManagedAgentsURLDocumentSourceType` + + - `const BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"` + + - `URL string` + + URL of the document to fetch. + + - `type BetaManagedAgentsFileDocumentSource struct{…}` + + Document referenced by file ID. + + - `FileID string` + + ID of a previously uploaded file. + + - `Type BetaManagedAgentsFileDocumentSourceType` + + - `const BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"` + + - `Type BetaManagedAgentsDocumentBlockType` + + - `const BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"` + + - `Context string` + + Additional context about the document for the model. + + - `Title string` + + The title of the document. + + - `IsError bool` + + Whether the tool execution resulted in an error. + + - `type BetaManagedAgentsAgentThreadContextCompactedEvent struct{…}` + + Indicates that context compaction (summarization) occurred during the session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsAgentThreadContextCompactedEventType` + + - `const BetaManagedAgentsAgentThreadContextCompactedEventTypeAgentThreadContextCompacted BetaManagedAgentsAgentThreadContextCompactedEventType = "agent.thread_context_compacted"` + + - `type BetaManagedAgentsSessionErrorEvent struct{…}` + + An error event indicating a problem occurred during session execution. + + - `ID string` + + Unique identifier for this event. + + - `Error BetaManagedAgentsSessionErrorEventErrorUnion` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `type BetaManagedAgentsUnknownError struct{…}` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsUnknownErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsUnknownErrorType` + + - `const BetaManagedAgentsUnknownErrorTypeUnknownError BetaManagedAgentsUnknownErrorType = "unknown_error"` + + - `type BetaManagedAgentsModelOverloadedError struct{…}` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelOverloadedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelOverloadedErrorType` + + - `const BetaManagedAgentsModelOverloadedErrorTypeModelOverloadedError BetaManagedAgentsModelOverloadedErrorType = "model_overloaded_error"` + + - `type BetaManagedAgentsModelRateLimitedError struct{…}` + + The model request was rate-limited. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRateLimitedErrorType` + + - `const BetaManagedAgentsModelRateLimitedErrorTypeModelRateLimitedError BetaManagedAgentsModelRateLimitedErrorType = "model_rate_limited_error"` + + - `type BetaManagedAgentsModelRequestFailedError struct{…}` + + A model request failed for a reason other than overload or rate-limiting. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsModelRequestFailedErrorType` + + - `const BetaManagedAgentsModelRequestFailedErrorTypeModelRequestFailedError BetaManagedAgentsModelRequestFailedErrorType = "model_request_failed_error"` + + - `type BetaManagedAgentsMCPConnectionFailedError struct{…}` + + Failed to connect to an MCP server. + + - `MCPServerName string` + + Name of the MCP server that failed to connect. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPConnectionFailedErrorType` + + - `const BetaManagedAgentsMCPConnectionFailedErrorTypeMCPConnectionFailedError BetaManagedAgentsMCPConnectionFailedErrorType = "mcp_connection_failed_error"` + + - `type BetaManagedAgentsMCPAuthenticationFailedError struct{…}` + + Authentication to an MCP server failed. + + - `MCPServerName string` + + Name of the MCP server that failed authentication. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsMCPAuthenticationFailedErrorType` + + - `const BetaManagedAgentsMCPAuthenticationFailedErrorTypeMCPAuthenticationFailedError BetaManagedAgentsMCPAuthenticationFailedErrorType = "mcp_authentication_failed_error"` + + - `type BetaManagedAgentsBillingError struct{…}` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `Message string` + + Human-readable error description. + + - `RetryStatus BetaManagedAgentsBillingErrorRetryStatusUnion` + + What the client should do next in response to this error. + + - `type BetaManagedAgentsRetryStatusRetrying struct{…}` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type BetaManagedAgentsRetryStatusRetryingType` + + - `const BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"` + + - `type BetaManagedAgentsRetryStatusExhausted struct{…}` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type BetaManagedAgentsRetryStatusExhaustedType` + + - `const BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"` + + - `type BetaManagedAgentsRetryStatusTerminal struct{…}` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type BetaManagedAgentsRetryStatusTerminalType` + + - `const BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"` + + - `Type BetaManagedAgentsBillingErrorType` + + - `const BetaManagedAgentsBillingErrorTypeBillingError BetaManagedAgentsBillingErrorType = "billing_error"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionErrorEventType` + + - `const BetaManagedAgentsSessionErrorEventTypeSessionError BetaManagedAgentsSessionErrorEventType = "session.error"` + + - `type BetaManagedAgentsSessionStatusRescheduledEvent struct{…}` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRescheduledEventType` + + - `const BetaManagedAgentsSessionStatusRescheduledEventTypeSessionStatusRescheduled BetaManagedAgentsSessionStatusRescheduledEventType = "session.status_rescheduled"` + + - `type BetaManagedAgentsSessionStatusRunningEvent struct{…}` + + Indicates the session is actively running and the agent is working. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusRunningEventType` + + - `const BetaManagedAgentsSessionStatusRunningEventTypeSessionStatusRunning BetaManagedAgentsSessionStatusRunningEventType = "session.status_running"` + + - `type BetaManagedAgentsSessionStatusIdleEvent struct{…}` + + Indicates the agent has paused and is awaiting user input. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `StopReason BetaManagedAgentsSessionStatusIdleEventStopReasonUnion` + + The agent completed its turn naturally and is ready for the next user message. + + - `type BetaManagedAgentsSessionEndTurn struct{…}` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type BetaManagedAgentsSessionEndTurnType` + + - `const BetaManagedAgentsSessionEndTurnTypeEndTurn BetaManagedAgentsSessionEndTurnType = "end_turn"` + + - `type BetaManagedAgentsSessionRequiresAction struct{…}` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `EventIDs []string` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type BetaManagedAgentsSessionRequiresActionType` + + - `const BetaManagedAgentsSessionRequiresActionTypeRequiresAction BetaManagedAgentsSessionRequiresActionType = "requires_action"` + + - `type BetaManagedAgentsSessionRetriesExhausted struct{…}` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type BetaManagedAgentsSessionRetriesExhaustedType` + + - `const BetaManagedAgentsSessionRetriesExhaustedTypeRetriesExhausted BetaManagedAgentsSessionRetriesExhaustedType = "retries_exhausted"` + + - `Type BetaManagedAgentsSessionStatusIdleEventType` + + - `const BetaManagedAgentsSessionStatusIdleEventTypeSessionStatusIdle BetaManagedAgentsSessionStatusIdleEventType = "session.status_idle"` + + - `type BetaManagedAgentsSessionStatusTerminatedEvent struct{…}` + + Indicates the session has terminated, either due to an error or completion. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionStatusTerminatedEventType` + + - `const BetaManagedAgentsSessionStatusTerminatedEventTypeSessionStatusTerminated BetaManagedAgentsSessionStatusTerminatedEventType = "session.status_terminated"` + + - `type BetaManagedAgentsSpanModelRequestStartEvent struct{…}` + + Emitted when a model request is initiated by the agent. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestStartEventType` + + - `const BetaManagedAgentsSpanModelRequestStartEventTypeSpanModelRequestStart BetaManagedAgentsSpanModelRequestStartEventType = "span.model_request_start"` + + - `type BetaManagedAgentsSpanModelRequestEndEvent struct{…}` + + Emitted when a model request completes. + + - `ID string` + + Unique identifier for this event. + + - `IsError bool` + + Whether the model request resulted in an error. + + - `ModelRequestStartID string` + + The id of the corresponding `span.model_request_start` event. + + - `ModelUsage BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `CacheCreationInputTokens int64` + + Tokens used to create prompt cache in this request. + + - `CacheReadInputTokens int64` + + Tokens read from prompt cache in this request. + + - `InputTokens int64` + + Input tokens consumed by this request. + + - `OutputTokens int64` + + Output tokens generated by this request. + + - `Speed BetaManagedAgentsSpanModelUsageSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsSpanModelUsageSpeedStandard BetaManagedAgentsSpanModelUsageSpeed = "standard"` + + - `const BetaManagedAgentsSpanModelUsageSpeedFast BetaManagedAgentsSpanModelUsageSpeed = "fast"` + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSpanModelRequestEndEventType` + + - `const BetaManagedAgentsSpanModelRequestEndEventTypeSpanModelRequestEnd BetaManagedAgentsSpanModelRequestEndEventType = "span.model_request_end"` + + - `type BetaManagedAgentsSessionDeletedEvent struct{…}` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `ID string` + + Unique identifier for this event. + + - `ProcessedAt Time` + + A timestamp in RFC 3339 format + + - `Type BetaManagedAgentsSessionDeletedEventType` + + - `const BetaManagedAgentsSessionDeletedEventTypeSessionDeleted BetaManagedAgentsSessionDeletedEventType = "session.deleted"` + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + stream := client.Beta.Sessions.Events.StreamEvents( + context.TODO(), + "sesn_011CZkZAtmR3yMPDzynEDxu7", + anthropic.BetaSessionEventStreamParams{ + + }, + ) + for stream.Next() { + fmt.Printf("%+v\n", stream.Current()) + } + err := stream.Err() + if err != nil { + panic(err.Error()) + } +} +``` diff --git a/content/en/api/go/beta/sessions/list.md b/content/en/api/go/beta/sessions/list.md new file mode 100644 index 000000000..ae84bf50d --- /dev/null +++ b/content/en/api/go/beta/sessions/list.md @@ -0,0 +1,562 @@ +## List + +`client.Beta.Sessions.List(ctx, params) (*PageCursor[BetaManagedAgentsSession], error)` + +**get** `/v1/sessions` + +List Sessions + +### Parameters + +- `params BetaSessionListParams` + + - `AgentID param.Field[string]` + + Query param: Filter sessions created with this agent ID. + + - `AgentVersion param.Field[int64]` + + Query param: Filter by agent version. Only applies when agent_id is also set. + + - `CreatedAtGt param.Field[Time]` + + Query param: Return sessions created after this time (exclusive). + + - `CreatedAtGte param.Field[Time]` + + Query param: Return sessions created at or after this time (inclusive). + + - `CreatedAtLt param.Field[Time]` + + Query param: Return sessions created before this time (exclusive). + + - `CreatedAtLte param.Field[Time]` + + Query param: Return sessions created at or before this time (inclusive). + + - `IncludeArchived param.Field[bool]` + + Query param: When true, includes archived sessions. Default: false (exclude archived). + + - `Limit param.Field[int64]` + + Query param: Maximum number of results to return. + + - `Order param.Field[BetaSessionListParamsOrder]` + + Query param: Sort direction for results, ordered by created_at. Defaults to desc (newest first). + + - `const BetaSessionListParamsOrderAsc BetaSessionListParamsOrder = "asc"` + + - `const BetaSessionListParamsOrderDesc BetaSessionListParamsOrder = "desc"` + + - `Page param.Field[string]` + + Query param: Opaque pagination cursor from a previous response's next_page. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsSession struct{…}` + + A Managed Agents `session`. + + - `ID string` + + - `Agent BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `ID string` + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsSessionAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsSessionAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsSessionAgentType` + + - `const BetaManagedAgentsSessionAgentTypeAgent BetaManagedAgentsSessionAgentType = "agent"` + + - `Version int64` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `EnvironmentID string` + + - `Metadata map[string, string]` + + - `Resources []BetaManagedAgentsSessionResourceUnion` + + - `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Stats BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `ActiveSeconds float64` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `DurationSeconds float64` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `Status BetaManagedAgentsSessionStatus` + + SessionStatus enum + + - `const BetaManagedAgentsSessionStatusRescheduling BetaManagedAgentsSessionStatus = "rescheduling"` + + - `const BetaManagedAgentsSessionStatusRunning BetaManagedAgentsSessionStatus = "running"` + + - `const BetaManagedAgentsSessionStatusIdle BetaManagedAgentsSessionStatus = "idle"` + + - `const BetaManagedAgentsSessionStatusTerminated BetaManagedAgentsSessionStatus = "terminated"` + + - `Title string` + + - `Type BetaManagedAgentsSessionType` + + - `const BetaManagedAgentsSessionTypeSession BetaManagedAgentsSessionType = "session"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Usage BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `CacheCreation BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Ephemeral1hInputTokens int64` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Ephemeral5mInputTokens int64` + + Tokens used to create 5-minute ephemeral cache entries. + + - `CacheReadInputTokens int64` + + Total tokens read from prompt cache. + + - `InputTokens int64` + + Total input tokens consumed across all turns. + + - `OutputTokens int64` + + Total output tokens generated across all turns. + + - `VaultIDs []string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Beta.Sessions.List(context.TODO(), anthropic.BetaSessionListParams{ + + }) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", page) +} +``` diff --git a/content/en/api/go/beta/sessions/resources.md b/content/en/api/go/beta/sessions/resources.md new file mode 100644 index 000000000..401f30e20 --- /dev/null +++ b/content/en/api/go/beta/sessions/resources.md @@ -0,0 +1,890 @@ +# Resources + +## Add + +`client.Beta.Sessions.Resources.Add(ctx, sessionID, params) (*BetaManagedAgentsFileResource, error)` + +**post** `/v1/sessions/{session_id}/resources` + +Add Session Resource + +### Parameters + +- `sessionID string` + +- `params BetaSessionResourceAddParams` + + - `BetaManagedAgentsFileResourceParams param.Field[BetaManagedAgentsFileResourceParamsResp]` + + Body param: Mount a file uploaded via the Files API into the session. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsFileResource, err := client.Beta.Sessions.Resources.Add( + context.TODO(), + "sesn_011CZkZAtmR3yMPDzynEDxu7", + anthropic.BetaSessionResourceAddParams{ + BetaManagedAgentsFileResourceParams: anthropic.BetaManagedAgentsFileResourceParams{ + FileID: "file_011CNha8iCJcU1wXNR6q4V8w", + Type: anthropic.BetaManagedAgentsFileResourceParamsTypeFile, + }, + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsFileResource.ID) +} +``` + +## List + +`client.Beta.Sessions.Resources.List(ctx, sessionID, params) (*PageCursor[BetaManagedAgentsSessionResourceUnion], error)` + +**get** `/v1/sessions/{session_id}/resources` + +List Session Resources + +### Parameters + +- `sessionID string` + +- `params BetaSessionResourceListParams` + + - `Limit param.Field[int64]` + + Query param: Maximum number of resources to return per page (max 1000). If omitted, returns all resources. + + - `Page param.Field[string]` + + Query param: Opaque cursor from a previous response's next_page field. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsSessionResourceUnion interface{…}` + + - `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Beta.Sessions.Resources.List( + context.TODO(), + "sesn_011CZkZAtmR3yMPDzynEDxu7", + anthropic.BetaSessionResourceListParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", page) +} +``` + +## Retrieve + +`client.Beta.Sessions.Resources.Get(ctx, resourceID, params) (*BetaSessionResourceGetResponseUnion, error)` + +**get** `/v1/sessions/{session_id}/resources/{resource_id}` + +Get Session Resource + +### Parameters + +- `resourceID string` + +- `params BetaSessionResourceGetParams` + + - `SessionID param.Field[string]` + + Path param: Path parameter session_id + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaSessionResourceGetResponseUnion interface{…}` + + The requested session resource. + + - `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + resource, err := client.Beta.Sessions.Resources.Get( + context.TODO(), + "sesrsc_011CZkZBJq5dWxk9fVLNcPht", + anthropic.BetaSessionResourceGetParams{ + SessionID: "sesn_011CZkZAtmR3yMPDzynEDxu7", + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", resource) +} +``` + +## Update + +`client.Beta.Sessions.Resources.Update(ctx, resourceID, params) (*BetaSessionResourceUpdateResponseUnion, error)` + +**post** `/v1/sessions/{session_id}/resources/{resource_id}` + +Update Session Resource + +### Parameters + +- `resourceID string` + +- `params BetaSessionResourceUpdateParams` + + - `SessionID param.Field[string]` + + Path param: Path parameter session_id + + - `AuthorizationToken param.Field[string]` + + Body param: New authorization token for the resource. Currently only `github_repository` resources support token rotation. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaSessionResourceUpdateResponseUnion interface{…}` + + The updated session resource. + + - `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + resource, err := client.Beta.Sessions.Resources.Update( + context.TODO(), + "sesrsc_011CZkZBJq5dWxk9fVLNcPht", + anthropic.BetaSessionResourceUpdateParams{ + SessionID: "sesn_011CZkZAtmR3yMPDzynEDxu7", + AuthorizationToken: "ghp_exampletoken", + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", resource) +} +``` + +## Delete + +`client.Beta.Sessions.Resources.Delete(ctx, resourceID, params) (*BetaManagedAgentsDeleteSessionResource, error)` + +**delete** `/v1/sessions/{session_id}/resources/{resource_id}` + +Delete Session Resource + +### Parameters + +- `resourceID string` + +- `params BetaSessionResourceDeleteParams` + + - `SessionID param.Field[string]` + + Path param: Path parameter session_id + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsDeleteSessionResource struct{…}` + + Confirmation of resource deletion. + + - `ID string` + + - `Type BetaManagedAgentsDeleteSessionResourceType` + + - `const BetaManagedAgentsDeleteSessionResourceTypeSessionResourceDeleted BetaManagedAgentsDeleteSessionResourceType = "session_resource_deleted"` + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsDeleteSessionResource, err := client.Beta.Sessions.Resources.Delete( + context.TODO(), + "sesrsc_011CZkZBJq5dWxk9fVLNcPht", + anthropic.BetaSessionResourceDeleteParams{ + SessionID: "sesn_011CZkZAtmR3yMPDzynEDxu7", + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsDeleteSessionResource.ID) +} +``` + +## Domain Types + +### Beta Managed Agents Delete Session Resource + +- `type BetaManagedAgentsDeleteSessionResource struct{…}` + + Confirmation of resource deletion. + + - `ID string` + + - `Type BetaManagedAgentsDeleteSessionResourceType` + + - `const BetaManagedAgentsDeleteSessionResourceTypeSessionResourceDeleted BetaManagedAgentsDeleteSessionResourceType = "session_resource_deleted"` + +### Beta Managed Agents File Resource + +- `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents GitHub Repository Resource + +- `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + +### Beta Managed Agents Session Resource + +- `type BetaManagedAgentsSessionResourceUnion interface{…}` + + - `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format diff --git a/content/en/api/go/beta/sessions/resources/add.md b/content/en/api/go/beta/sessions/resources/add.md new file mode 100644 index 000000000..27e9683e4 --- /dev/null +++ b/content/en/api/go/beta/sessions/resources/add.md @@ -0,0 +1,123 @@ +## Add + +`client.Beta.Sessions.Resources.Add(ctx, sessionID, params) (*BetaManagedAgentsFileResource, error)` + +**post** `/v1/sessions/{session_id}/resources` + +Add Session Resource + +### Parameters + +- `sessionID string` + +- `params BetaSessionResourceAddParams` + + - `BetaManagedAgentsFileResourceParams param.Field[BetaManagedAgentsFileResourceParamsResp]` + + Body param: Mount a file uploaded via the Files API into the session. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsFileResource, err := client.Beta.Sessions.Resources.Add( + context.TODO(), + "sesn_011CZkZAtmR3yMPDzynEDxu7", + anthropic.BetaSessionResourceAddParams{ + BetaManagedAgentsFileResourceParams: anthropic.BetaManagedAgentsFileResourceParams{ + FileID: "file_011CNha8iCJcU1wXNR6q4V8w", + Type: anthropic.BetaManagedAgentsFileResourceParamsTypeFile, + }, + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsFileResource.ID) +} +``` diff --git a/content/en/api/go/beta/sessions/resources/delete.md b/content/en/api/go/beta/sessions/resources/delete.md new file mode 100644 index 000000000..3ed9c61ba --- /dev/null +++ b/content/en/api/go/beta/sessions/resources/delete.md @@ -0,0 +1,110 @@ +## Delete + +`client.Beta.Sessions.Resources.Delete(ctx, resourceID, params) (*BetaManagedAgentsDeleteSessionResource, error)` + +**delete** `/v1/sessions/{session_id}/resources/{resource_id}` + +Delete Session Resource + +### Parameters + +- `resourceID string` + +- `params BetaSessionResourceDeleteParams` + + - `SessionID param.Field[string]` + + Path param: Path parameter session_id + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsDeleteSessionResource struct{…}` + + Confirmation of resource deletion. + + - `ID string` + + - `Type BetaManagedAgentsDeleteSessionResourceType` + + - `const BetaManagedAgentsDeleteSessionResourceTypeSessionResourceDeleted BetaManagedAgentsDeleteSessionResourceType = "session_resource_deleted"` + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsDeleteSessionResource, err := client.Beta.Sessions.Resources.Delete( + context.TODO(), + "sesrsc_011CZkZBJq5dWxk9fVLNcPht", + anthropic.BetaSessionResourceDeleteParams{ + SessionID: "sesn_011CZkZAtmR3yMPDzynEDxu7", + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsDeleteSessionResource.ID) +} +``` diff --git a/content/en/api/go/beta/sessions/resources/list.md b/content/en/api/go/beta/sessions/resources/list.md new file mode 100644 index 000000000..a91ccee47 --- /dev/null +++ b/content/en/api/go/beta/sessions/resources/list.md @@ -0,0 +1,168 @@ +## List + +`client.Beta.Sessions.Resources.List(ctx, sessionID, params) (*PageCursor[BetaManagedAgentsSessionResourceUnion], error)` + +**get** `/v1/sessions/{session_id}/resources` + +List Session Resources + +### Parameters + +- `sessionID string` + +- `params BetaSessionResourceListParams` + + - `Limit param.Field[int64]` + + Query param: Maximum number of resources to return per page (max 1000). If omitted, returns all resources. + + - `Page param.Field[string]` + + Query param: Opaque cursor from a previous response's next_page field. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsSessionResourceUnion interface{…}` + + - `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Beta.Sessions.Resources.List( + context.TODO(), + "sesn_011CZkZAtmR3yMPDzynEDxu7", + anthropic.BetaSessionResourceListParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", page) +} +``` diff --git a/content/en/api/go/beta/sessions/resources/retrieve.md b/content/en/api/go/beta/sessions/resources/retrieve.md new file mode 100644 index 000000000..e2e5813cf --- /dev/null +++ b/content/en/api/go/beta/sessions/resources/retrieve.md @@ -0,0 +1,166 @@ +## Retrieve + +`client.Beta.Sessions.Resources.Get(ctx, resourceID, params) (*BetaSessionResourceGetResponseUnion, error)` + +**get** `/v1/sessions/{session_id}/resources/{resource_id}` + +Get Session Resource + +### Parameters + +- `resourceID string` + +- `params BetaSessionResourceGetParams` + + - `SessionID param.Field[string]` + + Path param: Path parameter session_id + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaSessionResourceGetResponseUnion interface{…}` + + The requested session resource. + + - `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + resource, err := client.Beta.Sessions.Resources.Get( + context.TODO(), + "sesrsc_011CZkZBJq5dWxk9fVLNcPht", + anthropic.BetaSessionResourceGetParams{ + SessionID: "sesn_011CZkZAtmR3yMPDzynEDxu7", + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", resource) +} +``` diff --git a/content/en/api/go/beta/sessions/resources/update.md b/content/en/api/go/beta/sessions/resources/update.md new file mode 100644 index 000000000..9d18a95d9 --- /dev/null +++ b/content/en/api/go/beta/sessions/resources/update.md @@ -0,0 +1,171 @@ +## Update + +`client.Beta.Sessions.Resources.Update(ctx, resourceID, params) (*BetaSessionResourceUpdateResponseUnion, error)` + +**post** `/v1/sessions/{session_id}/resources/{resource_id}` + +Update Session Resource + +### Parameters + +- `resourceID string` + +- `params BetaSessionResourceUpdateParams` + + - `SessionID param.Field[string]` + + Path param: Path parameter session_id + + - `AuthorizationToken param.Field[string]` + + Body param: New authorization token for the resource. Currently only `github_repository` resources support token rotation. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaSessionResourceUpdateResponseUnion interface{…}` + + The updated session resource. + + - `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + resource, err := client.Beta.Sessions.Resources.Update( + context.TODO(), + "sesrsc_011CZkZBJq5dWxk9fVLNcPht", + anthropic.BetaSessionResourceUpdateParams{ + SessionID: "sesn_011CZkZAtmR3yMPDzynEDxu7", + AuthorizationToken: "ghp_exampletoken", + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", resource) +} +``` diff --git a/content/en/api/go/beta/sessions/retrieve.md b/content/en/api/go/beta/sessions/retrieve.md new file mode 100644 index 000000000..6f95e5c92 --- /dev/null +++ b/content/en/api/go/beta/sessions/retrieve.md @@ -0,0 +1,524 @@ +## Retrieve + +`client.Beta.Sessions.Get(ctx, sessionID, query) (*BetaManagedAgentsSession, error)` + +**get** `/v1/sessions/{session_id}` + +Get Session + +### Parameters + +- `sessionID string` + +- `query BetaSessionGetParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsSession struct{…}` + + A Managed Agents `session`. + + - `ID string` + + - `Agent BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `ID string` + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsSessionAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsSessionAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsSessionAgentType` + + - `const BetaManagedAgentsSessionAgentTypeAgent BetaManagedAgentsSessionAgentType = "agent"` + + - `Version int64` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `EnvironmentID string` + + - `Metadata map[string, string]` + + - `Resources []BetaManagedAgentsSessionResourceUnion` + + - `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Stats BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `ActiveSeconds float64` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `DurationSeconds float64` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `Status BetaManagedAgentsSessionStatus` + + SessionStatus enum + + - `const BetaManagedAgentsSessionStatusRescheduling BetaManagedAgentsSessionStatus = "rescheduling"` + + - `const BetaManagedAgentsSessionStatusRunning BetaManagedAgentsSessionStatus = "running"` + + - `const BetaManagedAgentsSessionStatusIdle BetaManagedAgentsSessionStatus = "idle"` + + - `const BetaManagedAgentsSessionStatusTerminated BetaManagedAgentsSessionStatus = "terminated"` + + - `Title string` + + - `Type BetaManagedAgentsSessionType` + + - `const BetaManagedAgentsSessionTypeSession BetaManagedAgentsSessionType = "session"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Usage BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `CacheCreation BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Ephemeral1hInputTokens int64` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Ephemeral5mInputTokens int64` + + Tokens used to create 5-minute ephemeral cache entries. + + - `CacheReadInputTokens int64` + + Total tokens read from prompt cache. + + - `InputTokens int64` + + Total input tokens consumed across all turns. + + - `OutputTokens int64` + + Total output tokens generated across all turns. + + - `VaultIDs []string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsSession, err := client.Beta.Sessions.Get( + context.TODO(), + "sesn_011CZkZAtmR3yMPDzynEDxu7", + anthropic.BetaSessionGetParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsSession.ID) +} +``` diff --git a/content/en/api/go/beta/sessions/update.md b/content/en/api/go/beta/sessions/update.md new file mode 100644 index 000000000..2c2d1127d --- /dev/null +++ b/content/en/api/go/beta/sessions/update.md @@ -0,0 +1,536 @@ +## Update + +`client.Beta.Sessions.Update(ctx, sessionID, params) (*BetaManagedAgentsSession, error)` + +**post** `/v1/sessions/{session_id}` + +Update Session + +### Parameters + +- `sessionID string` + +- `params BetaSessionUpdateParams` + + - `Metadata param.Field[map[string, string]]` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. + + - `Title param.Field[string]` + + Body param: Human-readable session title. + + - `VaultIDs param.Field[[]string]` + + Body param: Vault IDs (`vlt_*`) to attach to the session. Not yet supported; requests setting this field are rejected. Reserved for future use. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsSession struct{…}` + + A Managed Agents `session`. + + - `ID string` + + - `Agent BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `ID string` + + - `Description string` + + - `MCPServers []BetaManagedAgentsMCPServerURLDefinition` + + - `Name string` + + - `Type BetaManagedAgentsMCPServerURLDefinitionType` + + - `const BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"` + + - `URL string` + + - `Model BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `ID BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `type BetaManagedAgentsModel string` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `const BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `const BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `const BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `const BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `string` + + - `Speed BetaManagedAgentsModelConfigSpeed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `const BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard"` + + - `const BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast"` + + - `Name string` + + - `Skills []BetaManagedAgentsSessionAgentSkillUnion` + + - `type BetaManagedAgentsAnthropicSkill struct{…}` + + A resolved Anthropic-managed skill. + + - `SkillID string` + + - `Type BetaManagedAgentsAnthropicSkillType` + + - `const BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"` + + - `Version string` + + - `type BetaManagedAgentsCustomSkill struct{…}` + + A resolved user-created custom skill. + + - `SkillID string` + + - `Type BetaManagedAgentsCustomSkillType` + + - `const BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"` + + - `Version string` + + - `System string` + + - `Tools []BetaManagedAgentsSessionAgentToolUnion` + + - `type BetaManagedAgentsAgentToolset20260401 struct{…}` + + - `Configs []BetaManagedAgentsAgentToolConfig` + + - `Enabled bool` + + - `Name BetaManagedAgentsAgentToolConfigName` + + Built-in agent tool identifier. + + - `const BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash"` + + - `const BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit"` + + - `const BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read"` + + - `const BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write"` + + - `const BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob"` + + - `const BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep"` + + - `const BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch"` + + - `const BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search"` + + - `PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `Type BetaManagedAgentsAgentToolset20260401Type` + + - `const BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"` + + - `type BetaManagedAgentsMCPToolset struct{…}` + + - `Configs []BetaManagedAgentsMCPToolConfig` + + - `Enabled bool` + + - `Name string` + + - `PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `Enabled bool` + + - `PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion` + + Permission policy for tool execution. + + - `type BetaManagedAgentsAlwaysAllowPolicy struct{…}` + + Tool calls are automatically approved without user confirmation. + + - `Type BetaManagedAgentsAlwaysAllowPolicyType` + + - `const BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"` + + - `type BetaManagedAgentsAlwaysAskPolicy struct{…}` + + Tool calls require user confirmation before execution. + + - `Type BetaManagedAgentsAlwaysAskPolicyType` + + - `const BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"` + + - `MCPServerName string` + + - `Type BetaManagedAgentsMCPToolsetType` + + - `const BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"` + + - `type BetaManagedAgentsCustomTool struct{…}` + + A custom tool as returned in API responses. + + - `Description string` + + - `InputSchema BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `Properties map[string, any]` + + JSON Schema properties defining the tool's input parameters. + + - `Required []string` + + List of required property names. + + - `Type BetaManagedAgentsCustomToolInputSchemaType` + + Must be 'object' for tool input schemas. + + - `const BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"` + + - `Name string` + + - `Type BetaManagedAgentsCustomToolType` + + - `const BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"` + + - `Type BetaManagedAgentsSessionAgentType` + + - `const BetaManagedAgentsSessionAgentTypeAgent BetaManagedAgentsSessionAgentType = "agent"` + + - `Version int64` + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `EnvironmentID string` + + - `Metadata map[string, string]` + + - `Resources []BetaManagedAgentsSessionResourceUnion` + + - `type BetaManagedAgentsGitHubRepositoryResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `MountPath string` + + - `Type BetaManagedAgentsGitHubRepositoryResourceType` + + - `const BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `URL string` + + - `Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion` + + - `type BetaManagedAgentsBranchCheckout struct{…}` + + - `Name string` + + Branch name to check out. + + - `Type BetaManagedAgentsBranchCheckoutType` + + - `const BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"` + + - `type BetaManagedAgentsCommitCheckout struct{…}` + + - `Sha string` + + Full commit SHA to check out. + + - `Type BetaManagedAgentsCommitCheckoutType` + + - `const BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"` + + - `type BetaManagedAgentsFileResource struct{…}` + + - `ID string` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `FileID string` + + - `MountPath string` + + - `Type BetaManagedAgentsFileResourceType` + + - `const BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Stats BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `ActiveSeconds float64` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `DurationSeconds float64` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `Status BetaManagedAgentsSessionStatus` + + SessionStatus enum + + - `const BetaManagedAgentsSessionStatusRescheduling BetaManagedAgentsSessionStatus = "rescheduling"` + + - `const BetaManagedAgentsSessionStatusRunning BetaManagedAgentsSessionStatus = "running"` + + - `const BetaManagedAgentsSessionStatusIdle BetaManagedAgentsSessionStatus = "idle"` + + - `const BetaManagedAgentsSessionStatusTerminated BetaManagedAgentsSessionStatus = "terminated"` + + - `Title string` + + - `Type BetaManagedAgentsSessionType` + + - `const BetaManagedAgentsSessionTypeSession BetaManagedAgentsSessionType = "session"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `Usage BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `CacheCreation BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Ephemeral1hInputTokens int64` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Ephemeral5mInputTokens int64` + + Tokens used to create 5-minute ephemeral cache entries. + + - `CacheReadInputTokens int64` + + Total tokens read from prompt cache. + + - `InputTokens int64` + + Total input tokens consumed across all turns. + + - `OutputTokens int64` + + Total output tokens generated across all turns. + + - `VaultIDs []string` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsSession, err := client.Beta.Sessions.Update( + context.TODO(), + "sesn_011CZkZAtmR3yMPDzynEDxu7", + anthropic.BetaSessionUpdateParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsSession.ID) +} +``` diff --git a/content/en/api/go/beta/skills.md b/content/en/api/go/beta/skills.md index e104f2dd6..bb35a0aef 100644 --- a/content/en/api/go/beta/skills.md +++ b/content/en/api/go/beta/skills.md @@ -74,8 +74,6 @@ Create Skill - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaSkillNewResponse struct{…}` @@ -231,8 +229,6 @@ List Skills - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaSkillListResponse struct{…}` @@ -373,8 +369,6 @@ Get Skill - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaSkillGetResponse struct{…}` @@ -519,8 +513,6 @@ Delete Skill - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaSkillDeleteResponse struct{…}` @@ -644,8 +636,6 @@ Create Skill Version - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaSkillVersionNewResponse struct{…}` @@ -803,8 +793,6 @@ List Skill Versions - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaSkillVersionListResponse struct{…}` @@ -958,8 +946,6 @@ Get Skill Version - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaSkillVersionGetResponse struct{…}` @@ -1113,8 +1099,6 @@ Delete Skill Version - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaSkillVersionDeleteResponse struct{…}` diff --git a/content/en/api/go/beta/skills/create.md b/content/en/api/go/beta/skills/create.md index 367ffa1e3..0d7f95b88 100644 --- a/content/en/api/go/beta/skills/create.md +++ b/content/en/api/go/beta/skills/create.md @@ -72,8 +72,6 @@ Create Skill - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaSkillNewResponse struct{…}` diff --git a/content/en/api/go/beta/skills/delete.md b/content/en/api/go/beta/skills/delete.md index d63fefd3b..d4f9c4c23 100644 --- a/content/en/api/go/beta/skills/delete.md +++ b/content/en/api/go/beta/skills/delete.md @@ -66,8 +66,6 @@ Delete Skill - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaSkillDeleteResponse struct{…}` diff --git a/content/en/api/go/beta/skills/list.md b/content/en/api/go/beta/skills/list.md index cf9bb27de..b6b306b1b 100644 --- a/content/en/api/go/beta/skills/list.md +++ b/content/en/api/go/beta/skills/list.md @@ -81,8 +81,6 @@ List Skills - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaSkillListResponse struct{…}` diff --git a/content/en/api/go/beta/skills/retrieve.md b/content/en/api/go/beta/skills/retrieve.md index 115d1ad55..c62d62f63 100644 --- a/content/en/api/go/beta/skills/retrieve.md +++ b/content/en/api/go/beta/skills/retrieve.md @@ -66,8 +66,6 @@ Get Skill - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaSkillGetResponse struct{…}` diff --git a/content/en/api/go/beta/skills/versions.md b/content/en/api/go/beta/skills/versions.md index c59b92866..5007d92e3 100644 --- a/content/en/api/go/beta/skills/versions.md +++ b/content/en/api/go/beta/skills/versions.md @@ -74,8 +74,6 @@ Create Skill Version - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaSkillVersionNewResponse struct{…}` @@ -233,8 +231,6 @@ List Skill Versions - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaSkillVersionListResponse struct{…}` @@ -388,8 +384,6 @@ Get Skill Version - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaSkillVersionGetResponse struct{…}` @@ -543,8 +537,6 @@ Delete Skill Version - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaSkillVersionDeleteResponse struct{…}` diff --git a/content/en/api/go/beta/skills/versions/create.md b/content/en/api/go/beta/skills/versions/create.md index 3c339f30d..71284f49a 100644 --- a/content/en/api/go/beta/skills/versions/create.md +++ b/content/en/api/go/beta/skills/versions/create.md @@ -72,8 +72,6 @@ Create Skill Version - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaSkillVersionNewResponse struct{…}` diff --git a/content/en/api/go/beta/skills/versions/delete.md b/content/en/api/go/beta/skills/versions/delete.md index e7d734343..e3b8b96a6 100644 --- a/content/en/api/go/beta/skills/versions/delete.md +++ b/content/en/api/go/beta/skills/versions/delete.md @@ -72,8 +72,6 @@ Delete Skill Version - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaSkillVersionDeleteResponse struct{…}` diff --git a/content/en/api/go/beta/skills/versions/list.md b/content/en/api/go/beta/skills/versions/list.md index 9d5920717..6ded72a73 100644 --- a/content/en/api/go/beta/skills/versions/list.md +++ b/content/en/api/go/beta/skills/versions/list.md @@ -76,8 +76,6 @@ List Skill Versions - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaSkillVersionListResponse struct{…}` diff --git a/content/en/api/go/beta/skills/versions/retrieve.md b/content/en/api/go/beta/skills/versions/retrieve.md index c95d9c73b..8749aa144 100644 --- a/content/en/api/go/beta/skills/versions/retrieve.md +++ b/content/en/api/go/beta/skills/versions/retrieve.md @@ -72,8 +72,6 @@ Get Skill Version - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type BetaSkillVersionGetResponse struct{…}` diff --git a/content/en/api/go/beta/vaults.md b/content/en/api/go/beta/vaults.md new file mode 100644 index 000000000..e890fcefc --- /dev/null +++ b/content/en/api/go/beta/vaults.md @@ -0,0 +1,2855 @@ +# Vaults + +## Create + +`client.Beta.Vaults.New(ctx, params) (*BetaManagedAgentsVault, error)` + +**post** `/v1/vaults` + +Create Vault + +### Parameters + +- `params BetaVaultNewParams` + + - `DisplayName param.Field[string]` + + Body param: Human-readable name for the vault. 1-255 characters. + + - `Metadata param.Field[map[string, string]]` + + Body param: Arbitrary key-value metadata to attach to the vault. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsVault struct{…}` + + A vault that stores credentials for use by agents during sessions. + + - `ID string` + + Unique identifier for the vault. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `DisplayName string` + + Human-readable name for the vault. + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the vault. + + - `Type BetaManagedAgentsVaultType` + + - `const BetaManagedAgentsVaultTypeVault BetaManagedAgentsVaultType = "vault"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsVault, err := client.Beta.Vaults.New(context.TODO(), anthropic.BetaVaultNewParams{ + DisplayName: "Example vault", + }) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsVault.ID) +} +``` + +## List + +`client.Beta.Vaults.List(ctx, params) (*PageCursor[BetaManagedAgentsVault], error)` + +**get** `/v1/vaults` + +List Vaults + +### Parameters + +- `params BetaVaultListParams` + + - `IncludeArchived param.Field[bool]` + + Query param: Whether to include archived vaults in the results. + + - `Limit param.Field[int64]` + + Query param: Maximum number of vaults to return per page. Defaults to 20, maximum 100. + + - `Page param.Field[string]` + + Query param: Opaque pagination token from a previous `list_vaults` response. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsVault struct{…}` + + A vault that stores credentials for use by agents during sessions. + + - `ID string` + + Unique identifier for the vault. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `DisplayName string` + + Human-readable name for the vault. + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the vault. + + - `Type BetaManagedAgentsVaultType` + + - `const BetaManagedAgentsVaultTypeVault BetaManagedAgentsVaultType = "vault"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Beta.Vaults.List(context.TODO(), anthropic.BetaVaultListParams{ + + }) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", page) +} +``` + +## Retrieve + +`client.Beta.Vaults.Get(ctx, vaultID, query) (*BetaManagedAgentsVault, error)` + +**get** `/v1/vaults/{vault_id}` + +Get Vault + +### Parameters + +- `vaultID string` + +- `query BetaVaultGetParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsVault struct{…}` + + A vault that stores credentials for use by agents during sessions. + + - `ID string` + + Unique identifier for the vault. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `DisplayName string` + + Human-readable name for the vault. + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the vault. + + - `Type BetaManagedAgentsVaultType` + + - `const BetaManagedAgentsVaultTypeVault BetaManagedAgentsVaultType = "vault"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsVault, err := client.Beta.Vaults.Get( + context.TODO(), + "vlt_011CZkZDLs7fYzm1hXNPeRjv", + anthropic.BetaVaultGetParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsVault.ID) +} +``` + +## Update + +`client.Beta.Vaults.Update(ctx, vaultID, params) (*BetaManagedAgentsVault, error)` + +**post** `/v1/vaults/{vault_id}` + +Update Vault + +### Parameters + +- `vaultID string` + +- `params BetaVaultUpdateParams` + + - `DisplayName param.Field[string]` + + Body param: Updated human-readable name for the vault. 1-255 characters. + + - `Metadata param.Field[map[string, string]]` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsVault struct{…}` + + A vault that stores credentials for use by agents during sessions. + + - `ID string` + + Unique identifier for the vault. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `DisplayName string` + + Human-readable name for the vault. + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the vault. + + - `Type BetaManagedAgentsVaultType` + + - `const BetaManagedAgentsVaultTypeVault BetaManagedAgentsVaultType = "vault"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsVault, err := client.Beta.Vaults.Update( + context.TODO(), + "vlt_011CZkZDLs7fYzm1hXNPeRjv", + anthropic.BetaVaultUpdateParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsVault.ID) +} +``` + +## Delete + +`client.Beta.Vaults.Delete(ctx, vaultID, body) (*BetaManagedAgentsDeletedVault, error)` + +**delete** `/v1/vaults/{vault_id}` + +Delete Vault + +### Parameters + +- `vaultID string` + +- `body BetaVaultDeleteParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsDeletedVault struct{…}` + + Confirmation of a deleted vault. + + - `ID string` + + Unique identifier of the deleted vault. + + - `Type BetaManagedAgentsDeletedVaultType` + + - `const BetaManagedAgentsDeletedVaultTypeVaultDeleted BetaManagedAgentsDeletedVaultType = "vault_deleted"` + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsDeletedVault, err := client.Beta.Vaults.Delete( + context.TODO(), + "vlt_011CZkZDLs7fYzm1hXNPeRjv", + anthropic.BetaVaultDeleteParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsDeletedVault.ID) +} +``` + +## Archive + +`client.Beta.Vaults.Archive(ctx, vaultID, body) (*BetaManagedAgentsVault, error)` + +**post** `/v1/vaults/{vault_id}/archive` + +Archive Vault + +### Parameters + +- `vaultID string` + +- `body BetaVaultArchiveParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsVault struct{…}` + + A vault that stores credentials for use by agents during sessions. + + - `ID string` + + Unique identifier for the vault. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `DisplayName string` + + Human-readable name for the vault. + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the vault. + + - `Type BetaManagedAgentsVaultType` + + - `const BetaManagedAgentsVaultTypeVault BetaManagedAgentsVaultType = "vault"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsVault, err := client.Beta.Vaults.Archive( + context.TODO(), + "vlt_011CZkZDLs7fYzm1hXNPeRjv", + anthropic.BetaVaultArchiveParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsVault.ID) +} +``` + +## Domain Types + +### Beta Managed Agents Deleted Vault + +- `type BetaManagedAgentsDeletedVault struct{…}` + + Confirmation of a deleted vault. + + - `ID string` + + Unique identifier of the deleted vault. + + - `Type BetaManagedAgentsDeletedVaultType` + + - `const BetaManagedAgentsDeletedVaultTypeVaultDeleted BetaManagedAgentsDeletedVaultType = "vault_deleted"` + +### Beta Managed Agents Vault + +- `type BetaManagedAgentsVault struct{…}` + + A vault that stores credentials for use by agents during sessions. + + - `ID string` + + Unique identifier for the vault. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `DisplayName string` + + Human-readable name for the vault. + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the vault. + + - `Type BetaManagedAgentsVaultType` + + - `const BetaManagedAgentsVaultTypeVault BetaManagedAgentsVaultType = "vault"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +# Credentials + +## Create + +`client.Beta.Vaults.Credentials.New(ctx, vaultID, params) (*BetaManagedAgentsCredential, error)` + +**post** `/v1/vaults/{vault_id}/credentials` + +Create Credential + +### Parameters + +- `vaultID string` + +- `params BetaVaultCredentialNewParams` + + - `Auth param.Field[BetaVaultCredentialNewParamsAuthUnion]` + + Body param: Authentication details for creating a credential. + + - `type BetaManagedAgentsMCPOAuthCreateParamsResp struct{…}` + + Parameters for creating an MCP OAuth credential. + + - `AccessToken string` + + OAuth access token. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsMCPOAuthCreateParamsType` + + - `const BetaManagedAgentsMCPOAuthCreateParamsTypeMCPOAuth BetaManagedAgentsMCPOAuthCreateParamsType = "mcp_oauth"` + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshParamsResp` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `ClientID string` + + OAuth client ID. + + - `RefreshToken string` + + OAuth refresh token. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshParamsTokenEndpointAuthUnionResp` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneParamResp struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneParamType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneParamTypeNone BetaManagedAgentsTokenEndpointAuthNoneParamType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicParamResp struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `ClientSecret string` + + OAuth client secret. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicParamType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicParamTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicParamType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostParamResp struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `ClientSecret string` + + OAuth client secret. + + - `Type BetaManagedAgentsTokenEndpointAuthPostParamType` + + - `const BetaManagedAgentsTokenEndpointAuthPostParamTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostParamType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + + - `type BetaManagedAgentsStaticBearerCreateParamsResp struct{…}` + + Parameters for creating a static bearer token credential. + + - `Token string` + + Static bearer token value. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsStaticBearerCreateParamsType` + + - `const BetaManagedAgentsStaticBearerCreateParamsTypeStaticBearer BetaManagedAgentsStaticBearerCreateParamsType = "static_bearer"` + + - `DisplayName param.Field[string]` + + Body param: Human-readable name for the credential. Up to 255 characters. + + - `Metadata param.Field[map[string, string]]` + + Body param: Arbitrary key-value metadata to attach to the credential. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsCredential struct{…}` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `ID string` + + Unique identifier for the credential. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `Auth BetaManagedAgentsCredentialAuthUnion` + + Authentication details for a credential. + + - `type BetaManagedAgentsMCPOAuthAuthResponse struct{…}` + + OAuth credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsMCPOAuthAuthResponseType` + + - `const BetaManagedAgentsMCPOAuthAuthResponseTypeMCPOAuth BetaManagedAgentsMCPOAuthAuthResponseType = "mcp_oauth"` + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `ClientID string` + + OAuth client ID. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneResponse struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneResponseTypeNone BetaManagedAgentsTokenEndpointAuthNoneResponseType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicResponse struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicResponseTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicResponseType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostResponse struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthPostResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthPostResponseTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostResponseType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + + - `type BetaManagedAgentsStaticBearerAuthResponse struct{…}` + + Static bearer token credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsStaticBearerAuthResponseType` + + - `const BetaManagedAgentsStaticBearerAuthResponseTypeStaticBearer BetaManagedAgentsStaticBearerAuthResponseType = "static_bearer"` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the credential. + + - `Type BetaManagedAgentsCredentialType` + + - `const BetaManagedAgentsCredentialTypeVaultCredential BetaManagedAgentsCredentialType = "vault_credential"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `VaultID string` + + Identifier of the vault this credential belongs to. + + - `DisplayName string` + + Human-readable name for the credential. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsCredential, err := client.Beta.Vaults.Credentials.New( + context.TODO(), + "vlt_011CZkZDLs7fYzm1hXNPeRjv", + anthropic.BetaVaultCredentialNewParams{ + Auth: anthropic.BetaVaultCredentialNewParamsAuthUnion{ + OfStaticBearer: &anthropic.BetaManagedAgentsStaticBearerCreateParams{ + Token: "bearer_exampletoken", + MCPServerURL: "https://example-server.modelcontextprotocol.io/sse", + Type: anthropic.BetaManagedAgentsStaticBearerCreateParamsTypeStaticBearer, + }, + }, + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsCredential.ID) +} +``` + +## List + +`client.Beta.Vaults.Credentials.List(ctx, vaultID, params) (*PageCursor[BetaManagedAgentsCredential], error)` + +**get** `/v1/vaults/{vault_id}/credentials` + +List Credentials + +### Parameters + +- `vaultID string` + +- `params BetaVaultCredentialListParams` + + - `IncludeArchived param.Field[bool]` + + Query param: Whether to include archived credentials in the results. + + - `Limit param.Field[int64]` + + Query param: Maximum number of credentials to return per page. Defaults to 20, maximum 100. + + - `Page param.Field[string]` + + Query param: Opaque pagination token from a previous `list_credentials` response. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsCredential struct{…}` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `ID string` + + Unique identifier for the credential. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `Auth BetaManagedAgentsCredentialAuthUnion` + + Authentication details for a credential. + + - `type BetaManagedAgentsMCPOAuthAuthResponse struct{…}` + + OAuth credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsMCPOAuthAuthResponseType` + + - `const BetaManagedAgentsMCPOAuthAuthResponseTypeMCPOAuth BetaManagedAgentsMCPOAuthAuthResponseType = "mcp_oauth"` + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `ClientID string` + + OAuth client ID. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneResponse struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneResponseTypeNone BetaManagedAgentsTokenEndpointAuthNoneResponseType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicResponse struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicResponseTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicResponseType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostResponse struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthPostResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthPostResponseTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostResponseType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + + - `type BetaManagedAgentsStaticBearerAuthResponse struct{…}` + + Static bearer token credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsStaticBearerAuthResponseType` + + - `const BetaManagedAgentsStaticBearerAuthResponseTypeStaticBearer BetaManagedAgentsStaticBearerAuthResponseType = "static_bearer"` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the credential. + + - `Type BetaManagedAgentsCredentialType` + + - `const BetaManagedAgentsCredentialTypeVaultCredential BetaManagedAgentsCredentialType = "vault_credential"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `VaultID string` + + Identifier of the vault this credential belongs to. + + - `DisplayName string` + + Human-readable name for the credential. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Beta.Vaults.Credentials.List( + context.TODO(), + "vlt_011CZkZDLs7fYzm1hXNPeRjv", + anthropic.BetaVaultCredentialListParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", page) +} +``` + +## Retrieve + +`client.Beta.Vaults.Credentials.Get(ctx, credentialID, params) (*BetaManagedAgentsCredential, error)` + +**get** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Get Credential + +### Parameters + +- `credentialID string` + +- `params BetaVaultCredentialGetParams` + + - `VaultID param.Field[string]` + + Path param: Path parameter vault_id + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsCredential struct{…}` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `ID string` + + Unique identifier for the credential. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `Auth BetaManagedAgentsCredentialAuthUnion` + + Authentication details for a credential. + + - `type BetaManagedAgentsMCPOAuthAuthResponse struct{…}` + + OAuth credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsMCPOAuthAuthResponseType` + + - `const BetaManagedAgentsMCPOAuthAuthResponseTypeMCPOAuth BetaManagedAgentsMCPOAuthAuthResponseType = "mcp_oauth"` + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `ClientID string` + + OAuth client ID. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneResponse struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneResponseTypeNone BetaManagedAgentsTokenEndpointAuthNoneResponseType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicResponse struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicResponseTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicResponseType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostResponse struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthPostResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthPostResponseTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostResponseType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + + - `type BetaManagedAgentsStaticBearerAuthResponse struct{…}` + + Static bearer token credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsStaticBearerAuthResponseType` + + - `const BetaManagedAgentsStaticBearerAuthResponseTypeStaticBearer BetaManagedAgentsStaticBearerAuthResponseType = "static_bearer"` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the credential. + + - `Type BetaManagedAgentsCredentialType` + + - `const BetaManagedAgentsCredentialTypeVaultCredential BetaManagedAgentsCredentialType = "vault_credential"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `VaultID string` + + Identifier of the vault this credential belongs to. + + - `DisplayName string` + + Human-readable name for the credential. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsCredential, err := client.Beta.Vaults.Credentials.Get( + context.TODO(), + "vcrd_011CZkZEMt8gZan2iYOQfSkw", + anthropic.BetaVaultCredentialGetParams{ + VaultID: "vlt_011CZkZDLs7fYzm1hXNPeRjv", + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsCredential.ID) +} +``` + +## Update + +`client.Beta.Vaults.Credentials.Update(ctx, credentialID, params) (*BetaManagedAgentsCredential, error)` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Update Credential + +### Parameters + +- `credentialID string` + +- `params BetaVaultCredentialUpdateParams` + + - `VaultID param.Field[string]` + + Path param: Path parameter vault_id + + - `Auth param.Field[BetaVaultCredentialUpdateParamsAuthUnion]` + + Body param: Updated authentication details for a credential. + + - `type BetaManagedAgentsMCPOAuthUpdateParamsResp struct{…}` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `Type BetaManagedAgentsMCPOAuthUpdateParamsType` + + - `const BetaManagedAgentsMCPOAuthUpdateParamsTypeMCPOAuth BetaManagedAgentsMCPOAuthUpdateParamsType = "mcp_oauth"` + + - `AccessToken string` + + Updated OAuth access token. + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshUpdateParamsResp` + + Parameters for updating OAuth refresh token configuration. + + - `RefreshToken string` + + Updated OAuth refresh token. + + - `Scope string` + + Updated OAuth scope for the refresh request. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshUpdateParamsTokenEndpointAuthUnionResp` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type BetaManagedAgentsTokenEndpointAuthBasicUpdateParamResp struct{…}` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicUpdateParamType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicUpdateParamTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicUpdateParamType = "client_secret_basic"` + + - `ClientSecret string` + + Updated OAuth client secret. + + - `type BetaManagedAgentsTokenEndpointAuthPostUpdateParamResp struct{…}` + + Updated POST body authentication parameters for the token endpoint. + + - `Type BetaManagedAgentsTokenEndpointAuthPostUpdateParamType` + + - `const BetaManagedAgentsTokenEndpointAuthPostUpdateParamTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostUpdateParamType = "client_secret_post"` + + - `ClientSecret string` + + Updated OAuth client secret. + + - `type BetaManagedAgentsStaticBearerUpdateParamsResp struct{…}` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `Type BetaManagedAgentsStaticBearerUpdateParamsType` + + - `const BetaManagedAgentsStaticBearerUpdateParamsTypeStaticBearer BetaManagedAgentsStaticBearerUpdateParamsType = "static_bearer"` + + - `Token string` + + Updated static bearer token value. + + - `DisplayName param.Field[string]` + + Body param: Updated human-readable name for the credential. 1-255 characters. + + - `Metadata param.Field[map[string, string]]` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsCredential struct{…}` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `ID string` + + Unique identifier for the credential. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `Auth BetaManagedAgentsCredentialAuthUnion` + + Authentication details for a credential. + + - `type BetaManagedAgentsMCPOAuthAuthResponse struct{…}` + + OAuth credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsMCPOAuthAuthResponseType` + + - `const BetaManagedAgentsMCPOAuthAuthResponseTypeMCPOAuth BetaManagedAgentsMCPOAuthAuthResponseType = "mcp_oauth"` + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `ClientID string` + + OAuth client ID. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneResponse struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneResponseTypeNone BetaManagedAgentsTokenEndpointAuthNoneResponseType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicResponse struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicResponseTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicResponseType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostResponse struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthPostResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthPostResponseTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostResponseType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + + - `type BetaManagedAgentsStaticBearerAuthResponse struct{…}` + + Static bearer token credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsStaticBearerAuthResponseType` + + - `const BetaManagedAgentsStaticBearerAuthResponseTypeStaticBearer BetaManagedAgentsStaticBearerAuthResponseType = "static_bearer"` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the credential. + + - `Type BetaManagedAgentsCredentialType` + + - `const BetaManagedAgentsCredentialTypeVaultCredential BetaManagedAgentsCredentialType = "vault_credential"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `VaultID string` + + Identifier of the vault this credential belongs to. + + - `DisplayName string` + + Human-readable name for the credential. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsCredential, err := client.Beta.Vaults.Credentials.Update( + context.TODO(), + "vcrd_011CZkZEMt8gZan2iYOQfSkw", + anthropic.BetaVaultCredentialUpdateParams{ + VaultID: "vlt_011CZkZDLs7fYzm1hXNPeRjv", + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsCredential.ID) +} +``` + +## Delete + +`client.Beta.Vaults.Credentials.Delete(ctx, credentialID, params) (*BetaManagedAgentsDeletedCredential, error)` + +**delete** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Delete Credential + +### Parameters + +- `credentialID string` + +- `params BetaVaultCredentialDeleteParams` + + - `VaultID param.Field[string]` + + Path param: Path parameter vault_id + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsDeletedCredential struct{…}` + + Confirmation of a deleted credential. + + - `ID string` + + Unique identifier of the deleted credential. + + - `Type BetaManagedAgentsDeletedCredentialType` + + - `const BetaManagedAgentsDeletedCredentialTypeVaultCredentialDeleted BetaManagedAgentsDeletedCredentialType = "vault_credential_deleted"` + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsDeletedCredential, err := client.Beta.Vaults.Credentials.Delete( + context.TODO(), + "vcrd_011CZkZEMt8gZan2iYOQfSkw", + anthropic.BetaVaultCredentialDeleteParams{ + VaultID: "vlt_011CZkZDLs7fYzm1hXNPeRjv", + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsDeletedCredential.ID) +} +``` + +## Archive + +`client.Beta.Vaults.Credentials.Archive(ctx, credentialID, params) (*BetaManagedAgentsCredential, error)` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}/archive` + +Archive Credential + +### Parameters + +- `credentialID string` + +- `params BetaVaultCredentialArchiveParams` + + - `VaultID param.Field[string]` + + Path param: Path parameter vault_id + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsCredential struct{…}` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `ID string` + + Unique identifier for the credential. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `Auth BetaManagedAgentsCredentialAuthUnion` + + Authentication details for a credential. + + - `type BetaManagedAgentsMCPOAuthAuthResponse struct{…}` + + OAuth credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsMCPOAuthAuthResponseType` + + - `const BetaManagedAgentsMCPOAuthAuthResponseTypeMCPOAuth BetaManagedAgentsMCPOAuthAuthResponseType = "mcp_oauth"` + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `ClientID string` + + OAuth client ID. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneResponse struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneResponseTypeNone BetaManagedAgentsTokenEndpointAuthNoneResponseType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicResponse struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicResponseTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicResponseType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostResponse struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthPostResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthPostResponseTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostResponseType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + + - `type BetaManagedAgentsStaticBearerAuthResponse struct{…}` + + Static bearer token credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsStaticBearerAuthResponseType` + + - `const BetaManagedAgentsStaticBearerAuthResponseTypeStaticBearer BetaManagedAgentsStaticBearerAuthResponseType = "static_bearer"` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the credential. + + - `Type BetaManagedAgentsCredentialType` + + - `const BetaManagedAgentsCredentialTypeVaultCredential BetaManagedAgentsCredentialType = "vault_credential"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `VaultID string` + + Identifier of the vault this credential belongs to. + + - `DisplayName string` + + Human-readable name for the credential. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsCredential, err := client.Beta.Vaults.Credentials.Archive( + context.TODO(), + "vcrd_011CZkZEMt8gZan2iYOQfSkw", + anthropic.BetaVaultCredentialArchiveParams{ + VaultID: "vlt_011CZkZDLs7fYzm1hXNPeRjv", + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsCredential.ID) +} +``` + +## Domain Types + +### Beta Managed Agents Credential + +- `type BetaManagedAgentsCredential struct{…}` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `ID string` + + Unique identifier for the credential. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `Auth BetaManagedAgentsCredentialAuthUnion` + + Authentication details for a credential. + + - `type BetaManagedAgentsMCPOAuthAuthResponse struct{…}` + + OAuth credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsMCPOAuthAuthResponseType` + + - `const BetaManagedAgentsMCPOAuthAuthResponseTypeMCPOAuth BetaManagedAgentsMCPOAuthAuthResponseType = "mcp_oauth"` + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `ClientID string` + + OAuth client ID. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneResponse struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneResponseTypeNone BetaManagedAgentsTokenEndpointAuthNoneResponseType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicResponse struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicResponseTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicResponseType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostResponse struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthPostResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthPostResponseTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostResponseType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + + - `type BetaManagedAgentsStaticBearerAuthResponse struct{…}` + + Static bearer token credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsStaticBearerAuthResponseType` + + - `const BetaManagedAgentsStaticBearerAuthResponseTypeStaticBearer BetaManagedAgentsStaticBearerAuthResponseType = "static_bearer"` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the credential. + + - `Type BetaManagedAgentsCredentialType` + + - `const BetaManagedAgentsCredentialTypeVaultCredential BetaManagedAgentsCredentialType = "vault_credential"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `VaultID string` + + Identifier of the vault this credential belongs to. + + - `DisplayName string` + + Human-readable name for the credential. + +### Beta Managed Agents Deleted Credential + +- `type BetaManagedAgentsDeletedCredential struct{…}` + + Confirmation of a deleted credential. + + - `ID string` + + Unique identifier of the deleted credential. + + - `Type BetaManagedAgentsDeletedCredentialType` + + - `const BetaManagedAgentsDeletedCredentialTypeVaultCredentialDeleted BetaManagedAgentsDeletedCredentialType = "vault_credential_deleted"` + +### Beta Managed Agents MCP OAuth Auth Response + +- `type BetaManagedAgentsMCPOAuthAuthResponse struct{…}` + + OAuth credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsMCPOAuthAuthResponseType` + + - `const BetaManagedAgentsMCPOAuthAuthResponseTypeMCPOAuth BetaManagedAgentsMCPOAuthAuthResponseType = "mcp_oauth"` + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `ClientID string` + + OAuth client ID. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneResponse struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneResponseTypeNone BetaManagedAgentsTokenEndpointAuthNoneResponseType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicResponse struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicResponseTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicResponseType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostResponse struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthPostResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthPostResponseTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostResponseType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Create Params + +- `type BetaManagedAgentsMCPOAuthCreateParamsResp struct{…}` + + Parameters for creating an MCP OAuth credential. + + - `AccessToken string` + + OAuth access token. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsMCPOAuthCreateParamsType` + + - `const BetaManagedAgentsMCPOAuthCreateParamsTypeMCPOAuth BetaManagedAgentsMCPOAuthCreateParamsType = "mcp_oauth"` + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshParamsResp` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `ClientID string` + + OAuth client ID. + + - `RefreshToken string` + + OAuth refresh token. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshParamsTokenEndpointAuthUnionResp` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneParamResp struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneParamType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneParamTypeNone BetaManagedAgentsTokenEndpointAuthNoneParamType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicParamResp struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `ClientSecret string` + + OAuth client secret. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicParamType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicParamTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicParamType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostParamResp struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `ClientSecret string` + + OAuth client secret. + + - `Type BetaManagedAgentsTokenEndpointAuthPostParamType` + + - `const BetaManagedAgentsTokenEndpointAuthPostParamTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostParamType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Params + +- `type BetaManagedAgentsMCPOAuthRefreshParamsResp struct{…}` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `ClientID string` + + OAuth client ID. + + - `RefreshToken string` + + OAuth refresh token. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshParamsTokenEndpointAuthUnionResp` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneParamResp struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneParamType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneParamTypeNone BetaManagedAgentsTokenEndpointAuthNoneParamType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicParamResp struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `ClientSecret string` + + OAuth client secret. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicParamType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicParamTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicParamType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostParamResp struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `ClientSecret string` + + OAuth client secret. + + - `Type BetaManagedAgentsTokenEndpointAuthPostParamType` + + - `const BetaManagedAgentsTokenEndpointAuthPostParamTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostParamType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Response + +- `type BetaManagedAgentsMCPOAuthRefreshResponse struct{…}` + + OAuth refresh token configuration returned in credential responses. + + - `ClientID string` + + OAuth client ID. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneResponse struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneResponseTypeNone BetaManagedAgentsTokenEndpointAuthNoneResponseType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicResponse struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicResponseTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicResponseType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostResponse struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthPostResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthPostResponseTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostResponseType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Update Params + +- `type BetaManagedAgentsMCPOAuthRefreshUpdateParamsResp struct{…}` + + Parameters for updating OAuth refresh token configuration. + + - `RefreshToken string` + + Updated OAuth refresh token. + + - `Scope string` + + Updated OAuth scope for the refresh request. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshUpdateParamsTokenEndpointAuthUnionResp` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type BetaManagedAgentsTokenEndpointAuthBasicUpdateParamResp struct{…}` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicUpdateParamType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicUpdateParamTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicUpdateParamType = "client_secret_basic"` + + - `ClientSecret string` + + Updated OAuth client secret. + + - `type BetaManagedAgentsTokenEndpointAuthPostUpdateParamResp struct{…}` + + Updated POST body authentication parameters for the token endpoint. + + - `Type BetaManagedAgentsTokenEndpointAuthPostUpdateParamType` + + - `const BetaManagedAgentsTokenEndpointAuthPostUpdateParamTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostUpdateParamType = "client_secret_post"` + + - `ClientSecret string` + + Updated OAuth client secret. + +### Beta Managed Agents MCP OAuth Update Params + +- `type BetaManagedAgentsMCPOAuthUpdateParamsResp struct{…}` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `Type BetaManagedAgentsMCPOAuthUpdateParamsType` + + - `const BetaManagedAgentsMCPOAuthUpdateParamsTypeMCPOAuth BetaManagedAgentsMCPOAuthUpdateParamsType = "mcp_oauth"` + + - `AccessToken string` + + Updated OAuth access token. + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshUpdateParamsResp` + + Parameters for updating OAuth refresh token configuration. + + - `RefreshToken string` + + Updated OAuth refresh token. + + - `Scope string` + + Updated OAuth scope for the refresh request. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshUpdateParamsTokenEndpointAuthUnionResp` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type BetaManagedAgentsTokenEndpointAuthBasicUpdateParamResp struct{…}` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicUpdateParamType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicUpdateParamTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicUpdateParamType = "client_secret_basic"` + + - `ClientSecret string` + + Updated OAuth client secret. + + - `type BetaManagedAgentsTokenEndpointAuthPostUpdateParamResp struct{…}` + + Updated POST body authentication parameters for the token endpoint. + + - `Type BetaManagedAgentsTokenEndpointAuthPostUpdateParamType` + + - `const BetaManagedAgentsTokenEndpointAuthPostUpdateParamTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostUpdateParamType = "client_secret_post"` + + - `ClientSecret string` + + Updated OAuth client secret. + +### Beta Managed Agents Static Bearer Auth Response + +- `type BetaManagedAgentsStaticBearerAuthResponse struct{…}` + + Static bearer token credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsStaticBearerAuthResponseType` + + - `const BetaManagedAgentsStaticBearerAuthResponseTypeStaticBearer BetaManagedAgentsStaticBearerAuthResponseType = "static_bearer"` + +### Beta Managed Agents Static Bearer Create Params + +- `type BetaManagedAgentsStaticBearerCreateParamsResp struct{…}` + + Parameters for creating a static bearer token credential. + + - `Token string` + + Static bearer token value. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsStaticBearerCreateParamsType` + + - `const BetaManagedAgentsStaticBearerCreateParamsTypeStaticBearer BetaManagedAgentsStaticBearerCreateParamsType = "static_bearer"` + +### Beta Managed Agents Static Bearer Update Params + +- `type BetaManagedAgentsStaticBearerUpdateParamsResp struct{…}` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `Type BetaManagedAgentsStaticBearerUpdateParamsType` + + - `const BetaManagedAgentsStaticBearerUpdateParamsTypeStaticBearer BetaManagedAgentsStaticBearerUpdateParamsType = "static_bearer"` + + - `Token string` + + Updated static bearer token value. + +### Beta Managed Agents Token Endpoint Auth Basic Param + +- `type BetaManagedAgentsTokenEndpointAuthBasicParamResp struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `ClientSecret string` + + OAuth client secret. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicParamType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicParamTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicParamType = "client_secret_basic"` + +### Beta Managed Agents Token Endpoint Auth Basic Response + +- `type BetaManagedAgentsTokenEndpointAuthBasicResponse struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicResponseTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicResponseType = "client_secret_basic"` + +### Beta Managed Agents Token Endpoint Auth Basic Update Param + +- `type BetaManagedAgentsTokenEndpointAuthBasicUpdateParamResp struct{…}` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicUpdateParamType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicUpdateParamTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicUpdateParamType = "client_secret_basic"` + + - `ClientSecret string` + + Updated OAuth client secret. + +### Beta Managed Agents Token Endpoint Auth None Param + +- `type BetaManagedAgentsTokenEndpointAuthNoneParamResp struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneParamType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneParamTypeNone BetaManagedAgentsTokenEndpointAuthNoneParamType = "none"` + +### Beta Managed Agents Token Endpoint Auth None Response + +- `type BetaManagedAgentsTokenEndpointAuthNoneResponse struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneResponseTypeNone BetaManagedAgentsTokenEndpointAuthNoneResponseType = "none"` + +### Beta Managed Agents Token Endpoint Auth Post Param + +- `type BetaManagedAgentsTokenEndpointAuthPostParamResp struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `ClientSecret string` + + OAuth client secret. + + - `Type BetaManagedAgentsTokenEndpointAuthPostParamType` + + - `const BetaManagedAgentsTokenEndpointAuthPostParamTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostParamType = "client_secret_post"` + +### Beta Managed Agents Token Endpoint Auth Post Response + +- `type BetaManagedAgentsTokenEndpointAuthPostResponse struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthPostResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthPostResponseTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostResponseType = "client_secret_post"` + +### Beta Managed Agents Token Endpoint Auth Post Update Param + +- `type BetaManagedAgentsTokenEndpointAuthPostUpdateParamResp struct{…}` + + Updated POST body authentication parameters for the token endpoint. + + - `Type BetaManagedAgentsTokenEndpointAuthPostUpdateParamType` + + - `const BetaManagedAgentsTokenEndpointAuthPostUpdateParamTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostUpdateParamType = "client_secret_post"` + + - `ClientSecret string` + + Updated OAuth client secret. diff --git a/content/en/api/go/beta/vaults/archive.md b/content/en/api/go/beta/vaults/archive.md new file mode 100644 index 000000000..8c6084082 --- /dev/null +++ b/content/en/api/go/beta/vaults/archive.md @@ -0,0 +1,128 @@ +## Archive + +`client.Beta.Vaults.Archive(ctx, vaultID, body) (*BetaManagedAgentsVault, error)` + +**post** `/v1/vaults/{vault_id}/archive` + +Archive Vault + +### Parameters + +- `vaultID string` + +- `body BetaVaultArchiveParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsVault struct{…}` + + A vault that stores credentials for use by agents during sessions. + + - `ID string` + + Unique identifier for the vault. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `DisplayName string` + + Human-readable name for the vault. + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the vault. + + - `Type BetaManagedAgentsVaultType` + + - `const BetaManagedAgentsVaultTypeVault BetaManagedAgentsVaultType = "vault"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsVault, err := client.Beta.Vaults.Archive( + context.TODO(), + "vlt_011CZkZDLs7fYzm1hXNPeRjv", + anthropic.BetaVaultArchiveParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsVault.ID) +} +``` diff --git a/content/en/api/go/beta/vaults/create.md b/content/en/api/go/beta/vaults/create.md new file mode 100644 index 000000000..f651c82fb --- /dev/null +++ b/content/en/api/go/beta/vaults/create.md @@ -0,0 +1,130 @@ +## Create + +`client.Beta.Vaults.New(ctx, params) (*BetaManagedAgentsVault, error)` + +**post** `/v1/vaults` + +Create Vault + +### Parameters + +- `params BetaVaultNewParams` + + - `DisplayName param.Field[string]` + + Body param: Human-readable name for the vault. 1-255 characters. + + - `Metadata param.Field[map[string, string]]` + + Body param: Arbitrary key-value metadata to attach to the vault. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsVault struct{…}` + + A vault that stores credentials for use by agents during sessions. + + - `ID string` + + Unique identifier for the vault. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `DisplayName string` + + Human-readable name for the vault. + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the vault. + + - `Type BetaManagedAgentsVaultType` + + - `const BetaManagedAgentsVaultTypeVault BetaManagedAgentsVaultType = "vault"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsVault, err := client.Beta.Vaults.New(context.TODO(), anthropic.BetaVaultNewParams{ + DisplayName: "Example vault", + }) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsVault.ID) +} +``` diff --git a/content/en/api/go/beta/vaults/credentials.md b/content/en/api/go/beta/vaults/credentials.md new file mode 100644 index 000000000..f9751c290 --- /dev/null +++ b/content/en/api/go/beta/vaults/credentials.md @@ -0,0 +1,2033 @@ +# Credentials + +## Create + +`client.Beta.Vaults.Credentials.New(ctx, vaultID, params) (*BetaManagedAgentsCredential, error)` + +**post** `/v1/vaults/{vault_id}/credentials` + +Create Credential + +### Parameters + +- `vaultID string` + +- `params BetaVaultCredentialNewParams` + + - `Auth param.Field[BetaVaultCredentialNewParamsAuthUnion]` + + Body param: Authentication details for creating a credential. + + - `type BetaManagedAgentsMCPOAuthCreateParamsResp struct{…}` + + Parameters for creating an MCP OAuth credential. + + - `AccessToken string` + + OAuth access token. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsMCPOAuthCreateParamsType` + + - `const BetaManagedAgentsMCPOAuthCreateParamsTypeMCPOAuth BetaManagedAgentsMCPOAuthCreateParamsType = "mcp_oauth"` + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshParamsResp` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `ClientID string` + + OAuth client ID. + + - `RefreshToken string` + + OAuth refresh token. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshParamsTokenEndpointAuthUnionResp` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneParamResp struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneParamType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneParamTypeNone BetaManagedAgentsTokenEndpointAuthNoneParamType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicParamResp struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `ClientSecret string` + + OAuth client secret. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicParamType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicParamTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicParamType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostParamResp struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `ClientSecret string` + + OAuth client secret. + + - `Type BetaManagedAgentsTokenEndpointAuthPostParamType` + + - `const BetaManagedAgentsTokenEndpointAuthPostParamTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostParamType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + + - `type BetaManagedAgentsStaticBearerCreateParamsResp struct{…}` + + Parameters for creating a static bearer token credential. + + - `Token string` + + Static bearer token value. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsStaticBearerCreateParamsType` + + - `const BetaManagedAgentsStaticBearerCreateParamsTypeStaticBearer BetaManagedAgentsStaticBearerCreateParamsType = "static_bearer"` + + - `DisplayName param.Field[string]` + + Body param: Human-readable name for the credential. Up to 255 characters. + + - `Metadata param.Field[map[string, string]]` + + Body param: Arbitrary key-value metadata to attach to the credential. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsCredential struct{…}` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `ID string` + + Unique identifier for the credential. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `Auth BetaManagedAgentsCredentialAuthUnion` + + Authentication details for a credential. + + - `type BetaManagedAgentsMCPOAuthAuthResponse struct{…}` + + OAuth credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsMCPOAuthAuthResponseType` + + - `const BetaManagedAgentsMCPOAuthAuthResponseTypeMCPOAuth BetaManagedAgentsMCPOAuthAuthResponseType = "mcp_oauth"` + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `ClientID string` + + OAuth client ID. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneResponse struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneResponseTypeNone BetaManagedAgentsTokenEndpointAuthNoneResponseType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicResponse struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicResponseTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicResponseType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostResponse struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthPostResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthPostResponseTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostResponseType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + + - `type BetaManagedAgentsStaticBearerAuthResponse struct{…}` + + Static bearer token credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsStaticBearerAuthResponseType` + + - `const BetaManagedAgentsStaticBearerAuthResponseTypeStaticBearer BetaManagedAgentsStaticBearerAuthResponseType = "static_bearer"` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the credential. + + - `Type BetaManagedAgentsCredentialType` + + - `const BetaManagedAgentsCredentialTypeVaultCredential BetaManagedAgentsCredentialType = "vault_credential"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `VaultID string` + + Identifier of the vault this credential belongs to. + + - `DisplayName string` + + Human-readable name for the credential. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsCredential, err := client.Beta.Vaults.Credentials.New( + context.TODO(), + "vlt_011CZkZDLs7fYzm1hXNPeRjv", + anthropic.BetaVaultCredentialNewParams{ + Auth: anthropic.BetaVaultCredentialNewParamsAuthUnion{ + OfStaticBearer: &anthropic.BetaManagedAgentsStaticBearerCreateParams{ + Token: "bearer_exampletoken", + MCPServerURL: "https://example-server.modelcontextprotocol.io/sse", + Type: anthropic.BetaManagedAgentsStaticBearerCreateParamsTypeStaticBearer, + }, + }, + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsCredential.ID) +} +``` + +## List + +`client.Beta.Vaults.Credentials.List(ctx, vaultID, params) (*PageCursor[BetaManagedAgentsCredential], error)` + +**get** `/v1/vaults/{vault_id}/credentials` + +List Credentials + +### Parameters + +- `vaultID string` + +- `params BetaVaultCredentialListParams` + + - `IncludeArchived param.Field[bool]` + + Query param: Whether to include archived credentials in the results. + + - `Limit param.Field[int64]` + + Query param: Maximum number of credentials to return per page. Defaults to 20, maximum 100. + + - `Page param.Field[string]` + + Query param: Opaque pagination token from a previous `list_credentials` response. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsCredential struct{…}` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `ID string` + + Unique identifier for the credential. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `Auth BetaManagedAgentsCredentialAuthUnion` + + Authentication details for a credential. + + - `type BetaManagedAgentsMCPOAuthAuthResponse struct{…}` + + OAuth credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsMCPOAuthAuthResponseType` + + - `const BetaManagedAgentsMCPOAuthAuthResponseTypeMCPOAuth BetaManagedAgentsMCPOAuthAuthResponseType = "mcp_oauth"` + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `ClientID string` + + OAuth client ID. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneResponse struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneResponseTypeNone BetaManagedAgentsTokenEndpointAuthNoneResponseType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicResponse struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicResponseTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicResponseType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostResponse struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthPostResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthPostResponseTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostResponseType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + + - `type BetaManagedAgentsStaticBearerAuthResponse struct{…}` + + Static bearer token credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsStaticBearerAuthResponseType` + + - `const BetaManagedAgentsStaticBearerAuthResponseTypeStaticBearer BetaManagedAgentsStaticBearerAuthResponseType = "static_bearer"` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the credential. + + - `Type BetaManagedAgentsCredentialType` + + - `const BetaManagedAgentsCredentialTypeVaultCredential BetaManagedAgentsCredentialType = "vault_credential"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `VaultID string` + + Identifier of the vault this credential belongs to. + + - `DisplayName string` + + Human-readable name for the credential. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Beta.Vaults.Credentials.List( + context.TODO(), + "vlt_011CZkZDLs7fYzm1hXNPeRjv", + anthropic.BetaVaultCredentialListParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", page) +} +``` + +## Retrieve + +`client.Beta.Vaults.Credentials.Get(ctx, credentialID, params) (*BetaManagedAgentsCredential, error)` + +**get** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Get Credential + +### Parameters + +- `credentialID string` + +- `params BetaVaultCredentialGetParams` + + - `VaultID param.Field[string]` + + Path param: Path parameter vault_id + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsCredential struct{…}` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `ID string` + + Unique identifier for the credential. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `Auth BetaManagedAgentsCredentialAuthUnion` + + Authentication details for a credential. + + - `type BetaManagedAgentsMCPOAuthAuthResponse struct{…}` + + OAuth credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsMCPOAuthAuthResponseType` + + - `const BetaManagedAgentsMCPOAuthAuthResponseTypeMCPOAuth BetaManagedAgentsMCPOAuthAuthResponseType = "mcp_oauth"` + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `ClientID string` + + OAuth client ID. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneResponse struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneResponseTypeNone BetaManagedAgentsTokenEndpointAuthNoneResponseType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicResponse struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicResponseTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicResponseType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostResponse struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthPostResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthPostResponseTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostResponseType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + + - `type BetaManagedAgentsStaticBearerAuthResponse struct{…}` + + Static bearer token credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsStaticBearerAuthResponseType` + + - `const BetaManagedAgentsStaticBearerAuthResponseTypeStaticBearer BetaManagedAgentsStaticBearerAuthResponseType = "static_bearer"` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the credential. + + - `Type BetaManagedAgentsCredentialType` + + - `const BetaManagedAgentsCredentialTypeVaultCredential BetaManagedAgentsCredentialType = "vault_credential"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `VaultID string` + + Identifier of the vault this credential belongs to. + + - `DisplayName string` + + Human-readable name for the credential. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsCredential, err := client.Beta.Vaults.Credentials.Get( + context.TODO(), + "vcrd_011CZkZEMt8gZan2iYOQfSkw", + anthropic.BetaVaultCredentialGetParams{ + VaultID: "vlt_011CZkZDLs7fYzm1hXNPeRjv", + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsCredential.ID) +} +``` + +## Update + +`client.Beta.Vaults.Credentials.Update(ctx, credentialID, params) (*BetaManagedAgentsCredential, error)` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Update Credential + +### Parameters + +- `credentialID string` + +- `params BetaVaultCredentialUpdateParams` + + - `VaultID param.Field[string]` + + Path param: Path parameter vault_id + + - `Auth param.Field[BetaVaultCredentialUpdateParamsAuthUnion]` + + Body param: Updated authentication details for a credential. + + - `type BetaManagedAgentsMCPOAuthUpdateParamsResp struct{…}` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `Type BetaManagedAgentsMCPOAuthUpdateParamsType` + + - `const BetaManagedAgentsMCPOAuthUpdateParamsTypeMCPOAuth BetaManagedAgentsMCPOAuthUpdateParamsType = "mcp_oauth"` + + - `AccessToken string` + + Updated OAuth access token. + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshUpdateParamsResp` + + Parameters for updating OAuth refresh token configuration. + + - `RefreshToken string` + + Updated OAuth refresh token. + + - `Scope string` + + Updated OAuth scope for the refresh request. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshUpdateParamsTokenEndpointAuthUnionResp` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type BetaManagedAgentsTokenEndpointAuthBasicUpdateParamResp struct{…}` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicUpdateParamType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicUpdateParamTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicUpdateParamType = "client_secret_basic"` + + - `ClientSecret string` + + Updated OAuth client secret. + + - `type BetaManagedAgentsTokenEndpointAuthPostUpdateParamResp struct{…}` + + Updated POST body authentication parameters for the token endpoint. + + - `Type BetaManagedAgentsTokenEndpointAuthPostUpdateParamType` + + - `const BetaManagedAgentsTokenEndpointAuthPostUpdateParamTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostUpdateParamType = "client_secret_post"` + + - `ClientSecret string` + + Updated OAuth client secret. + + - `type BetaManagedAgentsStaticBearerUpdateParamsResp struct{…}` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `Type BetaManagedAgentsStaticBearerUpdateParamsType` + + - `const BetaManagedAgentsStaticBearerUpdateParamsTypeStaticBearer BetaManagedAgentsStaticBearerUpdateParamsType = "static_bearer"` + + - `Token string` + + Updated static bearer token value. + + - `DisplayName param.Field[string]` + + Body param: Updated human-readable name for the credential. 1-255 characters. + + - `Metadata param.Field[map[string, string]]` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsCredential struct{…}` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `ID string` + + Unique identifier for the credential. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `Auth BetaManagedAgentsCredentialAuthUnion` + + Authentication details for a credential. + + - `type BetaManagedAgentsMCPOAuthAuthResponse struct{…}` + + OAuth credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsMCPOAuthAuthResponseType` + + - `const BetaManagedAgentsMCPOAuthAuthResponseTypeMCPOAuth BetaManagedAgentsMCPOAuthAuthResponseType = "mcp_oauth"` + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `ClientID string` + + OAuth client ID. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneResponse struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneResponseTypeNone BetaManagedAgentsTokenEndpointAuthNoneResponseType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicResponse struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicResponseTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicResponseType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostResponse struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthPostResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthPostResponseTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostResponseType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + + - `type BetaManagedAgentsStaticBearerAuthResponse struct{…}` + + Static bearer token credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsStaticBearerAuthResponseType` + + - `const BetaManagedAgentsStaticBearerAuthResponseTypeStaticBearer BetaManagedAgentsStaticBearerAuthResponseType = "static_bearer"` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the credential. + + - `Type BetaManagedAgentsCredentialType` + + - `const BetaManagedAgentsCredentialTypeVaultCredential BetaManagedAgentsCredentialType = "vault_credential"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `VaultID string` + + Identifier of the vault this credential belongs to. + + - `DisplayName string` + + Human-readable name for the credential. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsCredential, err := client.Beta.Vaults.Credentials.Update( + context.TODO(), + "vcrd_011CZkZEMt8gZan2iYOQfSkw", + anthropic.BetaVaultCredentialUpdateParams{ + VaultID: "vlt_011CZkZDLs7fYzm1hXNPeRjv", + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsCredential.ID) +} +``` + +## Delete + +`client.Beta.Vaults.Credentials.Delete(ctx, credentialID, params) (*BetaManagedAgentsDeletedCredential, error)` + +**delete** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Delete Credential + +### Parameters + +- `credentialID string` + +- `params BetaVaultCredentialDeleteParams` + + - `VaultID param.Field[string]` + + Path param: Path parameter vault_id + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsDeletedCredential struct{…}` + + Confirmation of a deleted credential. + + - `ID string` + + Unique identifier of the deleted credential. + + - `Type BetaManagedAgentsDeletedCredentialType` + + - `const BetaManagedAgentsDeletedCredentialTypeVaultCredentialDeleted BetaManagedAgentsDeletedCredentialType = "vault_credential_deleted"` + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsDeletedCredential, err := client.Beta.Vaults.Credentials.Delete( + context.TODO(), + "vcrd_011CZkZEMt8gZan2iYOQfSkw", + anthropic.BetaVaultCredentialDeleteParams{ + VaultID: "vlt_011CZkZDLs7fYzm1hXNPeRjv", + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsDeletedCredential.ID) +} +``` + +## Archive + +`client.Beta.Vaults.Credentials.Archive(ctx, credentialID, params) (*BetaManagedAgentsCredential, error)` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}/archive` + +Archive Credential + +### Parameters + +- `credentialID string` + +- `params BetaVaultCredentialArchiveParams` + + - `VaultID param.Field[string]` + + Path param: Path parameter vault_id + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsCredential struct{…}` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `ID string` + + Unique identifier for the credential. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `Auth BetaManagedAgentsCredentialAuthUnion` + + Authentication details for a credential. + + - `type BetaManagedAgentsMCPOAuthAuthResponse struct{…}` + + OAuth credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsMCPOAuthAuthResponseType` + + - `const BetaManagedAgentsMCPOAuthAuthResponseTypeMCPOAuth BetaManagedAgentsMCPOAuthAuthResponseType = "mcp_oauth"` + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `ClientID string` + + OAuth client ID. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneResponse struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneResponseTypeNone BetaManagedAgentsTokenEndpointAuthNoneResponseType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicResponse struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicResponseTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicResponseType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostResponse struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthPostResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthPostResponseTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostResponseType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + + - `type BetaManagedAgentsStaticBearerAuthResponse struct{…}` + + Static bearer token credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsStaticBearerAuthResponseType` + + - `const BetaManagedAgentsStaticBearerAuthResponseTypeStaticBearer BetaManagedAgentsStaticBearerAuthResponseType = "static_bearer"` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the credential. + + - `Type BetaManagedAgentsCredentialType` + + - `const BetaManagedAgentsCredentialTypeVaultCredential BetaManagedAgentsCredentialType = "vault_credential"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `VaultID string` + + Identifier of the vault this credential belongs to. + + - `DisplayName string` + + Human-readable name for the credential. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsCredential, err := client.Beta.Vaults.Credentials.Archive( + context.TODO(), + "vcrd_011CZkZEMt8gZan2iYOQfSkw", + anthropic.BetaVaultCredentialArchiveParams{ + VaultID: "vlt_011CZkZDLs7fYzm1hXNPeRjv", + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsCredential.ID) +} +``` + +## Domain Types + +### Beta Managed Agents Credential + +- `type BetaManagedAgentsCredential struct{…}` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `ID string` + + Unique identifier for the credential. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `Auth BetaManagedAgentsCredentialAuthUnion` + + Authentication details for a credential. + + - `type BetaManagedAgentsMCPOAuthAuthResponse struct{…}` + + OAuth credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsMCPOAuthAuthResponseType` + + - `const BetaManagedAgentsMCPOAuthAuthResponseTypeMCPOAuth BetaManagedAgentsMCPOAuthAuthResponseType = "mcp_oauth"` + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `ClientID string` + + OAuth client ID. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneResponse struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneResponseTypeNone BetaManagedAgentsTokenEndpointAuthNoneResponseType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicResponse struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicResponseTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicResponseType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostResponse struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthPostResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthPostResponseTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostResponseType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + + - `type BetaManagedAgentsStaticBearerAuthResponse struct{…}` + + Static bearer token credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsStaticBearerAuthResponseType` + + - `const BetaManagedAgentsStaticBearerAuthResponseTypeStaticBearer BetaManagedAgentsStaticBearerAuthResponseType = "static_bearer"` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the credential. + + - `Type BetaManagedAgentsCredentialType` + + - `const BetaManagedAgentsCredentialTypeVaultCredential BetaManagedAgentsCredentialType = "vault_credential"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `VaultID string` + + Identifier of the vault this credential belongs to. + + - `DisplayName string` + + Human-readable name for the credential. + +### Beta Managed Agents Deleted Credential + +- `type BetaManagedAgentsDeletedCredential struct{…}` + + Confirmation of a deleted credential. + + - `ID string` + + Unique identifier of the deleted credential. + + - `Type BetaManagedAgentsDeletedCredentialType` + + - `const BetaManagedAgentsDeletedCredentialTypeVaultCredentialDeleted BetaManagedAgentsDeletedCredentialType = "vault_credential_deleted"` + +### Beta Managed Agents MCP OAuth Auth Response + +- `type BetaManagedAgentsMCPOAuthAuthResponse struct{…}` + + OAuth credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsMCPOAuthAuthResponseType` + + - `const BetaManagedAgentsMCPOAuthAuthResponseTypeMCPOAuth BetaManagedAgentsMCPOAuthAuthResponseType = "mcp_oauth"` + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `ClientID string` + + OAuth client ID. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneResponse struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneResponseTypeNone BetaManagedAgentsTokenEndpointAuthNoneResponseType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicResponse struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicResponseTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicResponseType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostResponse struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthPostResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthPostResponseTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostResponseType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Create Params + +- `type BetaManagedAgentsMCPOAuthCreateParamsResp struct{…}` + + Parameters for creating an MCP OAuth credential. + + - `AccessToken string` + + OAuth access token. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsMCPOAuthCreateParamsType` + + - `const BetaManagedAgentsMCPOAuthCreateParamsTypeMCPOAuth BetaManagedAgentsMCPOAuthCreateParamsType = "mcp_oauth"` + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshParamsResp` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `ClientID string` + + OAuth client ID. + + - `RefreshToken string` + + OAuth refresh token. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshParamsTokenEndpointAuthUnionResp` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneParamResp struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneParamType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneParamTypeNone BetaManagedAgentsTokenEndpointAuthNoneParamType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicParamResp struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `ClientSecret string` + + OAuth client secret. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicParamType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicParamTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicParamType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostParamResp struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `ClientSecret string` + + OAuth client secret. + + - `Type BetaManagedAgentsTokenEndpointAuthPostParamType` + + - `const BetaManagedAgentsTokenEndpointAuthPostParamTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostParamType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Params + +- `type BetaManagedAgentsMCPOAuthRefreshParamsResp struct{…}` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `ClientID string` + + OAuth client ID. + + - `RefreshToken string` + + OAuth refresh token. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshParamsTokenEndpointAuthUnionResp` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneParamResp struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneParamType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneParamTypeNone BetaManagedAgentsTokenEndpointAuthNoneParamType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicParamResp struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `ClientSecret string` + + OAuth client secret. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicParamType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicParamTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicParamType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostParamResp struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `ClientSecret string` + + OAuth client secret. + + - `Type BetaManagedAgentsTokenEndpointAuthPostParamType` + + - `const BetaManagedAgentsTokenEndpointAuthPostParamTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostParamType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Response + +- `type BetaManagedAgentsMCPOAuthRefreshResponse struct{…}` + + OAuth refresh token configuration returned in credential responses. + + - `ClientID string` + + OAuth client ID. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneResponse struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneResponseTypeNone BetaManagedAgentsTokenEndpointAuthNoneResponseType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicResponse struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicResponseTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicResponseType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostResponse struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthPostResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthPostResponseTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostResponseType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Update Params + +- `type BetaManagedAgentsMCPOAuthRefreshUpdateParamsResp struct{…}` + + Parameters for updating OAuth refresh token configuration. + + - `RefreshToken string` + + Updated OAuth refresh token. + + - `Scope string` + + Updated OAuth scope for the refresh request. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshUpdateParamsTokenEndpointAuthUnionResp` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type BetaManagedAgentsTokenEndpointAuthBasicUpdateParamResp struct{…}` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicUpdateParamType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicUpdateParamTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicUpdateParamType = "client_secret_basic"` + + - `ClientSecret string` + + Updated OAuth client secret. + + - `type BetaManagedAgentsTokenEndpointAuthPostUpdateParamResp struct{…}` + + Updated POST body authentication parameters for the token endpoint. + + - `Type BetaManagedAgentsTokenEndpointAuthPostUpdateParamType` + + - `const BetaManagedAgentsTokenEndpointAuthPostUpdateParamTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostUpdateParamType = "client_secret_post"` + + - `ClientSecret string` + + Updated OAuth client secret. + +### Beta Managed Agents MCP OAuth Update Params + +- `type BetaManagedAgentsMCPOAuthUpdateParamsResp struct{…}` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `Type BetaManagedAgentsMCPOAuthUpdateParamsType` + + - `const BetaManagedAgentsMCPOAuthUpdateParamsTypeMCPOAuth BetaManagedAgentsMCPOAuthUpdateParamsType = "mcp_oauth"` + + - `AccessToken string` + + Updated OAuth access token. + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshUpdateParamsResp` + + Parameters for updating OAuth refresh token configuration. + + - `RefreshToken string` + + Updated OAuth refresh token. + + - `Scope string` + + Updated OAuth scope for the refresh request. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshUpdateParamsTokenEndpointAuthUnionResp` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type BetaManagedAgentsTokenEndpointAuthBasicUpdateParamResp struct{…}` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicUpdateParamType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicUpdateParamTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicUpdateParamType = "client_secret_basic"` + + - `ClientSecret string` + + Updated OAuth client secret. + + - `type BetaManagedAgentsTokenEndpointAuthPostUpdateParamResp struct{…}` + + Updated POST body authentication parameters for the token endpoint. + + - `Type BetaManagedAgentsTokenEndpointAuthPostUpdateParamType` + + - `const BetaManagedAgentsTokenEndpointAuthPostUpdateParamTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostUpdateParamType = "client_secret_post"` + + - `ClientSecret string` + + Updated OAuth client secret. + +### Beta Managed Agents Static Bearer Auth Response + +- `type BetaManagedAgentsStaticBearerAuthResponse struct{…}` + + Static bearer token credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsStaticBearerAuthResponseType` + + - `const BetaManagedAgentsStaticBearerAuthResponseTypeStaticBearer BetaManagedAgentsStaticBearerAuthResponseType = "static_bearer"` + +### Beta Managed Agents Static Bearer Create Params + +- `type BetaManagedAgentsStaticBearerCreateParamsResp struct{…}` + + Parameters for creating a static bearer token credential. + + - `Token string` + + Static bearer token value. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsStaticBearerCreateParamsType` + + - `const BetaManagedAgentsStaticBearerCreateParamsTypeStaticBearer BetaManagedAgentsStaticBearerCreateParamsType = "static_bearer"` + +### Beta Managed Agents Static Bearer Update Params + +- `type BetaManagedAgentsStaticBearerUpdateParamsResp struct{…}` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `Type BetaManagedAgentsStaticBearerUpdateParamsType` + + - `const BetaManagedAgentsStaticBearerUpdateParamsTypeStaticBearer BetaManagedAgentsStaticBearerUpdateParamsType = "static_bearer"` + + - `Token string` + + Updated static bearer token value. + +### Beta Managed Agents Token Endpoint Auth Basic Param + +- `type BetaManagedAgentsTokenEndpointAuthBasicParamResp struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `ClientSecret string` + + OAuth client secret. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicParamType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicParamTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicParamType = "client_secret_basic"` + +### Beta Managed Agents Token Endpoint Auth Basic Response + +- `type BetaManagedAgentsTokenEndpointAuthBasicResponse struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicResponseTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicResponseType = "client_secret_basic"` + +### Beta Managed Agents Token Endpoint Auth Basic Update Param + +- `type BetaManagedAgentsTokenEndpointAuthBasicUpdateParamResp struct{…}` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicUpdateParamType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicUpdateParamTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicUpdateParamType = "client_secret_basic"` + + - `ClientSecret string` + + Updated OAuth client secret. + +### Beta Managed Agents Token Endpoint Auth None Param + +- `type BetaManagedAgentsTokenEndpointAuthNoneParamResp struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneParamType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneParamTypeNone BetaManagedAgentsTokenEndpointAuthNoneParamType = "none"` + +### Beta Managed Agents Token Endpoint Auth None Response + +- `type BetaManagedAgentsTokenEndpointAuthNoneResponse struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneResponseTypeNone BetaManagedAgentsTokenEndpointAuthNoneResponseType = "none"` + +### Beta Managed Agents Token Endpoint Auth Post Param + +- `type BetaManagedAgentsTokenEndpointAuthPostParamResp struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `ClientSecret string` + + OAuth client secret. + + - `Type BetaManagedAgentsTokenEndpointAuthPostParamType` + + - `const BetaManagedAgentsTokenEndpointAuthPostParamTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostParamType = "client_secret_post"` + +### Beta Managed Agents Token Endpoint Auth Post Response + +- `type BetaManagedAgentsTokenEndpointAuthPostResponse struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthPostResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthPostResponseTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostResponseType = "client_secret_post"` + +### Beta Managed Agents Token Endpoint Auth Post Update Param + +- `type BetaManagedAgentsTokenEndpointAuthPostUpdateParamResp struct{…}` + + Updated POST body authentication parameters for the token endpoint. + + - `Type BetaManagedAgentsTokenEndpointAuthPostUpdateParamType` + + - `const BetaManagedAgentsTokenEndpointAuthPostUpdateParamTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostUpdateParamType = "client_secret_post"` + + - `ClientSecret string` + + Updated OAuth client secret. diff --git a/content/en/api/go/beta/vaults/credentials/archive.md b/content/en/api/go/beta/vaults/credentials/archive.md new file mode 100644 index 000000000..4313e56f3 --- /dev/null +++ b/content/en/api/go/beta/vaults/credentials/archive.md @@ -0,0 +1,216 @@ +## Archive + +`client.Beta.Vaults.Credentials.Archive(ctx, credentialID, params) (*BetaManagedAgentsCredential, error)` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}/archive` + +Archive Credential + +### Parameters + +- `credentialID string` + +- `params BetaVaultCredentialArchiveParams` + + - `VaultID param.Field[string]` + + Path param: Path parameter vault_id + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsCredential struct{…}` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `ID string` + + Unique identifier for the credential. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `Auth BetaManagedAgentsCredentialAuthUnion` + + Authentication details for a credential. + + - `type BetaManagedAgentsMCPOAuthAuthResponse struct{…}` + + OAuth credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsMCPOAuthAuthResponseType` + + - `const BetaManagedAgentsMCPOAuthAuthResponseTypeMCPOAuth BetaManagedAgentsMCPOAuthAuthResponseType = "mcp_oauth"` + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `ClientID string` + + OAuth client ID. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneResponse struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneResponseTypeNone BetaManagedAgentsTokenEndpointAuthNoneResponseType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicResponse struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicResponseTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicResponseType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostResponse struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthPostResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthPostResponseTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostResponseType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + + - `type BetaManagedAgentsStaticBearerAuthResponse struct{…}` + + Static bearer token credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsStaticBearerAuthResponseType` + + - `const BetaManagedAgentsStaticBearerAuthResponseTypeStaticBearer BetaManagedAgentsStaticBearerAuthResponseType = "static_bearer"` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the credential. + + - `Type BetaManagedAgentsCredentialType` + + - `const BetaManagedAgentsCredentialTypeVaultCredential BetaManagedAgentsCredentialType = "vault_credential"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `VaultID string` + + Identifier of the vault this credential belongs to. + + - `DisplayName string` + + Human-readable name for the credential. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsCredential, err := client.Beta.Vaults.Credentials.Archive( + context.TODO(), + "vcrd_011CZkZEMt8gZan2iYOQfSkw", + anthropic.BetaVaultCredentialArchiveParams{ + VaultID: "vlt_011CZkZDLs7fYzm1hXNPeRjv", + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsCredential.ID) +} +``` diff --git a/content/en/api/go/beta/vaults/credentials/create.md b/content/en/api/go/beta/vaults/credentials/create.md new file mode 100644 index 000000000..a0c99be2f --- /dev/null +++ b/content/en/api/go/beta/vaults/credentials/create.md @@ -0,0 +1,326 @@ +## Create + +`client.Beta.Vaults.Credentials.New(ctx, vaultID, params) (*BetaManagedAgentsCredential, error)` + +**post** `/v1/vaults/{vault_id}/credentials` + +Create Credential + +### Parameters + +- `vaultID string` + +- `params BetaVaultCredentialNewParams` + + - `Auth param.Field[BetaVaultCredentialNewParamsAuthUnion]` + + Body param: Authentication details for creating a credential. + + - `type BetaManagedAgentsMCPOAuthCreateParamsResp struct{…}` + + Parameters for creating an MCP OAuth credential. + + - `AccessToken string` + + OAuth access token. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsMCPOAuthCreateParamsType` + + - `const BetaManagedAgentsMCPOAuthCreateParamsTypeMCPOAuth BetaManagedAgentsMCPOAuthCreateParamsType = "mcp_oauth"` + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshParamsResp` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `ClientID string` + + OAuth client ID. + + - `RefreshToken string` + + OAuth refresh token. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshParamsTokenEndpointAuthUnionResp` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneParamResp struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneParamType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneParamTypeNone BetaManagedAgentsTokenEndpointAuthNoneParamType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicParamResp struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `ClientSecret string` + + OAuth client secret. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicParamType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicParamTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicParamType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostParamResp struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `ClientSecret string` + + OAuth client secret. + + - `Type BetaManagedAgentsTokenEndpointAuthPostParamType` + + - `const BetaManagedAgentsTokenEndpointAuthPostParamTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostParamType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + + - `type BetaManagedAgentsStaticBearerCreateParamsResp struct{…}` + + Parameters for creating a static bearer token credential. + + - `Token string` + + Static bearer token value. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsStaticBearerCreateParamsType` + + - `const BetaManagedAgentsStaticBearerCreateParamsTypeStaticBearer BetaManagedAgentsStaticBearerCreateParamsType = "static_bearer"` + + - `DisplayName param.Field[string]` + + Body param: Human-readable name for the credential. Up to 255 characters. + + - `Metadata param.Field[map[string, string]]` + + Body param: Arbitrary key-value metadata to attach to the credential. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsCredential struct{…}` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `ID string` + + Unique identifier for the credential. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `Auth BetaManagedAgentsCredentialAuthUnion` + + Authentication details for a credential. + + - `type BetaManagedAgentsMCPOAuthAuthResponse struct{…}` + + OAuth credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsMCPOAuthAuthResponseType` + + - `const BetaManagedAgentsMCPOAuthAuthResponseTypeMCPOAuth BetaManagedAgentsMCPOAuthAuthResponseType = "mcp_oauth"` + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `ClientID string` + + OAuth client ID. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneResponse struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneResponseTypeNone BetaManagedAgentsTokenEndpointAuthNoneResponseType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicResponse struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicResponseTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicResponseType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostResponse struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthPostResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthPostResponseTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostResponseType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + + - `type BetaManagedAgentsStaticBearerAuthResponse struct{…}` + + Static bearer token credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsStaticBearerAuthResponseType` + + - `const BetaManagedAgentsStaticBearerAuthResponseTypeStaticBearer BetaManagedAgentsStaticBearerAuthResponseType = "static_bearer"` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the credential. + + - `Type BetaManagedAgentsCredentialType` + + - `const BetaManagedAgentsCredentialTypeVaultCredential BetaManagedAgentsCredentialType = "vault_credential"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `VaultID string` + + Identifier of the vault this credential belongs to. + + - `DisplayName string` + + Human-readable name for the credential. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsCredential, err := client.Beta.Vaults.Credentials.New( + context.TODO(), + "vlt_011CZkZDLs7fYzm1hXNPeRjv", + anthropic.BetaVaultCredentialNewParams{ + Auth: anthropic.BetaVaultCredentialNewParamsAuthUnion{ + OfStaticBearer: &anthropic.BetaManagedAgentsStaticBearerCreateParams{ + Token: "bearer_exampletoken", + MCPServerURL: "https://example-server.modelcontextprotocol.io/sse", + Type: anthropic.BetaManagedAgentsStaticBearerCreateParamsTypeStaticBearer, + }, + }, + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsCredential.ID) +} +``` diff --git a/content/en/api/go/beta/vaults/credentials/delete.md b/content/en/api/go/beta/vaults/credentials/delete.md new file mode 100644 index 000000000..4c1e8d77e --- /dev/null +++ b/content/en/api/go/beta/vaults/credentials/delete.md @@ -0,0 +1,112 @@ +## Delete + +`client.Beta.Vaults.Credentials.Delete(ctx, credentialID, params) (*BetaManagedAgentsDeletedCredential, error)` + +**delete** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Delete Credential + +### Parameters + +- `credentialID string` + +- `params BetaVaultCredentialDeleteParams` + + - `VaultID param.Field[string]` + + Path param: Path parameter vault_id + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsDeletedCredential struct{…}` + + Confirmation of a deleted credential. + + - `ID string` + + Unique identifier of the deleted credential. + + - `Type BetaManagedAgentsDeletedCredentialType` + + - `const BetaManagedAgentsDeletedCredentialTypeVaultCredentialDeleted BetaManagedAgentsDeletedCredentialType = "vault_credential_deleted"` + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsDeletedCredential, err := client.Beta.Vaults.Credentials.Delete( + context.TODO(), + "vcrd_011CZkZEMt8gZan2iYOQfSkw", + anthropic.BetaVaultCredentialDeleteParams{ + VaultID: "vlt_011CZkZDLs7fYzm1hXNPeRjv", + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsDeletedCredential.ID) +} +``` diff --git a/content/en/api/go/beta/vaults/credentials/list.md b/content/en/api/go/beta/vaults/credentials/list.md new file mode 100644 index 000000000..45dc04b75 --- /dev/null +++ b/content/en/api/go/beta/vaults/credentials/list.md @@ -0,0 +1,224 @@ +## List + +`client.Beta.Vaults.Credentials.List(ctx, vaultID, params) (*PageCursor[BetaManagedAgentsCredential], error)` + +**get** `/v1/vaults/{vault_id}/credentials` + +List Credentials + +### Parameters + +- `vaultID string` + +- `params BetaVaultCredentialListParams` + + - `IncludeArchived param.Field[bool]` + + Query param: Whether to include archived credentials in the results. + + - `Limit param.Field[int64]` + + Query param: Maximum number of credentials to return per page. Defaults to 20, maximum 100. + + - `Page param.Field[string]` + + Query param: Opaque pagination token from a previous `list_credentials` response. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsCredential struct{…}` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `ID string` + + Unique identifier for the credential. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `Auth BetaManagedAgentsCredentialAuthUnion` + + Authentication details for a credential. + + - `type BetaManagedAgentsMCPOAuthAuthResponse struct{…}` + + OAuth credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsMCPOAuthAuthResponseType` + + - `const BetaManagedAgentsMCPOAuthAuthResponseTypeMCPOAuth BetaManagedAgentsMCPOAuthAuthResponseType = "mcp_oauth"` + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `ClientID string` + + OAuth client ID. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneResponse struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneResponseTypeNone BetaManagedAgentsTokenEndpointAuthNoneResponseType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicResponse struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicResponseTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicResponseType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostResponse struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthPostResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthPostResponseTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostResponseType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + + - `type BetaManagedAgentsStaticBearerAuthResponse struct{…}` + + Static bearer token credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsStaticBearerAuthResponseType` + + - `const BetaManagedAgentsStaticBearerAuthResponseTypeStaticBearer BetaManagedAgentsStaticBearerAuthResponseType = "static_bearer"` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the credential. + + - `Type BetaManagedAgentsCredentialType` + + - `const BetaManagedAgentsCredentialTypeVaultCredential BetaManagedAgentsCredentialType = "vault_credential"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `VaultID string` + + Identifier of the vault this credential belongs to. + + - `DisplayName string` + + Human-readable name for the credential. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Beta.Vaults.Credentials.List( + context.TODO(), + "vlt_011CZkZDLs7fYzm1hXNPeRjv", + anthropic.BetaVaultCredentialListParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", page) +} +``` diff --git a/content/en/api/go/beta/vaults/credentials/retrieve.md b/content/en/api/go/beta/vaults/credentials/retrieve.md new file mode 100644 index 000000000..692960166 --- /dev/null +++ b/content/en/api/go/beta/vaults/credentials/retrieve.md @@ -0,0 +1,216 @@ +## Retrieve + +`client.Beta.Vaults.Credentials.Get(ctx, credentialID, params) (*BetaManagedAgentsCredential, error)` + +**get** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Get Credential + +### Parameters + +- `credentialID string` + +- `params BetaVaultCredentialGetParams` + + - `VaultID param.Field[string]` + + Path param: Path parameter vault_id + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsCredential struct{…}` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `ID string` + + Unique identifier for the credential. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `Auth BetaManagedAgentsCredentialAuthUnion` + + Authentication details for a credential. + + - `type BetaManagedAgentsMCPOAuthAuthResponse struct{…}` + + OAuth credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsMCPOAuthAuthResponseType` + + - `const BetaManagedAgentsMCPOAuthAuthResponseTypeMCPOAuth BetaManagedAgentsMCPOAuthAuthResponseType = "mcp_oauth"` + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `ClientID string` + + OAuth client ID. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneResponse struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneResponseTypeNone BetaManagedAgentsTokenEndpointAuthNoneResponseType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicResponse struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicResponseTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicResponseType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostResponse struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthPostResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthPostResponseTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostResponseType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + + - `type BetaManagedAgentsStaticBearerAuthResponse struct{…}` + + Static bearer token credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsStaticBearerAuthResponseType` + + - `const BetaManagedAgentsStaticBearerAuthResponseTypeStaticBearer BetaManagedAgentsStaticBearerAuthResponseType = "static_bearer"` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the credential. + + - `Type BetaManagedAgentsCredentialType` + + - `const BetaManagedAgentsCredentialTypeVaultCredential BetaManagedAgentsCredentialType = "vault_credential"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `VaultID string` + + Identifier of the vault this credential belongs to. + + - `DisplayName string` + + Human-readable name for the credential. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsCredential, err := client.Beta.Vaults.Credentials.Get( + context.TODO(), + "vcrd_011CZkZEMt8gZan2iYOQfSkw", + anthropic.BetaVaultCredentialGetParams{ + VaultID: "vlt_011CZkZDLs7fYzm1hXNPeRjv", + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsCredential.ID) +} +``` diff --git a/content/en/api/go/beta/vaults/credentials/update.md b/content/en/api/go/beta/vaults/credentials/update.md new file mode 100644 index 000000000..f339785ff --- /dev/null +++ b/content/en/api/go/beta/vaults/credentials/update.md @@ -0,0 +1,296 @@ +## Update + +`client.Beta.Vaults.Credentials.Update(ctx, credentialID, params) (*BetaManagedAgentsCredential, error)` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Update Credential + +### Parameters + +- `credentialID string` + +- `params BetaVaultCredentialUpdateParams` + + - `VaultID param.Field[string]` + + Path param: Path parameter vault_id + + - `Auth param.Field[BetaVaultCredentialUpdateParamsAuthUnion]` + + Body param: Updated authentication details for a credential. + + - `type BetaManagedAgentsMCPOAuthUpdateParamsResp struct{…}` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `Type BetaManagedAgentsMCPOAuthUpdateParamsType` + + - `const BetaManagedAgentsMCPOAuthUpdateParamsTypeMCPOAuth BetaManagedAgentsMCPOAuthUpdateParamsType = "mcp_oauth"` + + - `AccessToken string` + + Updated OAuth access token. + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshUpdateParamsResp` + + Parameters for updating OAuth refresh token configuration. + + - `RefreshToken string` + + Updated OAuth refresh token. + + - `Scope string` + + Updated OAuth scope for the refresh request. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshUpdateParamsTokenEndpointAuthUnionResp` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type BetaManagedAgentsTokenEndpointAuthBasicUpdateParamResp struct{…}` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicUpdateParamType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicUpdateParamTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicUpdateParamType = "client_secret_basic"` + + - `ClientSecret string` + + Updated OAuth client secret. + + - `type BetaManagedAgentsTokenEndpointAuthPostUpdateParamResp struct{…}` + + Updated POST body authentication parameters for the token endpoint. + + - `Type BetaManagedAgentsTokenEndpointAuthPostUpdateParamType` + + - `const BetaManagedAgentsTokenEndpointAuthPostUpdateParamTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostUpdateParamType = "client_secret_post"` + + - `ClientSecret string` + + Updated OAuth client secret. + + - `type BetaManagedAgentsStaticBearerUpdateParamsResp struct{…}` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `Type BetaManagedAgentsStaticBearerUpdateParamsType` + + - `const BetaManagedAgentsStaticBearerUpdateParamsTypeStaticBearer BetaManagedAgentsStaticBearerUpdateParamsType = "static_bearer"` + + - `Token string` + + Updated static bearer token value. + + - `DisplayName param.Field[string]` + + Body param: Updated human-readable name for the credential. 1-255 characters. + + - `Metadata param.Field[map[string, string]]` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsCredential struct{…}` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `ID string` + + Unique identifier for the credential. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `Auth BetaManagedAgentsCredentialAuthUnion` + + Authentication details for a credential. + + - `type BetaManagedAgentsMCPOAuthAuthResponse struct{…}` + + OAuth credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsMCPOAuthAuthResponseType` + + - `const BetaManagedAgentsMCPOAuthAuthResponseTypeMCPOAuth BetaManagedAgentsMCPOAuthAuthResponseType = "mcp_oauth"` + + - `ExpiresAt Time` + + A timestamp in RFC 3339 format + + - `Refresh BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `ClientID string` + + OAuth client ID. + + - `TokenEndpoint string` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion` + + Token endpoint requires no client authentication. + + - `type BetaManagedAgentsTokenEndpointAuthNoneResponse struct{…}` + + Token endpoint requires no client authentication. + + - `Type BetaManagedAgentsTokenEndpointAuthNoneResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthNoneResponseTypeNone BetaManagedAgentsTokenEndpointAuthNoneResponseType = "none"` + + - `type BetaManagedAgentsTokenEndpointAuthBasicResponse struct{…}` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthBasicResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthBasicResponseTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicResponseType = "client_secret_basic"` + + - `type BetaManagedAgentsTokenEndpointAuthPostResponse struct{…}` + + Token endpoint uses POST body authentication with client credentials. + + - `Type BetaManagedAgentsTokenEndpointAuthPostResponseType` + + - `const BetaManagedAgentsTokenEndpointAuthPostResponseTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostResponseType = "client_secret_post"` + + - `Resource string` + + OAuth resource indicator. + + - `Scope string` + + OAuth scope for the refresh request. + + - `type BetaManagedAgentsStaticBearerAuthResponse struct{…}` + + Static bearer token credential details for an MCP server. + + - `MCPServerURL string` + + URL of the MCP server this credential authenticates against. + + - `Type BetaManagedAgentsStaticBearerAuthResponseType` + + - `const BetaManagedAgentsStaticBearerAuthResponseTypeStaticBearer BetaManagedAgentsStaticBearerAuthResponseType = "static_bearer"` + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the credential. + + - `Type BetaManagedAgentsCredentialType` + + - `const BetaManagedAgentsCredentialTypeVaultCredential BetaManagedAgentsCredentialType = "vault_credential"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + + - `VaultID string` + + Identifier of the vault this credential belongs to. + + - `DisplayName string` + + Human-readable name for the credential. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsCredential, err := client.Beta.Vaults.Credentials.Update( + context.TODO(), + "vcrd_011CZkZEMt8gZan2iYOQfSkw", + anthropic.BetaVaultCredentialUpdateParams{ + VaultID: "vlt_011CZkZDLs7fYzm1hXNPeRjv", + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsCredential.ID) +} +``` diff --git a/content/en/api/go/beta/vaults/delete.md b/content/en/api/go/beta/vaults/delete.md new file mode 100644 index 000000000..f67048e36 --- /dev/null +++ b/content/en/api/go/beta/vaults/delete.md @@ -0,0 +1,108 @@ +## Delete + +`client.Beta.Vaults.Delete(ctx, vaultID, body) (*BetaManagedAgentsDeletedVault, error)` + +**delete** `/v1/vaults/{vault_id}` + +Delete Vault + +### Parameters + +- `vaultID string` + +- `body BetaVaultDeleteParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsDeletedVault struct{…}` + + Confirmation of a deleted vault. + + - `ID string` + + Unique identifier of the deleted vault. + + - `Type BetaManagedAgentsDeletedVaultType` + + - `const BetaManagedAgentsDeletedVaultTypeVaultDeleted BetaManagedAgentsDeletedVaultType = "vault_deleted"` + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsDeletedVault, err := client.Beta.Vaults.Delete( + context.TODO(), + "vlt_011CZkZDLs7fYzm1hXNPeRjv", + anthropic.BetaVaultDeleteParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsDeletedVault.ID) +} +``` diff --git a/content/en/api/go/beta/vaults/list.md b/content/en/api/go/beta/vaults/list.md new file mode 100644 index 000000000..b5e5595a2 --- /dev/null +++ b/content/en/api/go/beta/vaults/list.md @@ -0,0 +1,134 @@ +## List + +`client.Beta.Vaults.List(ctx, params) (*PageCursor[BetaManagedAgentsVault], error)` + +**get** `/v1/vaults` + +List Vaults + +### Parameters + +- `params BetaVaultListParams` + + - `IncludeArchived param.Field[bool]` + + Query param: Whether to include archived vaults in the results. + + - `Limit param.Field[int64]` + + Query param: Maximum number of vaults to return per page. Defaults to 20, maximum 100. + + - `Page param.Field[string]` + + Query param: Opaque pagination token from a previous `list_vaults` response. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsVault struct{…}` + + A vault that stores credentials for use by agents during sessions. + + - `ID string` + + Unique identifier for the vault. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `DisplayName string` + + Human-readable name for the vault. + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the vault. + + - `Type BetaManagedAgentsVaultType` + + - `const BetaManagedAgentsVaultTypeVault BetaManagedAgentsVaultType = "vault"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Beta.Vaults.List(context.TODO(), anthropic.BetaVaultListParams{ + + }) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", page) +} +``` diff --git a/content/en/api/go/beta/vaults/retrieve.md b/content/en/api/go/beta/vaults/retrieve.md new file mode 100644 index 000000000..422ab443b --- /dev/null +++ b/content/en/api/go/beta/vaults/retrieve.md @@ -0,0 +1,128 @@ +## Retrieve + +`client.Beta.Vaults.Get(ctx, vaultID, query) (*BetaManagedAgentsVault, error)` + +**get** `/v1/vaults/{vault_id}` + +Get Vault + +### Parameters + +- `vaultID string` + +- `query BetaVaultGetParams` + + - `Betas param.Field[[]AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsVault struct{…}` + + A vault that stores credentials for use by agents during sessions. + + - `ID string` + + Unique identifier for the vault. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `DisplayName string` + + Human-readable name for the vault. + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the vault. + + - `Type BetaManagedAgentsVaultType` + + - `const BetaManagedAgentsVaultTypeVault BetaManagedAgentsVaultType = "vault"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsVault, err := client.Beta.Vaults.Get( + context.TODO(), + "vlt_011CZkZDLs7fYzm1hXNPeRjv", + anthropic.BetaVaultGetParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsVault.ID) +} +``` diff --git a/content/en/api/go/beta/vaults/update.md b/content/en/api/go/beta/vaults/update.md new file mode 100644 index 000000000..c76a8384e --- /dev/null +++ b/content/en/api/go/beta/vaults/update.md @@ -0,0 +1,136 @@ +## Update + +`client.Beta.Vaults.Update(ctx, vaultID, params) (*BetaManagedAgentsVault, error)` + +**post** `/v1/vaults/{vault_id}` + +Update Vault + +### Parameters + +- `vaultID string` + +- `params BetaVaultUpdateParams` + + - `DisplayName param.Field[string]` + + Body param: Updated human-readable name for the vault. 1-255 characters. + + - `Metadata param.Field[map[string, string]]` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + + - `Betas param.Field[[]AnthropicBeta]` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `string` + + - `type AnthropicBeta string` + + - `const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"` + + - `const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"` + + - `const AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22"` + + - `const AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24"` + + - `const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"` + + - `const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"` + + - `const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"` + + - `const AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19"` + + - `const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"` + + - `const AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04"` + + - `const AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20"` + + - `const AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14"` + + - `const AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14"` + + - `const AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22"` + + - `const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"` + + - `const AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07"` + + - `const AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27"` + + - `const AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26"` + + - `const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"` + + - `const AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01"` + + - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` + +### Returns + +- `type BetaManagedAgentsVault struct{…}` + + A vault that stores credentials for use by agents during sessions. + + - `ID string` + + Unique identifier for the vault. + + - `ArchivedAt Time` + + A timestamp in RFC 3339 format + + - `CreatedAt Time` + + A timestamp in RFC 3339 format + + - `DisplayName string` + + Human-readable name for the vault. + + - `Metadata map[string, string]` + + Arbitrary key-value metadata attached to the vault. + + - `Type BetaManagedAgentsVaultType` + + - `const BetaManagedAgentsVaultTypeVault BetaManagedAgentsVaultType = "vault"` + + - `UpdatedAt Time` + + A timestamp in RFC 3339 format + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" +) + +func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaManagedAgentsVault, err := client.Beta.Vaults.Update( + context.TODO(), + "vlt_011CZkZDLs7fYzm1hXNPeRjv", + anthropic.BetaVaultUpdateParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaManagedAgentsVault.ID) +} +``` diff --git a/content/en/api/go/completions.md b/content/en/api/go/completions.md index 2fb67476d..056e0fdff 100644 --- a/content/en/api/go/completions.md +++ b/content/en/api/go/completions.md @@ -136,8 +136,6 @@ Future models and features will not be compatible with Text Completions. See our - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type Completion struct{…}` @@ -164,9 +162,13 @@ Future models and features will not be compatible with Text Completions. See our See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -262,7 +264,7 @@ func main() { ) completion, err := client.Completions.New(context.TODO(), anthropic.CompletionNewParams{ MaxTokensToSample: 256, - Model: anthropic.ModelClaudeOpus4_6, + Model: anthropic.ModelClaudeMythosPreview, Prompt: "\n\nHuman: Hello, world!\n\nAssistant:", }) if err != nil { @@ -300,9 +302,13 @@ func main() { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` diff --git a/content/en/api/go/completions/create.md b/content/en/api/go/completions/create.md index 45ff14c51..607645b64 100644 --- a/content/en/api/go/completions/create.md +++ b/content/en/api/go/completions/create.md @@ -134,8 +134,6 @@ Future models and features will not be compatible with Text Completions. See our - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type Completion struct{…}` @@ -162,9 +160,13 @@ Future models and features will not be compatible with Text Completions. See our See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -260,7 +262,7 @@ func main() { ) completion, err := client.Completions.New(context.TODO(), anthropic.CompletionNewParams{ MaxTokensToSample: 256, - Model: anthropic.ModelClaudeOpus4_6, + Model: anthropic.ModelClaudeMythosPreview, Prompt: "\n\nHuman: Hello, world!\n\nAssistant:", }) if err != nil { diff --git a/content/en/api/go/messages.md b/content/en/api/go/messages.md index 27c60ff3f..1fb4a1480 100644 --- a/content/en/api/go/messages.md +++ b/content/en/api/go/messages.md @@ -4317,9 +4317,13 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -8124,7 +8128,7 @@ func main() { }}, Role: anthropic.MessageParamRoleUser, }}, - Model: anthropic.ModelClaudeOpus4_6, + Model: anthropic.ModelClaudeMythosPreview, }) if err != nil { panic(err.Error()) @@ -13827,9 +13831,13 @@ func main() { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -17360,9 +17368,13 @@ func main() { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -19235,9 +19247,13 @@ func main() { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -20171,9 +20187,13 @@ func main() { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -29262,9 +29282,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -32122,9 +32146,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -33406,9 +33434,13 @@ func main() { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -34470,9 +34502,13 @@ func main() { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -35496,9 +35532,13 @@ func main() { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` diff --git a/content/en/api/go/messages/batches.md b/content/en/api/go/messages/batches.md index 85c72d7b1..0a2ccea6b 100644 --- a/content/en/api/go/messages/batches.md +++ b/content/en/api/go/messages/batches.md @@ -2325,9 +2325,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -5185,9 +5189,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -6469,9 +6477,13 @@ func main() { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -7533,9 +7545,13 @@ func main() { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` @@ -8559,9 +8575,13 @@ func main() { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` diff --git a/content/en/api/go/messages/batches/create.md b/content/en/api/go/messages/batches/create.md index 9fd501e38..903a71a49 100644 --- a/content/en/api/go/messages/batches/create.md +++ b/content/en/api/go/messages/batches/create.md @@ -2323,9 +2323,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` diff --git a/content/en/api/go/messages/batches/results.md b/content/en/api/go/messages/batches/results.md index 95cf9c913..22e2a9ef3 100644 --- a/content/en/api/go/messages/batches/results.md +++ b/content/en/api/go/messages/batches/results.md @@ -753,9 +753,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` diff --git a/content/en/api/go/messages/count_tokens.md b/content/en/api/go/messages/count_tokens.md index f507ab298..75e913cac 100644 --- a/content/en/api/go/messages/count_tokens.md +++ b/content/en/api/go/messages/count_tokens.md @@ -3568,7 +3568,7 @@ func main() { }}, Role: anthropic.MessageParamRoleUser, }}, - Model: anthropic.ModelClaudeOpus4_6, + Model: anthropic.ModelClaudeMythosPreview, }) if err != nil { panic(err.Error()) diff --git a/content/en/api/go/messages/create.md b/content/en/api/go/messages/create.md index ac2aafb22..129ac7281 100644 --- a/content/en/api/go/messages/create.md +++ b/content/en/api/go/messages/create.md @@ -4315,9 +4315,13 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"` diff --git a/content/en/api/go/models.md b/content/en/api/go/models.md index e50e746fc..c328a3259 100644 --- a/content/en/api/go/models.md +++ b/content/en/api/go/models.md @@ -78,8 +78,6 @@ The Models API response can be used to determine which models are available for - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type ModelInfo struct{…}` @@ -359,8 +357,6 @@ The Models API response can be used to determine information about a specific mo - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type ModelInfo struct{…}` diff --git a/content/en/api/go/models/list.md b/content/en/api/go/models/list.md index 44b5ed586..0a4dc7441 100644 --- a/content/en/api/go/models/list.md +++ b/content/en/api/go/models/list.md @@ -76,8 +76,6 @@ The Models API response can be used to determine which models are available for - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type ModelInfo struct{…}` diff --git a/content/en/api/go/models/retrieve.md b/content/en/api/go/models/retrieve.md index df7ec9820..a6a8b6346 100644 --- a/content/en/api/go/models/retrieve.md +++ b/content/en/api/go/models/retrieve.md @@ -66,8 +66,6 @@ The Models API response can be used to determine information about a specific mo - `const AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24"` - - `const AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24"` - ### Returns - `type ModelInfo struct{…}` diff --git a/content/en/api/java/beta.md b/content/en/api/java/beta.md index 005ce79dd..385ffefde 100644 --- a/content/en/api/java/beta.md +++ b/content/en/api/java/beta.md @@ -1,46814 +1 @@ -# Beta - -## Domain Types - -### Beta API Error - -- `class BetaApiError:` - - - `String message` - - - `JsonValue; type "api_error"constant` - - - `API_ERROR("api_error")` - -### Beta Authentication Error - -- `class BetaAuthenticationError:` - - - `String message` - - - `JsonValue; type "authentication_error"constant` - - - `AUTHENTICATION_ERROR("authentication_error")` - -### Beta Billing Error - -- `class BetaBillingError:` - - - `String message` - - - `JsonValue; type "billing_error"constant` - - - `BILLING_ERROR("billing_error")` - -### Beta Error - -- `class BetaError: A class that can be one of several variants.union` - - - `class BetaInvalidRequestError:` - - - `String message` - - - `JsonValue; type "invalid_request_error"constant` - - - `INVALID_REQUEST_ERROR("invalid_request_error")` - - - `class BetaAuthenticationError:` - - - `String message` - - - `JsonValue; type "authentication_error"constant` - - - `AUTHENTICATION_ERROR("authentication_error")` - - - `class BetaBillingError:` - - - `String message` - - - `JsonValue; type "billing_error"constant` - - - `BILLING_ERROR("billing_error")` - - - `class BetaPermissionError:` - - - `String message` - - - `JsonValue; type "permission_error"constant` - - - `PERMISSION_ERROR("permission_error")` - - - `class BetaNotFoundError:` - - - `String message` - - - `JsonValue; type "not_found_error"constant` - - - `NOT_FOUND_ERROR("not_found_error")` - - - `class BetaRateLimitError:` - - - `String message` - - - `JsonValue; type "rate_limit_error"constant` - - - `RATE_LIMIT_ERROR("rate_limit_error")` - - - `class BetaGatewayTimeoutError:` - - - `String message` - - - `JsonValue; type "timeout_error"constant` - - - `TIMEOUT_ERROR("timeout_error")` - - - `class BetaApiError:` - - - `String message` - - - `JsonValue; type "api_error"constant` - - - `API_ERROR("api_error")` - - - `class BetaOverloadedError:` - - - `String message` - - - `JsonValue; type "overloaded_error"constant` - - - `OVERLOADED_ERROR("overloaded_error")` - -### Beta Error Response - -- `class BetaErrorResponse:` - - - `BetaError error` - - - `class BetaInvalidRequestError:` - - - `String message` - - - `JsonValue; type "invalid_request_error"constant` - - - `INVALID_REQUEST_ERROR("invalid_request_error")` - - - `class BetaAuthenticationError:` - - - `String message` - - - `JsonValue; type "authentication_error"constant` - - - `AUTHENTICATION_ERROR("authentication_error")` - - - `class BetaBillingError:` - - - `String message` - - - `JsonValue; type "billing_error"constant` - - - `BILLING_ERROR("billing_error")` - - - `class BetaPermissionError:` - - - `String message` - - - `JsonValue; type "permission_error"constant` - - - `PERMISSION_ERROR("permission_error")` - - - `class BetaNotFoundError:` - - - `String message` - - - `JsonValue; type "not_found_error"constant` - - - `NOT_FOUND_ERROR("not_found_error")` - - - `class BetaRateLimitError:` - - - `String message` - - - `JsonValue; type "rate_limit_error"constant` - - - `RATE_LIMIT_ERROR("rate_limit_error")` - - - `class BetaGatewayTimeoutError:` - - - `String message` - - - `JsonValue; type "timeout_error"constant` - - - `TIMEOUT_ERROR("timeout_error")` - - - `class BetaApiError:` - - - `String message` - - - `JsonValue; type "api_error"constant` - - - `API_ERROR("api_error")` - - - `class BetaOverloadedError:` - - - `String message` - - - `JsonValue; type "overloaded_error"constant` - - - `OVERLOADED_ERROR("overloaded_error")` - - - `Optional requestId` - - - `JsonValue; type "error"constant` - - - `ERROR("error")` - -### Beta Gateway Timeout Error - -- `class BetaGatewayTimeoutError:` - - - `String message` - - - `JsonValue; type "timeout_error"constant` - - - `TIMEOUT_ERROR("timeout_error")` - -### Beta Invalid Request Error - -- `class BetaInvalidRequestError:` - - - `String message` - - - `JsonValue; type "invalid_request_error"constant` - - - `INVALID_REQUEST_ERROR("invalid_request_error")` - -### Beta Not Found Error - -- `class BetaNotFoundError:` - - - `String message` - - - `JsonValue; type "not_found_error"constant` - - - `NOT_FOUND_ERROR("not_found_error")` - -### Beta Overloaded Error - -- `class BetaOverloadedError:` - - - `String message` - - - `JsonValue; type "overloaded_error"constant` - - - `OVERLOADED_ERROR("overloaded_error")` - -### Beta Permission Error - -- `class BetaPermissionError:` - - - `String message` - - - `JsonValue; type "permission_error"constant` - - - `PERMISSION_ERROR("permission_error")` - -### Beta Rate Limit Error - -- `class BetaRateLimitError:` - - - `String message` - - - `JsonValue; type "rate_limit_error"constant` - - - `RATE_LIMIT_ERROR("rate_limit_error")` - -# Models - -## List - -`ModelListPage beta().models().list(ModelListParamsparams = ModelListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` - -**get** `/v1/models` - -List available models. - -The Models API response can be used to determine which models are available for use in the API. More recently released models are listed first. - -### Parameters - -- `ModelListParams params` - - - `Optional afterId` - - ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object. - - - `Optional beforeId` - - ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object. - - - `Optional limit` - - Number of items to return per page. - - Defaults to `20`. Ranges from `1` to `1000`. - - - `Optional> betas` - - Optional header to specify the beta version(s) you want to use. - - - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` - - - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` - - - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` - - - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` - - - `PDFS_2024_09_25("pdfs-2024-09-25")` - - - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` - - - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` - - - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` - - - `FILES_API_2025_04_14("files-api-2025-04-14")` - - - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` - - - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` - - - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` - - - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` - - - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` - - - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` - - - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` - - - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` - - - `SKILLS_2025_10_02("skills-2025-10-02")` - - - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` - - - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - -### Returns - -- `class BetaModelInfo:` - - - `String id` - - Unique model identifier. - - - `Optional capabilities` - - Model capability information. - - - `BetaCapabilitySupport batch` - - Whether the model supports the Batch API. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport citations` - - Whether the model supports citation generation. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport codeExecution` - - Whether the model supports code execution tools. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaContextManagementCapability contextManagement` - - Context management support and available strategies. - - - `Optional clearThinking20251015` - - Indicates whether a capability is supported. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `Optional clearToolUses20250919` - - Indicates whether a capability is supported. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `Optional compact20260112` - - Indicates whether a capability is supported. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaEffortCapability effort` - - Effort (reasoning_effort) support and available levels. - - - `BetaCapabilitySupport high` - - Whether the model supports high effort level. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport low` - - Whether the model supports low effort level. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport max` - - Whether the model supports max effort level. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport medium` - - Whether the model supports medium effort level. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport imageInput` - - Whether the model accepts image content blocks. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport pdfInput` - - Whether the model accepts PDF content blocks. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport structuredOutputs` - - Whether the model supports structured output / JSON mode / strict tool schemas. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaThinkingCapability thinking` - - Thinking capability and supported type configurations. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaThinkingTypes types` - - Supported thinking type configurations. - - - `BetaCapabilitySupport adaptive` - - Whether the model supports thinking with type 'adaptive' (auto). - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport enabled` - - Whether the model supports thinking with type 'enabled'. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `LocalDateTime createdAt` - - RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown. - - - `String displayName` - - A human-readable name for the model. - - - `Optional maxInputTokens` - - Maximum input context window size in tokens for this model. - - - `Optional maxTokens` - - Maximum value for the `max_tokens` parameter when using this model. - - - `JsonValue; type "model"constant` - - Object type. - - For Models, this is always `"model"`. - - - `MODEL("model")` - -### Example - -```java -package com.anthropic.example; - -import com.anthropic.client.AnthropicClient; -import com.anthropic.client.okhttp.AnthropicOkHttpClient; -import com.anthropic.models.beta.models.ModelListPage; -import com.anthropic.models.beta.models.ModelListParams; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - AnthropicClient client = AnthropicOkHttpClient.fromEnv(); - - ModelListPage page = client.beta().models().list(); - } -} -``` - -## Retrieve - -`BetaModelInfo beta().models().retrieve(ModelRetrieveParamsparams = ModelRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` - -**get** `/v1/models/{model_id}` - -Get a specific model. - -The Models API response can be used to determine information about a specific model or resolve a model alias to a model ID. - -### Parameters - -- `ModelRetrieveParams params` - - - `Optional modelId` - - Model identifier or alias. - - - `Optional> betas` - - Optional header to specify the beta version(s) you want to use. - - - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` - - - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` - - - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` - - - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` - - - `PDFS_2024_09_25("pdfs-2024-09-25")` - - - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` - - - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` - - - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` - - - `FILES_API_2025_04_14("files-api-2025-04-14")` - - - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` - - - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` - - - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` - - - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` - - - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` - - - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` - - - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` - - - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` - - - `SKILLS_2025_10_02("skills-2025-10-02")` - - - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` - - - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - -### Returns - -- `class BetaModelInfo:` - - - `String id` - - Unique model identifier. - - - `Optional capabilities` - - Model capability information. - - - `BetaCapabilitySupport batch` - - Whether the model supports the Batch API. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport citations` - - Whether the model supports citation generation. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport codeExecution` - - Whether the model supports code execution tools. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaContextManagementCapability contextManagement` - - Context management support and available strategies. - - - `Optional clearThinking20251015` - - Indicates whether a capability is supported. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `Optional clearToolUses20250919` - - Indicates whether a capability is supported. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `Optional compact20260112` - - Indicates whether a capability is supported. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaEffortCapability effort` - - Effort (reasoning_effort) support and available levels. - - - `BetaCapabilitySupport high` - - Whether the model supports high effort level. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport low` - - Whether the model supports low effort level. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport max` - - Whether the model supports max effort level. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport medium` - - Whether the model supports medium effort level. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport imageInput` - - Whether the model accepts image content blocks. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport pdfInput` - - Whether the model accepts PDF content blocks. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport structuredOutputs` - - Whether the model supports structured output / JSON mode / strict tool schemas. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaThinkingCapability thinking` - - Thinking capability and supported type configurations. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaThinkingTypes types` - - Supported thinking type configurations. - - - `BetaCapabilitySupport adaptive` - - Whether the model supports thinking with type 'adaptive' (auto). - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport enabled` - - Whether the model supports thinking with type 'enabled'. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `LocalDateTime createdAt` - - RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown. - - - `String displayName` - - A human-readable name for the model. - - - `Optional maxInputTokens` - - Maximum input context window size in tokens for this model. - - - `Optional maxTokens` - - Maximum value for the `max_tokens` parameter when using this model. - - - `JsonValue; type "model"constant` - - Object type. - - For Models, this is always `"model"`. - - - `MODEL("model")` - -### Example - -```java -package com.anthropic.example; - -import com.anthropic.client.AnthropicClient; -import com.anthropic.client.okhttp.AnthropicOkHttpClient; -import com.anthropic.models.beta.models.BetaModelInfo; -import com.anthropic.models.beta.models.ModelRetrieveParams; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - AnthropicClient client = AnthropicOkHttpClient.fromEnv(); - - BetaModelInfo betaModelInfo = client.beta().models().retrieve("model_id"); - } -} -``` - -## Domain Types - -### Beta Capability Support - -- `class BetaCapabilitySupport:` - - Indicates whether a capability is supported. - - - `boolean supported` - - Whether this capability is supported by the model. - -### Beta Context Management Capability - -- `class BetaContextManagementCapability:` - - Context management capability details. - - - `Optional clearThinking20251015` - - Indicates whether a capability is supported. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `Optional clearToolUses20250919` - - Indicates whether a capability is supported. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `Optional compact20260112` - - Indicates whether a capability is supported. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `boolean supported` - - Whether this capability is supported by the model. - -### Beta Effort Capability - -- `class BetaEffortCapability:` - - Effort (reasoning_effort) capability details. - - - `BetaCapabilitySupport high` - - Whether the model supports high effort level. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport low` - - Whether the model supports low effort level. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport max` - - Whether the model supports max effort level. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport medium` - - Whether the model supports medium effort level. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `boolean supported` - - Whether this capability is supported by the model. - -### Beta Model Capabilities - -- `class BetaModelCapabilities:` - - Model capability information. - - - `BetaCapabilitySupport batch` - - Whether the model supports the Batch API. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport citations` - - Whether the model supports citation generation. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport codeExecution` - - Whether the model supports code execution tools. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaContextManagementCapability contextManagement` - - Context management support and available strategies. - - - `Optional clearThinking20251015` - - Indicates whether a capability is supported. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `Optional clearToolUses20250919` - - Indicates whether a capability is supported. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `Optional compact20260112` - - Indicates whether a capability is supported. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaEffortCapability effort` - - Effort (reasoning_effort) support and available levels. - - - `BetaCapabilitySupport high` - - Whether the model supports high effort level. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport low` - - Whether the model supports low effort level. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport max` - - Whether the model supports max effort level. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport medium` - - Whether the model supports medium effort level. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport imageInput` - - Whether the model accepts image content blocks. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport pdfInput` - - Whether the model accepts PDF content blocks. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport structuredOutputs` - - Whether the model supports structured output / JSON mode / strict tool schemas. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaThinkingCapability thinking` - - Thinking capability and supported type configurations. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaThinkingTypes types` - - Supported thinking type configurations. - - - `BetaCapabilitySupport adaptive` - - Whether the model supports thinking with type 'adaptive' (auto). - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport enabled` - - Whether the model supports thinking with type 'enabled'. - - - `boolean supported` - - Whether this capability is supported by the model. - -### Beta Model Info - -- `class BetaModelInfo:` - - - `String id` - - Unique model identifier. - - - `Optional capabilities` - - Model capability information. - - - `BetaCapabilitySupport batch` - - Whether the model supports the Batch API. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport citations` - - Whether the model supports citation generation. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport codeExecution` - - Whether the model supports code execution tools. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaContextManagementCapability contextManagement` - - Context management support and available strategies. - - - `Optional clearThinking20251015` - - Indicates whether a capability is supported. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `Optional clearToolUses20250919` - - Indicates whether a capability is supported. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `Optional compact20260112` - - Indicates whether a capability is supported. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaEffortCapability effort` - - Effort (reasoning_effort) support and available levels. - - - `BetaCapabilitySupport high` - - Whether the model supports high effort level. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport low` - - Whether the model supports low effort level. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport max` - - Whether the model supports max effort level. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport medium` - - Whether the model supports medium effort level. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport imageInput` - - Whether the model accepts image content blocks. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport pdfInput` - - Whether the model accepts PDF content blocks. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport structuredOutputs` - - Whether the model supports structured output / JSON mode / strict tool schemas. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaThinkingCapability thinking` - - Thinking capability and supported type configurations. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaThinkingTypes types` - - Supported thinking type configurations. - - - `BetaCapabilitySupport adaptive` - - Whether the model supports thinking with type 'adaptive' (auto). - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport enabled` - - Whether the model supports thinking with type 'enabled'. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `LocalDateTime createdAt` - - RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown. - - - `String displayName` - - A human-readable name for the model. - - - `Optional maxInputTokens` - - Maximum input context window size in tokens for this model. - - - `Optional maxTokens` - - Maximum value for the `max_tokens` parameter when using this model. - - - `JsonValue; type "model"constant` - - Object type. - - For Models, this is always `"model"`. - - - `MODEL("model")` - -### Beta Thinking Capability - -- `class BetaThinkingCapability:` - - Thinking capability details. - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaThinkingTypes types` - - Supported thinking type configurations. - - - `BetaCapabilitySupport adaptive` - - Whether the model supports thinking with type 'adaptive' (auto). - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport enabled` - - Whether the model supports thinking with type 'enabled'. - - - `boolean supported` - - Whether this capability is supported by the model. - -### Beta Thinking Types - -- `class BetaThinkingTypes:` - - Supported thinking type configurations. - - - `BetaCapabilitySupport adaptive` - - Whether the model supports thinking with type 'adaptive' (auto). - - - `boolean supported` - - Whether this capability is supported by the model. - - - `BetaCapabilitySupport enabled` - - Whether the model supports thinking with type 'enabled'. - - - `boolean supported` - - Whether this capability is supported by the model. - -# Messages - -## Create - -`BetaMessage beta().messages().create(MessageCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` - -**post** `/v1/messages` - -Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation. - -The Messages API can be used for either single queries or stateless multi-turn conversations. - -Learn more about the Messages API in our [user guide](https://docs.claude.com/en/docs/initial-setup) - -### Parameters - -- `MessageCreateParams params` - - - `Optional> betas` - - Optional header to specify the beta version(s) you want to use. - - - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` - - - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` - - - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` - - - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` - - - `PDFS_2024_09_25("pdfs-2024-09-25")` - - - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` - - - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` - - - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` - - - `FILES_API_2025_04_14("files-api-2025-04-14")` - - - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` - - - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` - - - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` - - - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` - - - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` - - - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` - - - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` - - - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` - - - `SKILLS_2025_10_02("skills-2025-10-02")` - - - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` - - - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - - - `long maxTokens` - - The maximum number of tokens to generate before stopping. - - Note that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate. - - Different models have different maximum values for this parameter. See [models](https://docs.claude.com/en/docs/models-overview) for details. - - - `List messages` - - Input messages. - - Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn. - - Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages. - - If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response. - - Example with a single `user` message: - - ```json - [{"role": "user", "content": "Hello, Claude"}] - ``` - - Example with multiple conversational turns: - - ```json - [ - {"role": "user", "content": "Hello there."}, - {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"}, - {"role": "user", "content": "Can you explain LLMs in plain English?"}, - ] - ``` - - Example with a partially-filled response from Claude: - - ```json - [ - {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, - {"role": "assistant", "content": "The best answer is ("}, - ] - ``` - - Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent: - - ```json - {"role": "user", "content": "Hello, Claude"} - ``` - - ```json - {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]} - ``` - - See [input examples](https://docs.claude.com/en/api/messages-examples). - - Note that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. - - There is a limit of 100,000 messages in a single request. - - - `Content content` - - - `String` - - - `List` - - - `class BetaTextBlockParam:` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `class BetaImageBlockParam:` - - - `Source source` - - - `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "image"constant` - - - `IMAGE("image")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaRequestDocumentBlock:` - - - `Source source` - - - `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `class BetaContentBlockSource:` - - - `Content content` - - - `String` - - - `List` - - - `class BetaTextBlockParam:` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `class BetaImageBlockParam:` - - - `Source source` - - - `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "image"constant` - - - `IMAGE("image")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `JsonValue; type "content"constant` - - - `CONTENT("content")` - - - `class BetaUrlPdfSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileDocumentSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "document"constant` - - - `DOCUMENT("document")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - - `Optional enabled` - - - `Optional context` - - - `Optional title` - - - `class BetaSearchResultBlockParam:` - - - `List content` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String source` - - - `String title` - - - `JsonValue; type "search_result"constant` - - - `SEARCH_RESULT("search_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - - `Optional enabled` - - - `class BetaThinkingBlockParam:` - - - `String signature` - - - `String thinking` - - - `JsonValue; type "thinking"constant` - - - `THINKING("thinking")` - - - `class BetaRedactedThinkingBlockParam:` - - - `String data` - - - `JsonValue; type "redacted_thinking"constant` - - - `REDACTED_THINKING("redacted_thinking")` - - - `class BetaToolUseBlockParam:` - - - `String id` - - - `Input input` - - - `String name` - - - `JsonValue; type "tool_use"constant` - - - `TOOL_USE("tool_use")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaToolResultBlockParam:` - - - `String toolUseId` - - - `JsonValue; type "tool_result"constant` - - - `TOOL_RESULT("tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional content` - - - `String` - - - `List` - - - `class BetaTextBlockParam:` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `class BetaImageBlockParam:` - - - `Source source` - - - `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "image"constant` - - - `IMAGE("image")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaSearchResultBlockParam:` - - - `List content` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String source` - - - `String title` - - - `JsonValue; type "search_result"constant` - - - `SEARCH_RESULT("search_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - - `Optional enabled` - - - `class BetaRequestDocumentBlock:` - - - `Source source` - - - `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `class BetaContentBlockSource:` - - - `Content content` - - - `String` - - - `List` - - - `class BetaTextBlockParam:` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `class BetaImageBlockParam:` - - - `Source source` - - - `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "image"constant` - - - `IMAGE("image")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `JsonValue; type "content"constant` - - - `CONTENT("content")` - - - `class BetaUrlPdfSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileDocumentSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "document"constant` - - - `DOCUMENT("document")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - - `Optional enabled` - - - `Optional context` - - - `Optional title` - - - `class BetaToolReferenceBlockParam:` - - Tool reference block that can be included in tool_result content. - - - `String toolName` - - - `JsonValue; type "tool_reference"constant` - - - `TOOL_REFERENCE("tool_reference")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional isError` - - - `class BetaServerToolUseBlockParam:` - - - `String id` - - - `Input input` - - - `Name name` - - - `WEB_SEARCH("web_search")` - - - `WEB_FETCH("web_fetch")` - - - `CODE_EXECUTION("code_execution")` - - - `BASH_CODE_EXECUTION("bash_code_execution")` - - - `TEXT_EDITOR_CODE_EXECUTION("text_editor_code_execution")` - - - `TOOL_SEARCH_TOOL_REGEX("tool_search_tool_regex")` - - - `TOOL_SEARCH_TOOL_BM25("tool_search_tool_bm25")` - - - `JsonValue; type "server_tool_use"constant` - - - `SERVER_TOOL_USE("server_tool_use")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaWebSearchToolResultBlockParam:` - - - `BetaWebSearchToolResultBlockParamContent content` - - - `List` - - - `String encryptedContent` - - - `String title` - - - `JsonValue; type "web_search_result"constant` - - - `WEB_SEARCH_RESULT("web_search_result")` - - - `String url` - - - `Optional pageAge` - - - `class BetaWebSearchToolRequestError:` - - - `BetaWebSearchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `QUERY_TOO_LONG("query_too_long")` - - - `REQUEST_TOO_LARGE("request_too_large")` - - - `JsonValue; type "web_search_tool_result_error"constant` - - - `WEB_SEARCH_TOOL_RESULT_ERROR("web_search_tool_result_error")` - - - `String toolUseId` - - - `JsonValue; type "web_search_tool_result"constant` - - - `WEB_SEARCH_TOOL_RESULT("web_search_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaWebFetchToolResultBlockParam:` - - - `Content content` - - - `class BetaWebFetchToolResultErrorBlockParam:` - - - `BetaWebFetchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `URL_TOO_LONG("url_too_long")` - - - `URL_NOT_ALLOWED("url_not_allowed")` - - - `URL_NOT_ACCESSIBLE("url_not_accessible")` - - - `UNSUPPORTED_CONTENT_TYPE("unsupported_content_type")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `UNAVAILABLE("unavailable")` - - - `JsonValue; type "web_fetch_tool_result_error"constant` - - - `WEB_FETCH_TOOL_RESULT_ERROR("web_fetch_tool_result_error")` - - - `class BetaWebFetchBlockParam:` - - - `BetaRequestDocumentBlock content` - - - `Source source` - - - `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `class BetaContentBlockSource:` - - - `Content content` - - - `String` - - - `List` - - - `class BetaTextBlockParam:` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `class BetaImageBlockParam:` - - - `Source source` - - - `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "image"constant` - - - `IMAGE("image")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `JsonValue; type "content"constant` - - - `CONTENT("content")` - - - `class BetaUrlPdfSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileDocumentSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "document"constant` - - - `DOCUMENT("document")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - - `Optional enabled` - - - `Optional context` - - - `Optional title` - - - `JsonValue; type "web_fetch_result"constant` - - - `WEB_FETCH_RESULT("web_fetch_result")` - - - `String url` - - Fetched content URL - - - `Optional retrievedAt` - - ISO 8601 timestamp when the content was retrieved - - - `String toolUseId` - - - `JsonValue; type "web_fetch_tool_result"constant` - - - `WEB_FETCH_TOOL_RESULT("web_fetch_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaCodeExecutionToolResultBlockParam:` - - - `BetaCodeExecutionToolResultBlockParamContent content` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `class BetaCodeExecutionToolResultErrorParam:` - - - `BetaCodeExecutionToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `JsonValue; type "code_execution_tool_result_error"constant` - - - `CODE_EXECUTION_TOOL_RESULT_ERROR("code_execution_tool_result_error")` - - - `class BetaCodeExecutionResultBlockParam:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "code_execution_result"constant` - - - `CODE_EXECUTION_RESULT("code_execution_result")` - - - `class BetaEncryptedCodeExecutionResultBlockParam:` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `String encryptedStdout` - - - `long returnCode` - - - `String stderr` - - - `JsonValue; type "encrypted_code_execution_result"constant` - - - `ENCRYPTED_CODE_EXECUTION_RESULT("encrypted_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "code_execution_tool_result"constant` - - - `CODE_EXECUTION_TOOL_RESULT("code_execution_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaBashCodeExecutionToolResultBlockParam:` - - - `Content content` - - - `class BetaBashCodeExecutionToolResultErrorParam:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `OUTPUT_FILE_TOO_LARGE("output_file_too_large")` - - - `JsonValue; type "bash_code_execution_tool_result_error"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT_ERROR("bash_code_execution_tool_result_error")` - - - `class BetaBashCodeExecutionResultBlockParam:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "bash_code_execution_output"constant` - - - `BASH_CODE_EXECUTION_OUTPUT("bash_code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "bash_code_execution_result"constant` - - - `BASH_CODE_EXECUTION_RESULT("bash_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "bash_code_execution_tool_result"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT("bash_code_execution_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaTextEditorCodeExecutionToolResultBlockParam:` - - - `Content content` - - - `class BetaTextEditorCodeExecutionToolResultErrorParam:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `FILE_NOT_FOUND("file_not_found")` - - - `JsonValue; type "text_editor_code_execution_tool_result_error"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT_ERROR("text_editor_code_execution_tool_result_error")` - - - `Optional errorMessage` - - - `class BetaTextEditorCodeExecutionViewResultBlockParam:` - - - `String content` - - - `FileType fileType` - - - `TEXT("text")` - - - `IMAGE("image")` - - - `PDF("pdf")` - - - `JsonValue; type "text_editor_code_execution_view_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_VIEW_RESULT("text_editor_code_execution_view_result")` - - - `Optional numLines` - - - `Optional startLine` - - - `Optional totalLines` - - - `class BetaTextEditorCodeExecutionCreateResultBlockParam:` - - - `boolean isFileUpdate` - - - `JsonValue; type "text_editor_code_execution_create_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_CREATE_RESULT("text_editor_code_execution_create_result")` - - - `class BetaTextEditorCodeExecutionStrReplaceResultBlockParam:` - - - `JsonValue; type "text_editor_code_execution_str_replace_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_STR_REPLACE_RESULT("text_editor_code_execution_str_replace_result")` - - - `Optional> lines` - - - `Optional newLines` - - - `Optional newStart` - - - `Optional oldLines` - - - `Optional oldStart` - - - `String toolUseId` - - - `JsonValue; type "text_editor_code_execution_tool_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT("text_editor_code_execution_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaToolSearchToolResultBlockParam:` - - - `Content content` - - - `class BetaToolSearchToolResultErrorParam:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `JsonValue; type "tool_search_tool_result_error"constant` - - - `TOOL_SEARCH_TOOL_RESULT_ERROR("tool_search_tool_result_error")` - - - `class BetaToolSearchToolSearchResultBlockParam:` - - - `List toolReferences` - - - `String toolName` - - - `JsonValue; type "tool_reference"constant` - - - `TOOL_REFERENCE("tool_reference")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `JsonValue; type "tool_search_tool_search_result"constant` - - - `TOOL_SEARCH_TOOL_SEARCH_RESULT("tool_search_tool_search_result")` - - - `String toolUseId` - - - `JsonValue; type "tool_search_tool_result"constant` - - - `TOOL_SEARCH_TOOL_RESULT("tool_search_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaMcpToolUseBlockParam:` - - - `String id` - - - `Input input` - - - `String name` - - - `String serverName` - - The name of the MCP server - - - `JsonValue; type "mcp_tool_use"constant` - - - `MCP_TOOL_USE("mcp_tool_use")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaRequestMcpToolResultBlockParam:` - - - `String toolUseId` - - - `JsonValue; type "mcp_tool_result"constant` - - - `MCP_TOOL_RESULT("mcp_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional content` - - - `String` - - - `List` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `Optional isError` - - - `class BetaContainerUploadBlockParam:` - - A content block that represents a file to be uploaded to the container - Files uploaded via this block will be available in the container's input directory. - - - `String fileId` - - - `JsonValue; type "container_upload"constant` - - - `CONTAINER_UPLOAD("container_upload")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaCompactionBlockParam:` - - A compaction block containing summary of previous context. - - Users should round-trip these blocks from responses to subsequent requests - to maintain context across compaction boundaries. - - When content is None, the block represents a failed compaction. The server - treats these as no-ops. Empty string content is not allowed. - - - `Optional content` - - Summary of previously compacted content, or null if compaction failed - - - `JsonValue; type "compaction"constant` - - - `COMPACTION("compaction")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Role role` - - - `USER("user")` - - - `ASSISTANT("assistant")` - - - `Model model` - - The model that will complete your prompt. - - See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - - `Optional cacheControl` - - Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request. - - - `Optional container` - - Container identifier for reuse across requests. - - - `class BetaContainerParams:` - - Container parameters with skills to be loaded. - - - `Optional id` - - Container id - - - `Optional> skills` - - List of skills to load in the container - - - `String skillId` - - Skill ID - - - `Type type` - - Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) - - - `ANTHROPIC("anthropic")` - - - `CUSTOM("custom")` - - - `Optional version` - - Skill version or 'latest' for most recent version - - - `String` - - - `Optional contextManagement` - - Context management configuration. - - This allows you to control how Claude manages context across multiple requests, such as whether to clear function results or not. - - - `Optional inferenceGeo` - - Specifies the geographic region for inference processing. If not specified, the workspace's `default_inference_geo` is used. - - - `Optional> mcpServers` - - MCP servers to be utilized in this request - - - `String name` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `Optional authorizationToken` - - - `Optional toolConfiguration` - - - `Optional> allowedTools` - - - `Optional enabled` - - - `Optional metadata` - - An object describing metadata about the request. - - - `Optional outputConfig` - - Configuration options for the model's output, such as the output format. - - - `Optional outputFormat` - - Deprecated: Use `output_config.format` instead. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) - - A schema to specify Claude's output format in responses. This parameter will be removed in a future release. - - - `Optional serviceTier` - - Determines whether to use priority capacity (if available) or standard capacity for this request. - - Anthropic offers different levels of service for your API requests. See [service-tiers](https://docs.claude.com/en/api/service-tiers) for details. - - - `AUTO("auto")` - - - `STANDARD_ONLY("standard_only")` - - - `Optional speed` - - The inference speed mode for this request. `"fast"` enables high output-tokens-per-second inference. - - - `STANDARD("standard")` - - - `FAST("fast")` - - - `Optional> stopSequences` - - Custom text sequences that will cause the model to stop generating. - - Our models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `"end_turn"`. - - If you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `"stop_sequence"` and the response `stop_sequence` value will contain the matched stop sequence. - - - `Optional system` - - System prompt. - - A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts). - - - `String` - - - `List` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `Optional temperature` - - Amount of randomness injected into the response. - - Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks. - - Note that even with `temperature` of `0.0`, the results will not be fully deterministic. - - - `Optional thinking` - - Configuration for enabling Claude's extended thinking. - - When enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit. - - See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details. - - - `Optional toolChoice` - - How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all. - - - `Optional> tools` - - Definitions of tools that the model may use. - - If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks. - - There are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)). - - Each tool definition includes: - - * `name`: Name of the tool. - * `description`: Optional, but strongly-recommended description of the tool. - * `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks. - - For example, if you defined `tools` as: - - ```json - [ - { - "name": "get_stock_price", - "description": "Get the current stock price for a given ticker symbol.", - "input_schema": { - "type": "object", - "properties": { - "ticker": { - "type": "string", - "description": "The stock ticker symbol, e.g. AAPL for Apple Inc." - } - }, - "required": ["ticker"] - } - } - ] - ``` - - And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this: - - ```json - [ - { - "type": "tool_use", - "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", - "name": "get_stock_price", - "input": { "ticker": "^GSPC" } - } - ] - ``` - - You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message: - - ```json - [ - { - "type": "tool_result", - "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", - "content": "259.75 USD" - } - ] - ``` - - Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output. - - See our [guide](https://docs.claude.com/en/docs/tool-use) for more details. - - - `class BetaTool:` - - - `InputSchema inputSchema` - - [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input. - - This defines the shape of the `input` that your tool accepts and that the model will produce. - - - `JsonValue; type "object"constant` - - - `OBJECT("object")` - - - `Optional properties` - - - `Optional> required` - - - `String name` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional description` - - Description of what this tool does. - - Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema. - - - `Optional eagerInputStreaming` - - Enable eager input streaming for this tool. When true, tool input parameters will be streamed incrementally as they are generated, and types will be inferred on-the-fly rather than buffering the full JSON output. When false, streaming is disabled for this tool even if the fine-grained-tool-streaming beta is active. When null (default), uses the default behavior based on beta headers. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `Optional type` - - - `CUSTOM("custom")` - - - `class BetaToolBash20241022:` - - - `JsonValue; name "bash"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `BASH("bash")` - - - `JsonValue; type "bash_20241022"constant` - - - `BASH_20241022("bash_20241022")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolBash20250124:` - - - `JsonValue; name "bash"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `BASH("bash")` - - - `JsonValue; type "bash_20250124"constant` - - - `BASH_20250124("bash_20250124")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaCodeExecutionTool20250522:` - - - `JsonValue; name "code_execution"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `CODE_EXECUTION("code_execution")` - - - `JsonValue; type "code_execution_20250522"constant` - - - `CODE_EXECUTION_20250522("code_execution_20250522")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaCodeExecutionTool20250825:` - - - `JsonValue; name "code_execution"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `CODE_EXECUTION("code_execution")` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaCodeExecutionTool20260120:` - - Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint). - - - `JsonValue; name "code_execution"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `CODE_EXECUTION("code_execution")` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolComputerUse20241022:` - - - `long displayHeightPx` - - The height of the display in pixels. - - - `long displayWidthPx` - - The width of the display in pixels. - - - `JsonValue; name "computer"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `COMPUTER("computer")` - - - `JsonValue; type "computer_20241022"constant` - - - `COMPUTER_20241022("computer_20241022")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional displayNumber` - - The X11 display number (e.g. 0, 1) for the display. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaMemoryTool20250818:` - - - `JsonValue; name "memory"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `MEMORY("memory")` - - - `JsonValue; type "memory_20250818"constant` - - - `MEMORY_20250818("memory_20250818")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolComputerUse20250124:` - - - `long displayHeightPx` - - The height of the display in pixels. - - - `long displayWidthPx` - - The width of the display in pixels. - - - `JsonValue; name "computer"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `COMPUTER("computer")` - - - `JsonValue; type "computer_20250124"constant` - - - `COMPUTER_20250124("computer_20250124")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional displayNumber` - - The X11 display number (e.g. 0, 1) for the display. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolTextEditor20241022:` - - - `JsonValue; name "str_replace_editor"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `STR_REPLACE_EDITOR("str_replace_editor")` - - - `JsonValue; type "text_editor_20241022"constant` - - - `TEXT_EDITOR_20241022("text_editor_20241022")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolComputerUse20251124:` - - - `long displayHeightPx` - - The height of the display in pixels. - - - `long displayWidthPx` - - The width of the display in pixels. - - - `JsonValue; name "computer"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `COMPUTER("computer")` - - - `JsonValue; type "computer_20251124"constant` - - - `COMPUTER_20251124("computer_20251124")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional displayNumber` - - The X11 display number (e.g. 0, 1) for the display. - - - `Optional enableZoom` - - Whether to enable an action to take a zoomed-in screenshot of the screen. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolTextEditor20250124:` - - - `JsonValue; name "str_replace_editor"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `STR_REPLACE_EDITOR("str_replace_editor")` - - - `JsonValue; type "text_editor_20250124"constant` - - - `TEXT_EDITOR_20250124("text_editor_20250124")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolTextEditor20250429:` - - - `JsonValue; name "str_replace_based_edit_tool"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `STR_REPLACE_BASED_EDIT_TOOL("str_replace_based_edit_tool")` - - - `JsonValue; type "text_editor_20250429"constant` - - - `TEXT_EDITOR_20250429("text_editor_20250429")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolTextEditor20250728:` - - - `JsonValue; name "str_replace_based_edit_tool"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `STR_REPLACE_BASED_EDIT_TOOL("str_replace_based_edit_tool")` - - - `JsonValue; type "text_editor_20250728"constant` - - - `TEXT_EDITOR_20250728("text_editor_20250728")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional maxCharacters` - - Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaWebSearchTool20250305:` - - - `JsonValue; name "web_search"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `WEB_SEARCH("web_search")` - - - `JsonValue; type "web_search_20250305"constant` - - - `WEB_SEARCH_20250305("web_search_20250305")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional> allowedDomains` - - If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`. - - - `Optional> blockedDomains` - - If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`. - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional maxUses` - - Maximum number of times the tool can be used in the API request. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `Optional userLocation` - - Parameters for the user's location. Used to provide more relevant search results. - - - `JsonValue; type "approximate"constant` - - - `APPROXIMATE("approximate")` - - - `Optional city` - - The city of the user. - - - `Optional country` - - The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user. - - - `Optional region` - - The region of the user. - - - `Optional timezone` - - The [IANA timezone](https://nodatime.org/TimeZones) of the user. - - - `class BetaWebFetchTool20250910:` - - - `JsonValue; name "web_fetch"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `WEB_FETCH("web_fetch")` - - - `JsonValue; type "web_fetch_20250910"constant` - - - `WEB_FETCH_20250910("web_fetch_20250910")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional> allowedDomains` - - List of domains to allow fetching from - - - `Optional> blockedDomains` - - List of domains to block fetching from - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - Citations configuration for fetched documents. Citations are disabled by default. - - - `Optional enabled` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional maxContentTokens` - - Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. - - - `Optional maxUses` - - Maximum number of times the tool can be used in the API request. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaWebSearchTool20260209:` - - - `JsonValue; name "web_search"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `WEB_SEARCH("web_search")` - - - `JsonValue; type "web_search_20260209"constant` - - - `WEB_SEARCH_20260209("web_search_20260209")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional> allowedDomains` - - If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`. - - - `Optional> blockedDomains` - - If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`. - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional maxUses` - - Maximum number of times the tool can be used in the API request. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `Optional userLocation` - - Parameters for the user's location. Used to provide more relevant search results. - - - `JsonValue; type "approximate"constant` - - - `APPROXIMATE("approximate")` - - - `Optional city` - - The city of the user. - - - `Optional country` - - The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user. - - - `Optional region` - - The region of the user. - - - `Optional timezone` - - The [IANA timezone](https://nodatime.org/TimeZones) of the user. - - - `class BetaWebFetchTool20260209:` - - - `JsonValue; name "web_fetch"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `WEB_FETCH("web_fetch")` - - - `JsonValue; type "web_fetch_20260209"constant` - - - `WEB_FETCH_20260209("web_fetch_20260209")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional> allowedDomains` - - List of domains to allow fetching from - - - `Optional> blockedDomains` - - List of domains to block fetching from - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - Citations configuration for fetched documents. Citations are disabled by default. - - - `Optional enabled` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional maxContentTokens` - - Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. - - - `Optional maxUses` - - Maximum number of times the tool can be used in the API request. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaWebFetchTool20260309:` - - Web fetch tool with use_cache parameter for bypassing cached content. - - - `JsonValue; name "web_fetch"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `WEB_FETCH("web_fetch")` - - - `JsonValue; type "web_fetch_20260309"constant` - - - `WEB_FETCH_20260309("web_fetch_20260309")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional> allowedDomains` - - List of domains to allow fetching from - - - `Optional> blockedDomains` - - List of domains to block fetching from - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - Citations configuration for fetched documents. Citations are disabled by default. - - - `Optional enabled` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional maxContentTokens` - - Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. - - - `Optional maxUses` - - Maximum number of times the tool can be used in the API request. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `Optional useCache` - - Whether to use cached content. Set to false to bypass the cache and fetch fresh content. Only set to false when the user explicitly requests fresh content or when fetching rapidly-changing sources. - - - `class BetaToolSearchToolBm25_20251119:` - - - `JsonValue; name "tool_search_tool_bm25"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `TOOL_SEARCH_TOOL_BM25("tool_search_tool_bm25")` - - - `Type type` - - - `TOOL_SEARCH_TOOL_BM25_20251119("tool_search_tool_bm25_20251119")` - - - `TOOL_SEARCH_TOOL_BM25("tool_search_tool_bm25")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolSearchToolRegex20251119:` - - - `JsonValue; name "tool_search_tool_regex"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `TOOL_SEARCH_TOOL_REGEX("tool_search_tool_regex")` - - - `Type type` - - - `TOOL_SEARCH_TOOL_REGEX_20251119("tool_search_tool_regex_20251119")` - - - `TOOL_SEARCH_TOOL_REGEX("tool_search_tool_regex")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaMcpToolset:` - - Configuration for a group of tools from an MCP server. - - Allows configuring enabled status and defer_loading for all tools - from an MCP server, with optional per-tool overrides. - - - `String mcpServerName` - - Name of the MCP server to configure tools for - - - `JsonValue; type "mcp_toolset"constant` - - - `MCP_TOOLSET("mcp_toolset")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional configs` - - Configuration overrides for specific tools, keyed by tool name - - - `Optional deferLoading` - - - `Optional enabled` - - - `Optional defaultConfig` - - Default configuration applied to all tools from this server - - - `Optional deferLoading` - - - `Optional enabled` - - - `Optional topK` - - Only sample from the top K options for each subsequent token. - - Used to remove "long tail" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277). - - Recommended for advanced use cases only. You usually only need to use `temperature`. - - - `Optional topP` - - Use nucleus sampling. - - In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both. - - Recommended for advanced use cases only. You usually only need to use `temperature`. - - - `Optional userProfileId` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - -### Returns - -- `class BetaMessage:` - - - `String id` - - Unique object identifier. - - The format and length of IDs may change over time. - - - `Optional container` - - Information about the container used in the request (for the code execution tool) - - - `String id` - - Identifier for the container used in this request - - - `LocalDateTime expiresAt` - - The time at which the container will expire. - - - `Optional> skills` - - Skills loaded in the container - - - `String skillId` - - Skill ID - - - `Type type` - - Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) - - - `ANTHROPIC("anthropic")` - - - `CUSTOM("custom")` - - - `String version` - - Skill version or 'latest' for most recent version - - - `List content` - - Content generated by the model. - - This is an array of content blocks, each of which has a `type` that determines its shape. - - Example: - - ```json - [{"type": "text", "text": "Hi, I'm Claude."}] - ``` - - If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. - - For example, if the input `messages` were: - - ```json - [ - {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, - {"role": "assistant", "content": "The best answer is ("} - ] - ``` - - Then the response `content` might be: - - ```json - [{"type": "text", "text": "B)"}] - ``` - - - `class BetaTextBlock:` - - - `Optional> citations` - - Citations supporting the text block. - - The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. - - - `class BetaCitationCharLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `Optional fileId` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `Optional fileId` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `Optional fileId` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationsWebSearchResultLocation:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocation:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `class BetaThinkingBlock:` - - - `String signature` - - - `String thinking` - - - `JsonValue; type "thinking"constant` - - - `THINKING("thinking")` - - - `class BetaRedactedThinkingBlock:` - - - `String data` - - - `JsonValue; type "redacted_thinking"constant` - - - `REDACTED_THINKING("redacted_thinking")` - - - `class BetaToolUseBlock:` - - - `String id` - - - `Input input` - - - `String name` - - - `JsonValue; type "tool_use"constant` - - - `TOOL_USE("tool_use")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaServerToolUseBlock:` - - - `String id` - - - `Input input` - - - `Name name` - - - `WEB_SEARCH("web_search")` - - - `WEB_FETCH("web_fetch")` - - - `CODE_EXECUTION("code_execution")` - - - `BASH_CODE_EXECUTION("bash_code_execution")` - - - `TEXT_EDITOR_CODE_EXECUTION("text_editor_code_execution")` - - - `TOOL_SEARCH_TOOL_REGEX("tool_search_tool_regex")` - - - `TOOL_SEARCH_TOOL_BM25("tool_search_tool_bm25")` - - - `JsonValue; type "server_tool_use"constant` - - - `SERVER_TOOL_USE("server_tool_use")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaWebSearchToolResultBlock:` - - - `BetaWebSearchToolResultBlockContent content` - - - `class BetaWebSearchToolResultError:` - - - `BetaWebSearchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `QUERY_TOO_LONG("query_too_long")` - - - `REQUEST_TOO_LARGE("request_too_large")` - - - `JsonValue; type "web_search_tool_result_error"constant` - - - `WEB_SEARCH_TOOL_RESULT_ERROR("web_search_tool_result_error")` - - - `List` - - - `String encryptedContent` - - - `Optional pageAge` - - - `String title` - - - `JsonValue; type "web_search_result"constant` - - - `WEB_SEARCH_RESULT("web_search_result")` - - - `String url` - - - `String toolUseId` - - - `JsonValue; type "web_search_tool_result"constant` - - - `WEB_SEARCH_TOOL_RESULT("web_search_tool_result")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaWebFetchToolResultBlock:` - - - `Content content` - - - `class BetaWebFetchToolResultErrorBlock:` - - - `BetaWebFetchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `URL_TOO_LONG("url_too_long")` - - - `URL_NOT_ALLOWED("url_not_allowed")` - - - `URL_NOT_ACCESSIBLE("url_not_accessible")` - - - `UNSUPPORTED_CONTENT_TYPE("unsupported_content_type")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `UNAVAILABLE("unavailable")` - - - `JsonValue; type "web_fetch_tool_result_error"constant` - - - `WEB_FETCH_TOOL_RESULT_ERROR("web_fetch_tool_result_error")` - - - `class BetaWebFetchBlock:` - - - `BetaDocumentBlock content` - - - `Optional citations` - - Citation configuration for the document - - - `boolean enabled` - - - `Source source` - - - `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional title` - - The title of the document - - - `JsonValue; type "document"constant` - - - `DOCUMENT("document")` - - - `Optional retrievedAt` - - ISO 8601 timestamp when the content was retrieved - - - `JsonValue; type "web_fetch_result"constant` - - - `WEB_FETCH_RESULT("web_fetch_result")` - - - `String url` - - Fetched content URL - - - `String toolUseId` - - - `JsonValue; type "web_fetch_tool_result"constant` - - - `WEB_FETCH_TOOL_RESULT("web_fetch_tool_result")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaCodeExecutionToolResultBlock:` - - - `BetaCodeExecutionToolResultBlockContent content` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `class BetaCodeExecutionToolResultError:` - - - `BetaCodeExecutionToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `JsonValue; type "code_execution_tool_result_error"constant` - - - `CODE_EXECUTION_TOOL_RESULT_ERROR("code_execution_tool_result_error")` - - - `class BetaCodeExecutionResultBlock:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "code_execution_result"constant` - - - `CODE_EXECUTION_RESULT("code_execution_result")` - - - `class BetaEncryptedCodeExecutionResultBlock:` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `String encryptedStdout` - - - `long returnCode` - - - `String stderr` - - - `JsonValue; type "encrypted_code_execution_result"constant` - - - `ENCRYPTED_CODE_EXECUTION_RESULT("encrypted_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "code_execution_tool_result"constant` - - - `CODE_EXECUTION_TOOL_RESULT("code_execution_tool_result")` - - - `class BetaBashCodeExecutionToolResultBlock:` - - - `Content content` - - - `class BetaBashCodeExecutionToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `OUTPUT_FILE_TOO_LARGE("output_file_too_large")` - - - `JsonValue; type "bash_code_execution_tool_result_error"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT_ERROR("bash_code_execution_tool_result_error")` - - - `class BetaBashCodeExecutionResultBlock:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "bash_code_execution_output"constant` - - - `BASH_CODE_EXECUTION_OUTPUT("bash_code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "bash_code_execution_result"constant` - - - `BASH_CODE_EXECUTION_RESULT("bash_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "bash_code_execution_tool_result"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT("bash_code_execution_tool_result")` - - - `class BetaTextEditorCodeExecutionToolResultBlock:` - - - `Content content` - - - `class BetaTextEditorCodeExecutionToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `FILE_NOT_FOUND("file_not_found")` - - - `Optional errorMessage` - - - `JsonValue; type "text_editor_code_execution_tool_result_error"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT_ERROR("text_editor_code_execution_tool_result_error")` - - - `class BetaTextEditorCodeExecutionViewResultBlock:` - - - `String content` - - - `FileType fileType` - - - `TEXT("text")` - - - `IMAGE("image")` - - - `PDF("pdf")` - - - `Optional numLines` - - - `Optional startLine` - - - `Optional totalLines` - - - `JsonValue; type "text_editor_code_execution_view_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_VIEW_RESULT("text_editor_code_execution_view_result")` - - - `class BetaTextEditorCodeExecutionCreateResultBlock:` - - - `boolean isFileUpdate` - - - `JsonValue; type "text_editor_code_execution_create_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_CREATE_RESULT("text_editor_code_execution_create_result")` - - - `class BetaTextEditorCodeExecutionStrReplaceResultBlock:` - - - `Optional> lines` - - - `Optional newLines` - - - `Optional newStart` - - - `Optional oldLines` - - - `Optional oldStart` - - - `JsonValue; type "text_editor_code_execution_str_replace_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_STR_REPLACE_RESULT("text_editor_code_execution_str_replace_result")` - - - `String toolUseId` - - - `JsonValue; type "text_editor_code_execution_tool_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT("text_editor_code_execution_tool_result")` - - - `class BetaToolSearchToolResultBlock:` - - - `Content content` - - - `class BetaToolSearchToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `Optional errorMessage` - - - `JsonValue; type "tool_search_tool_result_error"constant` - - - `TOOL_SEARCH_TOOL_RESULT_ERROR("tool_search_tool_result_error")` - - - `class BetaToolSearchToolSearchResultBlock:` - - - `List toolReferences` - - - `String toolName` - - - `JsonValue; type "tool_reference"constant` - - - `TOOL_REFERENCE("tool_reference")` - - - `JsonValue; type "tool_search_tool_search_result"constant` - - - `TOOL_SEARCH_TOOL_SEARCH_RESULT("tool_search_tool_search_result")` - - - `String toolUseId` - - - `JsonValue; type "tool_search_tool_result"constant` - - - `TOOL_SEARCH_TOOL_RESULT("tool_search_tool_result")` - - - `class BetaMcpToolUseBlock:` - - - `String id` - - - `Input input` - - - `String name` - - The name of the MCP tool - - - `String serverName` - - The name of the MCP server - - - `JsonValue; type "mcp_tool_use"constant` - - - `MCP_TOOL_USE("mcp_tool_use")` - - - `class BetaMcpToolResultBlock:` - - - `Content content` - - - `String` - - - `List` - - - `Optional> citations` - - Citations supporting the text block. - - The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. - - - `class BetaCitationCharLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `Optional fileId` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `Optional fileId` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `Optional fileId` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationsWebSearchResultLocation:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocation:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `boolean isError` - - - `String toolUseId` - - - `JsonValue; type "mcp_tool_result"constant` - - - `MCP_TOOL_RESULT("mcp_tool_result")` - - - `class BetaContainerUploadBlock:` - - Response model for a file uploaded to the container. - - - `String fileId` - - - `JsonValue; type "container_upload"constant` - - - `CONTAINER_UPLOAD("container_upload")` - - - `class BetaCompactionBlock:` - - A compaction block returned when autocompact is triggered. - - When content is None, it indicates the compaction failed to produce a valid - summary (e.g., malformed output from the model). Clients may round-trip - compaction blocks with null content; the server treats them as no-ops. - - - `Optional content` - - Summary of compacted content, or null if compaction failed - - - `JsonValue; type "compaction"constant` - - - `COMPACTION("compaction")` - - - `Optional contextManagement` - - Context management response. - - Information about context management strategies applied during the request. - - - `List appliedEdits` - - List of context management edits that were applied. - - - `class BetaClearToolUses20250919EditResponse:` - - - `long clearedInputTokens` - - Number of input tokens cleared by this edit. - - - `long clearedToolUses` - - Number of tool uses that were cleared. - - - `JsonValue; type "clear_tool_uses_20250919"constant` - - The type of context management edit applied. - - - `CLEAR_TOOL_USES_20250919("clear_tool_uses_20250919")` - - - `class BetaClearThinking20251015EditResponse:` - - - `long clearedInputTokens` - - Number of input tokens cleared by this edit. - - - `long clearedThinkingTurns` - - Number of thinking turns that were cleared. - - - `JsonValue; type "clear_thinking_20251015"constant` - - The type of context management edit applied. - - - `CLEAR_THINKING_20251015("clear_thinking_20251015")` - - - `Model model` - - The model that will complete your prompt. - - See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - - Most intelligent model for building agents and coding - - - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` - - Best combination of speed and intelligence - - - `CLAUDE_HAIKU_4_5("claude-haiku-4-5")` - - Fastest model with near-frontier intelligence - - - `CLAUDE_HAIKU_4_5_20251001("claude-haiku-4-5-20251001")` - - Fastest model with near-frontier intelligence - - - `CLAUDE_OPUS_4_5("claude-opus-4-5")` - - Premium model combining maximum intelligence with practical performance - - - `CLAUDE_OPUS_4_5_20251101("claude-opus-4-5-20251101")` - - Premium model combining maximum intelligence with practical performance - - - `CLAUDE_SONNET_4_5("claude-sonnet-4-5")` - - High-performance model for agents and coding - - - `CLAUDE_SONNET_4_5_20250929("claude-sonnet-4-5-20250929")` - - High-performance model for agents and coding - - - `CLAUDE_OPUS_4_1("claude-opus-4-1")` - - Exceptional model for specialized complex tasks - - - `CLAUDE_OPUS_4_1_20250805("claude-opus-4-1-20250805")` - - Exceptional model for specialized complex tasks - - - `CLAUDE_OPUS_4_0("claude-opus-4-0")` - - Powerful model for complex tasks - - - `CLAUDE_OPUS_4_20250514("claude-opus-4-20250514")` - - Powerful model for complex tasks - - - `CLAUDE_SONNET_4_0("claude-sonnet-4-0")` - - High-performance model with extended thinking - - - `CLAUDE_SONNET_4_20250514("claude-sonnet-4-20250514")` - - High-performance model with extended thinking - - - `CLAUDE_3_HAIKU_20240307("claude-3-haiku-20240307")` - - Fast and cost-effective model - - - `JsonValue; role "assistant"constant` - - Conversational role of the generated message. - - This will always be `"assistant"`. - - - `ASSISTANT("assistant")` - - - `Optional stopDetails` - - Structured information about a refusal. - - - `Optional category` - - The policy category that triggered the refusal. - - `null` when the refusal doesn't map to a named category. - - - `CYBER("cyber")` - - - `BIO("bio")` - - - `Optional explanation` - - Human-readable explanation of the refusal. - - This text is not guaranteed to be stable. `null` when no explanation is available for the category. - - - `JsonValue; type "refusal"constant` - - - `REFUSAL("refusal")` - - - `Optional stopReason` - - The reason that we stopped. - - This may be one the following values: - - * `"end_turn"`: the model reached a natural stopping point - * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum - * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated - * `"tool_use"`: the model invoked one or more tools - * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. - * `"refusal"`: when streaming classifiers intervene to handle potential policy violations - - In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. - - - `END_TURN("end_turn")` - - - `MAX_TOKENS("max_tokens")` - - - `STOP_SEQUENCE("stop_sequence")` - - - `TOOL_USE("tool_use")` - - - `PAUSE_TURN("pause_turn")` - - - `COMPACTION("compaction")` - - - `REFUSAL("refusal")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED("model_context_window_exceeded")` - - - `Optional stopSequence` - - Which custom stop sequence was generated, if any. - - This value will be a non-null string if one of your custom stop sequences was generated. - - - `JsonValue; type "message"constant` - - Object type. - - For Messages, this is always `"message"`. - - - `MESSAGE("message")` - - - `BetaUsage usage` - - Billing and rate-limit usage. - - Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. - - Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. - - For example, `output_tokens` will be non-zero, even for an empty string response from Claude. - - Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `Optional cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `Optional cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `Optional inferenceGeo` - - The geographic region where inference was performed for this request. - - - `long inputTokens` - - The number of input tokens which were used. - - - `Optional> iterations` - - Per-iteration token usage breakdown. - - Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: - - - Determine which iterations exceeded long context thresholds (>=200k tokens) - - Calculate the true context window size from the last iteration - - Understand token accumulation across server-side tool use loops - - - `class BetaMessageIterationUsage:` - - Token usage for a sampling iteration. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `long cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `long cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `long inputTokens` - - The number of input tokens which were used. - - - `long outputTokens` - - The number of output tokens which were used. - - - `JsonValue; type "message"constant` - - Usage for a sampling iteration - - - `MESSAGE("message")` - - - `class BetaCompactionIterationUsage:` - - Token usage for a compaction iteration. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `long cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `long cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `long inputTokens` - - The number of input tokens which were used. - - - `long outputTokens` - - The number of output tokens which were used. - - - `JsonValue; type "compaction"constant` - - Usage for a compaction iteration - - - `COMPACTION("compaction")` - - - `long outputTokens` - - The number of output tokens which were used. - - - `Optional serverToolUse` - - The number of server tool requests. - - - `long webFetchRequests` - - The number of web fetch tool requests. - - - `long webSearchRequests` - - The number of web search tool requests. - - - `Optional serviceTier` - - If the request used the priority, standard, or batch tier. - - - `STANDARD("standard")` - - - `PRIORITY("priority")` - - - `BATCH("batch")` - - - `Optional speed` - - The inference speed mode used for this request. - - - `STANDARD("standard")` - - - `FAST("fast")` - -### Example - -```java -package com.anthropic.example; - -import com.anthropic.client.AnthropicClient; -import com.anthropic.client.okhttp.AnthropicOkHttpClient; -import com.anthropic.models.beta.messages.BetaMessage; -import com.anthropic.models.beta.messages.MessageCreateParams; -import com.anthropic.models.messages.Model; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - AnthropicClient client = AnthropicOkHttpClient.fromEnv(); - - MessageCreateParams params = MessageCreateParams.builder() - .maxTokens(1024L) - .addUserMessage("Hello, world") - .model(Model.CLAUDE_OPUS_4_6) - .build(); - BetaMessage betaMessage = client.beta().messages().create(params); - } -} -``` - -## Count Tokens - -`BetaMessageTokensCount beta().messages().countTokens(MessageCountTokensParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` - -**post** `/v1/messages/count_tokens` - -Count the number of tokens in a Message. - -The Token Count API can be used to count the number of tokens in a Message, including tools, images, and documents, without creating it. - -Learn more about token counting in our [user guide](https://docs.claude.com/en/docs/build-with-claude/token-counting) - -### Parameters - -- `MessageCountTokensParams params` - - - `Optional> betas` - - Optional header to specify the beta version(s) you want to use. - - - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` - - - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` - - - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` - - - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` - - - `PDFS_2024_09_25("pdfs-2024-09-25")` - - - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` - - - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` - - - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` - - - `FILES_API_2025_04_14("files-api-2025-04-14")` - - - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` - - - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` - - - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` - - - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` - - - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` - - - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` - - - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` - - - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` - - - `SKILLS_2025_10_02("skills-2025-10-02")` - - - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` - - - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - - - `List messages` - - Input messages. - - Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn. - - Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages. - - If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response. - - Example with a single `user` message: - - ```json - [{"role": "user", "content": "Hello, Claude"}] - ``` - - Example with multiple conversational turns: - - ```json - [ - {"role": "user", "content": "Hello there."}, - {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"}, - {"role": "user", "content": "Can you explain LLMs in plain English?"}, - ] - ``` - - Example with a partially-filled response from Claude: - - ```json - [ - {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, - {"role": "assistant", "content": "The best answer is ("}, - ] - ``` - - Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent: - - ```json - {"role": "user", "content": "Hello, Claude"} - ``` - - ```json - {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]} - ``` - - See [input examples](https://docs.claude.com/en/api/messages-examples). - - Note that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. - - There is a limit of 100,000 messages in a single request. - - - `Content content` - - - `String` - - - `List` - - - `class BetaTextBlockParam:` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `class BetaImageBlockParam:` - - - `Source source` - - - `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "image"constant` - - - `IMAGE("image")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaRequestDocumentBlock:` - - - `Source source` - - - `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `class BetaContentBlockSource:` - - - `Content content` - - - `String` - - - `List` - - - `class BetaTextBlockParam:` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `class BetaImageBlockParam:` - - - `Source source` - - - `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "image"constant` - - - `IMAGE("image")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `JsonValue; type "content"constant` - - - `CONTENT("content")` - - - `class BetaUrlPdfSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileDocumentSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "document"constant` - - - `DOCUMENT("document")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - - `Optional enabled` - - - `Optional context` - - - `Optional title` - - - `class BetaSearchResultBlockParam:` - - - `List content` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String source` - - - `String title` - - - `JsonValue; type "search_result"constant` - - - `SEARCH_RESULT("search_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - - `Optional enabled` - - - `class BetaThinkingBlockParam:` - - - `String signature` - - - `String thinking` - - - `JsonValue; type "thinking"constant` - - - `THINKING("thinking")` - - - `class BetaRedactedThinkingBlockParam:` - - - `String data` - - - `JsonValue; type "redacted_thinking"constant` - - - `REDACTED_THINKING("redacted_thinking")` - - - `class BetaToolUseBlockParam:` - - - `String id` - - - `Input input` - - - `String name` - - - `JsonValue; type "tool_use"constant` - - - `TOOL_USE("tool_use")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaToolResultBlockParam:` - - - `String toolUseId` - - - `JsonValue; type "tool_result"constant` - - - `TOOL_RESULT("tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional content` - - - `String` - - - `List` - - - `class BetaTextBlockParam:` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `class BetaImageBlockParam:` - - - `Source source` - - - `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "image"constant` - - - `IMAGE("image")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaSearchResultBlockParam:` - - - `List content` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String source` - - - `String title` - - - `JsonValue; type "search_result"constant` - - - `SEARCH_RESULT("search_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - - `Optional enabled` - - - `class BetaRequestDocumentBlock:` - - - `Source source` - - - `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `class BetaContentBlockSource:` - - - `Content content` - - - `String` - - - `List` - - - `class BetaTextBlockParam:` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `class BetaImageBlockParam:` - - - `Source source` - - - `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "image"constant` - - - `IMAGE("image")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `JsonValue; type "content"constant` - - - `CONTENT("content")` - - - `class BetaUrlPdfSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileDocumentSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "document"constant` - - - `DOCUMENT("document")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - - `Optional enabled` - - - `Optional context` - - - `Optional title` - - - `class BetaToolReferenceBlockParam:` - - Tool reference block that can be included in tool_result content. - - - `String toolName` - - - `JsonValue; type "tool_reference"constant` - - - `TOOL_REFERENCE("tool_reference")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional isError` - - - `class BetaServerToolUseBlockParam:` - - - `String id` - - - `Input input` - - - `Name name` - - - `WEB_SEARCH("web_search")` - - - `WEB_FETCH("web_fetch")` - - - `CODE_EXECUTION("code_execution")` - - - `BASH_CODE_EXECUTION("bash_code_execution")` - - - `TEXT_EDITOR_CODE_EXECUTION("text_editor_code_execution")` - - - `TOOL_SEARCH_TOOL_REGEX("tool_search_tool_regex")` - - - `TOOL_SEARCH_TOOL_BM25("tool_search_tool_bm25")` - - - `JsonValue; type "server_tool_use"constant` - - - `SERVER_TOOL_USE("server_tool_use")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaWebSearchToolResultBlockParam:` - - - `BetaWebSearchToolResultBlockParamContent content` - - - `List` - - - `String encryptedContent` - - - `String title` - - - `JsonValue; type "web_search_result"constant` - - - `WEB_SEARCH_RESULT("web_search_result")` - - - `String url` - - - `Optional pageAge` - - - `class BetaWebSearchToolRequestError:` - - - `BetaWebSearchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `QUERY_TOO_LONG("query_too_long")` - - - `REQUEST_TOO_LARGE("request_too_large")` - - - `JsonValue; type "web_search_tool_result_error"constant` - - - `WEB_SEARCH_TOOL_RESULT_ERROR("web_search_tool_result_error")` - - - `String toolUseId` - - - `JsonValue; type "web_search_tool_result"constant` - - - `WEB_SEARCH_TOOL_RESULT("web_search_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaWebFetchToolResultBlockParam:` - - - `Content content` - - - `class BetaWebFetchToolResultErrorBlockParam:` - - - `BetaWebFetchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `URL_TOO_LONG("url_too_long")` - - - `URL_NOT_ALLOWED("url_not_allowed")` - - - `URL_NOT_ACCESSIBLE("url_not_accessible")` - - - `UNSUPPORTED_CONTENT_TYPE("unsupported_content_type")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `UNAVAILABLE("unavailable")` - - - `JsonValue; type "web_fetch_tool_result_error"constant` - - - `WEB_FETCH_TOOL_RESULT_ERROR("web_fetch_tool_result_error")` - - - `class BetaWebFetchBlockParam:` - - - `BetaRequestDocumentBlock content` - - - `Source source` - - - `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `class BetaContentBlockSource:` - - - `Content content` - - - `String` - - - `List` - - - `class BetaTextBlockParam:` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `class BetaImageBlockParam:` - - - `Source source` - - - `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "image"constant` - - - `IMAGE("image")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `JsonValue; type "content"constant` - - - `CONTENT("content")` - - - `class BetaUrlPdfSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileDocumentSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "document"constant` - - - `DOCUMENT("document")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - - `Optional enabled` - - - `Optional context` - - - `Optional title` - - - `JsonValue; type "web_fetch_result"constant` - - - `WEB_FETCH_RESULT("web_fetch_result")` - - - `String url` - - Fetched content URL - - - `Optional retrievedAt` - - ISO 8601 timestamp when the content was retrieved - - - `String toolUseId` - - - `JsonValue; type "web_fetch_tool_result"constant` - - - `WEB_FETCH_TOOL_RESULT("web_fetch_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaCodeExecutionToolResultBlockParam:` - - - `BetaCodeExecutionToolResultBlockParamContent content` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `class BetaCodeExecutionToolResultErrorParam:` - - - `BetaCodeExecutionToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `JsonValue; type "code_execution_tool_result_error"constant` - - - `CODE_EXECUTION_TOOL_RESULT_ERROR("code_execution_tool_result_error")` - - - `class BetaCodeExecutionResultBlockParam:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "code_execution_result"constant` - - - `CODE_EXECUTION_RESULT("code_execution_result")` - - - `class BetaEncryptedCodeExecutionResultBlockParam:` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `String encryptedStdout` - - - `long returnCode` - - - `String stderr` - - - `JsonValue; type "encrypted_code_execution_result"constant` - - - `ENCRYPTED_CODE_EXECUTION_RESULT("encrypted_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "code_execution_tool_result"constant` - - - `CODE_EXECUTION_TOOL_RESULT("code_execution_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaBashCodeExecutionToolResultBlockParam:` - - - `Content content` - - - `class BetaBashCodeExecutionToolResultErrorParam:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `OUTPUT_FILE_TOO_LARGE("output_file_too_large")` - - - `JsonValue; type "bash_code_execution_tool_result_error"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT_ERROR("bash_code_execution_tool_result_error")` - - - `class BetaBashCodeExecutionResultBlockParam:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "bash_code_execution_output"constant` - - - `BASH_CODE_EXECUTION_OUTPUT("bash_code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "bash_code_execution_result"constant` - - - `BASH_CODE_EXECUTION_RESULT("bash_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "bash_code_execution_tool_result"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT("bash_code_execution_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaTextEditorCodeExecutionToolResultBlockParam:` - - - `Content content` - - - `class BetaTextEditorCodeExecutionToolResultErrorParam:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `FILE_NOT_FOUND("file_not_found")` - - - `JsonValue; type "text_editor_code_execution_tool_result_error"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT_ERROR("text_editor_code_execution_tool_result_error")` - - - `Optional errorMessage` - - - `class BetaTextEditorCodeExecutionViewResultBlockParam:` - - - `String content` - - - `FileType fileType` - - - `TEXT("text")` - - - `IMAGE("image")` - - - `PDF("pdf")` - - - `JsonValue; type "text_editor_code_execution_view_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_VIEW_RESULT("text_editor_code_execution_view_result")` - - - `Optional numLines` - - - `Optional startLine` - - - `Optional totalLines` - - - `class BetaTextEditorCodeExecutionCreateResultBlockParam:` - - - `boolean isFileUpdate` - - - `JsonValue; type "text_editor_code_execution_create_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_CREATE_RESULT("text_editor_code_execution_create_result")` - - - `class BetaTextEditorCodeExecutionStrReplaceResultBlockParam:` - - - `JsonValue; type "text_editor_code_execution_str_replace_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_STR_REPLACE_RESULT("text_editor_code_execution_str_replace_result")` - - - `Optional> lines` - - - `Optional newLines` - - - `Optional newStart` - - - `Optional oldLines` - - - `Optional oldStart` - - - `String toolUseId` - - - `JsonValue; type "text_editor_code_execution_tool_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT("text_editor_code_execution_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaToolSearchToolResultBlockParam:` - - - `Content content` - - - `class BetaToolSearchToolResultErrorParam:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `JsonValue; type "tool_search_tool_result_error"constant` - - - `TOOL_SEARCH_TOOL_RESULT_ERROR("tool_search_tool_result_error")` - - - `class BetaToolSearchToolSearchResultBlockParam:` - - - `List toolReferences` - - - `String toolName` - - - `JsonValue; type "tool_reference"constant` - - - `TOOL_REFERENCE("tool_reference")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `JsonValue; type "tool_search_tool_search_result"constant` - - - `TOOL_SEARCH_TOOL_SEARCH_RESULT("tool_search_tool_search_result")` - - - `String toolUseId` - - - `JsonValue; type "tool_search_tool_result"constant` - - - `TOOL_SEARCH_TOOL_RESULT("tool_search_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaMcpToolUseBlockParam:` - - - `String id` - - - `Input input` - - - `String name` - - - `String serverName` - - The name of the MCP server - - - `JsonValue; type "mcp_tool_use"constant` - - - `MCP_TOOL_USE("mcp_tool_use")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaRequestMcpToolResultBlockParam:` - - - `String toolUseId` - - - `JsonValue; type "mcp_tool_result"constant` - - - `MCP_TOOL_RESULT("mcp_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional content` - - - `String` - - - `List` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `Optional isError` - - - `class BetaContainerUploadBlockParam:` - - A content block that represents a file to be uploaded to the container - Files uploaded via this block will be available in the container's input directory. - - - `String fileId` - - - `JsonValue; type "container_upload"constant` - - - `CONTAINER_UPLOAD("container_upload")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaCompactionBlockParam:` - - A compaction block containing summary of previous context. - - Users should round-trip these blocks from responses to subsequent requests - to maintain context across compaction boundaries. - - When content is None, the block represents a failed compaction. The server - treats these as no-ops. Empty string content is not allowed. - - - `Optional content` - - Summary of previously compacted content, or null if compaction failed - - - `JsonValue; type "compaction"constant` - - - `COMPACTION("compaction")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Role role` - - - `USER("user")` - - - `ASSISTANT("assistant")` - - - `Model model` - - The model that will complete your prompt. - - See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - - `Optional cacheControl` - - Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request. - - - `Optional contextManagement` - - Context management configuration. - - This allows you to control how Claude manages context across multiple requests, such as whether to clear function results or not. - - - `Optional> mcpServers` - - MCP servers to be utilized in this request - - - `String name` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `Optional authorizationToken` - - - `Optional toolConfiguration` - - - `Optional> allowedTools` - - - `Optional enabled` - - - `Optional outputConfig` - - Configuration options for the model's output, such as the output format. - - - `Optional outputFormat` - - Deprecated: Use `output_config.format` instead. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) - - A schema to specify Claude's output format in responses. This parameter will be removed in a future release. - - - `Optional speed` - - The inference speed mode for this request. `"fast"` enables high output-tokens-per-second inference. - - - `STANDARD("standard")` - - - `FAST("fast")` - - - `Optional system` - - System prompt. - - A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts). - - - `String` - - - `List` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `Optional thinking` - - Configuration for enabling Claude's extended thinking. - - When enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit. - - See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details. - - - `Optional toolChoice` - - How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all. - - - `Optional> tools` - - Definitions of tools that the model may use. - - If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks. - - There are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)). - - Each tool definition includes: - - * `name`: Name of the tool. - * `description`: Optional, but strongly-recommended description of the tool. - * `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks. - - For example, if you defined `tools` as: - - ```json - [ - { - "name": "get_stock_price", - "description": "Get the current stock price for a given ticker symbol.", - "input_schema": { - "type": "object", - "properties": { - "ticker": { - "type": "string", - "description": "The stock ticker symbol, e.g. AAPL for Apple Inc." - } - }, - "required": ["ticker"] - } - } - ] - ``` - - And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this: - - ```json - [ - { - "type": "tool_use", - "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", - "name": "get_stock_price", - "input": { "ticker": "^GSPC" } - } - ] - ``` - - You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message: - - ```json - [ - { - "type": "tool_result", - "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", - "content": "259.75 USD" - } - ] - ``` - - Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output. - - See our [guide](https://docs.claude.com/en/docs/tool-use) for more details. - - - `class BetaTool:` - - - `InputSchema inputSchema` - - [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input. - - This defines the shape of the `input` that your tool accepts and that the model will produce. - - - `JsonValue; type "object"constant` - - - `OBJECT("object")` - - - `Optional properties` - - - `Optional> required` - - - `String name` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional description` - - Description of what this tool does. - - Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema. - - - `Optional eagerInputStreaming` - - Enable eager input streaming for this tool. When true, tool input parameters will be streamed incrementally as they are generated, and types will be inferred on-the-fly rather than buffering the full JSON output. When false, streaming is disabled for this tool even if the fine-grained-tool-streaming beta is active. When null (default), uses the default behavior based on beta headers. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `Optional type` - - - `CUSTOM("custom")` - - - `class BetaToolBash20241022:` - - - `JsonValue; name "bash"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `BASH("bash")` - - - `JsonValue; type "bash_20241022"constant` - - - `BASH_20241022("bash_20241022")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolBash20250124:` - - - `JsonValue; name "bash"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `BASH("bash")` - - - `JsonValue; type "bash_20250124"constant` - - - `BASH_20250124("bash_20250124")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaCodeExecutionTool20250522:` - - - `JsonValue; name "code_execution"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `CODE_EXECUTION("code_execution")` - - - `JsonValue; type "code_execution_20250522"constant` - - - `CODE_EXECUTION_20250522("code_execution_20250522")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaCodeExecutionTool20250825:` - - - `JsonValue; name "code_execution"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `CODE_EXECUTION("code_execution")` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaCodeExecutionTool20260120:` - - Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint). - - - `JsonValue; name "code_execution"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `CODE_EXECUTION("code_execution")` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolComputerUse20241022:` - - - `long displayHeightPx` - - The height of the display in pixels. - - - `long displayWidthPx` - - The width of the display in pixels. - - - `JsonValue; name "computer"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `COMPUTER("computer")` - - - `JsonValue; type "computer_20241022"constant` - - - `COMPUTER_20241022("computer_20241022")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional displayNumber` - - The X11 display number (e.g. 0, 1) for the display. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaMemoryTool20250818:` - - - `JsonValue; name "memory"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `MEMORY("memory")` - - - `JsonValue; type "memory_20250818"constant` - - - `MEMORY_20250818("memory_20250818")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolComputerUse20250124:` - - - `long displayHeightPx` - - The height of the display in pixels. - - - `long displayWidthPx` - - The width of the display in pixels. - - - `JsonValue; name "computer"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `COMPUTER("computer")` - - - `JsonValue; type "computer_20250124"constant` - - - `COMPUTER_20250124("computer_20250124")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional displayNumber` - - The X11 display number (e.g. 0, 1) for the display. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolTextEditor20241022:` - - - `JsonValue; name "str_replace_editor"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `STR_REPLACE_EDITOR("str_replace_editor")` - - - `JsonValue; type "text_editor_20241022"constant` - - - `TEXT_EDITOR_20241022("text_editor_20241022")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolComputerUse20251124:` - - - `long displayHeightPx` - - The height of the display in pixels. - - - `long displayWidthPx` - - The width of the display in pixels. - - - `JsonValue; name "computer"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `COMPUTER("computer")` - - - `JsonValue; type "computer_20251124"constant` - - - `COMPUTER_20251124("computer_20251124")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional displayNumber` - - The X11 display number (e.g. 0, 1) for the display. - - - `Optional enableZoom` - - Whether to enable an action to take a zoomed-in screenshot of the screen. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolTextEditor20250124:` - - - `JsonValue; name "str_replace_editor"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `STR_REPLACE_EDITOR("str_replace_editor")` - - - `JsonValue; type "text_editor_20250124"constant` - - - `TEXT_EDITOR_20250124("text_editor_20250124")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolTextEditor20250429:` - - - `JsonValue; name "str_replace_based_edit_tool"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `STR_REPLACE_BASED_EDIT_TOOL("str_replace_based_edit_tool")` - - - `JsonValue; type "text_editor_20250429"constant` - - - `TEXT_EDITOR_20250429("text_editor_20250429")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolTextEditor20250728:` - - - `JsonValue; name "str_replace_based_edit_tool"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `STR_REPLACE_BASED_EDIT_TOOL("str_replace_based_edit_tool")` - - - `JsonValue; type "text_editor_20250728"constant` - - - `TEXT_EDITOR_20250728("text_editor_20250728")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional maxCharacters` - - Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaWebSearchTool20250305:` - - - `JsonValue; name "web_search"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `WEB_SEARCH("web_search")` - - - `JsonValue; type "web_search_20250305"constant` - - - `WEB_SEARCH_20250305("web_search_20250305")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional> allowedDomains` - - If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`. - - - `Optional> blockedDomains` - - If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`. - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional maxUses` - - Maximum number of times the tool can be used in the API request. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `Optional userLocation` - - Parameters for the user's location. Used to provide more relevant search results. - - - `JsonValue; type "approximate"constant` - - - `APPROXIMATE("approximate")` - - - `Optional city` - - The city of the user. - - - `Optional country` - - The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user. - - - `Optional region` - - The region of the user. - - - `Optional timezone` - - The [IANA timezone](https://nodatime.org/TimeZones) of the user. - - - `class BetaWebFetchTool20250910:` - - - `JsonValue; name "web_fetch"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `WEB_FETCH("web_fetch")` - - - `JsonValue; type "web_fetch_20250910"constant` - - - `WEB_FETCH_20250910("web_fetch_20250910")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional> allowedDomains` - - List of domains to allow fetching from - - - `Optional> blockedDomains` - - List of domains to block fetching from - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - Citations configuration for fetched documents. Citations are disabled by default. - - - `Optional enabled` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional maxContentTokens` - - Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. - - - `Optional maxUses` - - Maximum number of times the tool can be used in the API request. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaWebSearchTool20260209:` - - - `JsonValue; name "web_search"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `WEB_SEARCH("web_search")` - - - `JsonValue; type "web_search_20260209"constant` - - - `WEB_SEARCH_20260209("web_search_20260209")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional> allowedDomains` - - If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`. - - - `Optional> blockedDomains` - - If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`. - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional maxUses` - - Maximum number of times the tool can be used in the API request. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `Optional userLocation` - - Parameters for the user's location. Used to provide more relevant search results. - - - `JsonValue; type "approximate"constant` - - - `APPROXIMATE("approximate")` - - - `Optional city` - - The city of the user. - - - `Optional country` - - The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user. - - - `Optional region` - - The region of the user. - - - `Optional timezone` - - The [IANA timezone](https://nodatime.org/TimeZones) of the user. - - - `class BetaWebFetchTool20260209:` - - - `JsonValue; name "web_fetch"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `WEB_FETCH("web_fetch")` - - - `JsonValue; type "web_fetch_20260209"constant` - - - `WEB_FETCH_20260209("web_fetch_20260209")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional> allowedDomains` - - List of domains to allow fetching from - - - `Optional> blockedDomains` - - List of domains to block fetching from - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - Citations configuration for fetched documents. Citations are disabled by default. - - - `Optional enabled` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional maxContentTokens` - - Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. - - - `Optional maxUses` - - Maximum number of times the tool can be used in the API request. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaWebFetchTool20260309:` - - Web fetch tool with use_cache parameter for bypassing cached content. - - - `JsonValue; name "web_fetch"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `WEB_FETCH("web_fetch")` - - - `JsonValue; type "web_fetch_20260309"constant` - - - `WEB_FETCH_20260309("web_fetch_20260309")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional> allowedDomains` - - List of domains to allow fetching from - - - `Optional> blockedDomains` - - List of domains to block fetching from - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - Citations configuration for fetched documents. Citations are disabled by default. - - - `Optional enabled` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional maxContentTokens` - - Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. - - - `Optional maxUses` - - Maximum number of times the tool can be used in the API request. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `Optional useCache` - - Whether to use cached content. Set to false to bypass the cache and fetch fresh content. Only set to false when the user explicitly requests fresh content or when fetching rapidly-changing sources. - - - `class BetaToolSearchToolBm25_20251119:` - - - `JsonValue; name "tool_search_tool_bm25"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `TOOL_SEARCH_TOOL_BM25("tool_search_tool_bm25")` - - - `Type type` - - - `TOOL_SEARCH_TOOL_BM25_20251119("tool_search_tool_bm25_20251119")` - - - `TOOL_SEARCH_TOOL_BM25("tool_search_tool_bm25")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolSearchToolRegex20251119:` - - - `JsonValue; name "tool_search_tool_regex"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `TOOL_SEARCH_TOOL_REGEX("tool_search_tool_regex")` - - - `Type type` - - - `TOOL_SEARCH_TOOL_REGEX_20251119("tool_search_tool_regex_20251119")` - - - `TOOL_SEARCH_TOOL_REGEX("tool_search_tool_regex")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaMcpToolset:` - - Configuration for a group of tools from an MCP server. - - Allows configuring enabled status and defer_loading for all tools - from an MCP server, with optional per-tool overrides. - - - `String mcpServerName` - - Name of the MCP server to configure tools for - - - `JsonValue; type "mcp_toolset"constant` - - - `MCP_TOOLSET("mcp_toolset")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional configs` - - Configuration overrides for specific tools, keyed by tool name - - - `Optional deferLoading` - - - `Optional enabled` - - - `Optional defaultConfig` - - Default configuration applied to all tools from this server - - - `Optional deferLoading` - - - `Optional enabled` - -### Returns - -- `class BetaMessageTokensCount:` - - - `Optional contextManagement` - - Information about context management applied to the message. - - - `long originalInputTokens` - - The original token count before context management was applied - - - `long inputTokens` - - The total number of tokens across the provided list of messages, system prompt, and tools. - -### Example - -```java -package com.anthropic.example; - -import com.anthropic.client.AnthropicClient; -import com.anthropic.client.okhttp.AnthropicOkHttpClient; -import com.anthropic.models.beta.messages.BetaMessageTokensCount; -import com.anthropic.models.beta.messages.MessageCountTokensParams; -import com.anthropic.models.messages.Model; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - AnthropicClient client = AnthropicOkHttpClient.fromEnv(); - - MessageCountTokensParams params = MessageCountTokensParams.builder() - .addUserMessage("Hello, world") - .model(Model.CLAUDE_OPUS_4_6) - .build(); - BetaMessageTokensCount betaMessageTokensCount = client.beta().messages().countTokens(params); - } -} -``` - -## Domain Types - -### Beta All Thinking Turns - -- `class BetaAllThinkingTurns:` - - - `JsonValue; type "all"constant` - - - `ALL("all")` - -### Beta Base64 Image Source - -- `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - -### Beta Base64 PDF Source - -- `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - -### Beta Bash Code Execution Output Block - -- `class BetaBashCodeExecutionOutputBlock:` - - - `String fileId` - - - `JsonValue; type "bash_code_execution_output"constant` - - - `BASH_CODE_EXECUTION_OUTPUT("bash_code_execution_output")` - -### Beta Bash Code Execution Output Block Param - -- `class BetaBashCodeExecutionOutputBlockParam:` - - - `String fileId` - - - `JsonValue; type "bash_code_execution_output"constant` - - - `BASH_CODE_EXECUTION_OUTPUT("bash_code_execution_output")` - -### Beta Bash Code Execution Result Block - -- `class BetaBashCodeExecutionResultBlock:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "bash_code_execution_output"constant` - - - `BASH_CODE_EXECUTION_OUTPUT("bash_code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "bash_code_execution_result"constant` - - - `BASH_CODE_EXECUTION_RESULT("bash_code_execution_result")` - -### Beta Bash Code Execution Result Block Param - -- `class BetaBashCodeExecutionResultBlockParam:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "bash_code_execution_output"constant` - - - `BASH_CODE_EXECUTION_OUTPUT("bash_code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "bash_code_execution_result"constant` - - - `BASH_CODE_EXECUTION_RESULT("bash_code_execution_result")` - -### Beta Bash Code Execution Tool Result Block - -- `class BetaBashCodeExecutionToolResultBlock:` - - - `Content content` - - - `class BetaBashCodeExecutionToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `OUTPUT_FILE_TOO_LARGE("output_file_too_large")` - - - `JsonValue; type "bash_code_execution_tool_result_error"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT_ERROR("bash_code_execution_tool_result_error")` - - - `class BetaBashCodeExecutionResultBlock:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "bash_code_execution_output"constant` - - - `BASH_CODE_EXECUTION_OUTPUT("bash_code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "bash_code_execution_result"constant` - - - `BASH_CODE_EXECUTION_RESULT("bash_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "bash_code_execution_tool_result"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT("bash_code_execution_tool_result")` - -### Beta Bash Code Execution Tool Result Block Param - -- `class BetaBashCodeExecutionToolResultBlockParam:` - - - `Content content` - - - `class BetaBashCodeExecutionToolResultErrorParam:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `OUTPUT_FILE_TOO_LARGE("output_file_too_large")` - - - `JsonValue; type "bash_code_execution_tool_result_error"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT_ERROR("bash_code_execution_tool_result_error")` - - - `class BetaBashCodeExecutionResultBlockParam:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "bash_code_execution_output"constant` - - - `BASH_CODE_EXECUTION_OUTPUT("bash_code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "bash_code_execution_result"constant` - - - `BASH_CODE_EXECUTION_RESULT("bash_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "bash_code_execution_tool_result"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT("bash_code_execution_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - -### Beta Bash Code Execution Tool Result Error - -- `class BetaBashCodeExecutionToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `OUTPUT_FILE_TOO_LARGE("output_file_too_large")` - - - `JsonValue; type "bash_code_execution_tool_result_error"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT_ERROR("bash_code_execution_tool_result_error")` - -### Beta Bash Code Execution Tool Result Error Param - -- `class BetaBashCodeExecutionToolResultErrorParam:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `OUTPUT_FILE_TOO_LARGE("output_file_too_large")` - - - `JsonValue; type "bash_code_execution_tool_result_error"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT_ERROR("bash_code_execution_tool_result_error")` - -### Beta Cache Control Ephemeral - -- `class BetaCacheControlEphemeral:` - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - -### Beta Cache Creation - -- `class BetaCacheCreation:` - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - -### Beta Citation Char Location - -- `class BetaCitationCharLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `Optional fileId` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - -### Beta Citation Char Location Param - -- `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - -### Beta Citation Config - -- `class BetaCitationConfig:` - - - `boolean enabled` - -### Beta Citation Content Block Location - -- `class BetaCitationContentBlockLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `Optional fileId` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - -### Beta Citation Content Block Location Param - -- `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - -### Beta Citation Page Location - -- `class BetaCitationPageLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `Optional fileId` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - -### Beta Citation Page Location Param - -- `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - -### Beta Citation Search Result Location - -- `class BetaCitationSearchResultLocation:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - -### Beta Citation Search Result Location Param - -- `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - -### Beta Citation Web Search Result Location Param - -- `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - -### Beta Citations Config Param - -- `class BetaCitationsConfigParam:` - - - `Optional enabled` - -### Beta Citations Delta - -- `class BetaCitationsDelta:` - - - `Citation citation` - - - `class BetaCitationCharLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `Optional fileId` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `Optional fileId` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `Optional fileId` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationsWebSearchResultLocation:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocation:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `JsonValue; type "citations_delta"constant` - - - `CITATIONS_DELTA("citations_delta")` - -### Beta Citations Web Search Result Location - -- `class BetaCitationsWebSearchResultLocation:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - -### Beta Clear Thinking 20251015 Edit - -- `class BetaClearThinking20251015Edit:` - - - `JsonValue; type "clear_thinking_20251015"constant` - - - `CLEAR_THINKING_20251015("clear_thinking_20251015")` - - - `Optional keep` - - Number of most recent assistant turns to keep thinking blocks for. Older turns will have their thinking blocks removed. - - - `class BetaThinkingTurns:` - - - `JsonValue; type "thinking_turns"constant` - - - `THINKING_TURNS("thinking_turns")` - - - `long value` - - - `class BetaAllThinkingTurns:` - - - `JsonValue; type "all"constant` - - - `ALL("all")` - - - `JsonValue;` - - - `ALL("all")` - -### Beta Clear Thinking 20251015 Edit Response - -- `class BetaClearThinking20251015EditResponse:` - - - `long clearedInputTokens` - - Number of input tokens cleared by this edit. - - - `long clearedThinkingTurns` - - Number of thinking turns that were cleared. - - - `JsonValue; type "clear_thinking_20251015"constant` - - The type of context management edit applied. - - - `CLEAR_THINKING_20251015("clear_thinking_20251015")` - -### Beta Clear Tool Uses 20250919 Edit - -- `class BetaClearToolUses20250919Edit:` - - - `JsonValue; type "clear_tool_uses_20250919"constant` - - - `CLEAR_TOOL_USES_20250919("clear_tool_uses_20250919")` - - - `Optional clearAtLeast` - - Minimum number of tokens that must be cleared when triggered. Context will only be modified if at least this many tokens can be removed. - - - `JsonValue; type "input_tokens"constant` - - - `INPUT_TOKENS("input_tokens")` - - - `long value` - - - `Optional clearToolInputs` - - Whether to clear all tool inputs (bool) or specific tool inputs to clear (list) - - - `boolean` - - - `List` - - - `Optional> excludeTools` - - Tool names whose uses are preserved from clearing - - - `Optional keep` - - Number of tool uses to retain in the conversation - - - `JsonValue; type "tool_uses"constant` - - - `TOOL_USES("tool_uses")` - - - `long value` - - - `Optional trigger` - - Condition that triggers the context management strategy - - - `class BetaInputTokensTrigger:` - - - `JsonValue; type "input_tokens"constant` - - - `INPUT_TOKENS("input_tokens")` - - - `long value` - - - `class BetaToolUsesTrigger:` - - - `JsonValue; type "tool_uses"constant` - - - `TOOL_USES("tool_uses")` - - - `long value` - -### Beta Clear Tool Uses 20250919 Edit Response - -- `class BetaClearToolUses20250919EditResponse:` - - - `long clearedInputTokens` - - Number of input tokens cleared by this edit. - - - `long clearedToolUses` - - Number of tool uses that were cleared. - - - `JsonValue; type "clear_tool_uses_20250919"constant` - - The type of context management edit applied. - - - `CLEAR_TOOL_USES_20250919("clear_tool_uses_20250919")` - -### Beta Code Execution Output Block - -- `class BetaCodeExecutionOutputBlock:` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - -### Beta Code Execution Output Block Param - -- `class BetaCodeExecutionOutputBlockParam:` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - -### Beta Code Execution Result Block - -- `class BetaCodeExecutionResultBlock:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "code_execution_result"constant` - - - `CODE_EXECUTION_RESULT("code_execution_result")` - -### Beta Code Execution Result Block Param - -- `class BetaCodeExecutionResultBlockParam:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "code_execution_result"constant` - - - `CODE_EXECUTION_RESULT("code_execution_result")` - -### Beta Code Execution Tool 20250522 - -- `class BetaCodeExecutionTool20250522:` - - - `JsonValue; name "code_execution"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `CODE_EXECUTION("code_execution")` - - - `JsonValue; type "code_execution_20250522"constant` - - - `CODE_EXECUTION_20250522("code_execution_20250522")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - -### Beta Code Execution Tool 20250825 - -- `class BetaCodeExecutionTool20250825:` - - - `JsonValue; name "code_execution"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `CODE_EXECUTION("code_execution")` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - -### Beta Code Execution Tool 20260120 - -- `class BetaCodeExecutionTool20260120:` - - Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint). - - - `JsonValue; name "code_execution"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `CODE_EXECUTION("code_execution")` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - -### Beta Code Execution Tool Result Block - -- `class BetaCodeExecutionToolResultBlock:` - - - `BetaCodeExecutionToolResultBlockContent content` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `class BetaCodeExecutionToolResultError:` - - - `BetaCodeExecutionToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `JsonValue; type "code_execution_tool_result_error"constant` - - - `CODE_EXECUTION_TOOL_RESULT_ERROR("code_execution_tool_result_error")` - - - `class BetaCodeExecutionResultBlock:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "code_execution_result"constant` - - - `CODE_EXECUTION_RESULT("code_execution_result")` - - - `class BetaEncryptedCodeExecutionResultBlock:` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `String encryptedStdout` - - - `long returnCode` - - - `String stderr` - - - `JsonValue; type "encrypted_code_execution_result"constant` - - - `ENCRYPTED_CODE_EXECUTION_RESULT("encrypted_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "code_execution_tool_result"constant` - - - `CODE_EXECUTION_TOOL_RESULT("code_execution_tool_result")` - -### Beta Code Execution Tool Result Block Content - -- `class BetaCodeExecutionToolResultBlockContent: A class that can be one of several variants.union` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `class BetaCodeExecutionToolResultError:` - - - `BetaCodeExecutionToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `JsonValue; type "code_execution_tool_result_error"constant` - - - `CODE_EXECUTION_TOOL_RESULT_ERROR("code_execution_tool_result_error")` - - - `class BetaCodeExecutionResultBlock:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "code_execution_result"constant` - - - `CODE_EXECUTION_RESULT("code_execution_result")` - - - `class BetaEncryptedCodeExecutionResultBlock:` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `String encryptedStdout` - - - `long returnCode` - - - `String stderr` - - - `JsonValue; type "encrypted_code_execution_result"constant` - - - `ENCRYPTED_CODE_EXECUTION_RESULT("encrypted_code_execution_result")` - -### Beta Code Execution Tool Result Block Param - -- `class BetaCodeExecutionToolResultBlockParam:` - - - `BetaCodeExecutionToolResultBlockParamContent content` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `class BetaCodeExecutionToolResultErrorParam:` - - - `BetaCodeExecutionToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `JsonValue; type "code_execution_tool_result_error"constant` - - - `CODE_EXECUTION_TOOL_RESULT_ERROR("code_execution_tool_result_error")` - - - `class BetaCodeExecutionResultBlockParam:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "code_execution_result"constant` - - - `CODE_EXECUTION_RESULT("code_execution_result")` - - - `class BetaEncryptedCodeExecutionResultBlockParam:` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `String encryptedStdout` - - - `long returnCode` - - - `String stderr` - - - `JsonValue; type "encrypted_code_execution_result"constant` - - - `ENCRYPTED_CODE_EXECUTION_RESULT("encrypted_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "code_execution_tool_result"constant` - - - `CODE_EXECUTION_TOOL_RESULT("code_execution_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - -### Beta Code Execution Tool Result Block Param Content - -- `class BetaCodeExecutionToolResultBlockParamContent: A class that can be one of several variants.union` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `class BetaCodeExecutionToolResultErrorParam:` - - - `BetaCodeExecutionToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `JsonValue; type "code_execution_tool_result_error"constant` - - - `CODE_EXECUTION_TOOL_RESULT_ERROR("code_execution_tool_result_error")` - - - `class BetaCodeExecutionResultBlockParam:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "code_execution_result"constant` - - - `CODE_EXECUTION_RESULT("code_execution_result")` - - - `class BetaEncryptedCodeExecutionResultBlockParam:` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `String encryptedStdout` - - - `long returnCode` - - - `String stderr` - - - `JsonValue; type "encrypted_code_execution_result"constant` - - - `ENCRYPTED_CODE_EXECUTION_RESULT("encrypted_code_execution_result")` - -### Beta Code Execution Tool Result Error - -- `class BetaCodeExecutionToolResultError:` - - - `BetaCodeExecutionToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `JsonValue; type "code_execution_tool_result_error"constant` - - - `CODE_EXECUTION_TOOL_RESULT_ERROR("code_execution_tool_result_error")` - -### Beta Code Execution Tool Result Error Code - -- `enum BetaCodeExecutionToolResultErrorCode:` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - -### Beta Code Execution Tool Result Error Param - -- `class BetaCodeExecutionToolResultErrorParam:` - - - `BetaCodeExecutionToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `JsonValue; type "code_execution_tool_result_error"constant` - - - `CODE_EXECUTION_TOOL_RESULT_ERROR("code_execution_tool_result_error")` - -### Beta Compact 20260112 Edit - -- `class BetaCompact20260112Edit:` - - Automatically compact older context when reaching the configured trigger threshold. - - - `JsonValue; type "compact_20260112"constant` - - - `COMPACT_20260112("compact_20260112")` - - - `Optional instructions` - - Additional instructions for summarization. - - - `Optional pauseAfterCompaction` - - Whether to pause after compaction and return the compaction block to the user. - - - `Optional trigger` - - When to trigger compaction. Defaults to 150000 input tokens. - - - `JsonValue; type "input_tokens"constant` - - - `INPUT_TOKENS("input_tokens")` - - - `long value` - -### Beta Compaction Block - -- `class BetaCompactionBlock:` - - A compaction block returned when autocompact is triggered. - - When content is None, it indicates the compaction failed to produce a valid - summary (e.g., malformed output from the model). Clients may round-trip - compaction blocks with null content; the server treats them as no-ops. - - - `Optional content` - - Summary of compacted content, or null if compaction failed - - - `JsonValue; type "compaction"constant` - - - `COMPACTION("compaction")` - -### Beta Compaction Block Param - -- `class BetaCompactionBlockParam:` - - A compaction block containing summary of previous context. - - Users should round-trip these blocks from responses to subsequent requests - to maintain context across compaction boundaries. - - When content is None, the block represents a failed compaction. The server - treats these as no-ops. Empty string content is not allowed. - - - `Optional content` - - Summary of previously compacted content, or null if compaction failed - - - `JsonValue; type "compaction"constant` - - - `COMPACTION("compaction")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - -### Beta Compaction Content Block Delta - -- `class BetaCompactionContentBlockDelta:` - - - `Optional content` - - - `JsonValue; type "compaction_delta"constant` - - - `COMPACTION_DELTA("compaction_delta")` - -### Beta Compaction Iteration Usage - -- `class BetaCompactionIterationUsage:` - - Token usage for a compaction iteration. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `long cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `long cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `long inputTokens` - - The number of input tokens which were used. - - - `long outputTokens` - - The number of output tokens which were used. - - - `JsonValue; type "compaction"constant` - - Usage for a compaction iteration - - - `COMPACTION("compaction")` - -### Beta Container - -- `class BetaContainer:` - - Information about the container used in the request (for the code execution tool) - - - `String id` - - Identifier for the container used in this request - - - `LocalDateTime expiresAt` - - The time at which the container will expire. - - - `Optional> skills` - - Skills loaded in the container - - - `String skillId` - - Skill ID - - - `Type type` - - Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) - - - `ANTHROPIC("anthropic")` - - - `CUSTOM("custom")` - - - `String version` - - Skill version or 'latest' for most recent version - -### Beta Container Params - -- `class BetaContainerParams:` - - Container parameters with skills to be loaded. - - - `Optional id` - - Container id - - - `Optional> skills` - - List of skills to load in the container - - - `String skillId` - - Skill ID - - - `Type type` - - Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) - - - `ANTHROPIC("anthropic")` - - - `CUSTOM("custom")` - - - `Optional version` - - Skill version or 'latest' for most recent version - -### Beta Container Upload Block - -- `class BetaContainerUploadBlock:` - - Response model for a file uploaded to the container. - - - `String fileId` - - - `JsonValue; type "container_upload"constant` - - - `CONTAINER_UPLOAD("container_upload")` - -### Beta Container Upload Block Param - -- `class BetaContainerUploadBlockParam:` - - A content block that represents a file to be uploaded to the container - Files uploaded via this block will be available in the container's input directory. - - - `String fileId` - - - `JsonValue; type "container_upload"constant` - - - `CONTAINER_UPLOAD("container_upload")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - -### Beta Content Block - -- `class BetaContentBlock: A class that can be one of several variants.union` - - Response model for a file uploaded to the container. - - - `class BetaTextBlock:` - - - `Optional> citations` - - Citations supporting the text block. - - The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. - - - `class BetaCitationCharLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `Optional fileId` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `Optional fileId` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `Optional fileId` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationsWebSearchResultLocation:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocation:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `class BetaThinkingBlock:` - - - `String signature` - - - `String thinking` - - - `JsonValue; type "thinking"constant` - - - `THINKING("thinking")` - - - `class BetaRedactedThinkingBlock:` - - - `String data` - - - `JsonValue; type "redacted_thinking"constant` - - - `REDACTED_THINKING("redacted_thinking")` - - - `class BetaToolUseBlock:` - - - `String id` - - - `Input input` - - - `String name` - - - `JsonValue; type "tool_use"constant` - - - `TOOL_USE("tool_use")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaServerToolUseBlock:` - - - `String id` - - - `Input input` - - - `Name name` - - - `WEB_SEARCH("web_search")` - - - `WEB_FETCH("web_fetch")` - - - `CODE_EXECUTION("code_execution")` - - - `BASH_CODE_EXECUTION("bash_code_execution")` - - - `TEXT_EDITOR_CODE_EXECUTION("text_editor_code_execution")` - - - `TOOL_SEARCH_TOOL_REGEX("tool_search_tool_regex")` - - - `TOOL_SEARCH_TOOL_BM25("tool_search_tool_bm25")` - - - `JsonValue; type "server_tool_use"constant` - - - `SERVER_TOOL_USE("server_tool_use")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaWebSearchToolResultBlock:` - - - `BetaWebSearchToolResultBlockContent content` - - - `class BetaWebSearchToolResultError:` - - - `BetaWebSearchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `QUERY_TOO_LONG("query_too_long")` - - - `REQUEST_TOO_LARGE("request_too_large")` - - - `JsonValue; type "web_search_tool_result_error"constant` - - - `WEB_SEARCH_TOOL_RESULT_ERROR("web_search_tool_result_error")` - - - `List` - - - `String encryptedContent` - - - `Optional pageAge` - - - `String title` - - - `JsonValue; type "web_search_result"constant` - - - `WEB_SEARCH_RESULT("web_search_result")` - - - `String url` - - - `String toolUseId` - - - `JsonValue; type "web_search_tool_result"constant` - - - `WEB_SEARCH_TOOL_RESULT("web_search_tool_result")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaWebFetchToolResultBlock:` - - - `Content content` - - - `class BetaWebFetchToolResultErrorBlock:` - - - `BetaWebFetchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `URL_TOO_LONG("url_too_long")` - - - `URL_NOT_ALLOWED("url_not_allowed")` - - - `URL_NOT_ACCESSIBLE("url_not_accessible")` - - - `UNSUPPORTED_CONTENT_TYPE("unsupported_content_type")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `UNAVAILABLE("unavailable")` - - - `JsonValue; type "web_fetch_tool_result_error"constant` - - - `WEB_FETCH_TOOL_RESULT_ERROR("web_fetch_tool_result_error")` - - - `class BetaWebFetchBlock:` - - - `BetaDocumentBlock content` - - - `Optional citations` - - Citation configuration for the document - - - `boolean enabled` - - - `Source source` - - - `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional title` - - The title of the document - - - `JsonValue; type "document"constant` - - - `DOCUMENT("document")` - - - `Optional retrievedAt` - - ISO 8601 timestamp when the content was retrieved - - - `JsonValue; type "web_fetch_result"constant` - - - `WEB_FETCH_RESULT("web_fetch_result")` - - - `String url` - - Fetched content URL - - - `String toolUseId` - - - `JsonValue; type "web_fetch_tool_result"constant` - - - `WEB_FETCH_TOOL_RESULT("web_fetch_tool_result")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaCodeExecutionToolResultBlock:` - - - `BetaCodeExecutionToolResultBlockContent content` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `class BetaCodeExecutionToolResultError:` - - - `BetaCodeExecutionToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `JsonValue; type "code_execution_tool_result_error"constant` - - - `CODE_EXECUTION_TOOL_RESULT_ERROR("code_execution_tool_result_error")` - - - `class BetaCodeExecutionResultBlock:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "code_execution_result"constant` - - - `CODE_EXECUTION_RESULT("code_execution_result")` - - - `class BetaEncryptedCodeExecutionResultBlock:` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `String encryptedStdout` - - - `long returnCode` - - - `String stderr` - - - `JsonValue; type "encrypted_code_execution_result"constant` - - - `ENCRYPTED_CODE_EXECUTION_RESULT("encrypted_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "code_execution_tool_result"constant` - - - `CODE_EXECUTION_TOOL_RESULT("code_execution_tool_result")` - - - `class BetaBashCodeExecutionToolResultBlock:` - - - `Content content` - - - `class BetaBashCodeExecutionToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `OUTPUT_FILE_TOO_LARGE("output_file_too_large")` - - - `JsonValue; type "bash_code_execution_tool_result_error"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT_ERROR("bash_code_execution_tool_result_error")` - - - `class BetaBashCodeExecutionResultBlock:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "bash_code_execution_output"constant` - - - `BASH_CODE_EXECUTION_OUTPUT("bash_code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "bash_code_execution_result"constant` - - - `BASH_CODE_EXECUTION_RESULT("bash_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "bash_code_execution_tool_result"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT("bash_code_execution_tool_result")` - - - `class BetaTextEditorCodeExecutionToolResultBlock:` - - - `Content content` - - - `class BetaTextEditorCodeExecutionToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `FILE_NOT_FOUND("file_not_found")` - - - `Optional errorMessage` - - - `JsonValue; type "text_editor_code_execution_tool_result_error"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT_ERROR("text_editor_code_execution_tool_result_error")` - - - `class BetaTextEditorCodeExecutionViewResultBlock:` - - - `String content` - - - `FileType fileType` - - - `TEXT("text")` - - - `IMAGE("image")` - - - `PDF("pdf")` - - - `Optional numLines` - - - `Optional startLine` - - - `Optional totalLines` - - - `JsonValue; type "text_editor_code_execution_view_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_VIEW_RESULT("text_editor_code_execution_view_result")` - - - `class BetaTextEditorCodeExecutionCreateResultBlock:` - - - `boolean isFileUpdate` - - - `JsonValue; type "text_editor_code_execution_create_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_CREATE_RESULT("text_editor_code_execution_create_result")` - - - `class BetaTextEditorCodeExecutionStrReplaceResultBlock:` - - - `Optional> lines` - - - `Optional newLines` - - - `Optional newStart` - - - `Optional oldLines` - - - `Optional oldStart` - - - `JsonValue; type "text_editor_code_execution_str_replace_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_STR_REPLACE_RESULT("text_editor_code_execution_str_replace_result")` - - - `String toolUseId` - - - `JsonValue; type "text_editor_code_execution_tool_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT("text_editor_code_execution_tool_result")` - - - `class BetaToolSearchToolResultBlock:` - - - `Content content` - - - `class BetaToolSearchToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `Optional errorMessage` - - - `JsonValue; type "tool_search_tool_result_error"constant` - - - `TOOL_SEARCH_TOOL_RESULT_ERROR("tool_search_tool_result_error")` - - - `class BetaToolSearchToolSearchResultBlock:` - - - `List toolReferences` - - - `String toolName` - - - `JsonValue; type "tool_reference"constant` - - - `TOOL_REFERENCE("tool_reference")` - - - `JsonValue; type "tool_search_tool_search_result"constant` - - - `TOOL_SEARCH_TOOL_SEARCH_RESULT("tool_search_tool_search_result")` - - - `String toolUseId` - - - `JsonValue; type "tool_search_tool_result"constant` - - - `TOOL_SEARCH_TOOL_RESULT("tool_search_tool_result")` - - - `class BetaMcpToolUseBlock:` - - - `String id` - - - `Input input` - - - `String name` - - The name of the MCP tool - - - `String serverName` - - The name of the MCP server - - - `JsonValue; type "mcp_tool_use"constant` - - - `MCP_TOOL_USE("mcp_tool_use")` - - - `class BetaMcpToolResultBlock:` - - - `Content content` - - - `String` - - - `List` - - - `Optional> citations` - - Citations supporting the text block. - - The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. - - - `class BetaCitationCharLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `Optional fileId` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `Optional fileId` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `Optional fileId` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationsWebSearchResultLocation:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocation:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `boolean isError` - - - `String toolUseId` - - - `JsonValue; type "mcp_tool_result"constant` - - - `MCP_TOOL_RESULT("mcp_tool_result")` - - - `class BetaContainerUploadBlock:` - - Response model for a file uploaded to the container. - - - `String fileId` - - - `JsonValue; type "container_upload"constant` - - - `CONTAINER_UPLOAD("container_upload")` - - - `class BetaCompactionBlock:` - - A compaction block returned when autocompact is triggered. - - When content is None, it indicates the compaction failed to produce a valid - summary (e.g., malformed output from the model). Clients may round-trip - compaction blocks with null content; the server treats them as no-ops. - - - `Optional content` - - Summary of compacted content, or null if compaction failed - - - `JsonValue; type "compaction"constant` - - - `COMPACTION("compaction")` - -### Beta Content Block Param - -- `class BetaContentBlockParam: A class that can be one of several variants.union` - - Regular text content. - - - `class BetaTextBlockParam:` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `class BetaImageBlockParam:` - - - `Source source` - - - `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "image"constant` - - - `IMAGE("image")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaRequestDocumentBlock:` - - - `Source source` - - - `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `class BetaContentBlockSource:` - - - `Content content` - - - `String` - - - `List` - - - `class BetaTextBlockParam:` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `class BetaImageBlockParam:` - - - `Source source` - - - `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "image"constant` - - - `IMAGE("image")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `JsonValue; type "content"constant` - - - `CONTENT("content")` - - - `class BetaUrlPdfSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileDocumentSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "document"constant` - - - `DOCUMENT("document")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - - `Optional enabled` - - - `Optional context` - - - `Optional title` - - - `class BetaSearchResultBlockParam:` - - - `List content` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String source` - - - `String title` - - - `JsonValue; type "search_result"constant` - - - `SEARCH_RESULT("search_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - - `Optional enabled` - - - `class BetaThinkingBlockParam:` - - - `String signature` - - - `String thinking` - - - `JsonValue; type "thinking"constant` - - - `THINKING("thinking")` - - - `class BetaRedactedThinkingBlockParam:` - - - `String data` - - - `JsonValue; type "redacted_thinking"constant` - - - `REDACTED_THINKING("redacted_thinking")` - - - `class BetaToolUseBlockParam:` - - - `String id` - - - `Input input` - - - `String name` - - - `JsonValue; type "tool_use"constant` - - - `TOOL_USE("tool_use")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaToolResultBlockParam:` - - - `String toolUseId` - - - `JsonValue; type "tool_result"constant` - - - `TOOL_RESULT("tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional content` - - - `String` - - - `List` - - - `class BetaTextBlockParam:` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `class BetaImageBlockParam:` - - - `Source source` - - - `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "image"constant` - - - `IMAGE("image")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaSearchResultBlockParam:` - - - `List content` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String source` - - - `String title` - - - `JsonValue; type "search_result"constant` - - - `SEARCH_RESULT("search_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - - `Optional enabled` - - - `class BetaRequestDocumentBlock:` - - - `Source source` - - - `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `class BetaContentBlockSource:` - - - `Content content` - - - `String` - - - `List` - - - `class BetaTextBlockParam:` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `class BetaImageBlockParam:` - - - `Source source` - - - `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "image"constant` - - - `IMAGE("image")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `JsonValue; type "content"constant` - - - `CONTENT("content")` - - - `class BetaUrlPdfSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileDocumentSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "document"constant` - - - `DOCUMENT("document")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - - `Optional enabled` - - - `Optional context` - - - `Optional title` - - - `class BetaToolReferenceBlockParam:` - - Tool reference block that can be included in tool_result content. - - - `String toolName` - - - `JsonValue; type "tool_reference"constant` - - - `TOOL_REFERENCE("tool_reference")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional isError` - - - `class BetaServerToolUseBlockParam:` - - - `String id` - - - `Input input` - - - `Name name` - - - `WEB_SEARCH("web_search")` - - - `WEB_FETCH("web_fetch")` - - - `CODE_EXECUTION("code_execution")` - - - `BASH_CODE_EXECUTION("bash_code_execution")` - - - `TEXT_EDITOR_CODE_EXECUTION("text_editor_code_execution")` - - - `TOOL_SEARCH_TOOL_REGEX("tool_search_tool_regex")` - - - `TOOL_SEARCH_TOOL_BM25("tool_search_tool_bm25")` - - - `JsonValue; type "server_tool_use"constant` - - - `SERVER_TOOL_USE("server_tool_use")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaWebSearchToolResultBlockParam:` - - - `BetaWebSearchToolResultBlockParamContent content` - - - `List` - - - `String encryptedContent` - - - `String title` - - - `JsonValue; type "web_search_result"constant` - - - `WEB_SEARCH_RESULT("web_search_result")` - - - `String url` - - - `Optional pageAge` - - - `class BetaWebSearchToolRequestError:` - - - `BetaWebSearchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `QUERY_TOO_LONG("query_too_long")` - - - `REQUEST_TOO_LARGE("request_too_large")` - - - `JsonValue; type "web_search_tool_result_error"constant` - - - `WEB_SEARCH_TOOL_RESULT_ERROR("web_search_tool_result_error")` - - - `String toolUseId` - - - `JsonValue; type "web_search_tool_result"constant` - - - `WEB_SEARCH_TOOL_RESULT("web_search_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaWebFetchToolResultBlockParam:` - - - `Content content` - - - `class BetaWebFetchToolResultErrorBlockParam:` - - - `BetaWebFetchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `URL_TOO_LONG("url_too_long")` - - - `URL_NOT_ALLOWED("url_not_allowed")` - - - `URL_NOT_ACCESSIBLE("url_not_accessible")` - - - `UNSUPPORTED_CONTENT_TYPE("unsupported_content_type")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `UNAVAILABLE("unavailable")` - - - `JsonValue; type "web_fetch_tool_result_error"constant` - - - `WEB_FETCH_TOOL_RESULT_ERROR("web_fetch_tool_result_error")` - - - `class BetaWebFetchBlockParam:` - - - `BetaRequestDocumentBlock content` - - - `Source source` - - - `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `class BetaContentBlockSource:` - - - `Content content` - - - `String` - - - `List` - - - `class BetaTextBlockParam:` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `class BetaImageBlockParam:` - - - `Source source` - - - `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "image"constant` - - - `IMAGE("image")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `JsonValue; type "content"constant` - - - `CONTENT("content")` - - - `class BetaUrlPdfSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileDocumentSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "document"constant` - - - `DOCUMENT("document")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - - `Optional enabled` - - - `Optional context` - - - `Optional title` - - - `JsonValue; type "web_fetch_result"constant` - - - `WEB_FETCH_RESULT("web_fetch_result")` - - - `String url` - - Fetched content URL - - - `Optional retrievedAt` - - ISO 8601 timestamp when the content was retrieved - - - `String toolUseId` - - - `JsonValue; type "web_fetch_tool_result"constant` - - - `WEB_FETCH_TOOL_RESULT("web_fetch_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaCodeExecutionToolResultBlockParam:` - - - `BetaCodeExecutionToolResultBlockParamContent content` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `class BetaCodeExecutionToolResultErrorParam:` - - - `BetaCodeExecutionToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `JsonValue; type "code_execution_tool_result_error"constant` - - - `CODE_EXECUTION_TOOL_RESULT_ERROR("code_execution_tool_result_error")` - - - `class BetaCodeExecutionResultBlockParam:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "code_execution_result"constant` - - - `CODE_EXECUTION_RESULT("code_execution_result")` - - - `class BetaEncryptedCodeExecutionResultBlockParam:` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `String encryptedStdout` - - - `long returnCode` - - - `String stderr` - - - `JsonValue; type "encrypted_code_execution_result"constant` - - - `ENCRYPTED_CODE_EXECUTION_RESULT("encrypted_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "code_execution_tool_result"constant` - - - `CODE_EXECUTION_TOOL_RESULT("code_execution_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaBashCodeExecutionToolResultBlockParam:` - - - `Content content` - - - `class BetaBashCodeExecutionToolResultErrorParam:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `OUTPUT_FILE_TOO_LARGE("output_file_too_large")` - - - `JsonValue; type "bash_code_execution_tool_result_error"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT_ERROR("bash_code_execution_tool_result_error")` - - - `class BetaBashCodeExecutionResultBlockParam:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "bash_code_execution_output"constant` - - - `BASH_CODE_EXECUTION_OUTPUT("bash_code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "bash_code_execution_result"constant` - - - `BASH_CODE_EXECUTION_RESULT("bash_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "bash_code_execution_tool_result"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT("bash_code_execution_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaTextEditorCodeExecutionToolResultBlockParam:` - - - `Content content` - - - `class BetaTextEditorCodeExecutionToolResultErrorParam:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `FILE_NOT_FOUND("file_not_found")` - - - `JsonValue; type "text_editor_code_execution_tool_result_error"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT_ERROR("text_editor_code_execution_tool_result_error")` - - - `Optional errorMessage` - - - `class BetaTextEditorCodeExecutionViewResultBlockParam:` - - - `String content` - - - `FileType fileType` - - - `TEXT("text")` - - - `IMAGE("image")` - - - `PDF("pdf")` - - - `JsonValue; type "text_editor_code_execution_view_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_VIEW_RESULT("text_editor_code_execution_view_result")` - - - `Optional numLines` - - - `Optional startLine` - - - `Optional totalLines` - - - `class BetaTextEditorCodeExecutionCreateResultBlockParam:` - - - `boolean isFileUpdate` - - - `JsonValue; type "text_editor_code_execution_create_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_CREATE_RESULT("text_editor_code_execution_create_result")` - - - `class BetaTextEditorCodeExecutionStrReplaceResultBlockParam:` - - - `JsonValue; type "text_editor_code_execution_str_replace_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_STR_REPLACE_RESULT("text_editor_code_execution_str_replace_result")` - - - `Optional> lines` - - - `Optional newLines` - - - `Optional newStart` - - - `Optional oldLines` - - - `Optional oldStart` - - - `String toolUseId` - - - `JsonValue; type "text_editor_code_execution_tool_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT("text_editor_code_execution_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaToolSearchToolResultBlockParam:` - - - `Content content` - - - `class BetaToolSearchToolResultErrorParam:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `JsonValue; type "tool_search_tool_result_error"constant` - - - `TOOL_SEARCH_TOOL_RESULT_ERROR("tool_search_tool_result_error")` - - - `class BetaToolSearchToolSearchResultBlockParam:` - - - `List toolReferences` - - - `String toolName` - - - `JsonValue; type "tool_reference"constant` - - - `TOOL_REFERENCE("tool_reference")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `JsonValue; type "tool_search_tool_search_result"constant` - - - `TOOL_SEARCH_TOOL_SEARCH_RESULT("tool_search_tool_search_result")` - - - `String toolUseId` - - - `JsonValue; type "tool_search_tool_result"constant` - - - `TOOL_SEARCH_TOOL_RESULT("tool_search_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaMcpToolUseBlockParam:` - - - `String id` - - - `Input input` - - - `String name` - - - `String serverName` - - The name of the MCP server - - - `JsonValue; type "mcp_tool_use"constant` - - - `MCP_TOOL_USE("mcp_tool_use")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaRequestMcpToolResultBlockParam:` - - - `String toolUseId` - - - `JsonValue; type "mcp_tool_result"constant` - - - `MCP_TOOL_RESULT("mcp_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional content` - - - `String` - - - `List` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `Optional isError` - - - `class BetaContainerUploadBlockParam:` - - A content block that represents a file to be uploaded to the container - Files uploaded via this block will be available in the container's input directory. - - - `String fileId` - - - `JsonValue; type "container_upload"constant` - - - `CONTAINER_UPLOAD("container_upload")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaCompactionBlockParam:` - - A compaction block containing summary of previous context. - - Users should round-trip these blocks from responses to subsequent requests - to maintain context across compaction boundaries. - - When content is None, the block represents a failed compaction. The server - treats these as no-ops. Empty string content is not allowed. - - - `Optional content` - - Summary of previously compacted content, or null if compaction failed - - - `JsonValue; type "compaction"constant` - - - `COMPACTION("compaction")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - -### Beta Content Block Source - -- `class BetaContentBlockSource:` - - - `Content content` - - - `String` - - - `List` - - - `class BetaTextBlockParam:` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `class BetaImageBlockParam:` - - - `Source source` - - - `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "image"constant` - - - `IMAGE("image")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `JsonValue; type "content"constant` - - - `CONTENT("content")` - -### Beta Content Block Source Content - -- `class BetaContentBlockSourceContent: A class that can be one of several variants.union` - - - `class BetaTextBlockParam:` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `class BetaImageBlockParam:` - - - `Source source` - - - `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "image"constant` - - - `IMAGE("image")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - -### Beta Context Management Config - -- `class BetaContextManagementConfig:` - - - `Optional> edits` - - List of context management edits to apply - - - `class BetaClearToolUses20250919Edit:` - - - `JsonValue; type "clear_tool_uses_20250919"constant` - - - `CLEAR_TOOL_USES_20250919("clear_tool_uses_20250919")` - - - `Optional clearAtLeast` - - Minimum number of tokens that must be cleared when triggered. Context will only be modified if at least this many tokens can be removed. - - - `JsonValue; type "input_tokens"constant` - - - `INPUT_TOKENS("input_tokens")` - - - `long value` - - - `Optional clearToolInputs` - - Whether to clear all tool inputs (bool) or specific tool inputs to clear (list) - - - `boolean` - - - `List` - - - `Optional> excludeTools` - - Tool names whose uses are preserved from clearing - - - `Optional keep` - - Number of tool uses to retain in the conversation - - - `JsonValue; type "tool_uses"constant` - - - `TOOL_USES("tool_uses")` - - - `long value` - - - `Optional trigger` - - Condition that triggers the context management strategy - - - `class BetaInputTokensTrigger:` - - - `JsonValue; type "input_tokens"constant` - - - `INPUT_TOKENS("input_tokens")` - - - `long value` - - - `class BetaToolUsesTrigger:` - - - `JsonValue; type "tool_uses"constant` - - - `TOOL_USES("tool_uses")` - - - `long value` - - - `class BetaClearThinking20251015Edit:` - - - `JsonValue; type "clear_thinking_20251015"constant` - - - `CLEAR_THINKING_20251015("clear_thinking_20251015")` - - - `Optional keep` - - Number of most recent assistant turns to keep thinking blocks for. Older turns will have their thinking blocks removed. - - - `class BetaThinkingTurns:` - - - `JsonValue; type "thinking_turns"constant` - - - `THINKING_TURNS("thinking_turns")` - - - `long value` - - - `class BetaAllThinkingTurns:` - - - `JsonValue; type "all"constant` - - - `ALL("all")` - - - `JsonValue;` - - - `ALL("all")` - - - `class BetaCompact20260112Edit:` - - Automatically compact older context when reaching the configured trigger threshold. - - - `JsonValue; type "compact_20260112"constant` - - - `COMPACT_20260112("compact_20260112")` - - - `Optional instructions` - - Additional instructions for summarization. - - - `Optional pauseAfterCompaction` - - Whether to pause after compaction and return the compaction block to the user. - - - `Optional trigger` - - When to trigger compaction. Defaults to 150000 input tokens. - - - `JsonValue; type "input_tokens"constant` - - - `INPUT_TOKENS("input_tokens")` - - - `long value` - -### Beta Context Management Response - -- `class BetaContextManagementResponse:` - - - `List appliedEdits` - - List of context management edits that were applied. - - - `class BetaClearToolUses20250919EditResponse:` - - - `long clearedInputTokens` - - Number of input tokens cleared by this edit. - - - `long clearedToolUses` - - Number of tool uses that were cleared. - - - `JsonValue; type "clear_tool_uses_20250919"constant` - - The type of context management edit applied. - - - `CLEAR_TOOL_USES_20250919("clear_tool_uses_20250919")` - - - `class BetaClearThinking20251015EditResponse:` - - - `long clearedInputTokens` - - Number of input tokens cleared by this edit. - - - `long clearedThinkingTurns` - - Number of thinking turns that were cleared. - - - `JsonValue; type "clear_thinking_20251015"constant` - - The type of context management edit applied. - - - `CLEAR_THINKING_20251015("clear_thinking_20251015")` - -### Beta Count Tokens Context Management Response - -- `class BetaCountTokensContextManagementResponse:` - - - `long originalInputTokens` - - The original token count before context management was applied - -### Beta Direct Caller - -- `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - -### Beta Document Block - -- `class BetaDocumentBlock:` - - - `Optional citations` - - Citation configuration for the document - - - `boolean enabled` - - - `Source source` - - - `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional title` - - The title of the document - - - `JsonValue; type "document"constant` - - - `DOCUMENT("document")` - -### Beta Encrypted Code Execution Result Block - -- `class BetaEncryptedCodeExecutionResultBlock:` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `String encryptedStdout` - - - `long returnCode` - - - `String stderr` - - - `JsonValue; type "encrypted_code_execution_result"constant` - - - `ENCRYPTED_CODE_EXECUTION_RESULT("encrypted_code_execution_result")` - -### Beta Encrypted Code Execution Result Block Param - -- `class BetaEncryptedCodeExecutionResultBlockParam:` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `String encryptedStdout` - - - `long returnCode` - - - `String stderr` - - - `JsonValue; type "encrypted_code_execution_result"constant` - - - `ENCRYPTED_CODE_EXECUTION_RESULT("encrypted_code_execution_result")` - -### Beta File Document Source - -- `class BetaFileDocumentSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - -### Beta File Image Source - -- `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - -### Beta Image Block Param - -- `class BetaImageBlockParam:` - - - `Source source` - - - `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "image"constant` - - - `IMAGE("image")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - -### Beta Input JSON Delta - -- `class BetaInputJsonDelta:` - - - `String partialJson` - - - `JsonValue; type "input_json_delta"constant` - - - `INPUT_JSON_DELTA("input_json_delta")` - -### Beta Input Tokens Clear At Least - -- `class BetaInputTokensClearAtLeast:` - - - `JsonValue; type "input_tokens"constant` - - - `INPUT_TOKENS("input_tokens")` - - - `long value` - -### Beta Input Tokens Trigger - -- `class BetaInputTokensTrigger:` - - - `JsonValue; type "input_tokens"constant` - - - `INPUT_TOKENS("input_tokens")` - - - `long value` - -### Beta JSON Output Format - -- `class BetaJsonOutputFormat:` - - - `Schema schema` - - The JSON schema of the format - - - `JsonValue; type "json_schema"constant` - - - `JSON_SCHEMA("json_schema")` - -### Beta MCP Tool Config - -- `class BetaMcpToolConfig:` - - Configuration for a specific tool in an MCP toolset. - - - `Optional deferLoading` - - - `Optional enabled` - -### Beta MCP Tool Default Config - -- `class BetaMcpToolDefaultConfig:` - - Default configuration for tools in an MCP toolset. - - - `Optional deferLoading` - - - `Optional enabled` - -### Beta MCP Tool Result Block - -- `class BetaMcpToolResultBlock:` - - - `Content content` - - - `String` - - - `List` - - - `Optional> citations` - - Citations supporting the text block. - - The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. - - - `class BetaCitationCharLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `Optional fileId` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `Optional fileId` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `Optional fileId` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationsWebSearchResultLocation:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocation:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `boolean isError` - - - `String toolUseId` - - - `JsonValue; type "mcp_tool_result"constant` - - - `MCP_TOOL_RESULT("mcp_tool_result")` - -### Beta MCP Tool Use Block - -- `class BetaMcpToolUseBlock:` - - - `String id` - - - `Input input` - - - `String name` - - The name of the MCP tool - - - `String serverName` - - The name of the MCP server - - - `JsonValue; type "mcp_tool_use"constant` - - - `MCP_TOOL_USE("mcp_tool_use")` - -### Beta MCP Tool Use Block Param - -- `class BetaMcpToolUseBlockParam:` - - - `String id` - - - `Input input` - - - `String name` - - - `String serverName` - - The name of the MCP server - - - `JsonValue; type "mcp_tool_use"constant` - - - `MCP_TOOL_USE("mcp_tool_use")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - -### Beta MCP Toolset - -- `class BetaMcpToolset:` - - Configuration for a group of tools from an MCP server. - - Allows configuring enabled status and defer_loading for all tools - from an MCP server, with optional per-tool overrides. - - - `String mcpServerName` - - Name of the MCP server to configure tools for - - - `JsonValue; type "mcp_toolset"constant` - - - `MCP_TOOLSET("mcp_toolset")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional configs` - - Configuration overrides for specific tools, keyed by tool name - - - `Optional deferLoading` - - - `Optional enabled` - - - `Optional defaultConfig` - - Default configuration applied to all tools from this server - - - `Optional deferLoading` - - - `Optional enabled` - -### Beta Memory Tool 20250818 - -- `class BetaMemoryTool20250818:` - - - `JsonValue; name "memory"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `MEMORY("memory")` - - - `JsonValue; type "memory_20250818"constant` - - - `MEMORY_20250818("memory_20250818")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - -### Beta Memory Tool 20250818 Command - -- `class BetaMemoryTool20250818Command: A class that can be one of several variants.union` - - - `class BetaMemoryTool20250818ViewCommand:` - - - `JsonValue; command "view"constant` - - Command type identifier - - - `VIEW("view")` - - - `String path` - - Path to directory or file to view - - - `Optional> viewRange` - - Optional line range for viewing specific lines - - - `class BetaMemoryTool20250818CreateCommand:` - - - `JsonValue; command "create"constant` - - Command type identifier - - - `CREATE("create")` - - - `String fileText` - - Content to write to the file - - - `String path` - - Path where the file should be created - - - `class BetaMemoryTool20250818StrReplaceCommand:` - - - `JsonValue; command "str_replace"constant` - - Command type identifier - - - `STR_REPLACE("str_replace")` - - - `String newStr` - - Text to replace with - - - `String oldStr` - - Text to search for and replace - - - `String path` - - Path to the file where text should be replaced - - - `class BetaMemoryTool20250818InsertCommand:` - - - `JsonValue; command "insert"constant` - - Command type identifier - - - `INSERT("insert")` - - - `long insertLine` - - Line number where text should be inserted - - - `String insertText` - - Text to insert at the specified line - - - `String path` - - Path to the file where text should be inserted - - - `class BetaMemoryTool20250818DeleteCommand:` - - - `JsonValue; command "delete"constant` - - Command type identifier - - - `DELETE("delete")` - - - `String path` - - Path to the file or directory to delete - - - `class BetaMemoryTool20250818RenameCommand:` - - - `JsonValue; command "rename"constant` - - Command type identifier - - - `RENAME("rename")` - - - `String newPath` - - New path for the file or directory - - - `String oldPath` - - Current path of the file or directory - -### Beta Memory Tool 20250818 Create Command - -- `class BetaMemoryTool20250818CreateCommand:` - - - `JsonValue; command "create"constant` - - Command type identifier - - - `CREATE("create")` - - - `String fileText` - - Content to write to the file - - - `String path` - - Path where the file should be created - -### Beta Memory Tool 20250818 Delete Command - -- `class BetaMemoryTool20250818DeleteCommand:` - - - `JsonValue; command "delete"constant` - - Command type identifier - - - `DELETE("delete")` - - - `String path` - - Path to the file or directory to delete - -### Beta Memory Tool 20250818 Insert Command - -- `class BetaMemoryTool20250818InsertCommand:` - - - `JsonValue; command "insert"constant` - - Command type identifier - - - `INSERT("insert")` - - - `long insertLine` - - Line number where text should be inserted - - - `String insertText` - - Text to insert at the specified line - - - `String path` - - Path to the file where text should be inserted - -### Beta Memory Tool 20250818 Rename Command - -- `class BetaMemoryTool20250818RenameCommand:` - - - `JsonValue; command "rename"constant` - - Command type identifier - - - `RENAME("rename")` - - - `String newPath` - - New path for the file or directory - - - `String oldPath` - - Current path of the file or directory - -### Beta Memory Tool 20250818 Str Replace Command - -- `class BetaMemoryTool20250818StrReplaceCommand:` - - - `JsonValue; command "str_replace"constant` - - Command type identifier - - - `STR_REPLACE("str_replace")` - - - `String newStr` - - Text to replace with - - - `String oldStr` - - Text to search for and replace - - - `String path` - - Path to the file where text should be replaced - -### Beta Memory Tool 20250818 View Command - -- `class BetaMemoryTool20250818ViewCommand:` - - - `JsonValue; command "view"constant` - - Command type identifier - - - `VIEW("view")` - - - `String path` - - Path to directory or file to view - - - `Optional> viewRange` - - Optional line range for viewing specific lines - -### Beta Message - -- `class BetaMessage:` - - - `String id` - - Unique object identifier. - - The format and length of IDs may change over time. - - - `Optional container` - - Information about the container used in the request (for the code execution tool) - - - `String id` - - Identifier for the container used in this request - - - `LocalDateTime expiresAt` - - The time at which the container will expire. - - - `Optional> skills` - - Skills loaded in the container - - - `String skillId` - - Skill ID - - - `Type type` - - Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) - - - `ANTHROPIC("anthropic")` - - - `CUSTOM("custom")` - - - `String version` - - Skill version or 'latest' for most recent version - - - `List content` - - Content generated by the model. - - This is an array of content blocks, each of which has a `type` that determines its shape. - - Example: - - ```json - [{"type": "text", "text": "Hi, I'm Claude."}] - ``` - - If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. - - For example, if the input `messages` were: - - ```json - [ - {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, - {"role": "assistant", "content": "The best answer is ("} - ] - ``` - - Then the response `content` might be: - - ```json - [{"type": "text", "text": "B)"}] - ``` - - - `class BetaTextBlock:` - - - `Optional> citations` - - Citations supporting the text block. - - The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. - - - `class BetaCitationCharLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `Optional fileId` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `Optional fileId` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `Optional fileId` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationsWebSearchResultLocation:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocation:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `class BetaThinkingBlock:` - - - `String signature` - - - `String thinking` - - - `JsonValue; type "thinking"constant` - - - `THINKING("thinking")` - - - `class BetaRedactedThinkingBlock:` - - - `String data` - - - `JsonValue; type "redacted_thinking"constant` - - - `REDACTED_THINKING("redacted_thinking")` - - - `class BetaToolUseBlock:` - - - `String id` - - - `Input input` - - - `String name` - - - `JsonValue; type "tool_use"constant` - - - `TOOL_USE("tool_use")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaServerToolUseBlock:` - - - `String id` - - - `Input input` - - - `Name name` - - - `WEB_SEARCH("web_search")` - - - `WEB_FETCH("web_fetch")` - - - `CODE_EXECUTION("code_execution")` - - - `BASH_CODE_EXECUTION("bash_code_execution")` - - - `TEXT_EDITOR_CODE_EXECUTION("text_editor_code_execution")` - - - `TOOL_SEARCH_TOOL_REGEX("tool_search_tool_regex")` - - - `TOOL_SEARCH_TOOL_BM25("tool_search_tool_bm25")` - - - `JsonValue; type "server_tool_use"constant` - - - `SERVER_TOOL_USE("server_tool_use")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaWebSearchToolResultBlock:` - - - `BetaWebSearchToolResultBlockContent content` - - - `class BetaWebSearchToolResultError:` - - - `BetaWebSearchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `QUERY_TOO_LONG("query_too_long")` - - - `REQUEST_TOO_LARGE("request_too_large")` - - - `JsonValue; type "web_search_tool_result_error"constant` - - - `WEB_SEARCH_TOOL_RESULT_ERROR("web_search_tool_result_error")` - - - `List` - - - `String encryptedContent` - - - `Optional pageAge` - - - `String title` - - - `JsonValue; type "web_search_result"constant` - - - `WEB_SEARCH_RESULT("web_search_result")` - - - `String url` - - - `String toolUseId` - - - `JsonValue; type "web_search_tool_result"constant` - - - `WEB_SEARCH_TOOL_RESULT("web_search_tool_result")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaWebFetchToolResultBlock:` - - - `Content content` - - - `class BetaWebFetchToolResultErrorBlock:` - - - `BetaWebFetchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `URL_TOO_LONG("url_too_long")` - - - `URL_NOT_ALLOWED("url_not_allowed")` - - - `URL_NOT_ACCESSIBLE("url_not_accessible")` - - - `UNSUPPORTED_CONTENT_TYPE("unsupported_content_type")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `UNAVAILABLE("unavailable")` - - - `JsonValue; type "web_fetch_tool_result_error"constant` - - - `WEB_FETCH_TOOL_RESULT_ERROR("web_fetch_tool_result_error")` - - - `class BetaWebFetchBlock:` - - - `BetaDocumentBlock content` - - - `Optional citations` - - Citation configuration for the document - - - `boolean enabled` - - - `Source source` - - - `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional title` - - The title of the document - - - `JsonValue; type "document"constant` - - - `DOCUMENT("document")` - - - `Optional retrievedAt` - - ISO 8601 timestamp when the content was retrieved - - - `JsonValue; type "web_fetch_result"constant` - - - `WEB_FETCH_RESULT("web_fetch_result")` - - - `String url` - - Fetched content URL - - - `String toolUseId` - - - `JsonValue; type "web_fetch_tool_result"constant` - - - `WEB_FETCH_TOOL_RESULT("web_fetch_tool_result")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaCodeExecutionToolResultBlock:` - - - `BetaCodeExecutionToolResultBlockContent content` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `class BetaCodeExecutionToolResultError:` - - - `BetaCodeExecutionToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `JsonValue; type "code_execution_tool_result_error"constant` - - - `CODE_EXECUTION_TOOL_RESULT_ERROR("code_execution_tool_result_error")` - - - `class BetaCodeExecutionResultBlock:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "code_execution_result"constant` - - - `CODE_EXECUTION_RESULT("code_execution_result")` - - - `class BetaEncryptedCodeExecutionResultBlock:` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `String encryptedStdout` - - - `long returnCode` - - - `String stderr` - - - `JsonValue; type "encrypted_code_execution_result"constant` - - - `ENCRYPTED_CODE_EXECUTION_RESULT("encrypted_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "code_execution_tool_result"constant` - - - `CODE_EXECUTION_TOOL_RESULT("code_execution_tool_result")` - - - `class BetaBashCodeExecutionToolResultBlock:` - - - `Content content` - - - `class BetaBashCodeExecutionToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `OUTPUT_FILE_TOO_LARGE("output_file_too_large")` - - - `JsonValue; type "bash_code_execution_tool_result_error"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT_ERROR("bash_code_execution_tool_result_error")` - - - `class BetaBashCodeExecutionResultBlock:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "bash_code_execution_output"constant` - - - `BASH_CODE_EXECUTION_OUTPUT("bash_code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "bash_code_execution_result"constant` - - - `BASH_CODE_EXECUTION_RESULT("bash_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "bash_code_execution_tool_result"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT("bash_code_execution_tool_result")` - - - `class BetaTextEditorCodeExecutionToolResultBlock:` - - - `Content content` - - - `class BetaTextEditorCodeExecutionToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `FILE_NOT_FOUND("file_not_found")` - - - `Optional errorMessage` - - - `JsonValue; type "text_editor_code_execution_tool_result_error"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT_ERROR("text_editor_code_execution_tool_result_error")` - - - `class BetaTextEditorCodeExecutionViewResultBlock:` - - - `String content` - - - `FileType fileType` - - - `TEXT("text")` - - - `IMAGE("image")` - - - `PDF("pdf")` - - - `Optional numLines` - - - `Optional startLine` - - - `Optional totalLines` - - - `JsonValue; type "text_editor_code_execution_view_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_VIEW_RESULT("text_editor_code_execution_view_result")` - - - `class BetaTextEditorCodeExecutionCreateResultBlock:` - - - `boolean isFileUpdate` - - - `JsonValue; type "text_editor_code_execution_create_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_CREATE_RESULT("text_editor_code_execution_create_result")` - - - `class BetaTextEditorCodeExecutionStrReplaceResultBlock:` - - - `Optional> lines` - - - `Optional newLines` - - - `Optional newStart` - - - `Optional oldLines` - - - `Optional oldStart` - - - `JsonValue; type "text_editor_code_execution_str_replace_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_STR_REPLACE_RESULT("text_editor_code_execution_str_replace_result")` - - - `String toolUseId` - - - `JsonValue; type "text_editor_code_execution_tool_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT("text_editor_code_execution_tool_result")` - - - `class BetaToolSearchToolResultBlock:` - - - `Content content` - - - `class BetaToolSearchToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `Optional errorMessage` - - - `JsonValue; type "tool_search_tool_result_error"constant` - - - `TOOL_SEARCH_TOOL_RESULT_ERROR("tool_search_tool_result_error")` - - - `class BetaToolSearchToolSearchResultBlock:` - - - `List toolReferences` - - - `String toolName` - - - `JsonValue; type "tool_reference"constant` - - - `TOOL_REFERENCE("tool_reference")` - - - `JsonValue; type "tool_search_tool_search_result"constant` - - - `TOOL_SEARCH_TOOL_SEARCH_RESULT("tool_search_tool_search_result")` - - - `String toolUseId` - - - `JsonValue; type "tool_search_tool_result"constant` - - - `TOOL_SEARCH_TOOL_RESULT("tool_search_tool_result")` - - - `class BetaMcpToolUseBlock:` - - - `String id` - - - `Input input` - - - `String name` - - The name of the MCP tool - - - `String serverName` - - The name of the MCP server - - - `JsonValue; type "mcp_tool_use"constant` - - - `MCP_TOOL_USE("mcp_tool_use")` - - - `class BetaMcpToolResultBlock:` - - - `Content content` - - - `String` - - - `List` - - - `Optional> citations` - - Citations supporting the text block. - - The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. - - - `class BetaCitationCharLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `Optional fileId` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `Optional fileId` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `Optional fileId` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationsWebSearchResultLocation:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocation:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `boolean isError` - - - `String toolUseId` - - - `JsonValue; type "mcp_tool_result"constant` - - - `MCP_TOOL_RESULT("mcp_tool_result")` - - - `class BetaContainerUploadBlock:` - - Response model for a file uploaded to the container. - - - `String fileId` - - - `JsonValue; type "container_upload"constant` - - - `CONTAINER_UPLOAD("container_upload")` - - - `class BetaCompactionBlock:` - - A compaction block returned when autocompact is triggered. - - When content is None, it indicates the compaction failed to produce a valid - summary (e.g., malformed output from the model). Clients may round-trip - compaction blocks with null content; the server treats them as no-ops. - - - `Optional content` - - Summary of compacted content, or null if compaction failed - - - `JsonValue; type "compaction"constant` - - - `COMPACTION("compaction")` - - - `Optional contextManagement` - - Context management response. - - Information about context management strategies applied during the request. - - - `List appliedEdits` - - List of context management edits that were applied. - - - `class BetaClearToolUses20250919EditResponse:` - - - `long clearedInputTokens` - - Number of input tokens cleared by this edit. - - - `long clearedToolUses` - - Number of tool uses that were cleared. - - - `JsonValue; type "clear_tool_uses_20250919"constant` - - The type of context management edit applied. - - - `CLEAR_TOOL_USES_20250919("clear_tool_uses_20250919")` - - - `class BetaClearThinking20251015EditResponse:` - - - `long clearedInputTokens` - - Number of input tokens cleared by this edit. - - - `long clearedThinkingTurns` - - Number of thinking turns that were cleared. - - - `JsonValue; type "clear_thinking_20251015"constant` - - The type of context management edit applied. - - - `CLEAR_THINKING_20251015("clear_thinking_20251015")` - - - `Model model` - - The model that will complete your prompt. - - See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - - Most intelligent model for building agents and coding - - - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` - - Best combination of speed and intelligence - - - `CLAUDE_HAIKU_4_5("claude-haiku-4-5")` - - Fastest model with near-frontier intelligence - - - `CLAUDE_HAIKU_4_5_20251001("claude-haiku-4-5-20251001")` - - Fastest model with near-frontier intelligence - - - `CLAUDE_OPUS_4_5("claude-opus-4-5")` - - Premium model combining maximum intelligence with practical performance - - - `CLAUDE_OPUS_4_5_20251101("claude-opus-4-5-20251101")` - - Premium model combining maximum intelligence with practical performance - - - `CLAUDE_SONNET_4_5("claude-sonnet-4-5")` - - High-performance model for agents and coding - - - `CLAUDE_SONNET_4_5_20250929("claude-sonnet-4-5-20250929")` - - High-performance model for agents and coding - - - `CLAUDE_OPUS_4_1("claude-opus-4-1")` - - Exceptional model for specialized complex tasks - - - `CLAUDE_OPUS_4_1_20250805("claude-opus-4-1-20250805")` - - Exceptional model for specialized complex tasks - - - `CLAUDE_OPUS_4_0("claude-opus-4-0")` - - Powerful model for complex tasks - - - `CLAUDE_OPUS_4_20250514("claude-opus-4-20250514")` - - Powerful model for complex tasks - - - `CLAUDE_SONNET_4_0("claude-sonnet-4-0")` - - High-performance model with extended thinking - - - `CLAUDE_SONNET_4_20250514("claude-sonnet-4-20250514")` - - High-performance model with extended thinking - - - `CLAUDE_3_HAIKU_20240307("claude-3-haiku-20240307")` - - Fast and cost-effective model - - - `JsonValue; role "assistant"constant` - - Conversational role of the generated message. - - This will always be `"assistant"`. - - - `ASSISTANT("assistant")` - - - `Optional stopDetails` - - Structured information about a refusal. - - - `Optional category` - - The policy category that triggered the refusal. - - `null` when the refusal doesn't map to a named category. - - - `CYBER("cyber")` - - - `BIO("bio")` - - - `Optional explanation` - - Human-readable explanation of the refusal. - - This text is not guaranteed to be stable. `null` when no explanation is available for the category. - - - `JsonValue; type "refusal"constant` - - - `REFUSAL("refusal")` - - - `Optional stopReason` - - The reason that we stopped. - - This may be one the following values: - - * `"end_turn"`: the model reached a natural stopping point - * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum - * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated - * `"tool_use"`: the model invoked one or more tools - * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. - * `"refusal"`: when streaming classifiers intervene to handle potential policy violations - - In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. - - - `END_TURN("end_turn")` - - - `MAX_TOKENS("max_tokens")` - - - `STOP_SEQUENCE("stop_sequence")` - - - `TOOL_USE("tool_use")` - - - `PAUSE_TURN("pause_turn")` - - - `COMPACTION("compaction")` - - - `REFUSAL("refusal")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED("model_context_window_exceeded")` - - - `Optional stopSequence` - - Which custom stop sequence was generated, if any. - - This value will be a non-null string if one of your custom stop sequences was generated. - - - `JsonValue; type "message"constant` - - Object type. - - For Messages, this is always `"message"`. - - - `MESSAGE("message")` - - - `BetaUsage usage` - - Billing and rate-limit usage. - - Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. - - Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. - - For example, `output_tokens` will be non-zero, even for an empty string response from Claude. - - Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `Optional cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `Optional cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `Optional inferenceGeo` - - The geographic region where inference was performed for this request. - - - `long inputTokens` - - The number of input tokens which were used. - - - `Optional> iterations` - - Per-iteration token usage breakdown. - - Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: - - - Determine which iterations exceeded long context thresholds (>=200k tokens) - - Calculate the true context window size from the last iteration - - Understand token accumulation across server-side tool use loops - - - `class BetaMessageIterationUsage:` - - Token usage for a sampling iteration. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `long cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `long cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `long inputTokens` - - The number of input tokens which were used. - - - `long outputTokens` - - The number of output tokens which were used. - - - `JsonValue; type "message"constant` - - Usage for a sampling iteration - - - `MESSAGE("message")` - - - `class BetaCompactionIterationUsage:` - - Token usage for a compaction iteration. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `long cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `long cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `long inputTokens` - - The number of input tokens which were used. - - - `long outputTokens` - - The number of output tokens which were used. - - - `JsonValue; type "compaction"constant` - - Usage for a compaction iteration - - - `COMPACTION("compaction")` - - - `long outputTokens` - - The number of output tokens which were used. - - - `Optional serverToolUse` - - The number of server tool requests. - - - `long webFetchRequests` - - The number of web fetch tool requests. - - - `long webSearchRequests` - - The number of web search tool requests. - - - `Optional serviceTier` - - If the request used the priority, standard, or batch tier. - - - `STANDARD("standard")` - - - `PRIORITY("priority")` - - - `BATCH("batch")` - - - `Optional speed` - - The inference speed mode used for this request. - - - `STANDARD("standard")` - - - `FAST("fast")` - -### Beta Message Delta Usage - -- `class BetaMessageDeltaUsage:` - - - `Optional cacheCreationInputTokens` - - The cumulative number of input tokens used to create the cache entry. - - - `Optional cacheReadInputTokens` - - The cumulative number of input tokens read from the cache. - - - `Optional inputTokens` - - The cumulative number of input tokens which were used. - - - `Optional> iterations` - - Per-iteration token usage breakdown. - - Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: - - - Determine which iterations exceeded long context thresholds (>=200k tokens) - - Calculate the true context window size from the last iteration - - Understand token accumulation across server-side tool use loops - - - `class BetaMessageIterationUsage:` - - Token usage for a sampling iteration. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `long cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `long cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `long inputTokens` - - The number of input tokens which were used. - - - `long outputTokens` - - The number of output tokens which were used. - - - `JsonValue; type "message"constant` - - Usage for a sampling iteration - - - `MESSAGE("message")` - - - `class BetaCompactionIterationUsage:` - - Token usage for a compaction iteration. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `long cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `long cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `long inputTokens` - - The number of input tokens which were used. - - - `long outputTokens` - - The number of output tokens which were used. - - - `JsonValue; type "compaction"constant` - - Usage for a compaction iteration - - - `COMPACTION("compaction")` - - - `long outputTokens` - - The cumulative number of output tokens which were used. - - - `Optional serverToolUse` - - The number of server tool requests. - - - `long webFetchRequests` - - The number of web fetch tool requests. - - - `long webSearchRequests` - - The number of web search tool requests. - -### Beta Message Iteration Usage - -- `class BetaMessageIterationUsage:` - - Token usage for a sampling iteration. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `long cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `long cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `long inputTokens` - - The number of input tokens which were used. - - - `long outputTokens` - - The number of output tokens which were used. - - - `JsonValue; type "message"constant` - - Usage for a sampling iteration - - - `MESSAGE("message")` - -### Beta Message Param - -- `class BetaMessageParam:` - - - `Content content` - - - `String` - - - `List` - - - `class BetaTextBlockParam:` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `class BetaImageBlockParam:` - - - `Source source` - - - `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "image"constant` - - - `IMAGE("image")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaRequestDocumentBlock:` - - - `Source source` - - - `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `class BetaContentBlockSource:` - - - `Content content` - - - `String` - - - `List` - - - `class BetaTextBlockParam:` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `class BetaImageBlockParam:` - - - `Source source` - - - `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "image"constant` - - - `IMAGE("image")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `JsonValue; type "content"constant` - - - `CONTENT("content")` - - - `class BetaUrlPdfSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileDocumentSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "document"constant` - - - `DOCUMENT("document")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - - `Optional enabled` - - - `Optional context` - - - `Optional title` - - - `class BetaSearchResultBlockParam:` - - - `List content` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String source` - - - `String title` - - - `JsonValue; type "search_result"constant` - - - `SEARCH_RESULT("search_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - - `Optional enabled` - - - `class BetaThinkingBlockParam:` - - - `String signature` - - - `String thinking` - - - `JsonValue; type "thinking"constant` - - - `THINKING("thinking")` - - - `class BetaRedactedThinkingBlockParam:` - - - `String data` - - - `JsonValue; type "redacted_thinking"constant` - - - `REDACTED_THINKING("redacted_thinking")` - - - `class BetaToolUseBlockParam:` - - - `String id` - - - `Input input` - - - `String name` - - - `JsonValue; type "tool_use"constant` - - - `TOOL_USE("tool_use")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaToolResultBlockParam:` - - - `String toolUseId` - - - `JsonValue; type "tool_result"constant` - - - `TOOL_RESULT("tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional content` - - - `String` - - - `List` - - - `class BetaTextBlockParam:` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `class BetaImageBlockParam:` - - - `Source source` - - - `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "image"constant` - - - `IMAGE("image")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaSearchResultBlockParam:` - - - `List content` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String source` - - - `String title` - - - `JsonValue; type "search_result"constant` - - - `SEARCH_RESULT("search_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - - `Optional enabled` - - - `class BetaRequestDocumentBlock:` - - - `Source source` - - - `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `class BetaContentBlockSource:` - - - `Content content` - - - `String` - - - `List` - - - `class BetaTextBlockParam:` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `class BetaImageBlockParam:` - - - `Source source` - - - `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "image"constant` - - - `IMAGE("image")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `JsonValue; type "content"constant` - - - `CONTENT("content")` - - - `class BetaUrlPdfSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileDocumentSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "document"constant` - - - `DOCUMENT("document")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - - `Optional enabled` - - - `Optional context` - - - `Optional title` - - - `class BetaToolReferenceBlockParam:` - - Tool reference block that can be included in tool_result content. - - - `String toolName` - - - `JsonValue; type "tool_reference"constant` - - - `TOOL_REFERENCE("tool_reference")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional isError` - - - `class BetaServerToolUseBlockParam:` - - - `String id` - - - `Input input` - - - `Name name` - - - `WEB_SEARCH("web_search")` - - - `WEB_FETCH("web_fetch")` - - - `CODE_EXECUTION("code_execution")` - - - `BASH_CODE_EXECUTION("bash_code_execution")` - - - `TEXT_EDITOR_CODE_EXECUTION("text_editor_code_execution")` - - - `TOOL_SEARCH_TOOL_REGEX("tool_search_tool_regex")` - - - `TOOL_SEARCH_TOOL_BM25("tool_search_tool_bm25")` - - - `JsonValue; type "server_tool_use"constant` - - - `SERVER_TOOL_USE("server_tool_use")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaWebSearchToolResultBlockParam:` - - - `BetaWebSearchToolResultBlockParamContent content` - - - `List` - - - `String encryptedContent` - - - `String title` - - - `JsonValue; type "web_search_result"constant` - - - `WEB_SEARCH_RESULT("web_search_result")` - - - `String url` - - - `Optional pageAge` - - - `class BetaWebSearchToolRequestError:` - - - `BetaWebSearchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `QUERY_TOO_LONG("query_too_long")` - - - `REQUEST_TOO_LARGE("request_too_large")` - - - `JsonValue; type "web_search_tool_result_error"constant` - - - `WEB_SEARCH_TOOL_RESULT_ERROR("web_search_tool_result_error")` - - - `String toolUseId` - - - `JsonValue; type "web_search_tool_result"constant` - - - `WEB_SEARCH_TOOL_RESULT("web_search_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaWebFetchToolResultBlockParam:` - - - `Content content` - - - `class BetaWebFetchToolResultErrorBlockParam:` - - - `BetaWebFetchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `URL_TOO_LONG("url_too_long")` - - - `URL_NOT_ALLOWED("url_not_allowed")` - - - `URL_NOT_ACCESSIBLE("url_not_accessible")` - - - `UNSUPPORTED_CONTENT_TYPE("unsupported_content_type")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `UNAVAILABLE("unavailable")` - - - `JsonValue; type "web_fetch_tool_result_error"constant` - - - `WEB_FETCH_TOOL_RESULT_ERROR("web_fetch_tool_result_error")` - - - `class BetaWebFetchBlockParam:` - - - `BetaRequestDocumentBlock content` - - - `Source source` - - - `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `class BetaContentBlockSource:` - - - `Content content` - - - `String` - - - `List` - - - `class BetaTextBlockParam:` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `class BetaImageBlockParam:` - - - `Source source` - - - `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "image"constant` - - - `IMAGE("image")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `JsonValue; type "content"constant` - - - `CONTENT("content")` - - - `class BetaUrlPdfSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileDocumentSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "document"constant` - - - `DOCUMENT("document")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - - `Optional enabled` - - - `Optional context` - - - `Optional title` - - - `JsonValue; type "web_fetch_result"constant` - - - `WEB_FETCH_RESULT("web_fetch_result")` - - - `String url` - - Fetched content URL - - - `Optional retrievedAt` - - ISO 8601 timestamp when the content was retrieved - - - `String toolUseId` - - - `JsonValue; type "web_fetch_tool_result"constant` - - - `WEB_FETCH_TOOL_RESULT("web_fetch_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaCodeExecutionToolResultBlockParam:` - - - `BetaCodeExecutionToolResultBlockParamContent content` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `class BetaCodeExecutionToolResultErrorParam:` - - - `BetaCodeExecutionToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `JsonValue; type "code_execution_tool_result_error"constant` - - - `CODE_EXECUTION_TOOL_RESULT_ERROR("code_execution_tool_result_error")` - - - `class BetaCodeExecutionResultBlockParam:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "code_execution_result"constant` - - - `CODE_EXECUTION_RESULT("code_execution_result")` - - - `class BetaEncryptedCodeExecutionResultBlockParam:` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `String encryptedStdout` - - - `long returnCode` - - - `String stderr` - - - `JsonValue; type "encrypted_code_execution_result"constant` - - - `ENCRYPTED_CODE_EXECUTION_RESULT("encrypted_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "code_execution_tool_result"constant` - - - `CODE_EXECUTION_TOOL_RESULT("code_execution_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaBashCodeExecutionToolResultBlockParam:` - - - `Content content` - - - `class BetaBashCodeExecutionToolResultErrorParam:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `OUTPUT_FILE_TOO_LARGE("output_file_too_large")` - - - `JsonValue; type "bash_code_execution_tool_result_error"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT_ERROR("bash_code_execution_tool_result_error")` - - - `class BetaBashCodeExecutionResultBlockParam:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "bash_code_execution_output"constant` - - - `BASH_CODE_EXECUTION_OUTPUT("bash_code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "bash_code_execution_result"constant` - - - `BASH_CODE_EXECUTION_RESULT("bash_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "bash_code_execution_tool_result"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT("bash_code_execution_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaTextEditorCodeExecutionToolResultBlockParam:` - - - `Content content` - - - `class BetaTextEditorCodeExecutionToolResultErrorParam:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `FILE_NOT_FOUND("file_not_found")` - - - `JsonValue; type "text_editor_code_execution_tool_result_error"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT_ERROR("text_editor_code_execution_tool_result_error")` - - - `Optional errorMessage` - - - `class BetaTextEditorCodeExecutionViewResultBlockParam:` - - - `String content` - - - `FileType fileType` - - - `TEXT("text")` - - - `IMAGE("image")` - - - `PDF("pdf")` - - - `JsonValue; type "text_editor_code_execution_view_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_VIEW_RESULT("text_editor_code_execution_view_result")` - - - `Optional numLines` - - - `Optional startLine` - - - `Optional totalLines` - - - `class BetaTextEditorCodeExecutionCreateResultBlockParam:` - - - `boolean isFileUpdate` - - - `JsonValue; type "text_editor_code_execution_create_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_CREATE_RESULT("text_editor_code_execution_create_result")` - - - `class BetaTextEditorCodeExecutionStrReplaceResultBlockParam:` - - - `JsonValue; type "text_editor_code_execution_str_replace_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_STR_REPLACE_RESULT("text_editor_code_execution_str_replace_result")` - - - `Optional> lines` - - - `Optional newLines` - - - `Optional newStart` - - - `Optional oldLines` - - - `Optional oldStart` - - - `String toolUseId` - - - `JsonValue; type "text_editor_code_execution_tool_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT("text_editor_code_execution_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaToolSearchToolResultBlockParam:` - - - `Content content` - - - `class BetaToolSearchToolResultErrorParam:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `JsonValue; type "tool_search_tool_result_error"constant` - - - `TOOL_SEARCH_TOOL_RESULT_ERROR("tool_search_tool_result_error")` - - - `class BetaToolSearchToolSearchResultBlockParam:` - - - `List toolReferences` - - - `String toolName` - - - `JsonValue; type "tool_reference"constant` - - - `TOOL_REFERENCE("tool_reference")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `JsonValue; type "tool_search_tool_search_result"constant` - - - `TOOL_SEARCH_TOOL_SEARCH_RESULT("tool_search_tool_search_result")` - - - `String toolUseId` - - - `JsonValue; type "tool_search_tool_result"constant` - - - `TOOL_SEARCH_TOOL_RESULT("tool_search_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaMcpToolUseBlockParam:` - - - `String id` - - - `Input input` - - - `String name` - - - `String serverName` - - The name of the MCP server - - - `JsonValue; type "mcp_tool_use"constant` - - - `MCP_TOOL_USE("mcp_tool_use")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaRequestMcpToolResultBlockParam:` - - - `String toolUseId` - - - `JsonValue; type "mcp_tool_result"constant` - - - `MCP_TOOL_RESULT("mcp_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional content` - - - `String` - - - `List` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `Optional isError` - - - `class BetaContainerUploadBlockParam:` - - A content block that represents a file to be uploaded to the container - Files uploaded via this block will be available in the container's input directory. - - - `String fileId` - - - `JsonValue; type "container_upload"constant` - - - `CONTAINER_UPLOAD("container_upload")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaCompactionBlockParam:` - - A compaction block containing summary of previous context. - - Users should round-trip these blocks from responses to subsequent requests - to maintain context across compaction boundaries. - - When content is None, the block represents a failed compaction. The server - treats these as no-ops. Empty string content is not allowed. - - - `Optional content` - - Summary of previously compacted content, or null if compaction failed - - - `JsonValue; type "compaction"constant` - - - `COMPACTION("compaction")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Role role` - - - `USER("user")` - - - `ASSISTANT("assistant")` - -### Beta Message Tokens Count - -- `class BetaMessageTokensCount:` - - - `Optional contextManagement` - - Information about context management applied to the message. - - - `long originalInputTokens` - - The original token count before context management was applied - - - `long inputTokens` - - The total number of tokens across the provided list of messages, system prompt, and tools. - -### Beta Metadata - -- `class BetaMetadata:` - - - `Optional userId` - - An external identifier for the user who is associated with the request. - - This should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number. - -### Beta Output Config - -- `class BetaOutputConfig:` - - - `Optional effort` - - All possible effort levels. - - - `LOW("low")` - - - `MEDIUM("medium")` - - - `HIGH("high")` - - - `MAX("max")` - - - `Optional format` - - A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) - - - `Schema schema` - - The JSON schema of the format - - - `JsonValue; type "json_schema"constant` - - - `JSON_SCHEMA("json_schema")` - -### Beta Plain Text Source - -- `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - -### Beta Raw Content Block Delta - -- `class BetaRawContentBlockDelta: A class that can be one of several variants.union` - - - `class BetaTextDelta:` - - - `String text` - - - `JsonValue; type "text_delta"constant` - - - `TEXT_DELTA("text_delta")` - - - `class BetaInputJsonDelta:` - - - `String partialJson` - - - `JsonValue; type "input_json_delta"constant` - - - `INPUT_JSON_DELTA("input_json_delta")` - - - `class BetaCitationsDelta:` - - - `Citation citation` - - - `class BetaCitationCharLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `Optional fileId` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `Optional fileId` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `Optional fileId` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationsWebSearchResultLocation:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocation:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `JsonValue; type "citations_delta"constant` - - - `CITATIONS_DELTA("citations_delta")` - - - `class BetaThinkingDelta:` - - - `String thinking` - - - `JsonValue; type "thinking_delta"constant` - - - `THINKING_DELTA("thinking_delta")` - - - `class BetaSignatureDelta:` - - - `String signature` - - - `JsonValue; type "signature_delta"constant` - - - `SIGNATURE_DELTA("signature_delta")` - - - `class BetaCompactionContentBlockDelta:` - - - `Optional content` - - - `JsonValue; type "compaction_delta"constant` - - - `COMPACTION_DELTA("compaction_delta")` - -### Beta Raw Content Block Delta Event - -- `class BetaRawContentBlockDeltaEvent:` - - - `BetaRawContentBlockDelta delta` - - - `class BetaTextDelta:` - - - `String text` - - - `JsonValue; type "text_delta"constant` - - - `TEXT_DELTA("text_delta")` - - - `class BetaInputJsonDelta:` - - - `String partialJson` - - - `JsonValue; type "input_json_delta"constant` - - - `INPUT_JSON_DELTA("input_json_delta")` - - - `class BetaCitationsDelta:` - - - `Citation citation` - - - `class BetaCitationCharLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `Optional fileId` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `Optional fileId` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `Optional fileId` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationsWebSearchResultLocation:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocation:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `JsonValue; type "citations_delta"constant` - - - `CITATIONS_DELTA("citations_delta")` - - - `class BetaThinkingDelta:` - - - `String thinking` - - - `JsonValue; type "thinking_delta"constant` - - - `THINKING_DELTA("thinking_delta")` - - - `class BetaSignatureDelta:` - - - `String signature` - - - `JsonValue; type "signature_delta"constant` - - - `SIGNATURE_DELTA("signature_delta")` - - - `class BetaCompactionContentBlockDelta:` - - - `Optional content` - - - `JsonValue; type "compaction_delta"constant` - - - `COMPACTION_DELTA("compaction_delta")` - - - `long index` - - - `JsonValue; type "content_block_delta"constant` - - - `CONTENT_BLOCK_DELTA("content_block_delta")` - -### Beta Raw Content Block Start Event - -- `class BetaRawContentBlockStartEvent:` - - - `ContentBlock contentBlock` - - Response model for a file uploaded to the container. - - - `class BetaTextBlock:` - - - `Optional> citations` - - Citations supporting the text block. - - The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. - - - `class BetaCitationCharLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `Optional fileId` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `Optional fileId` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `Optional fileId` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationsWebSearchResultLocation:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocation:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `class BetaThinkingBlock:` - - - `String signature` - - - `String thinking` - - - `JsonValue; type "thinking"constant` - - - `THINKING("thinking")` - - - `class BetaRedactedThinkingBlock:` - - - `String data` - - - `JsonValue; type "redacted_thinking"constant` - - - `REDACTED_THINKING("redacted_thinking")` - - - `class BetaToolUseBlock:` - - - `String id` - - - `Input input` - - - `String name` - - - `JsonValue; type "tool_use"constant` - - - `TOOL_USE("tool_use")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaServerToolUseBlock:` - - - `String id` - - - `Input input` - - - `Name name` - - - `WEB_SEARCH("web_search")` - - - `WEB_FETCH("web_fetch")` - - - `CODE_EXECUTION("code_execution")` - - - `BASH_CODE_EXECUTION("bash_code_execution")` - - - `TEXT_EDITOR_CODE_EXECUTION("text_editor_code_execution")` - - - `TOOL_SEARCH_TOOL_REGEX("tool_search_tool_regex")` - - - `TOOL_SEARCH_TOOL_BM25("tool_search_tool_bm25")` - - - `JsonValue; type "server_tool_use"constant` - - - `SERVER_TOOL_USE("server_tool_use")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaWebSearchToolResultBlock:` - - - `BetaWebSearchToolResultBlockContent content` - - - `class BetaWebSearchToolResultError:` - - - `BetaWebSearchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `QUERY_TOO_LONG("query_too_long")` - - - `REQUEST_TOO_LARGE("request_too_large")` - - - `JsonValue; type "web_search_tool_result_error"constant` - - - `WEB_SEARCH_TOOL_RESULT_ERROR("web_search_tool_result_error")` - - - `List` - - - `String encryptedContent` - - - `Optional pageAge` - - - `String title` - - - `JsonValue; type "web_search_result"constant` - - - `WEB_SEARCH_RESULT("web_search_result")` - - - `String url` - - - `String toolUseId` - - - `JsonValue; type "web_search_tool_result"constant` - - - `WEB_SEARCH_TOOL_RESULT("web_search_tool_result")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaWebFetchToolResultBlock:` - - - `Content content` - - - `class BetaWebFetchToolResultErrorBlock:` - - - `BetaWebFetchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `URL_TOO_LONG("url_too_long")` - - - `URL_NOT_ALLOWED("url_not_allowed")` - - - `URL_NOT_ACCESSIBLE("url_not_accessible")` - - - `UNSUPPORTED_CONTENT_TYPE("unsupported_content_type")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `UNAVAILABLE("unavailable")` - - - `JsonValue; type "web_fetch_tool_result_error"constant` - - - `WEB_FETCH_TOOL_RESULT_ERROR("web_fetch_tool_result_error")` - - - `class BetaWebFetchBlock:` - - - `BetaDocumentBlock content` - - - `Optional citations` - - Citation configuration for the document - - - `boolean enabled` - - - `Source source` - - - `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional title` - - The title of the document - - - `JsonValue; type "document"constant` - - - `DOCUMENT("document")` - - - `Optional retrievedAt` - - ISO 8601 timestamp when the content was retrieved - - - `JsonValue; type "web_fetch_result"constant` - - - `WEB_FETCH_RESULT("web_fetch_result")` - - - `String url` - - Fetched content URL - - - `String toolUseId` - - - `JsonValue; type "web_fetch_tool_result"constant` - - - `WEB_FETCH_TOOL_RESULT("web_fetch_tool_result")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaCodeExecutionToolResultBlock:` - - - `BetaCodeExecutionToolResultBlockContent content` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `class BetaCodeExecutionToolResultError:` - - - `BetaCodeExecutionToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `JsonValue; type "code_execution_tool_result_error"constant` - - - `CODE_EXECUTION_TOOL_RESULT_ERROR("code_execution_tool_result_error")` - - - `class BetaCodeExecutionResultBlock:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "code_execution_result"constant` - - - `CODE_EXECUTION_RESULT("code_execution_result")` - - - `class BetaEncryptedCodeExecutionResultBlock:` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `String encryptedStdout` - - - `long returnCode` - - - `String stderr` - - - `JsonValue; type "encrypted_code_execution_result"constant` - - - `ENCRYPTED_CODE_EXECUTION_RESULT("encrypted_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "code_execution_tool_result"constant` - - - `CODE_EXECUTION_TOOL_RESULT("code_execution_tool_result")` - - - `class BetaBashCodeExecutionToolResultBlock:` - - - `Content content` - - - `class BetaBashCodeExecutionToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `OUTPUT_FILE_TOO_LARGE("output_file_too_large")` - - - `JsonValue; type "bash_code_execution_tool_result_error"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT_ERROR("bash_code_execution_tool_result_error")` - - - `class BetaBashCodeExecutionResultBlock:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "bash_code_execution_output"constant` - - - `BASH_CODE_EXECUTION_OUTPUT("bash_code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "bash_code_execution_result"constant` - - - `BASH_CODE_EXECUTION_RESULT("bash_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "bash_code_execution_tool_result"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT("bash_code_execution_tool_result")` - - - `class BetaTextEditorCodeExecutionToolResultBlock:` - - - `Content content` - - - `class BetaTextEditorCodeExecutionToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `FILE_NOT_FOUND("file_not_found")` - - - `Optional errorMessage` - - - `JsonValue; type "text_editor_code_execution_tool_result_error"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT_ERROR("text_editor_code_execution_tool_result_error")` - - - `class BetaTextEditorCodeExecutionViewResultBlock:` - - - `String content` - - - `FileType fileType` - - - `TEXT("text")` - - - `IMAGE("image")` - - - `PDF("pdf")` - - - `Optional numLines` - - - `Optional startLine` - - - `Optional totalLines` - - - `JsonValue; type "text_editor_code_execution_view_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_VIEW_RESULT("text_editor_code_execution_view_result")` - - - `class BetaTextEditorCodeExecutionCreateResultBlock:` - - - `boolean isFileUpdate` - - - `JsonValue; type "text_editor_code_execution_create_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_CREATE_RESULT("text_editor_code_execution_create_result")` - - - `class BetaTextEditorCodeExecutionStrReplaceResultBlock:` - - - `Optional> lines` - - - `Optional newLines` - - - `Optional newStart` - - - `Optional oldLines` - - - `Optional oldStart` - - - `JsonValue; type "text_editor_code_execution_str_replace_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_STR_REPLACE_RESULT("text_editor_code_execution_str_replace_result")` - - - `String toolUseId` - - - `JsonValue; type "text_editor_code_execution_tool_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT("text_editor_code_execution_tool_result")` - - - `class BetaToolSearchToolResultBlock:` - - - `Content content` - - - `class BetaToolSearchToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `Optional errorMessage` - - - `JsonValue; type "tool_search_tool_result_error"constant` - - - `TOOL_SEARCH_TOOL_RESULT_ERROR("tool_search_tool_result_error")` - - - `class BetaToolSearchToolSearchResultBlock:` - - - `List toolReferences` - - - `String toolName` - - - `JsonValue; type "tool_reference"constant` - - - `TOOL_REFERENCE("tool_reference")` - - - `JsonValue; type "tool_search_tool_search_result"constant` - - - `TOOL_SEARCH_TOOL_SEARCH_RESULT("tool_search_tool_search_result")` - - - `String toolUseId` - - - `JsonValue; type "tool_search_tool_result"constant` - - - `TOOL_SEARCH_TOOL_RESULT("tool_search_tool_result")` - - - `class BetaMcpToolUseBlock:` - - - `String id` - - - `Input input` - - - `String name` - - The name of the MCP tool - - - `String serverName` - - The name of the MCP server - - - `JsonValue; type "mcp_tool_use"constant` - - - `MCP_TOOL_USE("mcp_tool_use")` - - - `class BetaMcpToolResultBlock:` - - - `Content content` - - - `String` - - - `List` - - - `Optional> citations` - - Citations supporting the text block. - - The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. - - - `class BetaCitationCharLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `Optional fileId` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `Optional fileId` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `Optional fileId` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationsWebSearchResultLocation:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocation:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `boolean isError` - - - `String toolUseId` - - - `JsonValue; type "mcp_tool_result"constant` - - - `MCP_TOOL_RESULT("mcp_tool_result")` - - - `class BetaContainerUploadBlock:` - - Response model for a file uploaded to the container. - - - `String fileId` - - - `JsonValue; type "container_upload"constant` - - - `CONTAINER_UPLOAD("container_upload")` - - - `class BetaCompactionBlock:` - - A compaction block returned when autocompact is triggered. - - When content is None, it indicates the compaction failed to produce a valid - summary (e.g., malformed output from the model). Clients may round-trip - compaction blocks with null content; the server treats them as no-ops. - - - `Optional content` - - Summary of compacted content, or null if compaction failed - - - `JsonValue; type "compaction"constant` - - - `COMPACTION("compaction")` - - - `long index` - - - `JsonValue; type "content_block_start"constant` - - - `CONTENT_BLOCK_START("content_block_start")` - -### Beta Raw Content Block Stop Event - -- `class BetaRawContentBlockStopEvent:` - - - `long index` - - - `JsonValue; type "content_block_stop"constant` - - - `CONTENT_BLOCK_STOP("content_block_stop")` - -### Beta Raw Message Delta Event - -- `class BetaRawMessageDeltaEvent:` - - - `Optional contextManagement` - - Information about context management strategies applied during the request - - - `List appliedEdits` - - List of context management edits that were applied. - - - `class BetaClearToolUses20250919EditResponse:` - - - `long clearedInputTokens` - - Number of input tokens cleared by this edit. - - - `long clearedToolUses` - - Number of tool uses that were cleared. - - - `JsonValue; type "clear_tool_uses_20250919"constant` - - The type of context management edit applied. - - - `CLEAR_TOOL_USES_20250919("clear_tool_uses_20250919")` - - - `class BetaClearThinking20251015EditResponse:` - - - `long clearedInputTokens` - - Number of input tokens cleared by this edit. - - - `long clearedThinkingTurns` - - Number of thinking turns that were cleared. - - - `JsonValue; type "clear_thinking_20251015"constant` - - The type of context management edit applied. - - - `CLEAR_THINKING_20251015("clear_thinking_20251015")` - - - `Delta delta` - - - `Optional container` - - Information about the container used in the request (for the code execution tool) - - - `String id` - - Identifier for the container used in this request - - - `LocalDateTime expiresAt` - - The time at which the container will expire. - - - `Optional> skills` - - Skills loaded in the container - - - `String skillId` - - Skill ID - - - `Type type` - - Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) - - - `ANTHROPIC("anthropic")` - - - `CUSTOM("custom")` - - - `String version` - - Skill version or 'latest' for most recent version - - - `Optional stopDetails` - - Structured information about a refusal. - - - `Optional category` - - The policy category that triggered the refusal. - - `null` when the refusal doesn't map to a named category. - - - `CYBER("cyber")` - - - `BIO("bio")` - - - `Optional explanation` - - Human-readable explanation of the refusal. - - This text is not guaranteed to be stable. `null` when no explanation is available for the category. - - - `JsonValue; type "refusal"constant` - - - `REFUSAL("refusal")` - - - `Optional stopReason` - - - `END_TURN("end_turn")` - - - `MAX_TOKENS("max_tokens")` - - - `STOP_SEQUENCE("stop_sequence")` - - - `TOOL_USE("tool_use")` - - - `PAUSE_TURN("pause_turn")` - - - `COMPACTION("compaction")` - - - `REFUSAL("refusal")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED("model_context_window_exceeded")` - - - `Optional stopSequence` - - - `JsonValue; type "message_delta"constant` - - - `MESSAGE_DELTA("message_delta")` - - - `BetaMessageDeltaUsage usage` - - Billing and rate-limit usage. - - Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. - - Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. - - For example, `output_tokens` will be non-zero, even for an empty string response from Claude. - - Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. - - - `Optional cacheCreationInputTokens` - - The cumulative number of input tokens used to create the cache entry. - - - `Optional cacheReadInputTokens` - - The cumulative number of input tokens read from the cache. - - - `Optional inputTokens` - - The cumulative number of input tokens which were used. - - - `Optional> iterations` - - Per-iteration token usage breakdown. - - Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: - - - Determine which iterations exceeded long context thresholds (>=200k tokens) - - Calculate the true context window size from the last iteration - - Understand token accumulation across server-side tool use loops - - - `class BetaMessageIterationUsage:` - - Token usage for a sampling iteration. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `long cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `long cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `long inputTokens` - - The number of input tokens which were used. - - - `long outputTokens` - - The number of output tokens which were used. - - - `JsonValue; type "message"constant` - - Usage for a sampling iteration - - - `MESSAGE("message")` - - - `class BetaCompactionIterationUsage:` - - Token usage for a compaction iteration. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `long cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `long cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `long inputTokens` - - The number of input tokens which were used. - - - `long outputTokens` - - The number of output tokens which were used. - - - `JsonValue; type "compaction"constant` - - Usage for a compaction iteration - - - `COMPACTION("compaction")` - - - `long outputTokens` - - The cumulative number of output tokens which were used. - - - `Optional serverToolUse` - - The number of server tool requests. - - - `long webFetchRequests` - - The number of web fetch tool requests. - - - `long webSearchRequests` - - The number of web search tool requests. - -### Beta Raw Message Start Event - -- `class BetaRawMessageStartEvent:` - - - `BetaMessage message` - - - `String id` - - Unique object identifier. - - The format and length of IDs may change over time. - - - `Optional container` - - Information about the container used in the request (for the code execution tool) - - - `String id` - - Identifier for the container used in this request - - - `LocalDateTime expiresAt` - - The time at which the container will expire. - - - `Optional> skills` - - Skills loaded in the container - - - `String skillId` - - Skill ID - - - `Type type` - - Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) - - - `ANTHROPIC("anthropic")` - - - `CUSTOM("custom")` - - - `String version` - - Skill version or 'latest' for most recent version - - - `List content` - - Content generated by the model. - - This is an array of content blocks, each of which has a `type` that determines its shape. - - Example: - - ```json - [{"type": "text", "text": "Hi, I'm Claude."}] - ``` - - If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. - - For example, if the input `messages` were: - - ```json - [ - {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, - {"role": "assistant", "content": "The best answer is ("} - ] - ``` - - Then the response `content` might be: - - ```json - [{"type": "text", "text": "B)"}] - ``` - - - `class BetaTextBlock:` - - - `Optional> citations` - - Citations supporting the text block. - - The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. - - - `class BetaCitationCharLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `Optional fileId` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `Optional fileId` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `Optional fileId` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationsWebSearchResultLocation:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocation:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `class BetaThinkingBlock:` - - - `String signature` - - - `String thinking` - - - `JsonValue; type "thinking"constant` - - - `THINKING("thinking")` - - - `class BetaRedactedThinkingBlock:` - - - `String data` - - - `JsonValue; type "redacted_thinking"constant` - - - `REDACTED_THINKING("redacted_thinking")` - - - `class BetaToolUseBlock:` - - - `String id` - - - `Input input` - - - `String name` - - - `JsonValue; type "tool_use"constant` - - - `TOOL_USE("tool_use")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaServerToolUseBlock:` - - - `String id` - - - `Input input` - - - `Name name` - - - `WEB_SEARCH("web_search")` - - - `WEB_FETCH("web_fetch")` - - - `CODE_EXECUTION("code_execution")` - - - `BASH_CODE_EXECUTION("bash_code_execution")` - - - `TEXT_EDITOR_CODE_EXECUTION("text_editor_code_execution")` - - - `TOOL_SEARCH_TOOL_REGEX("tool_search_tool_regex")` - - - `TOOL_SEARCH_TOOL_BM25("tool_search_tool_bm25")` - - - `JsonValue; type "server_tool_use"constant` - - - `SERVER_TOOL_USE("server_tool_use")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaWebSearchToolResultBlock:` - - - `BetaWebSearchToolResultBlockContent content` - - - `class BetaWebSearchToolResultError:` - - - `BetaWebSearchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `QUERY_TOO_LONG("query_too_long")` - - - `REQUEST_TOO_LARGE("request_too_large")` - - - `JsonValue; type "web_search_tool_result_error"constant` - - - `WEB_SEARCH_TOOL_RESULT_ERROR("web_search_tool_result_error")` - - - `List` - - - `String encryptedContent` - - - `Optional pageAge` - - - `String title` - - - `JsonValue; type "web_search_result"constant` - - - `WEB_SEARCH_RESULT("web_search_result")` - - - `String url` - - - `String toolUseId` - - - `JsonValue; type "web_search_tool_result"constant` - - - `WEB_SEARCH_TOOL_RESULT("web_search_tool_result")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaWebFetchToolResultBlock:` - - - `Content content` - - - `class BetaWebFetchToolResultErrorBlock:` - - - `BetaWebFetchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `URL_TOO_LONG("url_too_long")` - - - `URL_NOT_ALLOWED("url_not_allowed")` - - - `URL_NOT_ACCESSIBLE("url_not_accessible")` - - - `UNSUPPORTED_CONTENT_TYPE("unsupported_content_type")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `UNAVAILABLE("unavailable")` - - - `JsonValue; type "web_fetch_tool_result_error"constant` - - - `WEB_FETCH_TOOL_RESULT_ERROR("web_fetch_tool_result_error")` - - - `class BetaWebFetchBlock:` - - - `BetaDocumentBlock content` - - - `Optional citations` - - Citation configuration for the document - - - `boolean enabled` - - - `Source source` - - - `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional title` - - The title of the document - - - `JsonValue; type "document"constant` - - - `DOCUMENT("document")` - - - `Optional retrievedAt` - - ISO 8601 timestamp when the content was retrieved - - - `JsonValue; type "web_fetch_result"constant` - - - `WEB_FETCH_RESULT("web_fetch_result")` - - - `String url` - - Fetched content URL - - - `String toolUseId` - - - `JsonValue; type "web_fetch_tool_result"constant` - - - `WEB_FETCH_TOOL_RESULT("web_fetch_tool_result")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaCodeExecutionToolResultBlock:` - - - `BetaCodeExecutionToolResultBlockContent content` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `class BetaCodeExecutionToolResultError:` - - - `BetaCodeExecutionToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `JsonValue; type "code_execution_tool_result_error"constant` - - - `CODE_EXECUTION_TOOL_RESULT_ERROR("code_execution_tool_result_error")` - - - `class BetaCodeExecutionResultBlock:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "code_execution_result"constant` - - - `CODE_EXECUTION_RESULT("code_execution_result")` - - - `class BetaEncryptedCodeExecutionResultBlock:` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `String encryptedStdout` - - - `long returnCode` - - - `String stderr` - - - `JsonValue; type "encrypted_code_execution_result"constant` - - - `ENCRYPTED_CODE_EXECUTION_RESULT("encrypted_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "code_execution_tool_result"constant` - - - `CODE_EXECUTION_TOOL_RESULT("code_execution_tool_result")` - - - `class BetaBashCodeExecutionToolResultBlock:` - - - `Content content` - - - `class BetaBashCodeExecutionToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `OUTPUT_FILE_TOO_LARGE("output_file_too_large")` - - - `JsonValue; type "bash_code_execution_tool_result_error"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT_ERROR("bash_code_execution_tool_result_error")` - - - `class BetaBashCodeExecutionResultBlock:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "bash_code_execution_output"constant` - - - `BASH_CODE_EXECUTION_OUTPUT("bash_code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "bash_code_execution_result"constant` - - - `BASH_CODE_EXECUTION_RESULT("bash_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "bash_code_execution_tool_result"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT("bash_code_execution_tool_result")` - - - `class BetaTextEditorCodeExecutionToolResultBlock:` - - - `Content content` - - - `class BetaTextEditorCodeExecutionToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `FILE_NOT_FOUND("file_not_found")` - - - `Optional errorMessage` - - - `JsonValue; type "text_editor_code_execution_tool_result_error"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT_ERROR("text_editor_code_execution_tool_result_error")` - - - `class BetaTextEditorCodeExecutionViewResultBlock:` - - - `String content` - - - `FileType fileType` - - - `TEXT("text")` - - - `IMAGE("image")` - - - `PDF("pdf")` - - - `Optional numLines` - - - `Optional startLine` - - - `Optional totalLines` - - - `JsonValue; type "text_editor_code_execution_view_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_VIEW_RESULT("text_editor_code_execution_view_result")` - - - `class BetaTextEditorCodeExecutionCreateResultBlock:` - - - `boolean isFileUpdate` - - - `JsonValue; type "text_editor_code_execution_create_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_CREATE_RESULT("text_editor_code_execution_create_result")` - - - `class BetaTextEditorCodeExecutionStrReplaceResultBlock:` - - - `Optional> lines` - - - `Optional newLines` - - - `Optional newStart` - - - `Optional oldLines` - - - `Optional oldStart` - - - `JsonValue; type "text_editor_code_execution_str_replace_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_STR_REPLACE_RESULT("text_editor_code_execution_str_replace_result")` - - - `String toolUseId` - - - `JsonValue; type "text_editor_code_execution_tool_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT("text_editor_code_execution_tool_result")` - - - `class BetaToolSearchToolResultBlock:` - - - `Content content` - - - `class BetaToolSearchToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `Optional errorMessage` - - - `JsonValue; type "tool_search_tool_result_error"constant` - - - `TOOL_SEARCH_TOOL_RESULT_ERROR("tool_search_tool_result_error")` - - - `class BetaToolSearchToolSearchResultBlock:` - - - `List toolReferences` - - - `String toolName` - - - `JsonValue; type "tool_reference"constant` - - - `TOOL_REFERENCE("tool_reference")` - - - `JsonValue; type "tool_search_tool_search_result"constant` - - - `TOOL_SEARCH_TOOL_SEARCH_RESULT("tool_search_tool_search_result")` - - - `String toolUseId` - - - `JsonValue; type "tool_search_tool_result"constant` - - - `TOOL_SEARCH_TOOL_RESULT("tool_search_tool_result")` - - - `class BetaMcpToolUseBlock:` - - - `String id` - - - `Input input` - - - `String name` - - The name of the MCP tool - - - `String serverName` - - The name of the MCP server - - - `JsonValue; type "mcp_tool_use"constant` - - - `MCP_TOOL_USE("mcp_tool_use")` - - - `class BetaMcpToolResultBlock:` - - - `Content content` - - - `String` - - - `List` - - - `Optional> citations` - - Citations supporting the text block. - - The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. - - - `class BetaCitationCharLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `Optional fileId` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `Optional fileId` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `Optional fileId` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationsWebSearchResultLocation:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocation:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `boolean isError` - - - `String toolUseId` - - - `JsonValue; type "mcp_tool_result"constant` - - - `MCP_TOOL_RESULT("mcp_tool_result")` - - - `class BetaContainerUploadBlock:` - - Response model for a file uploaded to the container. - - - `String fileId` - - - `JsonValue; type "container_upload"constant` - - - `CONTAINER_UPLOAD("container_upload")` - - - `class BetaCompactionBlock:` - - A compaction block returned when autocompact is triggered. - - When content is None, it indicates the compaction failed to produce a valid - summary (e.g., malformed output from the model). Clients may round-trip - compaction blocks with null content; the server treats them as no-ops. - - - `Optional content` - - Summary of compacted content, or null if compaction failed - - - `JsonValue; type "compaction"constant` - - - `COMPACTION("compaction")` - - - `Optional contextManagement` - - Context management response. - - Information about context management strategies applied during the request. - - - `List appliedEdits` - - List of context management edits that were applied. - - - `class BetaClearToolUses20250919EditResponse:` - - - `long clearedInputTokens` - - Number of input tokens cleared by this edit. - - - `long clearedToolUses` - - Number of tool uses that were cleared. - - - `JsonValue; type "clear_tool_uses_20250919"constant` - - The type of context management edit applied. - - - `CLEAR_TOOL_USES_20250919("clear_tool_uses_20250919")` - - - `class BetaClearThinking20251015EditResponse:` - - - `long clearedInputTokens` - - Number of input tokens cleared by this edit. - - - `long clearedThinkingTurns` - - Number of thinking turns that were cleared. - - - `JsonValue; type "clear_thinking_20251015"constant` - - The type of context management edit applied. - - - `CLEAR_THINKING_20251015("clear_thinking_20251015")` - - - `Model model` - - The model that will complete your prompt. - - See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - - Most intelligent model for building agents and coding - - - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` - - Best combination of speed and intelligence - - - `CLAUDE_HAIKU_4_5("claude-haiku-4-5")` - - Fastest model with near-frontier intelligence - - - `CLAUDE_HAIKU_4_5_20251001("claude-haiku-4-5-20251001")` - - Fastest model with near-frontier intelligence - - - `CLAUDE_OPUS_4_5("claude-opus-4-5")` - - Premium model combining maximum intelligence with practical performance - - - `CLAUDE_OPUS_4_5_20251101("claude-opus-4-5-20251101")` - - Premium model combining maximum intelligence with practical performance - - - `CLAUDE_SONNET_4_5("claude-sonnet-4-5")` - - High-performance model for agents and coding - - - `CLAUDE_SONNET_4_5_20250929("claude-sonnet-4-5-20250929")` - - High-performance model for agents and coding - - - `CLAUDE_OPUS_4_1("claude-opus-4-1")` - - Exceptional model for specialized complex tasks - - - `CLAUDE_OPUS_4_1_20250805("claude-opus-4-1-20250805")` - - Exceptional model for specialized complex tasks - - - `CLAUDE_OPUS_4_0("claude-opus-4-0")` - - Powerful model for complex tasks - - - `CLAUDE_OPUS_4_20250514("claude-opus-4-20250514")` - - Powerful model for complex tasks - - - `CLAUDE_SONNET_4_0("claude-sonnet-4-0")` - - High-performance model with extended thinking - - - `CLAUDE_SONNET_4_20250514("claude-sonnet-4-20250514")` - - High-performance model with extended thinking - - - `CLAUDE_3_HAIKU_20240307("claude-3-haiku-20240307")` - - Fast and cost-effective model - - - `JsonValue; role "assistant"constant` - - Conversational role of the generated message. - - This will always be `"assistant"`. - - - `ASSISTANT("assistant")` - - - `Optional stopDetails` - - Structured information about a refusal. - - - `Optional category` - - The policy category that triggered the refusal. - - `null` when the refusal doesn't map to a named category. - - - `CYBER("cyber")` - - - `BIO("bio")` - - - `Optional explanation` - - Human-readable explanation of the refusal. - - This text is not guaranteed to be stable. `null` when no explanation is available for the category. - - - `JsonValue; type "refusal"constant` - - - `REFUSAL("refusal")` - - - `Optional stopReason` - - The reason that we stopped. - - This may be one the following values: - - * `"end_turn"`: the model reached a natural stopping point - * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum - * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated - * `"tool_use"`: the model invoked one or more tools - * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. - * `"refusal"`: when streaming classifiers intervene to handle potential policy violations - - In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. - - - `END_TURN("end_turn")` - - - `MAX_TOKENS("max_tokens")` - - - `STOP_SEQUENCE("stop_sequence")` - - - `TOOL_USE("tool_use")` - - - `PAUSE_TURN("pause_turn")` - - - `COMPACTION("compaction")` - - - `REFUSAL("refusal")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED("model_context_window_exceeded")` - - - `Optional stopSequence` - - Which custom stop sequence was generated, if any. - - This value will be a non-null string if one of your custom stop sequences was generated. - - - `JsonValue; type "message"constant` - - Object type. - - For Messages, this is always `"message"`. - - - `MESSAGE("message")` - - - `BetaUsage usage` - - Billing and rate-limit usage. - - Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. - - Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. - - For example, `output_tokens` will be non-zero, even for an empty string response from Claude. - - Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `Optional cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `Optional cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `Optional inferenceGeo` - - The geographic region where inference was performed for this request. - - - `long inputTokens` - - The number of input tokens which were used. - - - `Optional> iterations` - - Per-iteration token usage breakdown. - - Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: - - - Determine which iterations exceeded long context thresholds (>=200k tokens) - - Calculate the true context window size from the last iteration - - Understand token accumulation across server-side tool use loops - - - `class BetaMessageIterationUsage:` - - Token usage for a sampling iteration. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `long cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `long cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `long inputTokens` - - The number of input tokens which were used. - - - `long outputTokens` - - The number of output tokens which were used. - - - `JsonValue; type "message"constant` - - Usage for a sampling iteration - - - `MESSAGE("message")` - - - `class BetaCompactionIterationUsage:` - - Token usage for a compaction iteration. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `long cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `long cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `long inputTokens` - - The number of input tokens which were used. - - - `long outputTokens` - - The number of output tokens which were used. - - - `JsonValue; type "compaction"constant` - - Usage for a compaction iteration - - - `COMPACTION("compaction")` - - - `long outputTokens` - - The number of output tokens which were used. - - - `Optional serverToolUse` - - The number of server tool requests. - - - `long webFetchRequests` - - The number of web fetch tool requests. - - - `long webSearchRequests` - - The number of web search tool requests. - - - `Optional serviceTier` - - If the request used the priority, standard, or batch tier. - - - `STANDARD("standard")` - - - `PRIORITY("priority")` - - - `BATCH("batch")` - - - `Optional speed` - - The inference speed mode used for this request. - - - `STANDARD("standard")` - - - `FAST("fast")` - - - `JsonValue; type "message_start"constant` - - - `MESSAGE_START("message_start")` - -### Beta Raw Message Stop Event - -- `class BetaRawMessageStopEvent:` - - - `JsonValue; type "message_stop"constant` - - - `MESSAGE_STOP("message_stop")` - -### Beta Raw Message Stream Event - -- `class BetaRawMessageStreamEvent: A class that can be one of several variants.union` - - - `class BetaRawMessageStartEvent:` - - - `BetaMessage message` - - - `String id` - - Unique object identifier. - - The format and length of IDs may change over time. - - - `Optional container` - - Information about the container used in the request (for the code execution tool) - - - `String id` - - Identifier for the container used in this request - - - `LocalDateTime expiresAt` - - The time at which the container will expire. - - - `Optional> skills` - - Skills loaded in the container - - - `String skillId` - - Skill ID - - - `Type type` - - Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) - - - `ANTHROPIC("anthropic")` - - - `CUSTOM("custom")` - - - `String version` - - Skill version or 'latest' for most recent version - - - `List content` - - Content generated by the model. - - This is an array of content blocks, each of which has a `type` that determines its shape. - - Example: - - ```json - [{"type": "text", "text": "Hi, I'm Claude."}] - ``` - - If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. - - For example, if the input `messages` were: - - ```json - [ - {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, - {"role": "assistant", "content": "The best answer is ("} - ] - ``` - - Then the response `content` might be: - - ```json - [{"type": "text", "text": "B)"}] - ``` - - - `class BetaTextBlock:` - - - `Optional> citations` - - Citations supporting the text block. - - The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. - - - `class BetaCitationCharLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `Optional fileId` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `Optional fileId` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `Optional fileId` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationsWebSearchResultLocation:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocation:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `class BetaThinkingBlock:` - - - `String signature` - - - `String thinking` - - - `JsonValue; type "thinking"constant` - - - `THINKING("thinking")` - - - `class BetaRedactedThinkingBlock:` - - - `String data` - - - `JsonValue; type "redacted_thinking"constant` - - - `REDACTED_THINKING("redacted_thinking")` - - - `class BetaToolUseBlock:` - - - `String id` - - - `Input input` - - - `String name` - - - `JsonValue; type "tool_use"constant` - - - `TOOL_USE("tool_use")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaServerToolUseBlock:` - - - `String id` - - - `Input input` - - - `Name name` - - - `WEB_SEARCH("web_search")` - - - `WEB_FETCH("web_fetch")` - - - `CODE_EXECUTION("code_execution")` - - - `BASH_CODE_EXECUTION("bash_code_execution")` - - - `TEXT_EDITOR_CODE_EXECUTION("text_editor_code_execution")` - - - `TOOL_SEARCH_TOOL_REGEX("tool_search_tool_regex")` - - - `TOOL_SEARCH_TOOL_BM25("tool_search_tool_bm25")` - - - `JsonValue; type "server_tool_use"constant` - - - `SERVER_TOOL_USE("server_tool_use")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaWebSearchToolResultBlock:` - - - `BetaWebSearchToolResultBlockContent content` - - - `class BetaWebSearchToolResultError:` - - - `BetaWebSearchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `QUERY_TOO_LONG("query_too_long")` - - - `REQUEST_TOO_LARGE("request_too_large")` - - - `JsonValue; type "web_search_tool_result_error"constant` - - - `WEB_SEARCH_TOOL_RESULT_ERROR("web_search_tool_result_error")` - - - `List` - - - `String encryptedContent` - - - `Optional pageAge` - - - `String title` - - - `JsonValue; type "web_search_result"constant` - - - `WEB_SEARCH_RESULT("web_search_result")` - - - `String url` - - - `String toolUseId` - - - `JsonValue; type "web_search_tool_result"constant` - - - `WEB_SEARCH_TOOL_RESULT("web_search_tool_result")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaWebFetchToolResultBlock:` - - - `Content content` - - - `class BetaWebFetchToolResultErrorBlock:` - - - `BetaWebFetchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `URL_TOO_LONG("url_too_long")` - - - `URL_NOT_ALLOWED("url_not_allowed")` - - - `URL_NOT_ACCESSIBLE("url_not_accessible")` - - - `UNSUPPORTED_CONTENT_TYPE("unsupported_content_type")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `UNAVAILABLE("unavailable")` - - - `JsonValue; type "web_fetch_tool_result_error"constant` - - - `WEB_FETCH_TOOL_RESULT_ERROR("web_fetch_tool_result_error")` - - - `class BetaWebFetchBlock:` - - - `BetaDocumentBlock content` - - - `Optional citations` - - Citation configuration for the document - - - `boolean enabled` - - - `Source source` - - - `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional title` - - The title of the document - - - `JsonValue; type "document"constant` - - - `DOCUMENT("document")` - - - `Optional retrievedAt` - - ISO 8601 timestamp when the content was retrieved - - - `JsonValue; type "web_fetch_result"constant` - - - `WEB_FETCH_RESULT("web_fetch_result")` - - - `String url` - - Fetched content URL - - - `String toolUseId` - - - `JsonValue; type "web_fetch_tool_result"constant` - - - `WEB_FETCH_TOOL_RESULT("web_fetch_tool_result")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaCodeExecutionToolResultBlock:` - - - `BetaCodeExecutionToolResultBlockContent content` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `class BetaCodeExecutionToolResultError:` - - - `BetaCodeExecutionToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `JsonValue; type "code_execution_tool_result_error"constant` - - - `CODE_EXECUTION_TOOL_RESULT_ERROR("code_execution_tool_result_error")` - - - `class BetaCodeExecutionResultBlock:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "code_execution_result"constant` - - - `CODE_EXECUTION_RESULT("code_execution_result")` - - - `class BetaEncryptedCodeExecutionResultBlock:` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `String encryptedStdout` - - - `long returnCode` - - - `String stderr` - - - `JsonValue; type "encrypted_code_execution_result"constant` - - - `ENCRYPTED_CODE_EXECUTION_RESULT("encrypted_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "code_execution_tool_result"constant` - - - `CODE_EXECUTION_TOOL_RESULT("code_execution_tool_result")` - - - `class BetaBashCodeExecutionToolResultBlock:` - - - `Content content` - - - `class BetaBashCodeExecutionToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `OUTPUT_FILE_TOO_LARGE("output_file_too_large")` - - - `JsonValue; type "bash_code_execution_tool_result_error"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT_ERROR("bash_code_execution_tool_result_error")` - - - `class BetaBashCodeExecutionResultBlock:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "bash_code_execution_output"constant` - - - `BASH_CODE_EXECUTION_OUTPUT("bash_code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "bash_code_execution_result"constant` - - - `BASH_CODE_EXECUTION_RESULT("bash_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "bash_code_execution_tool_result"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT("bash_code_execution_tool_result")` - - - `class BetaTextEditorCodeExecutionToolResultBlock:` - - - `Content content` - - - `class BetaTextEditorCodeExecutionToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `FILE_NOT_FOUND("file_not_found")` - - - `Optional errorMessage` - - - `JsonValue; type "text_editor_code_execution_tool_result_error"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT_ERROR("text_editor_code_execution_tool_result_error")` - - - `class BetaTextEditorCodeExecutionViewResultBlock:` - - - `String content` - - - `FileType fileType` - - - `TEXT("text")` - - - `IMAGE("image")` - - - `PDF("pdf")` - - - `Optional numLines` - - - `Optional startLine` - - - `Optional totalLines` - - - `JsonValue; type "text_editor_code_execution_view_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_VIEW_RESULT("text_editor_code_execution_view_result")` - - - `class BetaTextEditorCodeExecutionCreateResultBlock:` - - - `boolean isFileUpdate` - - - `JsonValue; type "text_editor_code_execution_create_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_CREATE_RESULT("text_editor_code_execution_create_result")` - - - `class BetaTextEditorCodeExecutionStrReplaceResultBlock:` - - - `Optional> lines` - - - `Optional newLines` - - - `Optional newStart` - - - `Optional oldLines` - - - `Optional oldStart` - - - `JsonValue; type "text_editor_code_execution_str_replace_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_STR_REPLACE_RESULT("text_editor_code_execution_str_replace_result")` - - - `String toolUseId` - - - `JsonValue; type "text_editor_code_execution_tool_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT("text_editor_code_execution_tool_result")` - - - `class BetaToolSearchToolResultBlock:` - - - `Content content` - - - `class BetaToolSearchToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `Optional errorMessage` - - - `JsonValue; type "tool_search_tool_result_error"constant` - - - `TOOL_SEARCH_TOOL_RESULT_ERROR("tool_search_tool_result_error")` - - - `class BetaToolSearchToolSearchResultBlock:` - - - `List toolReferences` - - - `String toolName` - - - `JsonValue; type "tool_reference"constant` - - - `TOOL_REFERENCE("tool_reference")` - - - `JsonValue; type "tool_search_tool_search_result"constant` - - - `TOOL_SEARCH_TOOL_SEARCH_RESULT("tool_search_tool_search_result")` - - - `String toolUseId` - - - `JsonValue; type "tool_search_tool_result"constant` - - - `TOOL_SEARCH_TOOL_RESULT("tool_search_tool_result")` - - - `class BetaMcpToolUseBlock:` - - - `String id` - - - `Input input` - - - `String name` - - The name of the MCP tool - - - `String serverName` - - The name of the MCP server - - - `JsonValue; type "mcp_tool_use"constant` - - - `MCP_TOOL_USE("mcp_tool_use")` - - - `class BetaMcpToolResultBlock:` - - - `Content content` - - - `String` - - - `List` - - - `Optional> citations` - - Citations supporting the text block. - - The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. - - - `class BetaCitationCharLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `Optional fileId` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `Optional fileId` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `Optional fileId` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationsWebSearchResultLocation:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocation:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `boolean isError` - - - `String toolUseId` - - - `JsonValue; type "mcp_tool_result"constant` - - - `MCP_TOOL_RESULT("mcp_tool_result")` - - - `class BetaContainerUploadBlock:` - - Response model for a file uploaded to the container. - - - `String fileId` - - - `JsonValue; type "container_upload"constant` - - - `CONTAINER_UPLOAD("container_upload")` - - - `class BetaCompactionBlock:` - - A compaction block returned when autocompact is triggered. - - When content is None, it indicates the compaction failed to produce a valid - summary (e.g., malformed output from the model). Clients may round-trip - compaction blocks with null content; the server treats them as no-ops. - - - `Optional content` - - Summary of compacted content, or null if compaction failed - - - `JsonValue; type "compaction"constant` - - - `COMPACTION("compaction")` - - - `Optional contextManagement` - - Context management response. - - Information about context management strategies applied during the request. - - - `List appliedEdits` - - List of context management edits that were applied. - - - `class BetaClearToolUses20250919EditResponse:` - - - `long clearedInputTokens` - - Number of input tokens cleared by this edit. - - - `long clearedToolUses` - - Number of tool uses that were cleared. - - - `JsonValue; type "clear_tool_uses_20250919"constant` - - The type of context management edit applied. - - - `CLEAR_TOOL_USES_20250919("clear_tool_uses_20250919")` - - - `class BetaClearThinking20251015EditResponse:` - - - `long clearedInputTokens` - - Number of input tokens cleared by this edit. - - - `long clearedThinkingTurns` - - Number of thinking turns that were cleared. - - - `JsonValue; type "clear_thinking_20251015"constant` - - The type of context management edit applied. - - - `CLEAR_THINKING_20251015("clear_thinking_20251015")` - - - `Model model` - - The model that will complete your prompt. - - See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - - Most intelligent model for building agents and coding - - - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` - - Best combination of speed and intelligence - - - `CLAUDE_HAIKU_4_5("claude-haiku-4-5")` - - Fastest model with near-frontier intelligence - - - `CLAUDE_HAIKU_4_5_20251001("claude-haiku-4-5-20251001")` - - Fastest model with near-frontier intelligence - - - `CLAUDE_OPUS_4_5("claude-opus-4-5")` - - Premium model combining maximum intelligence with practical performance - - - `CLAUDE_OPUS_4_5_20251101("claude-opus-4-5-20251101")` - - Premium model combining maximum intelligence with practical performance - - - `CLAUDE_SONNET_4_5("claude-sonnet-4-5")` - - High-performance model for agents and coding - - - `CLAUDE_SONNET_4_5_20250929("claude-sonnet-4-5-20250929")` - - High-performance model for agents and coding - - - `CLAUDE_OPUS_4_1("claude-opus-4-1")` - - Exceptional model for specialized complex tasks - - - `CLAUDE_OPUS_4_1_20250805("claude-opus-4-1-20250805")` - - Exceptional model for specialized complex tasks - - - `CLAUDE_OPUS_4_0("claude-opus-4-0")` - - Powerful model for complex tasks - - - `CLAUDE_OPUS_4_20250514("claude-opus-4-20250514")` - - Powerful model for complex tasks - - - `CLAUDE_SONNET_4_0("claude-sonnet-4-0")` - - High-performance model with extended thinking - - - `CLAUDE_SONNET_4_20250514("claude-sonnet-4-20250514")` - - High-performance model with extended thinking - - - `CLAUDE_3_HAIKU_20240307("claude-3-haiku-20240307")` - - Fast and cost-effective model - - - `JsonValue; role "assistant"constant` - - Conversational role of the generated message. - - This will always be `"assistant"`. - - - `ASSISTANT("assistant")` - - - `Optional stopDetails` - - Structured information about a refusal. - - - `Optional category` - - The policy category that triggered the refusal. - - `null` when the refusal doesn't map to a named category. - - - `CYBER("cyber")` - - - `BIO("bio")` - - - `Optional explanation` - - Human-readable explanation of the refusal. - - This text is not guaranteed to be stable. `null` when no explanation is available for the category. - - - `JsonValue; type "refusal"constant` - - - `REFUSAL("refusal")` - - - `Optional stopReason` - - The reason that we stopped. - - This may be one the following values: - - * `"end_turn"`: the model reached a natural stopping point - * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum - * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated - * `"tool_use"`: the model invoked one or more tools - * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. - * `"refusal"`: when streaming classifiers intervene to handle potential policy violations - - In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. - - - `END_TURN("end_turn")` - - - `MAX_TOKENS("max_tokens")` - - - `STOP_SEQUENCE("stop_sequence")` - - - `TOOL_USE("tool_use")` - - - `PAUSE_TURN("pause_turn")` - - - `COMPACTION("compaction")` - - - `REFUSAL("refusal")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED("model_context_window_exceeded")` - - - `Optional stopSequence` - - Which custom stop sequence was generated, if any. - - This value will be a non-null string if one of your custom stop sequences was generated. - - - `JsonValue; type "message"constant` - - Object type. - - For Messages, this is always `"message"`. - - - `MESSAGE("message")` - - - `BetaUsage usage` - - Billing and rate-limit usage. - - Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. - - Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. - - For example, `output_tokens` will be non-zero, even for an empty string response from Claude. - - Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `Optional cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `Optional cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `Optional inferenceGeo` - - The geographic region where inference was performed for this request. - - - `long inputTokens` - - The number of input tokens which were used. - - - `Optional> iterations` - - Per-iteration token usage breakdown. - - Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: - - - Determine which iterations exceeded long context thresholds (>=200k tokens) - - Calculate the true context window size from the last iteration - - Understand token accumulation across server-side tool use loops - - - `class BetaMessageIterationUsage:` - - Token usage for a sampling iteration. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `long cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `long cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `long inputTokens` - - The number of input tokens which were used. - - - `long outputTokens` - - The number of output tokens which were used. - - - `JsonValue; type "message"constant` - - Usage for a sampling iteration - - - `MESSAGE("message")` - - - `class BetaCompactionIterationUsage:` - - Token usage for a compaction iteration. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `long cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `long cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `long inputTokens` - - The number of input tokens which were used. - - - `long outputTokens` - - The number of output tokens which were used. - - - `JsonValue; type "compaction"constant` - - Usage for a compaction iteration - - - `COMPACTION("compaction")` - - - `long outputTokens` - - The number of output tokens which were used. - - - `Optional serverToolUse` - - The number of server tool requests. - - - `long webFetchRequests` - - The number of web fetch tool requests. - - - `long webSearchRequests` - - The number of web search tool requests. - - - `Optional serviceTier` - - If the request used the priority, standard, or batch tier. - - - `STANDARD("standard")` - - - `PRIORITY("priority")` - - - `BATCH("batch")` - - - `Optional speed` - - The inference speed mode used for this request. - - - `STANDARD("standard")` - - - `FAST("fast")` - - - `JsonValue; type "message_start"constant` - - - `MESSAGE_START("message_start")` - - - `class BetaRawMessageDeltaEvent:` - - - `Optional contextManagement` - - Information about context management strategies applied during the request - - - `List appliedEdits` - - List of context management edits that were applied. - - - `class BetaClearToolUses20250919EditResponse:` - - - `long clearedInputTokens` - - Number of input tokens cleared by this edit. - - - `long clearedToolUses` - - Number of tool uses that were cleared. - - - `JsonValue; type "clear_tool_uses_20250919"constant` - - The type of context management edit applied. - - - `CLEAR_TOOL_USES_20250919("clear_tool_uses_20250919")` - - - `class BetaClearThinking20251015EditResponse:` - - - `long clearedInputTokens` - - Number of input tokens cleared by this edit. - - - `long clearedThinkingTurns` - - Number of thinking turns that were cleared. - - - `JsonValue; type "clear_thinking_20251015"constant` - - The type of context management edit applied. - - - `CLEAR_THINKING_20251015("clear_thinking_20251015")` - - - `Delta delta` - - - `Optional container` - - Information about the container used in the request (for the code execution tool) - - - `String id` - - Identifier for the container used in this request - - - `LocalDateTime expiresAt` - - The time at which the container will expire. - - - `Optional> skills` - - Skills loaded in the container - - - `String skillId` - - Skill ID - - - `Type type` - - Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) - - - `ANTHROPIC("anthropic")` - - - `CUSTOM("custom")` - - - `String version` - - Skill version or 'latest' for most recent version - - - `Optional stopDetails` - - Structured information about a refusal. - - - `Optional category` - - The policy category that triggered the refusal. - - `null` when the refusal doesn't map to a named category. - - - `CYBER("cyber")` - - - `BIO("bio")` - - - `Optional explanation` - - Human-readable explanation of the refusal. - - This text is not guaranteed to be stable. `null` when no explanation is available for the category. - - - `JsonValue; type "refusal"constant` - - - `REFUSAL("refusal")` - - - `Optional stopReason` - - - `END_TURN("end_turn")` - - - `MAX_TOKENS("max_tokens")` - - - `STOP_SEQUENCE("stop_sequence")` - - - `TOOL_USE("tool_use")` - - - `PAUSE_TURN("pause_turn")` - - - `COMPACTION("compaction")` - - - `REFUSAL("refusal")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED("model_context_window_exceeded")` - - - `Optional stopSequence` - - - `JsonValue; type "message_delta"constant` - - - `MESSAGE_DELTA("message_delta")` - - - `BetaMessageDeltaUsage usage` - - Billing and rate-limit usage. - - Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. - - Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. - - For example, `output_tokens` will be non-zero, even for an empty string response from Claude. - - Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. - - - `Optional cacheCreationInputTokens` - - The cumulative number of input tokens used to create the cache entry. - - - `Optional cacheReadInputTokens` - - The cumulative number of input tokens read from the cache. - - - `Optional inputTokens` - - The cumulative number of input tokens which were used. - - - `Optional> iterations` - - Per-iteration token usage breakdown. - - Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: - - - Determine which iterations exceeded long context thresholds (>=200k tokens) - - Calculate the true context window size from the last iteration - - Understand token accumulation across server-side tool use loops - - - `class BetaMessageIterationUsage:` - - Token usage for a sampling iteration. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `long cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `long cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `long inputTokens` - - The number of input tokens which were used. - - - `long outputTokens` - - The number of output tokens which were used. - - - `JsonValue; type "message"constant` - - Usage for a sampling iteration - - - `MESSAGE("message")` - - - `class BetaCompactionIterationUsage:` - - Token usage for a compaction iteration. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `long cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `long cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `long inputTokens` - - The number of input tokens which were used. - - - `long outputTokens` - - The number of output tokens which were used. - - - `JsonValue; type "compaction"constant` - - Usage for a compaction iteration - - - `COMPACTION("compaction")` - - - `long outputTokens` - - The cumulative number of output tokens which were used. - - - `Optional serverToolUse` - - The number of server tool requests. - - - `long webFetchRequests` - - The number of web fetch tool requests. - - - `long webSearchRequests` - - The number of web search tool requests. - - - `class BetaRawMessageStopEvent:` - - - `JsonValue; type "message_stop"constant` - - - `MESSAGE_STOP("message_stop")` - - - `class BetaRawContentBlockStartEvent:` - - - `ContentBlock contentBlock` - - Response model for a file uploaded to the container. - - - `class BetaTextBlock:` - - - `Optional> citations` - - Citations supporting the text block. - - The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. - - - `class BetaCitationCharLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `Optional fileId` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `Optional fileId` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `Optional fileId` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationsWebSearchResultLocation:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocation:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `class BetaThinkingBlock:` - - - `String signature` - - - `String thinking` - - - `JsonValue; type "thinking"constant` - - - `THINKING("thinking")` - - - `class BetaRedactedThinkingBlock:` - - - `String data` - - - `JsonValue; type "redacted_thinking"constant` - - - `REDACTED_THINKING("redacted_thinking")` - - - `class BetaToolUseBlock:` - - - `String id` - - - `Input input` - - - `String name` - - - `JsonValue; type "tool_use"constant` - - - `TOOL_USE("tool_use")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaServerToolUseBlock:` - - - `String id` - - - `Input input` - - - `Name name` - - - `WEB_SEARCH("web_search")` - - - `WEB_FETCH("web_fetch")` - - - `CODE_EXECUTION("code_execution")` - - - `BASH_CODE_EXECUTION("bash_code_execution")` - - - `TEXT_EDITOR_CODE_EXECUTION("text_editor_code_execution")` - - - `TOOL_SEARCH_TOOL_REGEX("tool_search_tool_regex")` - - - `TOOL_SEARCH_TOOL_BM25("tool_search_tool_bm25")` - - - `JsonValue; type "server_tool_use"constant` - - - `SERVER_TOOL_USE("server_tool_use")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaWebSearchToolResultBlock:` - - - `BetaWebSearchToolResultBlockContent content` - - - `class BetaWebSearchToolResultError:` - - - `BetaWebSearchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `QUERY_TOO_LONG("query_too_long")` - - - `REQUEST_TOO_LARGE("request_too_large")` - - - `JsonValue; type "web_search_tool_result_error"constant` - - - `WEB_SEARCH_TOOL_RESULT_ERROR("web_search_tool_result_error")` - - - `List` - - - `String encryptedContent` - - - `Optional pageAge` - - - `String title` - - - `JsonValue; type "web_search_result"constant` - - - `WEB_SEARCH_RESULT("web_search_result")` - - - `String url` - - - `String toolUseId` - - - `JsonValue; type "web_search_tool_result"constant` - - - `WEB_SEARCH_TOOL_RESULT("web_search_tool_result")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaWebFetchToolResultBlock:` - - - `Content content` - - - `class BetaWebFetchToolResultErrorBlock:` - - - `BetaWebFetchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `URL_TOO_LONG("url_too_long")` - - - `URL_NOT_ALLOWED("url_not_allowed")` - - - `URL_NOT_ACCESSIBLE("url_not_accessible")` - - - `UNSUPPORTED_CONTENT_TYPE("unsupported_content_type")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `UNAVAILABLE("unavailable")` - - - `JsonValue; type "web_fetch_tool_result_error"constant` - - - `WEB_FETCH_TOOL_RESULT_ERROR("web_fetch_tool_result_error")` - - - `class BetaWebFetchBlock:` - - - `BetaDocumentBlock content` - - - `Optional citations` - - Citation configuration for the document - - - `boolean enabled` - - - `Source source` - - - `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional title` - - The title of the document - - - `JsonValue; type "document"constant` - - - `DOCUMENT("document")` - - - `Optional retrievedAt` - - ISO 8601 timestamp when the content was retrieved - - - `JsonValue; type "web_fetch_result"constant` - - - `WEB_FETCH_RESULT("web_fetch_result")` - - - `String url` - - Fetched content URL - - - `String toolUseId` - - - `JsonValue; type "web_fetch_tool_result"constant` - - - `WEB_FETCH_TOOL_RESULT("web_fetch_tool_result")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaCodeExecutionToolResultBlock:` - - - `BetaCodeExecutionToolResultBlockContent content` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `class BetaCodeExecutionToolResultError:` - - - `BetaCodeExecutionToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `JsonValue; type "code_execution_tool_result_error"constant` - - - `CODE_EXECUTION_TOOL_RESULT_ERROR("code_execution_tool_result_error")` - - - `class BetaCodeExecutionResultBlock:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "code_execution_result"constant` - - - `CODE_EXECUTION_RESULT("code_execution_result")` - - - `class BetaEncryptedCodeExecutionResultBlock:` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `String encryptedStdout` - - - `long returnCode` - - - `String stderr` - - - `JsonValue; type "encrypted_code_execution_result"constant` - - - `ENCRYPTED_CODE_EXECUTION_RESULT("encrypted_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "code_execution_tool_result"constant` - - - `CODE_EXECUTION_TOOL_RESULT("code_execution_tool_result")` - - - `class BetaBashCodeExecutionToolResultBlock:` - - - `Content content` - - - `class BetaBashCodeExecutionToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `OUTPUT_FILE_TOO_LARGE("output_file_too_large")` - - - `JsonValue; type "bash_code_execution_tool_result_error"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT_ERROR("bash_code_execution_tool_result_error")` - - - `class BetaBashCodeExecutionResultBlock:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "bash_code_execution_output"constant` - - - `BASH_CODE_EXECUTION_OUTPUT("bash_code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "bash_code_execution_result"constant` - - - `BASH_CODE_EXECUTION_RESULT("bash_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "bash_code_execution_tool_result"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT("bash_code_execution_tool_result")` - - - `class BetaTextEditorCodeExecutionToolResultBlock:` - - - `Content content` - - - `class BetaTextEditorCodeExecutionToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `FILE_NOT_FOUND("file_not_found")` - - - `Optional errorMessage` - - - `JsonValue; type "text_editor_code_execution_tool_result_error"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT_ERROR("text_editor_code_execution_tool_result_error")` - - - `class BetaTextEditorCodeExecutionViewResultBlock:` - - - `String content` - - - `FileType fileType` - - - `TEXT("text")` - - - `IMAGE("image")` - - - `PDF("pdf")` - - - `Optional numLines` - - - `Optional startLine` - - - `Optional totalLines` - - - `JsonValue; type "text_editor_code_execution_view_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_VIEW_RESULT("text_editor_code_execution_view_result")` - - - `class BetaTextEditorCodeExecutionCreateResultBlock:` - - - `boolean isFileUpdate` - - - `JsonValue; type "text_editor_code_execution_create_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_CREATE_RESULT("text_editor_code_execution_create_result")` - - - `class BetaTextEditorCodeExecutionStrReplaceResultBlock:` - - - `Optional> lines` - - - `Optional newLines` - - - `Optional newStart` - - - `Optional oldLines` - - - `Optional oldStart` - - - `JsonValue; type "text_editor_code_execution_str_replace_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_STR_REPLACE_RESULT("text_editor_code_execution_str_replace_result")` - - - `String toolUseId` - - - `JsonValue; type "text_editor_code_execution_tool_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT("text_editor_code_execution_tool_result")` - - - `class BetaToolSearchToolResultBlock:` - - - `Content content` - - - `class BetaToolSearchToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `Optional errorMessage` - - - `JsonValue; type "tool_search_tool_result_error"constant` - - - `TOOL_SEARCH_TOOL_RESULT_ERROR("tool_search_tool_result_error")` - - - `class BetaToolSearchToolSearchResultBlock:` - - - `List toolReferences` - - - `String toolName` - - - `JsonValue; type "tool_reference"constant` - - - `TOOL_REFERENCE("tool_reference")` - - - `JsonValue; type "tool_search_tool_search_result"constant` - - - `TOOL_SEARCH_TOOL_SEARCH_RESULT("tool_search_tool_search_result")` - - - `String toolUseId` - - - `JsonValue; type "tool_search_tool_result"constant` - - - `TOOL_SEARCH_TOOL_RESULT("tool_search_tool_result")` - - - `class BetaMcpToolUseBlock:` - - - `String id` - - - `Input input` - - - `String name` - - The name of the MCP tool - - - `String serverName` - - The name of the MCP server - - - `JsonValue; type "mcp_tool_use"constant` - - - `MCP_TOOL_USE("mcp_tool_use")` - - - `class BetaMcpToolResultBlock:` - - - `Content content` - - - `String` - - - `List` - - - `Optional> citations` - - Citations supporting the text block. - - The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. - - - `class BetaCitationCharLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `Optional fileId` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `Optional fileId` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `Optional fileId` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationsWebSearchResultLocation:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocation:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `boolean isError` - - - `String toolUseId` - - - `JsonValue; type "mcp_tool_result"constant` - - - `MCP_TOOL_RESULT("mcp_tool_result")` - - - `class BetaContainerUploadBlock:` - - Response model for a file uploaded to the container. - - - `String fileId` - - - `JsonValue; type "container_upload"constant` - - - `CONTAINER_UPLOAD("container_upload")` - - - `class BetaCompactionBlock:` - - A compaction block returned when autocompact is triggered. - - When content is None, it indicates the compaction failed to produce a valid - summary (e.g., malformed output from the model). Clients may round-trip - compaction blocks with null content; the server treats them as no-ops. - - - `Optional content` - - Summary of compacted content, or null if compaction failed - - - `JsonValue; type "compaction"constant` - - - `COMPACTION("compaction")` - - - `long index` - - - `JsonValue; type "content_block_start"constant` - - - `CONTENT_BLOCK_START("content_block_start")` - - - `class BetaRawContentBlockDeltaEvent:` - - - `BetaRawContentBlockDelta delta` - - - `class BetaTextDelta:` - - - `String text` - - - `JsonValue; type "text_delta"constant` - - - `TEXT_DELTA("text_delta")` - - - `class BetaInputJsonDelta:` - - - `String partialJson` - - - `JsonValue; type "input_json_delta"constant` - - - `INPUT_JSON_DELTA("input_json_delta")` - - - `class BetaCitationsDelta:` - - - `Citation citation` - - - `class BetaCitationCharLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `Optional fileId` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `Optional fileId` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `Optional fileId` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationsWebSearchResultLocation:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocation:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `JsonValue; type "citations_delta"constant` - - - `CITATIONS_DELTA("citations_delta")` - - - `class BetaThinkingDelta:` - - - `String thinking` - - - `JsonValue; type "thinking_delta"constant` - - - `THINKING_DELTA("thinking_delta")` - - - `class BetaSignatureDelta:` - - - `String signature` - - - `JsonValue; type "signature_delta"constant` - - - `SIGNATURE_DELTA("signature_delta")` - - - `class BetaCompactionContentBlockDelta:` - - - `Optional content` - - - `JsonValue; type "compaction_delta"constant` - - - `COMPACTION_DELTA("compaction_delta")` - - - `long index` - - - `JsonValue; type "content_block_delta"constant` - - - `CONTENT_BLOCK_DELTA("content_block_delta")` - - - `class BetaRawContentBlockStopEvent:` - - - `long index` - - - `JsonValue; type "content_block_stop"constant` - - - `CONTENT_BLOCK_STOP("content_block_stop")` - -### Beta Redacted Thinking Block - -- `class BetaRedactedThinkingBlock:` - - - `String data` - - - `JsonValue; type "redacted_thinking"constant` - - - `REDACTED_THINKING("redacted_thinking")` - -### Beta Redacted Thinking Block Param - -- `class BetaRedactedThinkingBlockParam:` - - - `String data` - - - `JsonValue; type "redacted_thinking"constant` - - - `REDACTED_THINKING("redacted_thinking")` - -### Beta Refusal Stop Details - -- `class BetaRefusalStopDetails:` - - Structured information about a refusal. - - - `Optional category` - - The policy category that triggered the refusal. - - `null` when the refusal doesn't map to a named category. - - - `CYBER("cyber")` - - - `BIO("bio")` - - - `Optional explanation` - - Human-readable explanation of the refusal. - - This text is not guaranteed to be stable. `null` when no explanation is available for the category. - - - `JsonValue; type "refusal"constant` - - - `REFUSAL("refusal")` - -### Beta Request Document Block - -- `class BetaRequestDocumentBlock:` - - - `Source source` - - - `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `class BetaContentBlockSource:` - - - `Content content` - - - `String` - - - `List` - - - `class BetaTextBlockParam:` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `class BetaImageBlockParam:` - - - `Source source` - - - `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "image"constant` - - - `IMAGE("image")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `JsonValue; type "content"constant` - - - `CONTENT("content")` - - - `class BetaUrlPdfSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileDocumentSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "document"constant` - - - `DOCUMENT("document")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - - `Optional enabled` - - - `Optional context` - - - `Optional title` - -### Beta Request MCP Server Tool Configuration - -- `class BetaRequestMcpServerToolConfiguration:` - - - `Optional> allowedTools` - - - `Optional enabled` - -### Beta Request MCP Server URL Definition - -- `class BetaRequestMcpServerUrlDefinition:` - - - `String name` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `Optional authorizationToken` - - - `Optional toolConfiguration` - - - `Optional> allowedTools` - - - `Optional enabled` - -### Beta Request MCP Tool Result Block Param - -- `class BetaRequestMcpToolResultBlockParam:` - - - `String toolUseId` - - - `JsonValue; type "mcp_tool_result"constant` - - - `MCP_TOOL_RESULT("mcp_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional content` - - - `String` - - - `List` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `Optional isError` - -### Beta Search Result Block Param - -- `class BetaSearchResultBlockParam:` - - - `List content` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String source` - - - `String title` - - - `JsonValue; type "search_result"constant` - - - `SEARCH_RESULT("search_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - - `Optional enabled` - -### Beta Server Tool Caller - -- `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - -### Beta Server Tool Caller 20260120 - -- `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - -### Beta Server Tool Usage - -- `class BetaServerToolUsage:` - - - `long webFetchRequests` - - The number of web fetch tool requests. - - - `long webSearchRequests` - - The number of web search tool requests. - -### Beta Server Tool Use Block - -- `class BetaServerToolUseBlock:` - - - `String id` - - - `Input input` - - - `Name name` - - - `WEB_SEARCH("web_search")` - - - `WEB_FETCH("web_fetch")` - - - `CODE_EXECUTION("code_execution")` - - - `BASH_CODE_EXECUTION("bash_code_execution")` - - - `TEXT_EDITOR_CODE_EXECUTION("text_editor_code_execution")` - - - `TOOL_SEARCH_TOOL_REGEX("tool_search_tool_regex")` - - - `TOOL_SEARCH_TOOL_BM25("tool_search_tool_bm25")` - - - `JsonValue; type "server_tool_use"constant` - - - `SERVER_TOOL_USE("server_tool_use")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - -### Beta Server Tool Use Block Param - -- `class BetaServerToolUseBlockParam:` - - - `String id` - - - `Input input` - - - `Name name` - - - `WEB_SEARCH("web_search")` - - - `WEB_FETCH("web_fetch")` - - - `CODE_EXECUTION("code_execution")` - - - `BASH_CODE_EXECUTION("bash_code_execution")` - - - `TEXT_EDITOR_CODE_EXECUTION("text_editor_code_execution")` - - - `TOOL_SEARCH_TOOL_REGEX("tool_search_tool_regex")` - - - `TOOL_SEARCH_TOOL_BM25("tool_search_tool_bm25")` - - - `JsonValue; type "server_tool_use"constant` - - - `SERVER_TOOL_USE("server_tool_use")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - -### Beta Signature Delta - -- `class BetaSignatureDelta:` - - - `String signature` - - - `JsonValue; type "signature_delta"constant` - - - `SIGNATURE_DELTA("signature_delta")` - -### Beta Skill - -- `class BetaSkill:` - - A skill that was loaded in a container (response model). - - - `String skillId` - - Skill ID - - - `Type type` - - Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) - - - `ANTHROPIC("anthropic")` - - - `CUSTOM("custom")` - - - `String version` - - Skill version or 'latest' for most recent version - -### Beta Skill Params - -- `class BetaSkillParams:` - - Specification for a skill to be loaded in a container (request model). - - - `String skillId` - - Skill ID - - - `Type type` - - Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) - - - `ANTHROPIC("anthropic")` - - - `CUSTOM("custom")` - - - `Optional version` - - Skill version or 'latest' for most recent version - -### Beta Stop Reason - -- `enum BetaStopReason:` - - - `END_TURN("end_turn")` - - - `MAX_TOKENS("max_tokens")` - - - `STOP_SEQUENCE("stop_sequence")` - - - `TOOL_USE("tool_use")` - - - `PAUSE_TURN("pause_turn")` - - - `COMPACTION("compaction")` - - - `REFUSAL("refusal")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED("model_context_window_exceeded")` - -### Beta Text Block - -- `class BetaTextBlock:` - - - `Optional> citations` - - Citations supporting the text block. - - The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. - - - `class BetaCitationCharLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `Optional fileId` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `Optional fileId` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `Optional fileId` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationsWebSearchResultLocation:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocation:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - -### Beta Text Block Param - -- `class BetaTextBlockParam:` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - -### Beta Text Citation - -- `class BetaTextCitation: A class that can be one of several variants.union` - - - `class BetaCitationCharLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `Optional fileId` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `Optional fileId` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `Optional fileId` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationsWebSearchResultLocation:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocation:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - -### Beta Text Citation Param - -- `class BetaTextCitationParam: A class that can be one of several variants.union` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - -### Beta Text Delta - -- `class BetaTextDelta:` - - - `String text` - - - `JsonValue; type "text_delta"constant` - - - `TEXT_DELTA("text_delta")` - -### Beta Text Editor Code Execution Create Result Block - -- `class BetaTextEditorCodeExecutionCreateResultBlock:` - - - `boolean isFileUpdate` - - - `JsonValue; type "text_editor_code_execution_create_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_CREATE_RESULT("text_editor_code_execution_create_result")` - -### Beta Text Editor Code Execution Create Result Block Param - -- `class BetaTextEditorCodeExecutionCreateResultBlockParam:` - - - `boolean isFileUpdate` - - - `JsonValue; type "text_editor_code_execution_create_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_CREATE_RESULT("text_editor_code_execution_create_result")` - -### Beta Text Editor Code Execution Str Replace Result Block - -- `class BetaTextEditorCodeExecutionStrReplaceResultBlock:` - - - `Optional> lines` - - - `Optional newLines` - - - `Optional newStart` - - - `Optional oldLines` - - - `Optional oldStart` - - - `JsonValue; type "text_editor_code_execution_str_replace_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_STR_REPLACE_RESULT("text_editor_code_execution_str_replace_result")` - -### Beta Text Editor Code Execution Str Replace Result Block Param - -- `class BetaTextEditorCodeExecutionStrReplaceResultBlockParam:` - - - `JsonValue; type "text_editor_code_execution_str_replace_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_STR_REPLACE_RESULT("text_editor_code_execution_str_replace_result")` - - - `Optional> lines` - - - `Optional newLines` - - - `Optional newStart` - - - `Optional oldLines` - - - `Optional oldStart` - -### Beta Text Editor Code Execution Tool Result Block - -- `class BetaTextEditorCodeExecutionToolResultBlock:` - - - `Content content` - - - `class BetaTextEditorCodeExecutionToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `FILE_NOT_FOUND("file_not_found")` - - - `Optional errorMessage` - - - `JsonValue; type "text_editor_code_execution_tool_result_error"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT_ERROR("text_editor_code_execution_tool_result_error")` - - - `class BetaTextEditorCodeExecutionViewResultBlock:` - - - `String content` - - - `FileType fileType` - - - `TEXT("text")` - - - `IMAGE("image")` - - - `PDF("pdf")` - - - `Optional numLines` - - - `Optional startLine` - - - `Optional totalLines` - - - `JsonValue; type "text_editor_code_execution_view_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_VIEW_RESULT("text_editor_code_execution_view_result")` - - - `class BetaTextEditorCodeExecutionCreateResultBlock:` - - - `boolean isFileUpdate` - - - `JsonValue; type "text_editor_code_execution_create_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_CREATE_RESULT("text_editor_code_execution_create_result")` - - - `class BetaTextEditorCodeExecutionStrReplaceResultBlock:` - - - `Optional> lines` - - - `Optional newLines` - - - `Optional newStart` - - - `Optional oldLines` - - - `Optional oldStart` - - - `JsonValue; type "text_editor_code_execution_str_replace_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_STR_REPLACE_RESULT("text_editor_code_execution_str_replace_result")` - - - `String toolUseId` - - - `JsonValue; type "text_editor_code_execution_tool_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT("text_editor_code_execution_tool_result")` - -### Beta Text Editor Code Execution Tool Result Block Param - -- `class BetaTextEditorCodeExecutionToolResultBlockParam:` - - - `Content content` - - - `class BetaTextEditorCodeExecutionToolResultErrorParam:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `FILE_NOT_FOUND("file_not_found")` - - - `JsonValue; type "text_editor_code_execution_tool_result_error"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT_ERROR("text_editor_code_execution_tool_result_error")` - - - `Optional errorMessage` - - - `class BetaTextEditorCodeExecutionViewResultBlockParam:` - - - `String content` - - - `FileType fileType` - - - `TEXT("text")` - - - `IMAGE("image")` - - - `PDF("pdf")` - - - `JsonValue; type "text_editor_code_execution_view_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_VIEW_RESULT("text_editor_code_execution_view_result")` - - - `Optional numLines` - - - `Optional startLine` - - - `Optional totalLines` - - - `class BetaTextEditorCodeExecutionCreateResultBlockParam:` - - - `boolean isFileUpdate` - - - `JsonValue; type "text_editor_code_execution_create_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_CREATE_RESULT("text_editor_code_execution_create_result")` - - - `class BetaTextEditorCodeExecutionStrReplaceResultBlockParam:` - - - `JsonValue; type "text_editor_code_execution_str_replace_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_STR_REPLACE_RESULT("text_editor_code_execution_str_replace_result")` - - - `Optional> lines` - - - `Optional newLines` - - - `Optional newStart` - - - `Optional oldLines` - - - `Optional oldStart` - - - `String toolUseId` - - - `JsonValue; type "text_editor_code_execution_tool_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT("text_editor_code_execution_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - -### Beta Text Editor Code Execution Tool Result Error - -- `class BetaTextEditorCodeExecutionToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `FILE_NOT_FOUND("file_not_found")` - - - `Optional errorMessage` - - - `JsonValue; type "text_editor_code_execution_tool_result_error"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT_ERROR("text_editor_code_execution_tool_result_error")` - -### Beta Text Editor Code Execution Tool Result Error Param - -- `class BetaTextEditorCodeExecutionToolResultErrorParam:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `FILE_NOT_FOUND("file_not_found")` - - - `JsonValue; type "text_editor_code_execution_tool_result_error"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT_ERROR("text_editor_code_execution_tool_result_error")` - - - `Optional errorMessage` - -### Beta Text Editor Code Execution View Result Block - -- `class BetaTextEditorCodeExecutionViewResultBlock:` - - - `String content` - - - `FileType fileType` - - - `TEXT("text")` - - - `IMAGE("image")` - - - `PDF("pdf")` - - - `Optional numLines` - - - `Optional startLine` - - - `Optional totalLines` - - - `JsonValue; type "text_editor_code_execution_view_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_VIEW_RESULT("text_editor_code_execution_view_result")` - -### Beta Text Editor Code Execution View Result Block Param - -- `class BetaTextEditorCodeExecutionViewResultBlockParam:` - - - `String content` - - - `FileType fileType` - - - `TEXT("text")` - - - `IMAGE("image")` - - - `PDF("pdf")` - - - `JsonValue; type "text_editor_code_execution_view_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_VIEW_RESULT("text_editor_code_execution_view_result")` - - - `Optional numLines` - - - `Optional startLine` - - - `Optional totalLines` - -### Beta Thinking Block - -- `class BetaThinkingBlock:` - - - `String signature` - - - `String thinking` - - - `JsonValue; type "thinking"constant` - - - `THINKING("thinking")` - -### Beta Thinking Block Param - -- `class BetaThinkingBlockParam:` - - - `String signature` - - - `String thinking` - - - `JsonValue; type "thinking"constant` - - - `THINKING("thinking")` - -### Beta Thinking Config Adaptive - -- `class BetaThinkingConfigAdaptive:` - - - `JsonValue; type "adaptive"constant` - - - `ADAPTIVE("adaptive")` - - - `Optional display` - - Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`. - - - `SUMMARIZED("summarized")` - - - `OMITTED("omitted")` - -### Beta Thinking Config Disabled - -- `class BetaThinkingConfigDisabled:` - - - `JsonValue; type "disabled"constant` - - - `DISABLED("disabled")` - -### Beta Thinking Config Enabled - -- `class BetaThinkingConfigEnabled:` - - - `long budgetTokens` - - Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality. - - Must be ≥1024 and less than `max_tokens`. - - See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details. - - - `JsonValue; type "enabled"constant` - - - `ENABLED("enabled")` - - - `Optional display` - - Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`. - - - `SUMMARIZED("summarized")` - - - `OMITTED("omitted")` - -### Beta Thinking Config Param - -- `class BetaThinkingConfigParam: A class that can be one of several variants.union` - - Configuration for enabling Claude's extended thinking. - - When enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit. - - See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details. - - - `class BetaThinkingConfigEnabled:` - - - `long budgetTokens` - - Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality. - - Must be ≥1024 and less than `max_tokens`. - - See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details. - - - `JsonValue; type "enabled"constant` - - - `ENABLED("enabled")` - - - `Optional display` - - Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`. - - - `SUMMARIZED("summarized")` - - - `OMITTED("omitted")` - - - `class BetaThinkingConfigDisabled:` - - - `JsonValue; type "disabled"constant` - - - `DISABLED("disabled")` - - - `class BetaThinkingConfigAdaptive:` - - - `JsonValue; type "adaptive"constant` - - - `ADAPTIVE("adaptive")` - - - `Optional display` - - Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`. - - - `SUMMARIZED("summarized")` - - - `OMITTED("omitted")` - -### Beta Thinking Delta - -- `class BetaThinkingDelta:` - - - `String thinking` - - - `JsonValue; type "thinking_delta"constant` - - - `THINKING_DELTA("thinking_delta")` - -### Beta Thinking Turns - -- `class BetaThinkingTurns:` - - - `JsonValue; type "thinking_turns"constant` - - - `THINKING_TURNS("thinking_turns")` - - - `long value` - -### Beta Tool - -- `class BetaTool:` - - - `InputSchema inputSchema` - - [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input. - - This defines the shape of the `input` that your tool accepts and that the model will produce. - - - `JsonValue; type "object"constant` - - - `OBJECT("object")` - - - `Optional properties` - - - `Optional> required` - - - `String name` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional description` - - Description of what this tool does. - - Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema. - - - `Optional eagerInputStreaming` - - Enable eager input streaming for this tool. When true, tool input parameters will be streamed incrementally as they are generated, and types will be inferred on-the-fly rather than buffering the full JSON output. When false, streaming is disabled for this tool even if the fine-grained-tool-streaming beta is active. When null (default), uses the default behavior based on beta headers. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `Optional type` - - - `CUSTOM("custom")` - -### Beta Tool Bash 20241022 - -- `class BetaToolBash20241022:` - - - `JsonValue; name "bash"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `BASH("bash")` - - - `JsonValue; type "bash_20241022"constant` - - - `BASH_20241022("bash_20241022")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - -### Beta Tool Bash 20250124 - -- `class BetaToolBash20250124:` - - - `JsonValue; name "bash"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `BASH("bash")` - - - `JsonValue; type "bash_20250124"constant` - - - `BASH_20250124("bash_20250124")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - -### Beta Tool Choice - -- `class BetaToolChoice: A class that can be one of several variants.union` - - How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all. - - - `class BetaToolChoiceAuto:` - - The model will automatically decide whether to use tools. - - - `JsonValue; type "auto"constant` - - - `AUTO("auto")` - - - `Optional disableParallelToolUse` - - Whether to disable parallel tool use. - - Defaults to `false`. If set to `true`, the model will output at most one tool use. - - - `class BetaToolChoiceAny:` - - The model will use any available tools. - - - `JsonValue; type "any"constant` - - - `ANY("any")` - - - `Optional disableParallelToolUse` - - Whether to disable parallel tool use. - - Defaults to `false`. If set to `true`, the model will output exactly one tool use. - - - `class BetaToolChoiceTool:` - - The model will use the specified tool with `tool_choice.name`. - - - `String name` - - The name of the tool to use. - - - `JsonValue; type "tool"constant` - - - `TOOL("tool")` - - - `Optional disableParallelToolUse` - - Whether to disable parallel tool use. - - Defaults to `false`. If set to `true`, the model will output exactly one tool use. - - - `class BetaToolChoiceNone:` - - The model will not be allowed to use tools. - - - `JsonValue; type "none"constant` - - - `NONE("none")` - -### Beta Tool Choice Any - -- `class BetaToolChoiceAny:` - - The model will use any available tools. - - - `JsonValue; type "any"constant` - - - `ANY("any")` - - - `Optional disableParallelToolUse` - - Whether to disable parallel tool use. - - Defaults to `false`. If set to `true`, the model will output exactly one tool use. - -### Beta Tool Choice Auto - -- `class BetaToolChoiceAuto:` - - The model will automatically decide whether to use tools. - - - `JsonValue; type "auto"constant` - - - `AUTO("auto")` - - - `Optional disableParallelToolUse` - - Whether to disable parallel tool use. - - Defaults to `false`. If set to `true`, the model will output at most one tool use. - -### Beta Tool Choice None - -- `class BetaToolChoiceNone:` - - The model will not be allowed to use tools. - - - `JsonValue; type "none"constant` - - - `NONE("none")` - -### Beta Tool Choice Tool - -- `class BetaToolChoiceTool:` - - The model will use the specified tool with `tool_choice.name`. - - - `String name` - - The name of the tool to use. - - - `JsonValue; type "tool"constant` - - - `TOOL("tool")` - - - `Optional disableParallelToolUse` - - Whether to disable parallel tool use. - - Defaults to `false`. If set to `true`, the model will output exactly one tool use. - -### Beta Tool Computer Use 20241022 - -- `class BetaToolComputerUse20241022:` - - - `long displayHeightPx` - - The height of the display in pixels. - - - `long displayWidthPx` - - The width of the display in pixels. - - - `JsonValue; name "computer"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `COMPUTER("computer")` - - - `JsonValue; type "computer_20241022"constant` - - - `COMPUTER_20241022("computer_20241022")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional displayNumber` - - The X11 display number (e.g. 0, 1) for the display. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - -### Beta Tool Computer Use 20250124 - -- `class BetaToolComputerUse20250124:` - - - `long displayHeightPx` - - The height of the display in pixels. - - - `long displayWidthPx` - - The width of the display in pixels. - - - `JsonValue; name "computer"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `COMPUTER("computer")` - - - `JsonValue; type "computer_20250124"constant` - - - `COMPUTER_20250124("computer_20250124")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional displayNumber` - - The X11 display number (e.g. 0, 1) for the display. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - -### Beta Tool Computer Use 20251124 - -- `class BetaToolComputerUse20251124:` - - - `long displayHeightPx` - - The height of the display in pixels. - - - `long displayWidthPx` - - The width of the display in pixels. - - - `JsonValue; name "computer"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `COMPUTER("computer")` - - - `JsonValue; type "computer_20251124"constant` - - - `COMPUTER_20251124("computer_20251124")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional displayNumber` - - The X11 display number (e.g. 0, 1) for the display. - - - `Optional enableZoom` - - Whether to enable an action to take a zoomed-in screenshot of the screen. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - -### Beta Tool Reference Block - -- `class BetaToolReferenceBlock:` - - - `String toolName` - - - `JsonValue; type "tool_reference"constant` - - - `TOOL_REFERENCE("tool_reference")` - -### Beta Tool Reference Block Param - -- `class BetaToolReferenceBlockParam:` - - Tool reference block that can be included in tool_result content. - - - `String toolName` - - - `JsonValue; type "tool_reference"constant` - - - `TOOL_REFERENCE("tool_reference")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - -### Beta Tool Result Block Param - -- `class BetaToolResultBlockParam:` - - - `String toolUseId` - - - `JsonValue; type "tool_result"constant` - - - `TOOL_RESULT("tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional content` - - - `String` - - - `List` - - - `class BetaTextBlockParam:` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `class BetaImageBlockParam:` - - - `Source source` - - - `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "image"constant` - - - `IMAGE("image")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaSearchResultBlockParam:` - - - `List content` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String source` - - - `String title` - - - `JsonValue; type "search_result"constant` - - - `SEARCH_RESULT("search_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - - `Optional enabled` - - - `class BetaRequestDocumentBlock:` - - - `Source source` - - - `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `class BetaContentBlockSource:` - - - `Content content` - - - `String` - - - `List` - - - `class BetaTextBlockParam:` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `class BetaImageBlockParam:` - - - `Source source` - - - `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "image"constant` - - - `IMAGE("image")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `JsonValue; type "content"constant` - - - `CONTENT("content")` - - - `class BetaUrlPdfSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileDocumentSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "document"constant` - - - `DOCUMENT("document")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - - `Optional enabled` - - - `Optional context` - - - `Optional title` - - - `class BetaToolReferenceBlockParam:` - - Tool reference block that can be included in tool_result content. - - - `String toolName` - - - `JsonValue; type "tool_reference"constant` - - - `TOOL_REFERENCE("tool_reference")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional isError` - -### Beta Tool Search Tool Bm25 20251119 - -- `class BetaToolSearchToolBm25_20251119:` - - - `JsonValue; name "tool_search_tool_bm25"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `TOOL_SEARCH_TOOL_BM25("tool_search_tool_bm25")` - - - `Type type` - - - `TOOL_SEARCH_TOOL_BM25_20251119("tool_search_tool_bm25_20251119")` - - - `TOOL_SEARCH_TOOL_BM25("tool_search_tool_bm25")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - -### Beta Tool Search Tool Regex 20251119 - -- `class BetaToolSearchToolRegex20251119:` - - - `JsonValue; name "tool_search_tool_regex"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `TOOL_SEARCH_TOOL_REGEX("tool_search_tool_regex")` - - - `Type type` - - - `TOOL_SEARCH_TOOL_REGEX_20251119("tool_search_tool_regex_20251119")` - - - `TOOL_SEARCH_TOOL_REGEX("tool_search_tool_regex")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - -### Beta Tool Search Tool Result Block - -- `class BetaToolSearchToolResultBlock:` - - - `Content content` - - - `class BetaToolSearchToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `Optional errorMessage` - - - `JsonValue; type "tool_search_tool_result_error"constant` - - - `TOOL_SEARCH_TOOL_RESULT_ERROR("tool_search_tool_result_error")` - - - `class BetaToolSearchToolSearchResultBlock:` - - - `List toolReferences` - - - `String toolName` - - - `JsonValue; type "tool_reference"constant` - - - `TOOL_REFERENCE("tool_reference")` - - - `JsonValue; type "tool_search_tool_search_result"constant` - - - `TOOL_SEARCH_TOOL_SEARCH_RESULT("tool_search_tool_search_result")` - - - `String toolUseId` - - - `JsonValue; type "tool_search_tool_result"constant` - - - `TOOL_SEARCH_TOOL_RESULT("tool_search_tool_result")` - -### Beta Tool Search Tool Result Block Param - -- `class BetaToolSearchToolResultBlockParam:` - - - `Content content` - - - `class BetaToolSearchToolResultErrorParam:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `JsonValue; type "tool_search_tool_result_error"constant` - - - `TOOL_SEARCH_TOOL_RESULT_ERROR("tool_search_tool_result_error")` - - - `class BetaToolSearchToolSearchResultBlockParam:` - - - `List toolReferences` - - - `String toolName` - - - `JsonValue; type "tool_reference"constant` - - - `TOOL_REFERENCE("tool_reference")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `JsonValue; type "tool_search_tool_search_result"constant` - - - `TOOL_SEARCH_TOOL_SEARCH_RESULT("tool_search_tool_search_result")` - - - `String toolUseId` - - - `JsonValue; type "tool_search_tool_result"constant` - - - `TOOL_SEARCH_TOOL_RESULT("tool_search_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - -### Beta Tool Search Tool Result Error - -- `class BetaToolSearchToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `Optional errorMessage` - - - `JsonValue; type "tool_search_tool_result_error"constant` - - - `TOOL_SEARCH_TOOL_RESULT_ERROR("tool_search_tool_result_error")` - -### Beta Tool Search Tool Result Error Param - -- `class BetaToolSearchToolResultErrorParam:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `JsonValue; type "tool_search_tool_result_error"constant` - - - `TOOL_SEARCH_TOOL_RESULT_ERROR("tool_search_tool_result_error")` - -### Beta Tool Search Tool Search Result Block - -- `class BetaToolSearchToolSearchResultBlock:` - - - `List toolReferences` - - - `String toolName` - - - `JsonValue; type "tool_reference"constant` - - - `TOOL_REFERENCE("tool_reference")` - - - `JsonValue; type "tool_search_tool_search_result"constant` - - - `TOOL_SEARCH_TOOL_SEARCH_RESULT("tool_search_tool_search_result")` - -### Beta Tool Search Tool Search Result Block Param - -- `class BetaToolSearchToolSearchResultBlockParam:` - - - `List toolReferences` - - - `String toolName` - - - `JsonValue; type "tool_reference"constant` - - - `TOOL_REFERENCE("tool_reference")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `JsonValue; type "tool_search_tool_search_result"constant` - - - `TOOL_SEARCH_TOOL_SEARCH_RESULT("tool_search_tool_search_result")` - -### Beta Tool Text Editor 20241022 - -- `class BetaToolTextEditor20241022:` - - - `JsonValue; name "str_replace_editor"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `STR_REPLACE_EDITOR("str_replace_editor")` - - - `JsonValue; type "text_editor_20241022"constant` - - - `TEXT_EDITOR_20241022("text_editor_20241022")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - -### Beta Tool Text Editor 20250124 - -- `class BetaToolTextEditor20250124:` - - - `JsonValue; name "str_replace_editor"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `STR_REPLACE_EDITOR("str_replace_editor")` - - - `JsonValue; type "text_editor_20250124"constant` - - - `TEXT_EDITOR_20250124("text_editor_20250124")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - -### Beta Tool Text Editor 20250429 - -- `class BetaToolTextEditor20250429:` - - - `JsonValue; name "str_replace_based_edit_tool"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `STR_REPLACE_BASED_EDIT_TOOL("str_replace_based_edit_tool")` - - - `JsonValue; type "text_editor_20250429"constant` - - - `TEXT_EDITOR_20250429("text_editor_20250429")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - -### Beta Tool Text Editor 20250728 - -- `class BetaToolTextEditor20250728:` - - - `JsonValue; name "str_replace_based_edit_tool"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `STR_REPLACE_BASED_EDIT_TOOL("str_replace_based_edit_tool")` - - - `JsonValue; type "text_editor_20250728"constant` - - - `TEXT_EDITOR_20250728("text_editor_20250728")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional maxCharacters` - - Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - -### Beta Tool Union - -- `class BetaToolUnion: A class that can be one of several variants.union` - - Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint). - - - `class BetaTool:` - - - `InputSchema inputSchema` - - [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input. - - This defines the shape of the `input` that your tool accepts and that the model will produce. - - - `JsonValue; type "object"constant` - - - `OBJECT("object")` - - - `Optional properties` - - - `Optional> required` - - - `String name` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional description` - - Description of what this tool does. - - Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema. - - - `Optional eagerInputStreaming` - - Enable eager input streaming for this tool. When true, tool input parameters will be streamed incrementally as they are generated, and types will be inferred on-the-fly rather than buffering the full JSON output. When false, streaming is disabled for this tool even if the fine-grained-tool-streaming beta is active. When null (default), uses the default behavior based on beta headers. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `Optional type` - - - `CUSTOM("custom")` - - - `class BetaToolBash20241022:` - - - `JsonValue; name "bash"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `BASH("bash")` - - - `JsonValue; type "bash_20241022"constant` - - - `BASH_20241022("bash_20241022")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolBash20250124:` - - - `JsonValue; name "bash"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `BASH("bash")` - - - `JsonValue; type "bash_20250124"constant` - - - `BASH_20250124("bash_20250124")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaCodeExecutionTool20250522:` - - - `JsonValue; name "code_execution"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `CODE_EXECUTION("code_execution")` - - - `JsonValue; type "code_execution_20250522"constant` - - - `CODE_EXECUTION_20250522("code_execution_20250522")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaCodeExecutionTool20250825:` - - - `JsonValue; name "code_execution"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `CODE_EXECUTION("code_execution")` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaCodeExecutionTool20260120:` - - Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint). - - - `JsonValue; name "code_execution"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `CODE_EXECUTION("code_execution")` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolComputerUse20241022:` - - - `long displayHeightPx` - - The height of the display in pixels. - - - `long displayWidthPx` - - The width of the display in pixels. - - - `JsonValue; name "computer"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `COMPUTER("computer")` - - - `JsonValue; type "computer_20241022"constant` - - - `COMPUTER_20241022("computer_20241022")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional displayNumber` - - The X11 display number (e.g. 0, 1) for the display. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaMemoryTool20250818:` - - - `JsonValue; name "memory"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `MEMORY("memory")` - - - `JsonValue; type "memory_20250818"constant` - - - `MEMORY_20250818("memory_20250818")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolComputerUse20250124:` - - - `long displayHeightPx` - - The height of the display in pixels. - - - `long displayWidthPx` - - The width of the display in pixels. - - - `JsonValue; name "computer"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `COMPUTER("computer")` - - - `JsonValue; type "computer_20250124"constant` - - - `COMPUTER_20250124("computer_20250124")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional displayNumber` - - The X11 display number (e.g. 0, 1) for the display. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolTextEditor20241022:` - - - `JsonValue; name "str_replace_editor"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `STR_REPLACE_EDITOR("str_replace_editor")` - - - `JsonValue; type "text_editor_20241022"constant` - - - `TEXT_EDITOR_20241022("text_editor_20241022")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolComputerUse20251124:` - - - `long displayHeightPx` - - The height of the display in pixels. - - - `long displayWidthPx` - - The width of the display in pixels. - - - `JsonValue; name "computer"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `COMPUTER("computer")` - - - `JsonValue; type "computer_20251124"constant` - - - `COMPUTER_20251124("computer_20251124")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional displayNumber` - - The X11 display number (e.g. 0, 1) for the display. - - - `Optional enableZoom` - - Whether to enable an action to take a zoomed-in screenshot of the screen. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolTextEditor20250124:` - - - `JsonValue; name "str_replace_editor"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `STR_REPLACE_EDITOR("str_replace_editor")` - - - `JsonValue; type "text_editor_20250124"constant` - - - `TEXT_EDITOR_20250124("text_editor_20250124")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolTextEditor20250429:` - - - `JsonValue; name "str_replace_based_edit_tool"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `STR_REPLACE_BASED_EDIT_TOOL("str_replace_based_edit_tool")` - - - `JsonValue; type "text_editor_20250429"constant` - - - `TEXT_EDITOR_20250429("text_editor_20250429")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolTextEditor20250728:` - - - `JsonValue; name "str_replace_based_edit_tool"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `STR_REPLACE_BASED_EDIT_TOOL("str_replace_based_edit_tool")` - - - `JsonValue; type "text_editor_20250728"constant` - - - `TEXT_EDITOR_20250728("text_editor_20250728")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional maxCharacters` - - Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaWebSearchTool20250305:` - - - `JsonValue; name "web_search"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `WEB_SEARCH("web_search")` - - - `JsonValue; type "web_search_20250305"constant` - - - `WEB_SEARCH_20250305("web_search_20250305")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional> allowedDomains` - - If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`. - - - `Optional> blockedDomains` - - If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`. - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional maxUses` - - Maximum number of times the tool can be used in the API request. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `Optional userLocation` - - Parameters for the user's location. Used to provide more relevant search results. - - - `JsonValue; type "approximate"constant` - - - `APPROXIMATE("approximate")` - - - `Optional city` - - The city of the user. - - - `Optional country` - - The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user. - - - `Optional region` - - The region of the user. - - - `Optional timezone` - - The [IANA timezone](https://nodatime.org/TimeZones) of the user. - - - `class BetaWebFetchTool20250910:` - - - `JsonValue; name "web_fetch"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `WEB_FETCH("web_fetch")` - - - `JsonValue; type "web_fetch_20250910"constant` - - - `WEB_FETCH_20250910("web_fetch_20250910")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional> allowedDomains` - - List of domains to allow fetching from - - - `Optional> blockedDomains` - - List of domains to block fetching from - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - Citations configuration for fetched documents. Citations are disabled by default. - - - `Optional enabled` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional maxContentTokens` - - Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. - - - `Optional maxUses` - - Maximum number of times the tool can be used in the API request. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaWebSearchTool20260209:` - - - `JsonValue; name "web_search"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `WEB_SEARCH("web_search")` - - - `JsonValue; type "web_search_20260209"constant` - - - `WEB_SEARCH_20260209("web_search_20260209")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional> allowedDomains` - - If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`. - - - `Optional> blockedDomains` - - If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`. - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional maxUses` - - Maximum number of times the tool can be used in the API request. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `Optional userLocation` - - Parameters for the user's location. Used to provide more relevant search results. - - - `JsonValue; type "approximate"constant` - - - `APPROXIMATE("approximate")` - - - `Optional city` - - The city of the user. - - - `Optional country` - - The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user. - - - `Optional region` - - The region of the user. - - - `Optional timezone` - - The [IANA timezone](https://nodatime.org/TimeZones) of the user. - - - `class BetaWebFetchTool20260209:` - - - `JsonValue; name "web_fetch"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `WEB_FETCH("web_fetch")` - - - `JsonValue; type "web_fetch_20260209"constant` - - - `WEB_FETCH_20260209("web_fetch_20260209")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional> allowedDomains` - - List of domains to allow fetching from - - - `Optional> blockedDomains` - - List of domains to block fetching from - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - Citations configuration for fetched documents. Citations are disabled by default. - - - `Optional enabled` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional maxContentTokens` - - Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. - - - `Optional maxUses` - - Maximum number of times the tool can be used in the API request. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaWebFetchTool20260309:` - - Web fetch tool with use_cache parameter for bypassing cached content. - - - `JsonValue; name "web_fetch"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `WEB_FETCH("web_fetch")` - - - `JsonValue; type "web_fetch_20260309"constant` - - - `WEB_FETCH_20260309("web_fetch_20260309")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional> allowedDomains` - - List of domains to allow fetching from - - - `Optional> blockedDomains` - - List of domains to block fetching from - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - Citations configuration for fetched documents. Citations are disabled by default. - - - `Optional enabled` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional maxContentTokens` - - Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. - - - `Optional maxUses` - - Maximum number of times the tool can be used in the API request. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `Optional useCache` - - Whether to use cached content. Set to false to bypass the cache and fetch fresh content. Only set to false when the user explicitly requests fresh content or when fetching rapidly-changing sources. - - - `class BetaToolSearchToolBm25_20251119:` - - - `JsonValue; name "tool_search_tool_bm25"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `TOOL_SEARCH_TOOL_BM25("tool_search_tool_bm25")` - - - `Type type` - - - `TOOL_SEARCH_TOOL_BM25_20251119("tool_search_tool_bm25_20251119")` - - - `TOOL_SEARCH_TOOL_BM25("tool_search_tool_bm25")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolSearchToolRegex20251119:` - - - `JsonValue; name "tool_search_tool_regex"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `TOOL_SEARCH_TOOL_REGEX("tool_search_tool_regex")` - - - `Type type` - - - `TOOL_SEARCH_TOOL_REGEX_20251119("tool_search_tool_regex_20251119")` - - - `TOOL_SEARCH_TOOL_REGEX("tool_search_tool_regex")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaMcpToolset:` - - Configuration for a group of tools from an MCP server. - - Allows configuring enabled status and defer_loading for all tools - from an MCP server, with optional per-tool overrides. - - - `String mcpServerName` - - Name of the MCP server to configure tools for - - - `JsonValue; type "mcp_toolset"constant` - - - `MCP_TOOLSET("mcp_toolset")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional configs` - - Configuration overrides for specific tools, keyed by tool name - - - `Optional deferLoading` - - - `Optional enabled` - - - `Optional defaultConfig` - - Default configuration applied to all tools from this server - - - `Optional deferLoading` - - - `Optional enabled` - -### Beta Tool Use Block - -- `class BetaToolUseBlock:` - - - `String id` - - - `Input input` - - - `String name` - - - `JsonValue; type "tool_use"constant` - - - `TOOL_USE("tool_use")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - -### Beta Tool Use Block Param - -- `class BetaToolUseBlockParam:` - - - `String id` - - - `Input input` - - - `String name` - - - `JsonValue; type "tool_use"constant` - - - `TOOL_USE("tool_use")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - -### Beta Tool Uses Keep - -- `class BetaToolUsesKeep:` - - - `JsonValue; type "tool_uses"constant` - - - `TOOL_USES("tool_uses")` - - - `long value` - -### Beta Tool Uses Trigger - -- `class BetaToolUsesTrigger:` - - - `JsonValue; type "tool_uses"constant` - - - `TOOL_USES("tool_uses")` - - - `long value` - -### Beta URL Image Source - -- `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - -### Beta URL PDF Source - -- `class BetaUrlPdfSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - -### Beta Usage - -- `class BetaUsage:` - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `Optional cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `Optional cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `Optional inferenceGeo` - - The geographic region where inference was performed for this request. - - - `long inputTokens` - - The number of input tokens which were used. - - - `Optional> iterations` - - Per-iteration token usage breakdown. - - Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: - - - Determine which iterations exceeded long context thresholds (>=200k tokens) - - Calculate the true context window size from the last iteration - - Understand token accumulation across server-side tool use loops - - - `class BetaMessageIterationUsage:` - - Token usage for a sampling iteration. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `long cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `long cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `long inputTokens` - - The number of input tokens which were used. - - - `long outputTokens` - - The number of output tokens which were used. - - - `JsonValue; type "message"constant` - - Usage for a sampling iteration - - - `MESSAGE("message")` - - - `class BetaCompactionIterationUsage:` - - Token usage for a compaction iteration. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `long cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `long cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `long inputTokens` - - The number of input tokens which were used. - - - `long outputTokens` - - The number of output tokens which were used. - - - `JsonValue; type "compaction"constant` - - Usage for a compaction iteration - - - `COMPACTION("compaction")` - - - `long outputTokens` - - The number of output tokens which were used. - - - `Optional serverToolUse` - - The number of server tool requests. - - - `long webFetchRequests` - - The number of web fetch tool requests. - - - `long webSearchRequests` - - The number of web search tool requests. - - - `Optional serviceTier` - - If the request used the priority, standard, or batch tier. - - - `STANDARD("standard")` - - - `PRIORITY("priority")` - - - `BATCH("batch")` - - - `Optional speed` - - The inference speed mode used for this request. - - - `STANDARD("standard")` - - - `FAST("fast")` - -### Beta User Location - -- `class BetaUserLocation:` - - - `JsonValue; type "approximate"constant` - - - `APPROXIMATE("approximate")` - - - `Optional city` - - The city of the user. - - - `Optional country` - - The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user. - - - `Optional region` - - The region of the user. - - - `Optional timezone` - - The [IANA timezone](https://nodatime.org/TimeZones) of the user. - -### Beta Web Fetch Block - -- `class BetaWebFetchBlock:` - - - `BetaDocumentBlock content` - - - `Optional citations` - - Citation configuration for the document - - - `boolean enabled` - - - `Source source` - - - `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional title` - - The title of the document - - - `JsonValue; type "document"constant` - - - `DOCUMENT("document")` - - - `Optional retrievedAt` - - ISO 8601 timestamp when the content was retrieved - - - `JsonValue; type "web_fetch_result"constant` - - - `WEB_FETCH_RESULT("web_fetch_result")` - - - `String url` - - Fetched content URL - -### Beta Web Fetch Block Param - -- `class BetaWebFetchBlockParam:` - - - `BetaRequestDocumentBlock content` - - - `Source source` - - - `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `class BetaContentBlockSource:` - - - `Content content` - - - `String` - - - `List` - - - `class BetaTextBlockParam:` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `class BetaImageBlockParam:` - - - `Source source` - - - `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "image"constant` - - - `IMAGE("image")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `JsonValue; type "content"constant` - - - `CONTENT("content")` - - - `class BetaUrlPdfSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileDocumentSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "document"constant` - - - `DOCUMENT("document")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - - `Optional enabled` - - - `Optional context` - - - `Optional title` - - - `JsonValue; type "web_fetch_result"constant` - - - `WEB_FETCH_RESULT("web_fetch_result")` - - - `String url` - - Fetched content URL - - - `Optional retrievedAt` - - ISO 8601 timestamp when the content was retrieved - -### Beta Web Fetch Tool 20250910 - -- `class BetaWebFetchTool20250910:` - - - `JsonValue; name "web_fetch"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `WEB_FETCH("web_fetch")` - - - `JsonValue; type "web_fetch_20250910"constant` - - - `WEB_FETCH_20250910("web_fetch_20250910")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional> allowedDomains` - - List of domains to allow fetching from - - - `Optional> blockedDomains` - - List of domains to block fetching from - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - Citations configuration for fetched documents. Citations are disabled by default. - - - `Optional enabled` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional maxContentTokens` - - Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. - - - `Optional maxUses` - - Maximum number of times the tool can be used in the API request. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - -### Beta Web Fetch Tool 20260209 - -- `class BetaWebFetchTool20260209:` - - - `JsonValue; name "web_fetch"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `WEB_FETCH("web_fetch")` - - - `JsonValue; type "web_fetch_20260209"constant` - - - `WEB_FETCH_20260209("web_fetch_20260209")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional> allowedDomains` - - List of domains to allow fetching from - - - `Optional> blockedDomains` - - List of domains to block fetching from - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - Citations configuration for fetched documents. Citations are disabled by default. - - - `Optional enabled` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional maxContentTokens` - - Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. - - - `Optional maxUses` - - Maximum number of times the tool can be used in the API request. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - -### Beta Web Fetch Tool 20260309 - -- `class BetaWebFetchTool20260309:` - - Web fetch tool with use_cache parameter for bypassing cached content. - - - `JsonValue; name "web_fetch"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `WEB_FETCH("web_fetch")` - - - `JsonValue; type "web_fetch_20260309"constant` - - - `WEB_FETCH_20260309("web_fetch_20260309")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional> allowedDomains` - - List of domains to allow fetching from - - - `Optional> blockedDomains` - - List of domains to block fetching from - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - Citations configuration for fetched documents. Citations are disabled by default. - - - `Optional enabled` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional maxContentTokens` - - Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. - - - `Optional maxUses` - - Maximum number of times the tool can be used in the API request. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `Optional useCache` - - Whether to use cached content. Set to false to bypass the cache and fetch fresh content. Only set to false when the user explicitly requests fresh content or when fetching rapidly-changing sources. - -### Beta Web Fetch Tool Result Block - -- `class BetaWebFetchToolResultBlock:` - - - `Content content` - - - `class BetaWebFetchToolResultErrorBlock:` - - - `BetaWebFetchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `URL_TOO_LONG("url_too_long")` - - - `URL_NOT_ALLOWED("url_not_allowed")` - - - `URL_NOT_ACCESSIBLE("url_not_accessible")` - - - `UNSUPPORTED_CONTENT_TYPE("unsupported_content_type")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `UNAVAILABLE("unavailable")` - - - `JsonValue; type "web_fetch_tool_result_error"constant` - - - `WEB_FETCH_TOOL_RESULT_ERROR("web_fetch_tool_result_error")` - - - `class BetaWebFetchBlock:` - - - `BetaDocumentBlock content` - - - `Optional citations` - - Citation configuration for the document - - - `boolean enabled` - - - `Source source` - - - `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional title` - - The title of the document - - - `JsonValue; type "document"constant` - - - `DOCUMENT("document")` - - - `Optional retrievedAt` - - ISO 8601 timestamp when the content was retrieved - - - `JsonValue; type "web_fetch_result"constant` - - - `WEB_FETCH_RESULT("web_fetch_result")` - - - `String url` - - Fetched content URL - - - `String toolUseId` - - - `JsonValue; type "web_fetch_tool_result"constant` - - - `WEB_FETCH_TOOL_RESULT("web_fetch_tool_result")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - -### Beta Web Fetch Tool Result Block Param - -- `class BetaWebFetchToolResultBlockParam:` - - - `Content content` - - - `class BetaWebFetchToolResultErrorBlockParam:` - - - `BetaWebFetchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `URL_TOO_LONG("url_too_long")` - - - `URL_NOT_ALLOWED("url_not_allowed")` - - - `URL_NOT_ACCESSIBLE("url_not_accessible")` - - - `UNSUPPORTED_CONTENT_TYPE("unsupported_content_type")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `UNAVAILABLE("unavailable")` - - - `JsonValue; type "web_fetch_tool_result_error"constant` - - - `WEB_FETCH_TOOL_RESULT_ERROR("web_fetch_tool_result_error")` - - - `class BetaWebFetchBlockParam:` - - - `BetaRequestDocumentBlock content` - - - `Source source` - - - `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `class BetaContentBlockSource:` - - - `Content content` - - - `String` - - - `List` - - - `class BetaTextBlockParam:` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `class BetaImageBlockParam:` - - - `Source source` - - - `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "image"constant` - - - `IMAGE("image")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `JsonValue; type "content"constant` - - - `CONTENT("content")` - - - `class BetaUrlPdfSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileDocumentSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "document"constant` - - - `DOCUMENT("document")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - - `Optional enabled` - - - `Optional context` - - - `Optional title` - - - `JsonValue; type "web_fetch_result"constant` - - - `WEB_FETCH_RESULT("web_fetch_result")` - - - `String url` - - Fetched content URL - - - `Optional retrievedAt` - - ISO 8601 timestamp when the content was retrieved - - - `String toolUseId` - - - `JsonValue; type "web_fetch_tool_result"constant` - - - `WEB_FETCH_TOOL_RESULT("web_fetch_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - -### Beta Web Fetch Tool Result Error Block - -- `class BetaWebFetchToolResultErrorBlock:` - - - `BetaWebFetchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `URL_TOO_LONG("url_too_long")` - - - `URL_NOT_ALLOWED("url_not_allowed")` - - - `URL_NOT_ACCESSIBLE("url_not_accessible")` - - - `UNSUPPORTED_CONTENT_TYPE("unsupported_content_type")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `UNAVAILABLE("unavailable")` - - - `JsonValue; type "web_fetch_tool_result_error"constant` - - - `WEB_FETCH_TOOL_RESULT_ERROR("web_fetch_tool_result_error")` - -### Beta Web Fetch Tool Result Error Block Param - -- `class BetaWebFetchToolResultErrorBlockParam:` - - - `BetaWebFetchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `URL_TOO_LONG("url_too_long")` - - - `URL_NOT_ALLOWED("url_not_allowed")` - - - `URL_NOT_ACCESSIBLE("url_not_accessible")` - - - `UNSUPPORTED_CONTENT_TYPE("unsupported_content_type")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `UNAVAILABLE("unavailable")` - - - `JsonValue; type "web_fetch_tool_result_error"constant` - - - `WEB_FETCH_TOOL_RESULT_ERROR("web_fetch_tool_result_error")` - -### Beta Web Fetch Tool Result Error Code - -- `enum BetaWebFetchToolResultErrorCode:` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `URL_TOO_LONG("url_too_long")` - - - `URL_NOT_ALLOWED("url_not_allowed")` - - - `URL_NOT_ACCESSIBLE("url_not_accessible")` - - - `UNSUPPORTED_CONTENT_TYPE("unsupported_content_type")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `UNAVAILABLE("unavailable")` - -### Beta Web Search Result Block - -- `class BetaWebSearchResultBlock:` - - - `String encryptedContent` - - - `Optional pageAge` - - - `String title` - - - `JsonValue; type "web_search_result"constant` - - - `WEB_SEARCH_RESULT("web_search_result")` - - - `String url` - -### Beta Web Search Result Block Param - -- `class BetaWebSearchResultBlockParam:` - - - `String encryptedContent` - - - `String title` - - - `JsonValue; type "web_search_result"constant` - - - `WEB_SEARCH_RESULT("web_search_result")` - - - `String url` - - - `Optional pageAge` - -### Beta Web Search Tool 20250305 - -- `class BetaWebSearchTool20250305:` - - - `JsonValue; name "web_search"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `WEB_SEARCH("web_search")` - - - `JsonValue; type "web_search_20250305"constant` - - - `WEB_SEARCH_20250305("web_search_20250305")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional> allowedDomains` - - If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`. - - - `Optional> blockedDomains` - - If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`. - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional maxUses` - - Maximum number of times the tool can be used in the API request. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `Optional userLocation` - - Parameters for the user's location. Used to provide more relevant search results. - - - `JsonValue; type "approximate"constant` - - - `APPROXIMATE("approximate")` - - - `Optional city` - - The city of the user. - - - `Optional country` - - The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user. - - - `Optional region` - - The region of the user. - - - `Optional timezone` - - The [IANA timezone](https://nodatime.org/TimeZones) of the user. - -### Beta Web Search Tool 20260209 - -- `class BetaWebSearchTool20260209:` - - - `JsonValue; name "web_search"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `WEB_SEARCH("web_search")` - - - `JsonValue; type "web_search_20260209"constant` - - - `WEB_SEARCH_20260209("web_search_20260209")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional> allowedDomains` - - If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`. - - - `Optional> blockedDomains` - - If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`. - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional maxUses` - - Maximum number of times the tool can be used in the API request. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `Optional userLocation` - - Parameters for the user's location. Used to provide more relevant search results. - - - `JsonValue; type "approximate"constant` - - - `APPROXIMATE("approximate")` - - - `Optional city` - - The city of the user. - - - `Optional country` - - The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user. - - - `Optional region` - - The region of the user. - - - `Optional timezone` - - The [IANA timezone](https://nodatime.org/TimeZones) of the user. - -### Beta Web Search Tool Request Error - -- `class BetaWebSearchToolRequestError:` - - - `BetaWebSearchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `QUERY_TOO_LONG("query_too_long")` - - - `REQUEST_TOO_LARGE("request_too_large")` - - - `JsonValue; type "web_search_tool_result_error"constant` - - - `WEB_SEARCH_TOOL_RESULT_ERROR("web_search_tool_result_error")` - -### Beta Web Search Tool Result Block - -- `class BetaWebSearchToolResultBlock:` - - - `BetaWebSearchToolResultBlockContent content` - - - `class BetaWebSearchToolResultError:` - - - `BetaWebSearchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `QUERY_TOO_LONG("query_too_long")` - - - `REQUEST_TOO_LARGE("request_too_large")` - - - `JsonValue; type "web_search_tool_result_error"constant` - - - `WEB_SEARCH_TOOL_RESULT_ERROR("web_search_tool_result_error")` - - - `List` - - - `String encryptedContent` - - - `Optional pageAge` - - - `String title` - - - `JsonValue; type "web_search_result"constant` - - - `WEB_SEARCH_RESULT("web_search_result")` - - - `String url` - - - `String toolUseId` - - - `JsonValue; type "web_search_tool_result"constant` - - - `WEB_SEARCH_TOOL_RESULT("web_search_tool_result")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - -### Beta Web Search Tool Result Block Content - -- `class BetaWebSearchToolResultBlockContent: A class that can be one of several variants.union` - - - `class BetaWebSearchToolResultError:` - - - `BetaWebSearchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `QUERY_TOO_LONG("query_too_long")` - - - `REQUEST_TOO_LARGE("request_too_large")` - - - `JsonValue; type "web_search_tool_result_error"constant` - - - `WEB_SEARCH_TOOL_RESULT_ERROR("web_search_tool_result_error")` - - - `List` - - - `String encryptedContent` - - - `Optional pageAge` - - - `String title` - - - `JsonValue; type "web_search_result"constant` - - - `WEB_SEARCH_RESULT("web_search_result")` - - - `String url` - -### Beta Web Search Tool Result Block Param - -- `class BetaWebSearchToolResultBlockParam:` - - - `BetaWebSearchToolResultBlockParamContent content` - - - `List` - - - `String encryptedContent` - - - `String title` - - - `JsonValue; type "web_search_result"constant` - - - `WEB_SEARCH_RESULT("web_search_result")` - - - `String url` - - - `Optional pageAge` - - - `class BetaWebSearchToolRequestError:` - - - `BetaWebSearchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `QUERY_TOO_LONG("query_too_long")` - - - `REQUEST_TOO_LARGE("request_too_large")` - - - `JsonValue; type "web_search_tool_result_error"constant` - - - `WEB_SEARCH_TOOL_RESULT_ERROR("web_search_tool_result_error")` - - - `String toolUseId` - - - `JsonValue; type "web_search_tool_result"constant` - - - `WEB_SEARCH_TOOL_RESULT("web_search_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - -### Beta Web Search Tool Result Block Param Content - -- `class BetaWebSearchToolResultBlockParamContent: A class that can be one of several variants.union` - - - `List` - - - `String encryptedContent` - - - `String title` - - - `JsonValue; type "web_search_result"constant` - - - `WEB_SEARCH_RESULT("web_search_result")` - - - `String url` - - - `Optional pageAge` - - - `class BetaWebSearchToolRequestError:` - - - `BetaWebSearchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `QUERY_TOO_LONG("query_too_long")` - - - `REQUEST_TOO_LARGE("request_too_large")` - - - `JsonValue; type "web_search_tool_result_error"constant` - - - `WEB_SEARCH_TOOL_RESULT_ERROR("web_search_tool_result_error")` - -### Beta Web Search Tool Result Error - -- `class BetaWebSearchToolResultError:` - - - `BetaWebSearchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `QUERY_TOO_LONG("query_too_long")` - - - `REQUEST_TOO_LARGE("request_too_large")` - - - `JsonValue; type "web_search_tool_result_error"constant` - - - `WEB_SEARCH_TOOL_RESULT_ERROR("web_search_tool_result_error")` - -### Beta Web Search Tool Result Error Code - -- `enum BetaWebSearchToolResultErrorCode:` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `QUERY_TOO_LONG("query_too_long")` - - - `REQUEST_TOO_LARGE("request_too_large")` - -# Batches - -## Create - -`BetaMessageBatch beta().messages().batches().create(BatchCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` - -**post** `/v1/messages/batches` - -Send a batch of Message creation requests. - -The Message Batches API can be used to process multiple Messages API requests at once. Once a Message Batch is created, it begins processing immediately. Batches can take up to 24 hours to complete. - -Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) - -### Parameters - -- `BatchCreateParams params` - - - `Optional> betas` - - Optional header to specify the beta version(s) you want to use. - - - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` - - - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` - - - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` - - - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` - - - `PDFS_2024_09_25("pdfs-2024-09-25")` - - - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` - - - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` - - - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` - - - `FILES_API_2025_04_14("files-api-2025-04-14")` - - - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` - - - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` - - - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` - - - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` - - - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` - - - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` - - - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` - - - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` - - - `SKILLS_2025_10_02("skills-2025-10-02")` - - - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` - - - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - - - `List requests` - - List of requests for prompt completion. Each is an individual request to create a Message. - - - `String customId` - - Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order. - - Must be unique for each request within the Message Batch. - - - `Params params` - - Messages API creation parameters for the individual request. - - See the [Messages API reference](https://docs.claude.com/en/api/messages) for full documentation on available parameters. - - - `long maxTokens` - - The maximum number of tokens to generate before stopping. - - Note that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate. - - Different models have different maximum values for this parameter. See [models](https://docs.claude.com/en/docs/models-overview) for details. - - - `List messages` - - Input messages. - - Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn. - - Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages. - - If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response. - - Example with a single `user` message: - - ```json - [{"role": "user", "content": "Hello, Claude"}] - ``` - - Example with multiple conversational turns: - - ```json - [ - {"role": "user", "content": "Hello there."}, - {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"}, - {"role": "user", "content": "Can you explain LLMs in plain English?"}, - ] - ``` - - Example with a partially-filled response from Claude: - - ```json - [ - {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, - {"role": "assistant", "content": "The best answer is ("}, - ] - ``` - - Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent: - - ```json - {"role": "user", "content": "Hello, Claude"} - ``` - - ```json - {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]} - ``` - - See [input examples](https://docs.claude.com/en/api/messages-examples). - - Note that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. - - There is a limit of 100,000 messages in a single request. - - - `Content content` - - - `String` - - - `List` - - - `class BetaTextBlockParam:` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `class BetaImageBlockParam:` - - - `Source source` - - - `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "image"constant` - - - `IMAGE("image")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaRequestDocumentBlock:` - - - `Source source` - - - `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `class BetaContentBlockSource:` - - - `Content content` - - - `String` - - - `List` - - - `class BetaTextBlockParam:` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `class BetaImageBlockParam:` - - - `Source source` - - - `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "image"constant` - - - `IMAGE("image")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `JsonValue; type "content"constant` - - - `CONTENT("content")` - - - `class BetaUrlPdfSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileDocumentSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "document"constant` - - - `DOCUMENT("document")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - - `Optional enabled` - - - `Optional context` - - - `Optional title` - - - `class BetaSearchResultBlockParam:` - - - `List content` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String source` - - - `String title` - - - `JsonValue; type "search_result"constant` - - - `SEARCH_RESULT("search_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - - `Optional enabled` - - - `class BetaThinkingBlockParam:` - - - `String signature` - - - `String thinking` - - - `JsonValue; type "thinking"constant` - - - `THINKING("thinking")` - - - `class BetaRedactedThinkingBlockParam:` - - - `String data` - - - `JsonValue; type "redacted_thinking"constant` - - - `REDACTED_THINKING("redacted_thinking")` - - - `class BetaToolUseBlockParam:` - - - `String id` - - - `Input input` - - - `String name` - - - `JsonValue; type "tool_use"constant` - - - `TOOL_USE("tool_use")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaToolResultBlockParam:` - - - `String toolUseId` - - - `JsonValue; type "tool_result"constant` - - - `TOOL_RESULT("tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional content` - - - `String` - - - `List` - - - `class BetaTextBlockParam:` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `class BetaImageBlockParam:` - - - `Source source` - - - `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "image"constant` - - - `IMAGE("image")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaSearchResultBlockParam:` - - - `List content` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String source` - - - `String title` - - - `JsonValue; type "search_result"constant` - - - `SEARCH_RESULT("search_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - - `Optional enabled` - - - `class BetaRequestDocumentBlock:` - - - `Source source` - - - `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `class BetaContentBlockSource:` - - - `Content content` - - - `String` - - - `List` - - - `class BetaTextBlockParam:` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `class BetaImageBlockParam:` - - - `Source source` - - - `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "image"constant` - - - `IMAGE("image")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `JsonValue; type "content"constant` - - - `CONTENT("content")` - - - `class BetaUrlPdfSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileDocumentSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "document"constant` - - - `DOCUMENT("document")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - - `Optional enabled` - - - `Optional context` - - - `Optional title` - - - `class BetaToolReferenceBlockParam:` - - Tool reference block that can be included in tool_result content. - - - `String toolName` - - - `JsonValue; type "tool_reference"constant` - - - `TOOL_REFERENCE("tool_reference")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional isError` - - - `class BetaServerToolUseBlockParam:` - - - `String id` - - - `Input input` - - - `Name name` - - - `WEB_SEARCH("web_search")` - - - `WEB_FETCH("web_fetch")` - - - `CODE_EXECUTION("code_execution")` - - - `BASH_CODE_EXECUTION("bash_code_execution")` - - - `TEXT_EDITOR_CODE_EXECUTION("text_editor_code_execution")` - - - `TOOL_SEARCH_TOOL_REGEX("tool_search_tool_regex")` - - - `TOOL_SEARCH_TOOL_BM25("tool_search_tool_bm25")` - - - `JsonValue; type "server_tool_use"constant` - - - `SERVER_TOOL_USE("server_tool_use")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaWebSearchToolResultBlockParam:` - - - `BetaWebSearchToolResultBlockParamContent content` - - - `List` - - - `String encryptedContent` - - - `String title` - - - `JsonValue; type "web_search_result"constant` - - - `WEB_SEARCH_RESULT("web_search_result")` - - - `String url` - - - `Optional pageAge` - - - `class BetaWebSearchToolRequestError:` - - - `BetaWebSearchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `QUERY_TOO_LONG("query_too_long")` - - - `REQUEST_TOO_LARGE("request_too_large")` - - - `JsonValue; type "web_search_tool_result_error"constant` - - - `WEB_SEARCH_TOOL_RESULT_ERROR("web_search_tool_result_error")` - - - `String toolUseId` - - - `JsonValue; type "web_search_tool_result"constant` - - - `WEB_SEARCH_TOOL_RESULT("web_search_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaWebFetchToolResultBlockParam:` - - - `Content content` - - - `class BetaWebFetchToolResultErrorBlockParam:` - - - `BetaWebFetchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `URL_TOO_LONG("url_too_long")` - - - `URL_NOT_ALLOWED("url_not_allowed")` - - - `URL_NOT_ACCESSIBLE("url_not_accessible")` - - - `UNSUPPORTED_CONTENT_TYPE("unsupported_content_type")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `UNAVAILABLE("unavailable")` - - - `JsonValue; type "web_fetch_tool_result_error"constant` - - - `WEB_FETCH_TOOL_RESULT_ERROR("web_fetch_tool_result_error")` - - - `class BetaWebFetchBlockParam:` - - - `BetaRequestDocumentBlock content` - - - `Source source` - - - `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `class BetaContentBlockSource:` - - - `Content content` - - - `String` - - - `List` - - - `class BetaTextBlockParam:` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `class BetaImageBlockParam:` - - - `Source source` - - - `class BetaBase64ImageSource:` - - - `String data` - - - `MediaType mediaType` - - - `IMAGE_JPEG("image/jpeg")` - - - `IMAGE_PNG("image/png")` - - - `IMAGE_GIF("image/gif")` - - - `IMAGE_WEBP("image/webp")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaUrlImageSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileImageSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "image"constant` - - - `IMAGE("image")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `JsonValue; type "content"constant` - - - `CONTENT("content")` - - - `class BetaUrlPdfSource:` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `class BetaFileDocumentSource:` - - - `String fileId` - - - `JsonValue; type "file"constant` - - - `FILE("file")` - - - `JsonValue; type "document"constant` - - - `DOCUMENT("document")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - - `Optional enabled` - - - `Optional context` - - - `Optional title` - - - `JsonValue; type "web_fetch_result"constant` - - - `WEB_FETCH_RESULT("web_fetch_result")` - - - `String url` - - Fetched content URL - - - `Optional retrievedAt` - - ISO 8601 timestamp when the content was retrieved - - - `String toolUseId` - - - `JsonValue; type "web_fetch_tool_result"constant` - - - `WEB_FETCH_TOOL_RESULT("web_fetch_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaCodeExecutionToolResultBlockParam:` - - - `BetaCodeExecutionToolResultBlockParamContent content` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `class BetaCodeExecutionToolResultErrorParam:` - - - `BetaCodeExecutionToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `JsonValue; type "code_execution_tool_result_error"constant` - - - `CODE_EXECUTION_TOOL_RESULT_ERROR("code_execution_tool_result_error")` - - - `class BetaCodeExecutionResultBlockParam:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "code_execution_result"constant` - - - `CODE_EXECUTION_RESULT("code_execution_result")` - - - `class BetaEncryptedCodeExecutionResultBlockParam:` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `String encryptedStdout` - - - `long returnCode` - - - `String stderr` - - - `JsonValue; type "encrypted_code_execution_result"constant` - - - `ENCRYPTED_CODE_EXECUTION_RESULT("encrypted_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "code_execution_tool_result"constant` - - - `CODE_EXECUTION_TOOL_RESULT("code_execution_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaBashCodeExecutionToolResultBlockParam:` - - - `Content content` - - - `class BetaBashCodeExecutionToolResultErrorParam:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `OUTPUT_FILE_TOO_LARGE("output_file_too_large")` - - - `JsonValue; type "bash_code_execution_tool_result_error"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT_ERROR("bash_code_execution_tool_result_error")` - - - `class BetaBashCodeExecutionResultBlockParam:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "bash_code_execution_output"constant` - - - `BASH_CODE_EXECUTION_OUTPUT("bash_code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "bash_code_execution_result"constant` - - - `BASH_CODE_EXECUTION_RESULT("bash_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "bash_code_execution_tool_result"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT("bash_code_execution_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaTextEditorCodeExecutionToolResultBlockParam:` - - - `Content content` - - - `class BetaTextEditorCodeExecutionToolResultErrorParam:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `FILE_NOT_FOUND("file_not_found")` - - - `JsonValue; type "text_editor_code_execution_tool_result_error"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT_ERROR("text_editor_code_execution_tool_result_error")` - - - `Optional errorMessage` - - - `class BetaTextEditorCodeExecutionViewResultBlockParam:` - - - `String content` - - - `FileType fileType` - - - `TEXT("text")` - - - `IMAGE("image")` - - - `PDF("pdf")` - - - `JsonValue; type "text_editor_code_execution_view_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_VIEW_RESULT("text_editor_code_execution_view_result")` - - - `Optional numLines` - - - `Optional startLine` - - - `Optional totalLines` - - - `class BetaTextEditorCodeExecutionCreateResultBlockParam:` - - - `boolean isFileUpdate` - - - `JsonValue; type "text_editor_code_execution_create_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_CREATE_RESULT("text_editor_code_execution_create_result")` - - - `class BetaTextEditorCodeExecutionStrReplaceResultBlockParam:` - - - `JsonValue; type "text_editor_code_execution_str_replace_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_STR_REPLACE_RESULT("text_editor_code_execution_str_replace_result")` - - - `Optional> lines` - - - `Optional newLines` - - - `Optional newStart` - - - `Optional oldLines` - - - `Optional oldStart` - - - `String toolUseId` - - - `JsonValue; type "text_editor_code_execution_tool_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT("text_editor_code_execution_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaToolSearchToolResultBlockParam:` - - - `Content content` - - - `class BetaToolSearchToolResultErrorParam:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `JsonValue; type "tool_search_tool_result_error"constant` - - - `TOOL_SEARCH_TOOL_RESULT_ERROR("tool_search_tool_result_error")` - - - `class BetaToolSearchToolSearchResultBlockParam:` - - - `List toolReferences` - - - `String toolName` - - - `JsonValue; type "tool_reference"constant` - - - `TOOL_REFERENCE("tool_reference")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `JsonValue; type "tool_search_tool_search_result"constant` - - - `TOOL_SEARCH_TOOL_SEARCH_RESULT("tool_search_tool_search_result")` - - - `String toolUseId` - - - `JsonValue; type "tool_search_tool_result"constant` - - - `TOOL_SEARCH_TOOL_RESULT("tool_search_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaMcpToolUseBlockParam:` - - - `String id` - - - `Input input` - - - `String name` - - - `String serverName` - - The name of the MCP server - - - `JsonValue; type "mcp_tool_use"constant` - - - `MCP_TOOL_USE("mcp_tool_use")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaRequestMcpToolResultBlockParam:` - - - `String toolUseId` - - - `JsonValue; type "mcp_tool_result"constant` - - - `MCP_TOOL_RESULT("mcp_tool_result")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional content` - - - `String` - - - `List` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `Optional isError` - - - `class BetaContainerUploadBlockParam:` - - A content block that represents a file to be uploaded to the container - Files uploaded via this block will be available in the container's input directory. - - - `String fileId` - - - `JsonValue; type "container_upload"constant` - - - `CONTAINER_UPLOAD("container_upload")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `class BetaCompactionBlockParam:` - - A compaction block containing summary of previous context. - - Users should round-trip these blocks from responses to subsequent requests - to maintain context across compaction boundaries. - - When content is None, the block represents a failed compaction. The server - treats these as no-ops. Empty string content is not allowed. - - - `Optional content` - - Summary of previously compacted content, or null if compaction failed - - - `JsonValue; type "compaction"constant` - - - `COMPACTION("compaction")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Role role` - - - `USER("user")` - - - `ASSISTANT("assistant")` - - - `Model model` - - The model that will complete your prompt. - - See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - - Most intelligent model for building agents and coding - - - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` - - Best combination of speed and intelligence - - - `CLAUDE_HAIKU_4_5("claude-haiku-4-5")` - - Fastest model with near-frontier intelligence - - - `CLAUDE_HAIKU_4_5_20251001("claude-haiku-4-5-20251001")` - - Fastest model with near-frontier intelligence - - - `CLAUDE_OPUS_4_5("claude-opus-4-5")` - - Premium model combining maximum intelligence with practical performance - - - `CLAUDE_OPUS_4_5_20251101("claude-opus-4-5-20251101")` - - Premium model combining maximum intelligence with practical performance - - - `CLAUDE_SONNET_4_5("claude-sonnet-4-5")` - - High-performance model for agents and coding - - - `CLAUDE_SONNET_4_5_20250929("claude-sonnet-4-5-20250929")` - - High-performance model for agents and coding - - - `CLAUDE_OPUS_4_1("claude-opus-4-1")` - - Exceptional model for specialized complex tasks - - - `CLAUDE_OPUS_4_1_20250805("claude-opus-4-1-20250805")` - - Exceptional model for specialized complex tasks - - - `CLAUDE_OPUS_4_0("claude-opus-4-0")` - - Powerful model for complex tasks - - - `CLAUDE_OPUS_4_20250514("claude-opus-4-20250514")` - - Powerful model for complex tasks - - - `CLAUDE_SONNET_4_0("claude-sonnet-4-0")` - - High-performance model with extended thinking - - - `CLAUDE_SONNET_4_20250514("claude-sonnet-4-20250514")` - - High-performance model with extended thinking - - - `CLAUDE_3_HAIKU_20240307("claude-3-haiku-20240307")` - - Fast and cost-effective model - - - `Optional cacheControl` - - Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional container` - - Container identifier for reuse across requests. - - - `class BetaContainerParams:` - - Container parameters with skills to be loaded. - - - `Optional id` - - Container id - - - `Optional> skills` - - List of skills to load in the container - - - `String skillId` - - Skill ID - - - `Type type` - - Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) - - - `ANTHROPIC("anthropic")` - - - `CUSTOM("custom")` - - - `Optional version` - - Skill version or 'latest' for most recent version - - - `String` - - - `Optional contextManagement` - - Context management configuration. - - This allows you to control how Claude manages context across multiple requests, such as whether to clear function results or not. - - - `Optional> edits` - - List of context management edits to apply - - - `class BetaClearToolUses20250919Edit:` - - - `JsonValue; type "clear_tool_uses_20250919"constant` - - - `CLEAR_TOOL_USES_20250919("clear_tool_uses_20250919")` - - - `Optional clearAtLeast` - - Minimum number of tokens that must be cleared when triggered. Context will only be modified if at least this many tokens can be removed. - - - `JsonValue; type "input_tokens"constant` - - - `INPUT_TOKENS("input_tokens")` - - - `long value` - - - `Optional clearToolInputs` - - Whether to clear all tool inputs (bool) or specific tool inputs to clear (list) - - - `boolean` - - - `List` - - - `Optional> excludeTools` - - Tool names whose uses are preserved from clearing - - - `Optional keep` - - Number of tool uses to retain in the conversation - - - `JsonValue; type "tool_uses"constant` - - - `TOOL_USES("tool_uses")` - - - `long value` - - - `Optional trigger` - - Condition that triggers the context management strategy - - - `class BetaInputTokensTrigger:` - - - `JsonValue; type "input_tokens"constant` - - - `INPUT_TOKENS("input_tokens")` - - - `long value` - - - `class BetaToolUsesTrigger:` - - - `JsonValue; type "tool_uses"constant` - - - `TOOL_USES("tool_uses")` - - - `long value` - - - `class BetaClearThinking20251015Edit:` - - - `JsonValue; type "clear_thinking_20251015"constant` - - - `CLEAR_THINKING_20251015("clear_thinking_20251015")` - - - `Optional keep` - - Number of most recent assistant turns to keep thinking blocks for. Older turns will have their thinking blocks removed. - - - `class BetaThinkingTurns:` - - - `JsonValue; type "thinking_turns"constant` - - - `THINKING_TURNS("thinking_turns")` - - - `long value` - - - `class BetaAllThinkingTurns:` - - - `JsonValue; type "all"constant` - - - `ALL("all")` - - - `JsonValue;` - - - `ALL("all")` - - - `class BetaCompact20260112Edit:` - - Automatically compact older context when reaching the configured trigger threshold. - - - `JsonValue; type "compact_20260112"constant` - - - `COMPACT_20260112("compact_20260112")` - - - `Optional instructions` - - Additional instructions for summarization. - - - `Optional pauseAfterCompaction` - - Whether to pause after compaction and return the compaction block to the user. - - - `Optional trigger` - - When to trigger compaction. Defaults to 150000 input tokens. - - - `JsonValue; type "input_tokens"constant` - - - `INPUT_TOKENS("input_tokens")` - - - `long value` - - - `Optional inferenceGeo` - - Specifies the geographic region for inference processing. If not specified, the workspace's `default_inference_geo` is used. - - - `Optional> mcpServers` - - MCP servers to be utilized in this request - - - `String name` - - - `JsonValue; type "url"constant` - - - `URL("url")` - - - `String url` - - - `Optional authorizationToken` - - - `Optional toolConfiguration` - - - `Optional> allowedTools` - - - `Optional enabled` - - - `Optional metadata` - - An object describing metadata about the request. - - - `Optional userId` - - An external identifier for the user who is associated with the request. - - This should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number. - - - `Optional outputConfig` - - Configuration options for the model's output, such as the output format. - - - `Optional effort` - - All possible effort levels. - - - `LOW("low")` - - - `MEDIUM("medium")` - - - `HIGH("high")` - - - `MAX("max")` - - - `Optional format` - - A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) - - - `Schema schema` - - The JSON schema of the format - - - `JsonValue; type "json_schema"constant` - - - `JSON_SCHEMA("json_schema")` - - - `Optional outputFormat` - - Deprecated: Use `output_config.format` instead. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) - - A schema to specify Claude's output format in responses. This parameter will be removed in a future release. - - - `Schema schema` - - The JSON schema of the format - - - `JsonValue; type "json_schema"constant` - - - `JSON_SCHEMA("json_schema")` - - - `Optional serviceTier` - - Determines whether to use priority capacity (if available) or standard capacity for this request. - - Anthropic offers different levels of service for your API requests. See [service-tiers](https://docs.claude.com/en/api/service-tiers) for details. - - - `AUTO("auto")` - - - `STANDARD_ONLY("standard_only")` - - - `Optional speed` - - The inference speed mode for this request. `"fast"` enables high output-tokens-per-second inference. - - - `STANDARD("standard")` - - - `FAST("fast")` - - - `Optional> stopSequences` - - Custom text sequences that will cause the model to stop generating. - - Our models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `"end_turn"`. - - If you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `"stop_sequence"` and the response `stop_sequence` value will contain the matched stop sequence. - - - `Optional stream` - - Whether to incrementally stream the response using server-sent events. - - See [streaming](https://docs.claude.com/en/api/messages-streaming) for details. - - - `Optional system` - - System prompt. - - A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts). - - - `String` - - - `List` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional> citations` - - - `class BetaCitationCharLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocationParam:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationWebSearchResultLocationParam:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocationParam:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `Optional temperature` - - Amount of randomness injected into the response. - - Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks. - - Note that even with `temperature` of `0.0`, the results will not be fully deterministic. - - - `Optional thinking` - - Configuration for enabling Claude's extended thinking. - - When enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit. - - See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details. - - - `class BetaThinkingConfigEnabled:` - - - `long budgetTokens` - - Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality. - - Must be ≥1024 and less than `max_tokens`. - - See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details. - - - `JsonValue; type "enabled"constant` - - - `ENABLED("enabled")` - - - `Optional display` - - Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`. - - - `SUMMARIZED("summarized")` - - - `OMITTED("omitted")` - - - `class BetaThinkingConfigDisabled:` - - - `JsonValue; type "disabled"constant` - - - `DISABLED("disabled")` - - - `class BetaThinkingConfigAdaptive:` - - - `JsonValue; type "adaptive"constant` - - - `ADAPTIVE("adaptive")` - - - `Optional display` - - Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`. - - - `SUMMARIZED("summarized")` - - - `OMITTED("omitted")` - - - `Optional toolChoice` - - How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all. - - - `class BetaToolChoiceAuto:` - - The model will automatically decide whether to use tools. - - - `JsonValue; type "auto"constant` - - - `AUTO("auto")` - - - `Optional disableParallelToolUse` - - Whether to disable parallel tool use. - - Defaults to `false`. If set to `true`, the model will output at most one tool use. - - - `class BetaToolChoiceAny:` - - The model will use any available tools. - - - `JsonValue; type "any"constant` - - - `ANY("any")` - - - `Optional disableParallelToolUse` - - Whether to disable parallel tool use. - - Defaults to `false`. If set to `true`, the model will output exactly one tool use. - - - `class BetaToolChoiceTool:` - - The model will use the specified tool with `tool_choice.name`. - - - `String name` - - The name of the tool to use. - - - `JsonValue; type "tool"constant` - - - `TOOL("tool")` - - - `Optional disableParallelToolUse` - - Whether to disable parallel tool use. - - Defaults to `false`. If set to `true`, the model will output exactly one tool use. - - - `class BetaToolChoiceNone:` - - The model will not be allowed to use tools. - - - `JsonValue; type "none"constant` - - - `NONE("none")` - - - `Optional> tools` - - Definitions of tools that the model may use. - - If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks. - - There are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)). - - Each tool definition includes: - - * `name`: Name of the tool. - * `description`: Optional, but strongly-recommended description of the tool. - * `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks. - - For example, if you defined `tools` as: - - ```json - [ - { - "name": "get_stock_price", - "description": "Get the current stock price for a given ticker symbol.", - "input_schema": { - "type": "object", - "properties": { - "ticker": { - "type": "string", - "description": "The stock ticker symbol, e.g. AAPL for Apple Inc." - } - }, - "required": ["ticker"] - } - } - ] - ``` - - And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this: - - ```json - [ - { - "type": "tool_use", - "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", - "name": "get_stock_price", - "input": { "ticker": "^GSPC" } - } - ] - ``` - - You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message: - - ```json - [ - { - "type": "tool_result", - "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", - "content": "259.75 USD" - } - ] - ``` - - Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output. - - See our [guide](https://docs.claude.com/en/docs/tool-use) for more details. - - - `class BetaTool:` - - - `InputSchema inputSchema` - - [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input. - - This defines the shape of the `input` that your tool accepts and that the model will produce. - - - `JsonValue; type "object"constant` - - - `OBJECT("object")` - - - `Optional properties` - - - `Optional> required` - - - `String name` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional description` - - Description of what this tool does. - - Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema. - - - `Optional eagerInputStreaming` - - Enable eager input streaming for this tool. When true, tool input parameters will be streamed incrementally as they are generated, and types will be inferred on-the-fly rather than buffering the full JSON output. When false, streaming is disabled for this tool even if the fine-grained-tool-streaming beta is active. When null (default), uses the default behavior based on beta headers. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `Optional type` - - - `CUSTOM("custom")` - - - `class BetaToolBash20241022:` - - - `JsonValue; name "bash"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `BASH("bash")` - - - `JsonValue; type "bash_20241022"constant` - - - `BASH_20241022("bash_20241022")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolBash20250124:` - - - `JsonValue; name "bash"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `BASH("bash")` - - - `JsonValue; type "bash_20250124"constant` - - - `BASH_20250124("bash_20250124")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaCodeExecutionTool20250522:` - - - `JsonValue; name "code_execution"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `CODE_EXECUTION("code_execution")` - - - `JsonValue; type "code_execution_20250522"constant` - - - `CODE_EXECUTION_20250522("code_execution_20250522")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaCodeExecutionTool20250825:` - - - `JsonValue; name "code_execution"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `CODE_EXECUTION("code_execution")` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaCodeExecutionTool20260120:` - - Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint). - - - `JsonValue; name "code_execution"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `CODE_EXECUTION("code_execution")` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolComputerUse20241022:` - - - `long displayHeightPx` - - The height of the display in pixels. - - - `long displayWidthPx` - - The width of the display in pixels. - - - `JsonValue; name "computer"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `COMPUTER("computer")` - - - `JsonValue; type "computer_20241022"constant` - - - `COMPUTER_20241022("computer_20241022")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional displayNumber` - - The X11 display number (e.g. 0, 1) for the display. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaMemoryTool20250818:` - - - `JsonValue; name "memory"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `MEMORY("memory")` - - - `JsonValue; type "memory_20250818"constant` - - - `MEMORY_20250818("memory_20250818")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolComputerUse20250124:` - - - `long displayHeightPx` - - The height of the display in pixels. - - - `long displayWidthPx` - - The width of the display in pixels. - - - `JsonValue; name "computer"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `COMPUTER("computer")` - - - `JsonValue; type "computer_20250124"constant` - - - `COMPUTER_20250124("computer_20250124")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional displayNumber` - - The X11 display number (e.g. 0, 1) for the display. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolTextEditor20241022:` - - - `JsonValue; name "str_replace_editor"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `STR_REPLACE_EDITOR("str_replace_editor")` - - - `JsonValue; type "text_editor_20241022"constant` - - - `TEXT_EDITOR_20241022("text_editor_20241022")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolComputerUse20251124:` - - - `long displayHeightPx` - - The height of the display in pixels. - - - `long displayWidthPx` - - The width of the display in pixels. - - - `JsonValue; name "computer"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `COMPUTER("computer")` - - - `JsonValue; type "computer_20251124"constant` - - - `COMPUTER_20251124("computer_20251124")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional displayNumber` - - The X11 display number (e.g. 0, 1) for the display. - - - `Optional enableZoom` - - Whether to enable an action to take a zoomed-in screenshot of the screen. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolTextEditor20250124:` - - - `JsonValue; name "str_replace_editor"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `STR_REPLACE_EDITOR("str_replace_editor")` - - - `JsonValue; type "text_editor_20250124"constant` - - - `TEXT_EDITOR_20250124("text_editor_20250124")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolTextEditor20250429:` - - - `JsonValue; name "str_replace_based_edit_tool"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `STR_REPLACE_BASED_EDIT_TOOL("str_replace_based_edit_tool")` - - - `JsonValue; type "text_editor_20250429"constant` - - - `TEXT_EDITOR_20250429("text_editor_20250429")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolTextEditor20250728:` - - - `JsonValue; name "str_replace_based_edit_tool"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `STR_REPLACE_BASED_EDIT_TOOL("str_replace_based_edit_tool")` - - - `JsonValue; type "text_editor_20250728"constant` - - - `TEXT_EDITOR_20250728("text_editor_20250728")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional> inputExamples` - - - `Optional maxCharacters` - - Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaWebSearchTool20250305:` - - - `JsonValue; name "web_search"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `WEB_SEARCH("web_search")` - - - `JsonValue; type "web_search_20250305"constant` - - - `WEB_SEARCH_20250305("web_search_20250305")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional> allowedDomains` - - If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`. - - - `Optional> blockedDomains` - - If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`. - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional maxUses` - - Maximum number of times the tool can be used in the API request. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `Optional userLocation` - - Parameters for the user's location. Used to provide more relevant search results. - - - `JsonValue; type "approximate"constant` - - - `APPROXIMATE("approximate")` - - - `Optional city` - - The city of the user. - - - `Optional country` - - The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user. - - - `Optional region` - - The region of the user. - - - `Optional timezone` - - The [IANA timezone](https://nodatime.org/TimeZones) of the user. - - - `class BetaWebFetchTool20250910:` - - - `JsonValue; name "web_fetch"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `WEB_FETCH("web_fetch")` - - - `JsonValue; type "web_fetch_20250910"constant` - - - `WEB_FETCH_20250910("web_fetch_20250910")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional> allowedDomains` - - List of domains to allow fetching from - - - `Optional> blockedDomains` - - List of domains to block fetching from - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - Citations configuration for fetched documents. Citations are disabled by default. - - - `Optional enabled` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional maxContentTokens` - - Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. - - - `Optional maxUses` - - Maximum number of times the tool can be used in the API request. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaWebSearchTool20260209:` - - - `JsonValue; name "web_search"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `WEB_SEARCH("web_search")` - - - `JsonValue; type "web_search_20260209"constant` - - - `WEB_SEARCH_20260209("web_search_20260209")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional> allowedDomains` - - If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`. - - - `Optional> blockedDomains` - - If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`. - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional maxUses` - - Maximum number of times the tool can be used in the API request. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `Optional userLocation` - - Parameters for the user's location. Used to provide more relevant search results. - - - `JsonValue; type "approximate"constant` - - - `APPROXIMATE("approximate")` - - - `Optional city` - - The city of the user. - - - `Optional country` - - The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user. - - - `Optional region` - - The region of the user. - - - `Optional timezone` - - The [IANA timezone](https://nodatime.org/TimeZones) of the user. - - - `class BetaWebFetchTool20260209:` - - - `JsonValue; name "web_fetch"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `WEB_FETCH("web_fetch")` - - - `JsonValue; type "web_fetch_20260209"constant` - - - `WEB_FETCH_20260209("web_fetch_20260209")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional> allowedDomains` - - List of domains to allow fetching from - - - `Optional> blockedDomains` - - List of domains to block fetching from - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - Citations configuration for fetched documents. Citations are disabled by default. - - - `Optional enabled` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional maxContentTokens` - - Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. - - - `Optional maxUses` - - Maximum number of times the tool can be used in the API request. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaWebFetchTool20260309:` - - Web fetch tool with use_cache parameter for bypassing cached content. - - - `JsonValue; name "web_fetch"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `WEB_FETCH("web_fetch")` - - - `JsonValue; type "web_fetch_20260309"constant` - - - `WEB_FETCH_20260309("web_fetch_20260309")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional> allowedDomains` - - List of domains to allow fetching from - - - `Optional> blockedDomains` - - List of domains to block fetching from - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional citations` - - Citations configuration for fetched documents. Citations are disabled by default. - - - `Optional enabled` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional maxContentTokens` - - Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs. - - - `Optional maxUses` - - Maximum number of times the tool can be used in the API request. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `Optional useCache` - - Whether to use cached content. Set to false to bypass the cache and fetch fresh content. Only set to false when the user explicitly requests fresh content or when fetching rapidly-changing sources. - - - `class BetaToolSearchToolBm25_20251119:` - - - `JsonValue; name "tool_search_tool_bm25"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `TOOL_SEARCH_TOOL_BM25("tool_search_tool_bm25")` - - - `Type type` - - - `TOOL_SEARCH_TOOL_BM25_20251119("tool_search_tool_bm25_20251119")` - - - `TOOL_SEARCH_TOOL_BM25("tool_search_tool_bm25")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaToolSearchToolRegex20251119:` - - - `JsonValue; name "tool_search_tool_regex"constant` - - Name of the tool. - - This is how the tool will be called by the model and in `tool_use` blocks. - - - `TOOL_SEARCH_TOOL_REGEX("tool_search_tool_regex")` - - - `Type type` - - - `TOOL_SEARCH_TOOL_REGEX_20251119("tool_search_tool_regex_20251119")` - - - `TOOL_SEARCH_TOOL_REGEX("tool_search_tool_regex")` - - - `Optional> allowedCallers` - - - `DIRECT("direct")` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional deferLoading` - - If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search. - - - `Optional strict` - - When true, guarantees schema validation on tool names and inputs - - - `class BetaMcpToolset:` - - Configuration for a group of tools from an MCP server. - - Allows configuring enabled status and defer_loading for all tools - from an MCP server, with optional per-tool overrides. - - - `String mcpServerName` - - Name of the MCP server to configure tools for - - - `JsonValue; type "mcp_toolset"constant` - - - `MCP_TOOLSET("mcp_toolset")` - - - `Optional cacheControl` - - Create a cache control breakpoint at this content block. - - - `JsonValue; type "ephemeral"constant` - - - `EPHEMERAL("ephemeral")` - - - `Optional ttl` - - The time-to-live for the cache control breakpoint. - - This may be one the following values: - - - `5m`: 5 minutes - - `1h`: 1 hour - - Defaults to `5m`. - - - `TTL_5M("5m")` - - - `TTL_1H("1h")` - - - `Optional configs` - - Configuration overrides for specific tools, keyed by tool name - - - `Optional deferLoading` - - - `Optional enabled` - - - `Optional defaultConfig` - - Default configuration applied to all tools from this server - - - `Optional deferLoading` - - - `Optional enabled` - - - `Optional topK` - - Only sample from the top K options for each subsequent token. - - Used to remove "long tail" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277). - - Recommended for advanced use cases only. You usually only need to use `temperature`. - - - `Optional topP` - - Use nucleus sampling. - - In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both. - - Recommended for advanced use cases only. You usually only need to use `temperature`. - - - `Optional userProfileId` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - -### Returns - -- `class BetaMessageBatch:` - - - `String id` - - Unique object identifier. - - The format and length of IDs may change over time. - - - `Optional archivedAt` - - RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. - - - `Optional cancelInitiatedAt` - - RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. - - - `LocalDateTime createdAt` - - RFC 3339 datetime string representing the time at which the Message Batch was created. - - - `Optional endedAt` - - RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. - - Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. - - - `LocalDateTime expiresAt` - - RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. - - - `ProcessingStatus processingStatus` - - Processing status of the Message Batch. - - - `IN_PROGRESS("in_progress")` - - - `CANCELING("canceling")` - - - `ENDED("ended")` - - - `BetaMessageBatchRequestCounts requestCounts` - - Tallies requests within the Message Batch, categorized by their status. - - Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. - - - `long canceled` - - Number of requests in the Message Batch that have been canceled. - - This is zero until processing of the entire Message Batch has ended. - - - `long errored` - - Number of requests in the Message Batch that encountered an error. - - This is zero until processing of the entire Message Batch has ended. - - - `long expired` - - Number of requests in the Message Batch that have expired. - - This is zero until processing of the entire Message Batch has ended. - - - `long processing` - - Number of requests in the Message Batch that are processing. - - - `long succeeded` - - Number of requests in the Message Batch that have completed successfully. - - This is zero until processing of the entire Message Batch has ended. - - - `Optional resultsUrl` - - URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. - - Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. - - - `JsonValue; type "message_batch"constant` - - Object type. - - For Message Batches, this is always `"message_batch"`. - - - `MESSAGE_BATCH("message_batch")` - -### Example - -```java -package com.anthropic.example; - -import com.anthropic.client.AnthropicClient; -import com.anthropic.client.okhttp.AnthropicOkHttpClient; -import com.anthropic.models.beta.messages.batches.BatchCreateParams; -import com.anthropic.models.beta.messages.batches.BetaMessageBatch; -import com.anthropic.models.messages.Model; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - AnthropicClient client = AnthropicOkHttpClient.fromEnv(); - - BatchCreateParams params = BatchCreateParams.builder() - .addRequest(BatchCreateParams.Request.builder() - .customId("my-custom-id-1") - .params(BatchCreateParams.Request.Params.builder() - .maxTokens(1024L) - .addUserMessage("Hello, world") - .model(Model.CLAUDE_OPUS_4_6) - .build()) - .build()) - .build(); - BetaMessageBatch betaMessageBatch = client.beta().messages().batches().create(params); - } -} -``` - -## Retrieve - -`BetaMessageBatch beta().messages().batches().retrieve(BatchRetrieveParamsparams = BatchRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` - -**get** `/v1/messages/batches/{message_batch_id}` - -This endpoint is idempotent and can be used to poll for Message Batch completion. To access the results of a Message Batch, make a request to the `results_url` field in the response. - -Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) - -### Parameters - -- `BatchRetrieveParams params` - - - `Optional messageBatchId` - - ID of the Message Batch. - - - `Optional> betas` - - Optional header to specify the beta version(s) you want to use. - - - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` - - - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` - - - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` - - - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` - - - `PDFS_2024_09_25("pdfs-2024-09-25")` - - - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` - - - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` - - - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` - - - `FILES_API_2025_04_14("files-api-2025-04-14")` - - - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` - - - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` - - - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` - - - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` - - - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` - - - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` - - - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` - - - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` - - - `SKILLS_2025_10_02("skills-2025-10-02")` - - - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` - - - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - -### Returns - -- `class BetaMessageBatch:` - - - `String id` - - Unique object identifier. - - The format and length of IDs may change over time. - - - `Optional archivedAt` - - RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. - - - `Optional cancelInitiatedAt` - - RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. - - - `LocalDateTime createdAt` - - RFC 3339 datetime string representing the time at which the Message Batch was created. - - - `Optional endedAt` - - RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. - - Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. - - - `LocalDateTime expiresAt` - - RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. - - - `ProcessingStatus processingStatus` - - Processing status of the Message Batch. - - - `IN_PROGRESS("in_progress")` - - - `CANCELING("canceling")` - - - `ENDED("ended")` - - - `BetaMessageBatchRequestCounts requestCounts` - - Tallies requests within the Message Batch, categorized by their status. - - Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. - - - `long canceled` - - Number of requests in the Message Batch that have been canceled. - - This is zero until processing of the entire Message Batch has ended. - - - `long errored` - - Number of requests in the Message Batch that encountered an error. - - This is zero until processing of the entire Message Batch has ended. - - - `long expired` - - Number of requests in the Message Batch that have expired. - - This is zero until processing of the entire Message Batch has ended. - - - `long processing` - - Number of requests in the Message Batch that are processing. - - - `long succeeded` - - Number of requests in the Message Batch that have completed successfully. - - This is zero until processing of the entire Message Batch has ended. - - - `Optional resultsUrl` - - URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. - - Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. - - - `JsonValue; type "message_batch"constant` - - Object type. - - For Message Batches, this is always `"message_batch"`. - - - `MESSAGE_BATCH("message_batch")` - -### Example - -```java -package com.anthropic.example; - -import com.anthropic.client.AnthropicClient; -import com.anthropic.client.okhttp.AnthropicOkHttpClient; -import com.anthropic.models.beta.messages.batches.BatchRetrieveParams; -import com.anthropic.models.beta.messages.batches.BetaMessageBatch; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - AnthropicClient client = AnthropicOkHttpClient.fromEnv(); - - BetaMessageBatch betaMessageBatch = client.beta().messages().batches().retrieve("message_batch_id"); - } -} -``` - -## List - -`BatchListPage beta().messages().batches().list(BatchListParamsparams = BatchListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` - -**get** `/v1/messages/batches` - -List all Message Batches within a Workspace. Most recently created batches are returned first. - -Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) - -### Parameters - -- `BatchListParams params` - - - `Optional afterId` - - ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object. - - - `Optional beforeId` - - ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object. - - - `Optional limit` - - Number of items to return per page. - - Defaults to `20`. Ranges from `1` to `1000`. - - - `Optional> betas` - - Optional header to specify the beta version(s) you want to use. - - - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` - - - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` - - - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` - - - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` - - - `PDFS_2024_09_25("pdfs-2024-09-25")` - - - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` - - - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` - - - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` - - - `FILES_API_2025_04_14("files-api-2025-04-14")` - - - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` - - - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` - - - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` - - - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` - - - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` - - - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` - - - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` - - - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` - - - `SKILLS_2025_10_02("skills-2025-10-02")` - - - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` - - - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - -### Returns - -- `class BetaMessageBatch:` - - - `String id` - - Unique object identifier. - - The format and length of IDs may change over time. - - - `Optional archivedAt` - - RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. - - - `Optional cancelInitiatedAt` - - RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. - - - `LocalDateTime createdAt` - - RFC 3339 datetime string representing the time at which the Message Batch was created. - - - `Optional endedAt` - - RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. - - Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. - - - `LocalDateTime expiresAt` - - RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. - - - `ProcessingStatus processingStatus` - - Processing status of the Message Batch. - - - `IN_PROGRESS("in_progress")` - - - `CANCELING("canceling")` - - - `ENDED("ended")` - - - `BetaMessageBatchRequestCounts requestCounts` - - Tallies requests within the Message Batch, categorized by their status. - - Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. - - - `long canceled` - - Number of requests in the Message Batch that have been canceled. - - This is zero until processing of the entire Message Batch has ended. - - - `long errored` - - Number of requests in the Message Batch that encountered an error. - - This is zero until processing of the entire Message Batch has ended. - - - `long expired` - - Number of requests in the Message Batch that have expired. - - This is zero until processing of the entire Message Batch has ended. - - - `long processing` - - Number of requests in the Message Batch that are processing. - - - `long succeeded` - - Number of requests in the Message Batch that have completed successfully. - - This is zero until processing of the entire Message Batch has ended. - - - `Optional resultsUrl` - - URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. - - Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. - - - `JsonValue; type "message_batch"constant` - - Object type. - - For Message Batches, this is always `"message_batch"`. - - - `MESSAGE_BATCH("message_batch")` - -### Example - -```java -package com.anthropic.example; - -import com.anthropic.client.AnthropicClient; -import com.anthropic.client.okhttp.AnthropicOkHttpClient; -import com.anthropic.models.beta.messages.batches.BatchListPage; -import com.anthropic.models.beta.messages.batches.BatchListParams; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - AnthropicClient client = AnthropicOkHttpClient.fromEnv(); - - BatchListPage page = client.beta().messages().batches().list(); - } -} -``` - -## Cancel - -`BetaMessageBatch beta().messages().batches().cancel(BatchCancelParamsparams = BatchCancelParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` - -**post** `/v1/messages/batches/{message_batch_id}/cancel` - -Batches may be canceled any time before processing ends. Once cancellation is initiated, the batch enters a `canceling` state, at which time the system may complete any in-progress, non-interruptible requests before finalizing cancellation. - -The number of canceled requests is specified in `request_counts`. To determine which requests were canceled, check the individual results within the batch. Note that cancellation may not result in any canceled requests if they were non-interruptible. - -Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) - -### Parameters - -- `BatchCancelParams params` - - - `Optional messageBatchId` - - ID of the Message Batch. - - - `Optional> betas` - - Optional header to specify the beta version(s) you want to use. - - - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` - - - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` - - - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` - - - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` - - - `PDFS_2024_09_25("pdfs-2024-09-25")` - - - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` - - - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` - - - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` - - - `FILES_API_2025_04_14("files-api-2025-04-14")` - - - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` - - - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` - - - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` - - - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` - - - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` - - - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` - - - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` - - - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` - - - `SKILLS_2025_10_02("skills-2025-10-02")` - - - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` - - - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - -### Returns - -- `class BetaMessageBatch:` - - - `String id` - - Unique object identifier. - - The format and length of IDs may change over time. - - - `Optional archivedAt` - - RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. - - - `Optional cancelInitiatedAt` - - RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. - - - `LocalDateTime createdAt` - - RFC 3339 datetime string representing the time at which the Message Batch was created. - - - `Optional endedAt` - - RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. - - Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. - - - `LocalDateTime expiresAt` - - RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. - - - `ProcessingStatus processingStatus` - - Processing status of the Message Batch. - - - `IN_PROGRESS("in_progress")` - - - `CANCELING("canceling")` - - - `ENDED("ended")` - - - `BetaMessageBatchRequestCounts requestCounts` - - Tallies requests within the Message Batch, categorized by their status. - - Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. - - - `long canceled` - - Number of requests in the Message Batch that have been canceled. - - This is zero until processing of the entire Message Batch has ended. - - - `long errored` - - Number of requests in the Message Batch that encountered an error. - - This is zero until processing of the entire Message Batch has ended. - - - `long expired` - - Number of requests in the Message Batch that have expired. - - This is zero until processing of the entire Message Batch has ended. - - - `long processing` - - Number of requests in the Message Batch that are processing. - - - `long succeeded` - - Number of requests in the Message Batch that have completed successfully. - - This is zero until processing of the entire Message Batch has ended. - - - `Optional resultsUrl` - - URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. - - Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. - - - `JsonValue; type "message_batch"constant` - - Object type. - - For Message Batches, this is always `"message_batch"`. - - - `MESSAGE_BATCH("message_batch")` - -### Example - -```java -package com.anthropic.example; - -import com.anthropic.client.AnthropicClient; -import com.anthropic.client.okhttp.AnthropicOkHttpClient; -import com.anthropic.models.beta.messages.batches.BatchCancelParams; -import com.anthropic.models.beta.messages.batches.BetaMessageBatch; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - AnthropicClient client = AnthropicOkHttpClient.fromEnv(); - - BetaMessageBatch betaMessageBatch = client.beta().messages().batches().cancel("message_batch_id"); - } -} -``` - -## Delete - -`BetaDeletedMessageBatch beta().messages().batches().delete(BatchDeleteParamsparams = BatchDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` - -**delete** `/v1/messages/batches/{message_batch_id}` - -Delete a Message Batch. - -Message Batches can only be deleted once they've finished processing. If you'd like to delete an in-progress batch, you must first cancel it. - -Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) - -### Parameters - -- `BatchDeleteParams params` - - - `Optional messageBatchId` - - ID of the Message Batch. - - - `Optional> betas` - - Optional header to specify the beta version(s) you want to use. - - - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` - - - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` - - - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` - - - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` - - - `PDFS_2024_09_25("pdfs-2024-09-25")` - - - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` - - - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` - - - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` - - - `FILES_API_2025_04_14("files-api-2025-04-14")` - - - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` - - - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` - - - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` - - - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` - - - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` - - - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` - - - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` - - - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` - - - `SKILLS_2025_10_02("skills-2025-10-02")` - - - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` - - - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - -### Returns - -- `class BetaDeletedMessageBatch:` - - - `String id` - - ID of the Message Batch. - - - `JsonValue; type "message_batch_deleted"constant` - - Deleted object type. - - For Message Batches, this is always `"message_batch_deleted"`. - - - `MESSAGE_BATCH_DELETED("message_batch_deleted")` - -### Example - -```java -package com.anthropic.example; - -import com.anthropic.client.AnthropicClient; -import com.anthropic.client.okhttp.AnthropicOkHttpClient; -import com.anthropic.models.beta.messages.batches.BatchDeleteParams; -import com.anthropic.models.beta.messages.batches.BetaDeletedMessageBatch; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - AnthropicClient client = AnthropicOkHttpClient.fromEnv(); - - BetaDeletedMessageBatch betaDeletedMessageBatch = client.beta().messages().batches().delete("message_batch_id"); - } -} -``` - -## Results - -`BetaMessageBatchIndividualResponse beta().messages().batches().resultsStreaming(BatchResultsParamsparams = BatchResultsParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` - -**get** `/v1/messages/batches/{message_batch_id}/results` - -Streams the results of a Message Batch as a `.jsonl` file. - -Each line in the file is a JSON object containing the result of a single request in the Message Batch. Results are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. - -Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) - -### Parameters - -- `BatchResultsParams params` - - - `Optional messageBatchId` - - ID of the Message Batch. - - - `Optional> betas` - - Optional header to specify the beta version(s) you want to use. - - - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` - - - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` - - - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` - - - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` - - - `PDFS_2024_09_25("pdfs-2024-09-25")` - - - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` - - - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` - - - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` - - - `FILES_API_2025_04_14("files-api-2025-04-14")` - - - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` - - - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` - - - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` - - - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` - - - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` - - - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` - - - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` - - - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` - - - `SKILLS_2025_10_02("skills-2025-10-02")` - - - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` - - - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - -### Returns - -- `class BetaMessageBatchIndividualResponse:` - - This is a single line in the response `.jsonl` file and does not represent the response as a whole. - - - `String customId` - - Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order. - - Must be unique for each request within the Message Batch. - - - `BetaMessageBatchResult result` - - Processing result for this request. - - Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration. - - - `class BetaMessageBatchSucceededResult:` - - - `BetaMessage message` - - - `String id` - - Unique object identifier. - - The format and length of IDs may change over time. - - - `Optional container` - - Information about the container used in the request (for the code execution tool) - - - `String id` - - Identifier for the container used in this request - - - `LocalDateTime expiresAt` - - The time at which the container will expire. - - - `Optional> skills` - - Skills loaded in the container - - - `String skillId` - - Skill ID - - - `Type type` - - Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) - - - `ANTHROPIC("anthropic")` - - - `CUSTOM("custom")` - - - `String version` - - Skill version or 'latest' for most recent version - - - `List content` - - Content generated by the model. - - This is an array of content blocks, each of which has a `type` that determines its shape. - - Example: - - ```json - [{"type": "text", "text": "Hi, I'm Claude."}] - ``` - - If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. - - For example, if the input `messages` were: - - ```json - [ - {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, - {"role": "assistant", "content": "The best answer is ("} - ] - ``` - - Then the response `content` might be: - - ```json - [{"type": "text", "text": "B)"}] - ``` - - - `class BetaTextBlock:` - - - `Optional> citations` - - Citations supporting the text block. - - The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. - - - `class BetaCitationCharLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `Optional fileId` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `Optional fileId` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `Optional fileId` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationsWebSearchResultLocation:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocation:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `class BetaThinkingBlock:` - - - `String signature` - - - `String thinking` - - - `JsonValue; type "thinking"constant` - - - `THINKING("thinking")` - - - `class BetaRedactedThinkingBlock:` - - - `String data` - - - `JsonValue; type "redacted_thinking"constant` - - - `REDACTED_THINKING("redacted_thinking")` - - - `class BetaToolUseBlock:` - - - `String id` - - - `Input input` - - - `String name` - - - `JsonValue; type "tool_use"constant` - - - `TOOL_USE("tool_use")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaServerToolUseBlock:` - - - `String id` - - - `Input input` - - - `Name name` - - - `WEB_SEARCH("web_search")` - - - `WEB_FETCH("web_fetch")` - - - `CODE_EXECUTION("code_execution")` - - - `BASH_CODE_EXECUTION("bash_code_execution")` - - - `TEXT_EDITOR_CODE_EXECUTION("text_editor_code_execution")` - - - `TOOL_SEARCH_TOOL_REGEX("tool_search_tool_regex")` - - - `TOOL_SEARCH_TOOL_BM25("tool_search_tool_bm25")` - - - `JsonValue; type "server_tool_use"constant` - - - `SERVER_TOOL_USE("server_tool_use")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaWebSearchToolResultBlock:` - - - `BetaWebSearchToolResultBlockContent content` - - - `class BetaWebSearchToolResultError:` - - - `BetaWebSearchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `QUERY_TOO_LONG("query_too_long")` - - - `REQUEST_TOO_LARGE("request_too_large")` - - - `JsonValue; type "web_search_tool_result_error"constant` - - - `WEB_SEARCH_TOOL_RESULT_ERROR("web_search_tool_result_error")` - - - `List` - - - `String encryptedContent` - - - `Optional pageAge` - - - `String title` - - - `JsonValue; type "web_search_result"constant` - - - `WEB_SEARCH_RESULT("web_search_result")` - - - `String url` - - - `String toolUseId` - - - `JsonValue; type "web_search_tool_result"constant` - - - `WEB_SEARCH_TOOL_RESULT("web_search_tool_result")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaWebFetchToolResultBlock:` - - - `Content content` - - - `class BetaWebFetchToolResultErrorBlock:` - - - `BetaWebFetchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `URL_TOO_LONG("url_too_long")` - - - `URL_NOT_ALLOWED("url_not_allowed")` - - - `URL_NOT_ACCESSIBLE("url_not_accessible")` - - - `UNSUPPORTED_CONTENT_TYPE("unsupported_content_type")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `UNAVAILABLE("unavailable")` - - - `JsonValue; type "web_fetch_tool_result_error"constant` - - - `WEB_FETCH_TOOL_RESULT_ERROR("web_fetch_tool_result_error")` - - - `class BetaWebFetchBlock:` - - - `BetaDocumentBlock content` - - - `Optional citations` - - Citation configuration for the document - - - `boolean enabled` - - - `Source source` - - - `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional title` - - The title of the document - - - `JsonValue; type "document"constant` - - - `DOCUMENT("document")` - - - `Optional retrievedAt` - - ISO 8601 timestamp when the content was retrieved - - - `JsonValue; type "web_fetch_result"constant` - - - `WEB_FETCH_RESULT("web_fetch_result")` - - - `String url` - - Fetched content URL - - - `String toolUseId` - - - `JsonValue; type "web_fetch_tool_result"constant` - - - `WEB_FETCH_TOOL_RESULT("web_fetch_tool_result")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaCodeExecutionToolResultBlock:` - - - `BetaCodeExecutionToolResultBlockContent content` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `class BetaCodeExecutionToolResultError:` - - - `BetaCodeExecutionToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `JsonValue; type "code_execution_tool_result_error"constant` - - - `CODE_EXECUTION_TOOL_RESULT_ERROR("code_execution_tool_result_error")` - - - `class BetaCodeExecutionResultBlock:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "code_execution_result"constant` - - - `CODE_EXECUTION_RESULT("code_execution_result")` - - - `class BetaEncryptedCodeExecutionResultBlock:` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `String encryptedStdout` - - - `long returnCode` - - - `String stderr` - - - `JsonValue; type "encrypted_code_execution_result"constant` - - - `ENCRYPTED_CODE_EXECUTION_RESULT("encrypted_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "code_execution_tool_result"constant` - - - `CODE_EXECUTION_TOOL_RESULT("code_execution_tool_result")` - - - `class BetaBashCodeExecutionToolResultBlock:` - - - `Content content` - - - `class BetaBashCodeExecutionToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `OUTPUT_FILE_TOO_LARGE("output_file_too_large")` - - - `JsonValue; type "bash_code_execution_tool_result_error"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT_ERROR("bash_code_execution_tool_result_error")` - - - `class BetaBashCodeExecutionResultBlock:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "bash_code_execution_output"constant` - - - `BASH_CODE_EXECUTION_OUTPUT("bash_code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "bash_code_execution_result"constant` - - - `BASH_CODE_EXECUTION_RESULT("bash_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "bash_code_execution_tool_result"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT("bash_code_execution_tool_result")` - - - `class BetaTextEditorCodeExecutionToolResultBlock:` - - - `Content content` - - - `class BetaTextEditorCodeExecutionToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `FILE_NOT_FOUND("file_not_found")` - - - `Optional errorMessage` - - - `JsonValue; type "text_editor_code_execution_tool_result_error"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT_ERROR("text_editor_code_execution_tool_result_error")` - - - `class BetaTextEditorCodeExecutionViewResultBlock:` - - - `String content` - - - `FileType fileType` - - - `TEXT("text")` - - - `IMAGE("image")` - - - `PDF("pdf")` - - - `Optional numLines` - - - `Optional startLine` - - - `Optional totalLines` - - - `JsonValue; type "text_editor_code_execution_view_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_VIEW_RESULT("text_editor_code_execution_view_result")` - - - `class BetaTextEditorCodeExecutionCreateResultBlock:` - - - `boolean isFileUpdate` - - - `JsonValue; type "text_editor_code_execution_create_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_CREATE_RESULT("text_editor_code_execution_create_result")` - - - `class BetaTextEditorCodeExecutionStrReplaceResultBlock:` - - - `Optional> lines` - - - `Optional newLines` - - - `Optional newStart` - - - `Optional oldLines` - - - `Optional oldStart` - - - `JsonValue; type "text_editor_code_execution_str_replace_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_STR_REPLACE_RESULT("text_editor_code_execution_str_replace_result")` - - - `String toolUseId` - - - `JsonValue; type "text_editor_code_execution_tool_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT("text_editor_code_execution_tool_result")` - - - `class BetaToolSearchToolResultBlock:` - - - `Content content` - - - `class BetaToolSearchToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `Optional errorMessage` - - - `JsonValue; type "tool_search_tool_result_error"constant` - - - `TOOL_SEARCH_TOOL_RESULT_ERROR("tool_search_tool_result_error")` - - - `class BetaToolSearchToolSearchResultBlock:` - - - `List toolReferences` - - - `String toolName` - - - `JsonValue; type "tool_reference"constant` - - - `TOOL_REFERENCE("tool_reference")` - - - `JsonValue; type "tool_search_tool_search_result"constant` - - - `TOOL_SEARCH_TOOL_SEARCH_RESULT("tool_search_tool_search_result")` - - - `String toolUseId` - - - `JsonValue; type "tool_search_tool_result"constant` - - - `TOOL_SEARCH_TOOL_RESULT("tool_search_tool_result")` - - - `class BetaMcpToolUseBlock:` - - - `String id` - - - `Input input` - - - `String name` - - The name of the MCP tool - - - `String serverName` - - The name of the MCP server - - - `JsonValue; type "mcp_tool_use"constant` - - - `MCP_TOOL_USE("mcp_tool_use")` - - - `class BetaMcpToolResultBlock:` - - - `Content content` - - - `String` - - - `List` - - - `Optional> citations` - - Citations supporting the text block. - - The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. - - - `class BetaCitationCharLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `Optional fileId` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `Optional fileId` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `Optional fileId` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationsWebSearchResultLocation:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocation:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `boolean isError` - - - `String toolUseId` - - - `JsonValue; type "mcp_tool_result"constant` - - - `MCP_TOOL_RESULT("mcp_tool_result")` - - - `class BetaContainerUploadBlock:` - - Response model for a file uploaded to the container. - - - `String fileId` - - - `JsonValue; type "container_upload"constant` - - - `CONTAINER_UPLOAD("container_upload")` - - - `class BetaCompactionBlock:` - - A compaction block returned when autocompact is triggered. - - When content is None, it indicates the compaction failed to produce a valid - summary (e.g., malformed output from the model). Clients may round-trip - compaction blocks with null content; the server treats them as no-ops. - - - `Optional content` - - Summary of compacted content, or null if compaction failed - - - `JsonValue; type "compaction"constant` - - - `COMPACTION("compaction")` - - - `Optional contextManagement` - - Context management response. - - Information about context management strategies applied during the request. - - - `List appliedEdits` - - List of context management edits that were applied. - - - `class BetaClearToolUses20250919EditResponse:` - - - `long clearedInputTokens` - - Number of input tokens cleared by this edit. - - - `long clearedToolUses` - - Number of tool uses that were cleared. - - - `JsonValue; type "clear_tool_uses_20250919"constant` - - The type of context management edit applied. - - - `CLEAR_TOOL_USES_20250919("clear_tool_uses_20250919")` - - - `class BetaClearThinking20251015EditResponse:` - - - `long clearedInputTokens` - - Number of input tokens cleared by this edit. - - - `long clearedThinkingTurns` - - Number of thinking turns that were cleared. - - - `JsonValue; type "clear_thinking_20251015"constant` - - The type of context management edit applied. - - - `CLEAR_THINKING_20251015("clear_thinking_20251015")` - - - `Model model` - - The model that will complete your prompt. - - See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - - Most intelligent model for building agents and coding - - - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` - - Best combination of speed and intelligence - - - `CLAUDE_HAIKU_4_5("claude-haiku-4-5")` - - Fastest model with near-frontier intelligence - - - `CLAUDE_HAIKU_4_5_20251001("claude-haiku-4-5-20251001")` - - Fastest model with near-frontier intelligence - - - `CLAUDE_OPUS_4_5("claude-opus-4-5")` - - Premium model combining maximum intelligence with practical performance - - - `CLAUDE_OPUS_4_5_20251101("claude-opus-4-5-20251101")` - - Premium model combining maximum intelligence with practical performance - - - `CLAUDE_SONNET_4_5("claude-sonnet-4-5")` - - High-performance model for agents and coding - - - `CLAUDE_SONNET_4_5_20250929("claude-sonnet-4-5-20250929")` - - High-performance model for agents and coding - - - `CLAUDE_OPUS_4_1("claude-opus-4-1")` - - Exceptional model for specialized complex tasks - - - `CLAUDE_OPUS_4_1_20250805("claude-opus-4-1-20250805")` - - Exceptional model for specialized complex tasks - - - `CLAUDE_OPUS_4_0("claude-opus-4-0")` - - Powerful model for complex tasks - - - `CLAUDE_OPUS_4_20250514("claude-opus-4-20250514")` - - Powerful model for complex tasks - - - `CLAUDE_SONNET_4_0("claude-sonnet-4-0")` - - High-performance model with extended thinking - - - `CLAUDE_SONNET_4_20250514("claude-sonnet-4-20250514")` - - High-performance model with extended thinking - - - `CLAUDE_3_HAIKU_20240307("claude-3-haiku-20240307")` - - Fast and cost-effective model - - - `JsonValue; role "assistant"constant` - - Conversational role of the generated message. - - This will always be `"assistant"`. - - - `ASSISTANT("assistant")` - - - `Optional stopDetails` - - Structured information about a refusal. - - - `Optional category` - - The policy category that triggered the refusal. - - `null` when the refusal doesn't map to a named category. - - - `CYBER("cyber")` - - - `BIO("bio")` - - - `Optional explanation` - - Human-readable explanation of the refusal. - - This text is not guaranteed to be stable. `null` when no explanation is available for the category. - - - `JsonValue; type "refusal"constant` - - - `REFUSAL("refusal")` - - - `Optional stopReason` - - The reason that we stopped. - - This may be one the following values: - - * `"end_turn"`: the model reached a natural stopping point - * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum - * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated - * `"tool_use"`: the model invoked one or more tools - * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. - * `"refusal"`: when streaming classifiers intervene to handle potential policy violations - - In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. - - - `END_TURN("end_turn")` - - - `MAX_TOKENS("max_tokens")` - - - `STOP_SEQUENCE("stop_sequence")` - - - `TOOL_USE("tool_use")` - - - `PAUSE_TURN("pause_turn")` - - - `COMPACTION("compaction")` - - - `REFUSAL("refusal")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED("model_context_window_exceeded")` - - - `Optional stopSequence` - - Which custom stop sequence was generated, if any. - - This value will be a non-null string if one of your custom stop sequences was generated. - - - `JsonValue; type "message"constant` - - Object type. - - For Messages, this is always `"message"`. - - - `MESSAGE("message")` - - - `BetaUsage usage` - - Billing and rate-limit usage. - - Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. - - Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. - - For example, `output_tokens` will be non-zero, even for an empty string response from Claude. - - Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `Optional cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `Optional cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `Optional inferenceGeo` - - The geographic region where inference was performed for this request. - - - `long inputTokens` - - The number of input tokens which were used. - - - `Optional> iterations` - - Per-iteration token usage breakdown. - - Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: - - - Determine which iterations exceeded long context thresholds (>=200k tokens) - - Calculate the true context window size from the last iteration - - Understand token accumulation across server-side tool use loops - - - `class BetaMessageIterationUsage:` - - Token usage for a sampling iteration. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `long cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `long cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `long inputTokens` - - The number of input tokens which were used. - - - `long outputTokens` - - The number of output tokens which were used. - - - `JsonValue; type "message"constant` - - Usage for a sampling iteration - - - `MESSAGE("message")` - - - `class BetaCompactionIterationUsage:` - - Token usage for a compaction iteration. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `long cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `long cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `long inputTokens` - - The number of input tokens which were used. - - - `long outputTokens` - - The number of output tokens which were used. - - - `JsonValue; type "compaction"constant` - - Usage for a compaction iteration - - - `COMPACTION("compaction")` - - - `long outputTokens` - - The number of output tokens which were used. - - - `Optional serverToolUse` - - The number of server tool requests. - - - `long webFetchRequests` - - The number of web fetch tool requests. - - - `long webSearchRequests` - - The number of web search tool requests. - - - `Optional serviceTier` - - If the request used the priority, standard, or batch tier. - - - `STANDARD("standard")` - - - `PRIORITY("priority")` - - - `BATCH("batch")` - - - `Optional speed` - - The inference speed mode used for this request. - - - `STANDARD("standard")` - - - `FAST("fast")` - - - `JsonValue; type "succeeded"constant` - - - `SUCCEEDED("succeeded")` - - - `class BetaMessageBatchErroredResult:` - - - `BetaErrorResponse error` - - - `BetaError error` - - - `class BetaInvalidRequestError:` - - - `String message` - - - `JsonValue; type "invalid_request_error"constant` - - - `INVALID_REQUEST_ERROR("invalid_request_error")` - - - `class BetaAuthenticationError:` - - - `String message` - - - `JsonValue; type "authentication_error"constant` - - - `AUTHENTICATION_ERROR("authentication_error")` - - - `class BetaBillingError:` - - - `String message` - - - `JsonValue; type "billing_error"constant` - - - `BILLING_ERROR("billing_error")` - - - `class BetaPermissionError:` - - - `String message` - - - `JsonValue; type "permission_error"constant` - - - `PERMISSION_ERROR("permission_error")` - - - `class BetaNotFoundError:` - - - `String message` - - - `JsonValue; type "not_found_error"constant` - - - `NOT_FOUND_ERROR("not_found_error")` - - - `class BetaRateLimitError:` - - - `String message` - - - `JsonValue; type "rate_limit_error"constant` - - - `RATE_LIMIT_ERROR("rate_limit_error")` - - - `class BetaGatewayTimeoutError:` - - - `String message` - - - `JsonValue; type "timeout_error"constant` - - - `TIMEOUT_ERROR("timeout_error")` - - - `class BetaApiError:` - - - `String message` - - - `JsonValue; type "api_error"constant` - - - `API_ERROR("api_error")` - - - `class BetaOverloadedError:` - - - `String message` - - - `JsonValue; type "overloaded_error"constant` - - - `OVERLOADED_ERROR("overloaded_error")` - - - `Optional requestId` - - - `JsonValue; type "error"constant` - - - `ERROR("error")` - - - `JsonValue; type "errored"constant` - - - `ERRORED("errored")` - - - `class BetaMessageBatchCanceledResult:` - - - `JsonValue; type "canceled"constant` - - - `CANCELED("canceled")` - - - `class BetaMessageBatchExpiredResult:` - - - `JsonValue; type "expired"constant` - - - `EXPIRED("expired")` - -### Example - -```java -package com.anthropic.example; - -import com.anthropic.client.AnthropicClient; -import com.anthropic.client.okhttp.AnthropicOkHttpClient; -import com.anthropic.core.http.StreamResponse; -import com.anthropic.models.beta.messages.batches.BatchResultsParams; -import com.anthropic.models.beta.messages.batches.BetaMessageBatchIndividualResponse; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - AnthropicClient client = AnthropicOkHttpClient.fromEnv(); - - StreamResponse betaMessageBatchIndividualResponse = client.beta().messages().batches().resultsStreaming("message_batch_id"); - } -} -``` - -## Domain Types - -### Beta Deleted Message Batch - -- `class BetaDeletedMessageBatch:` - - - `String id` - - ID of the Message Batch. - - - `JsonValue; type "message_batch_deleted"constant` - - Deleted object type. - - For Message Batches, this is always `"message_batch_deleted"`. - - - `MESSAGE_BATCH_DELETED("message_batch_deleted")` - -### Beta Message Batch - -- `class BetaMessageBatch:` - - - `String id` - - Unique object identifier. - - The format and length of IDs may change over time. - - - `Optional archivedAt` - - RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. - - - `Optional cancelInitiatedAt` - - RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. - - - `LocalDateTime createdAt` - - RFC 3339 datetime string representing the time at which the Message Batch was created. - - - `Optional endedAt` - - RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. - - Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired. - - - `LocalDateTime expiresAt` - - RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. - - - `ProcessingStatus processingStatus` - - Processing status of the Message Batch. - - - `IN_PROGRESS("in_progress")` - - - `CANCELING("canceling")` - - - `ENDED("ended")` - - - `BetaMessageBatchRequestCounts requestCounts` - - Tallies requests within the Message Batch, categorized by their status. - - Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch. - - - `long canceled` - - Number of requests in the Message Batch that have been canceled. - - This is zero until processing of the entire Message Batch has ended. - - - `long errored` - - Number of requests in the Message Batch that encountered an error. - - This is zero until processing of the entire Message Batch has ended. - - - `long expired` - - Number of requests in the Message Batch that have expired. - - This is zero until processing of the entire Message Batch has ended. - - - `long processing` - - Number of requests in the Message Batch that are processing. - - - `long succeeded` - - Number of requests in the Message Batch that have completed successfully. - - This is zero until processing of the entire Message Batch has ended. - - - `Optional resultsUrl` - - URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. - - Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. - - - `JsonValue; type "message_batch"constant` - - Object type. - - For Message Batches, this is always `"message_batch"`. - - - `MESSAGE_BATCH("message_batch")` - -### Beta Message Batch Canceled Result - -- `class BetaMessageBatchCanceledResult:` - - - `JsonValue; type "canceled"constant` - - - `CANCELED("canceled")` - -### Beta Message Batch Errored Result - -- `class BetaMessageBatchErroredResult:` - - - `BetaErrorResponse error` - - - `BetaError error` - - - `class BetaInvalidRequestError:` - - - `String message` - - - `JsonValue; type "invalid_request_error"constant` - - - `INVALID_REQUEST_ERROR("invalid_request_error")` - - - `class BetaAuthenticationError:` - - - `String message` - - - `JsonValue; type "authentication_error"constant` - - - `AUTHENTICATION_ERROR("authentication_error")` - - - `class BetaBillingError:` - - - `String message` - - - `JsonValue; type "billing_error"constant` - - - `BILLING_ERROR("billing_error")` - - - `class BetaPermissionError:` - - - `String message` - - - `JsonValue; type "permission_error"constant` - - - `PERMISSION_ERROR("permission_error")` - - - `class BetaNotFoundError:` - - - `String message` - - - `JsonValue; type "not_found_error"constant` - - - `NOT_FOUND_ERROR("not_found_error")` - - - `class BetaRateLimitError:` - - - `String message` - - - `JsonValue; type "rate_limit_error"constant` - - - `RATE_LIMIT_ERROR("rate_limit_error")` - - - `class BetaGatewayTimeoutError:` - - - `String message` - - - `JsonValue; type "timeout_error"constant` - - - `TIMEOUT_ERROR("timeout_error")` - - - `class BetaApiError:` - - - `String message` - - - `JsonValue; type "api_error"constant` - - - `API_ERROR("api_error")` - - - `class BetaOverloadedError:` - - - `String message` - - - `JsonValue; type "overloaded_error"constant` - - - `OVERLOADED_ERROR("overloaded_error")` - - - `Optional requestId` - - - `JsonValue; type "error"constant` - - - `ERROR("error")` - - - `JsonValue; type "errored"constant` - - - `ERRORED("errored")` - -### Beta Message Batch Expired Result - -- `class BetaMessageBatchExpiredResult:` - - - `JsonValue; type "expired"constant` - - - `EXPIRED("expired")` - -### Beta Message Batch Individual Response - -- `class BetaMessageBatchIndividualResponse:` - - This is a single line in the response `.jsonl` file and does not represent the response as a whole. - - - `String customId` - - Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order. - - Must be unique for each request within the Message Batch. - - - `BetaMessageBatchResult result` - - Processing result for this request. - - Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration. - - - `class BetaMessageBatchSucceededResult:` - - - `BetaMessage message` - - - `String id` - - Unique object identifier. - - The format and length of IDs may change over time. - - - `Optional container` - - Information about the container used in the request (for the code execution tool) - - - `String id` - - Identifier for the container used in this request - - - `LocalDateTime expiresAt` - - The time at which the container will expire. - - - `Optional> skills` - - Skills loaded in the container - - - `String skillId` - - Skill ID - - - `Type type` - - Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) - - - `ANTHROPIC("anthropic")` - - - `CUSTOM("custom")` - - - `String version` - - Skill version or 'latest' for most recent version - - - `List content` - - Content generated by the model. - - This is an array of content blocks, each of which has a `type` that determines its shape. - - Example: - - ```json - [{"type": "text", "text": "Hi, I'm Claude."}] - ``` - - If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. - - For example, if the input `messages` were: - - ```json - [ - {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, - {"role": "assistant", "content": "The best answer is ("} - ] - ``` - - Then the response `content` might be: - - ```json - [{"type": "text", "text": "B)"}] - ``` - - - `class BetaTextBlock:` - - - `Optional> citations` - - Citations supporting the text block. - - The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. - - - `class BetaCitationCharLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `Optional fileId` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `Optional fileId` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `Optional fileId` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationsWebSearchResultLocation:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocation:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `class BetaThinkingBlock:` - - - `String signature` - - - `String thinking` - - - `JsonValue; type "thinking"constant` - - - `THINKING("thinking")` - - - `class BetaRedactedThinkingBlock:` - - - `String data` - - - `JsonValue; type "redacted_thinking"constant` - - - `REDACTED_THINKING("redacted_thinking")` - - - `class BetaToolUseBlock:` - - - `String id` - - - `Input input` - - - `String name` - - - `JsonValue; type "tool_use"constant` - - - `TOOL_USE("tool_use")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaServerToolUseBlock:` - - - `String id` - - - `Input input` - - - `Name name` - - - `WEB_SEARCH("web_search")` - - - `WEB_FETCH("web_fetch")` - - - `CODE_EXECUTION("code_execution")` - - - `BASH_CODE_EXECUTION("bash_code_execution")` - - - `TEXT_EDITOR_CODE_EXECUTION("text_editor_code_execution")` - - - `TOOL_SEARCH_TOOL_REGEX("tool_search_tool_regex")` - - - `TOOL_SEARCH_TOOL_BM25("tool_search_tool_bm25")` - - - `JsonValue; type "server_tool_use"constant` - - - `SERVER_TOOL_USE("server_tool_use")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaWebSearchToolResultBlock:` - - - `BetaWebSearchToolResultBlockContent content` - - - `class BetaWebSearchToolResultError:` - - - `BetaWebSearchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `QUERY_TOO_LONG("query_too_long")` - - - `REQUEST_TOO_LARGE("request_too_large")` - - - `JsonValue; type "web_search_tool_result_error"constant` - - - `WEB_SEARCH_TOOL_RESULT_ERROR("web_search_tool_result_error")` - - - `List` - - - `String encryptedContent` - - - `Optional pageAge` - - - `String title` - - - `JsonValue; type "web_search_result"constant` - - - `WEB_SEARCH_RESULT("web_search_result")` - - - `String url` - - - `String toolUseId` - - - `JsonValue; type "web_search_tool_result"constant` - - - `WEB_SEARCH_TOOL_RESULT("web_search_tool_result")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaWebFetchToolResultBlock:` - - - `Content content` - - - `class BetaWebFetchToolResultErrorBlock:` - - - `BetaWebFetchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `URL_TOO_LONG("url_too_long")` - - - `URL_NOT_ALLOWED("url_not_allowed")` - - - `URL_NOT_ACCESSIBLE("url_not_accessible")` - - - `UNSUPPORTED_CONTENT_TYPE("unsupported_content_type")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `UNAVAILABLE("unavailable")` - - - `JsonValue; type "web_fetch_tool_result_error"constant` - - - `WEB_FETCH_TOOL_RESULT_ERROR("web_fetch_tool_result_error")` - - - `class BetaWebFetchBlock:` - - - `BetaDocumentBlock content` - - - `Optional citations` - - Citation configuration for the document - - - `boolean enabled` - - - `Source source` - - - `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional title` - - The title of the document - - - `JsonValue; type "document"constant` - - - `DOCUMENT("document")` - - - `Optional retrievedAt` - - ISO 8601 timestamp when the content was retrieved - - - `JsonValue; type "web_fetch_result"constant` - - - `WEB_FETCH_RESULT("web_fetch_result")` - - - `String url` - - Fetched content URL - - - `String toolUseId` - - - `JsonValue; type "web_fetch_tool_result"constant` - - - `WEB_FETCH_TOOL_RESULT("web_fetch_tool_result")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaCodeExecutionToolResultBlock:` - - - `BetaCodeExecutionToolResultBlockContent content` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `class BetaCodeExecutionToolResultError:` - - - `BetaCodeExecutionToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `JsonValue; type "code_execution_tool_result_error"constant` - - - `CODE_EXECUTION_TOOL_RESULT_ERROR("code_execution_tool_result_error")` - - - `class BetaCodeExecutionResultBlock:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "code_execution_result"constant` - - - `CODE_EXECUTION_RESULT("code_execution_result")` - - - `class BetaEncryptedCodeExecutionResultBlock:` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `String encryptedStdout` - - - `long returnCode` - - - `String stderr` - - - `JsonValue; type "encrypted_code_execution_result"constant` - - - `ENCRYPTED_CODE_EXECUTION_RESULT("encrypted_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "code_execution_tool_result"constant` - - - `CODE_EXECUTION_TOOL_RESULT("code_execution_tool_result")` - - - `class BetaBashCodeExecutionToolResultBlock:` - - - `Content content` - - - `class BetaBashCodeExecutionToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `OUTPUT_FILE_TOO_LARGE("output_file_too_large")` - - - `JsonValue; type "bash_code_execution_tool_result_error"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT_ERROR("bash_code_execution_tool_result_error")` - - - `class BetaBashCodeExecutionResultBlock:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "bash_code_execution_output"constant` - - - `BASH_CODE_EXECUTION_OUTPUT("bash_code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "bash_code_execution_result"constant` - - - `BASH_CODE_EXECUTION_RESULT("bash_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "bash_code_execution_tool_result"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT("bash_code_execution_tool_result")` - - - `class BetaTextEditorCodeExecutionToolResultBlock:` - - - `Content content` - - - `class BetaTextEditorCodeExecutionToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `FILE_NOT_FOUND("file_not_found")` - - - `Optional errorMessage` - - - `JsonValue; type "text_editor_code_execution_tool_result_error"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT_ERROR("text_editor_code_execution_tool_result_error")` - - - `class BetaTextEditorCodeExecutionViewResultBlock:` - - - `String content` - - - `FileType fileType` - - - `TEXT("text")` - - - `IMAGE("image")` - - - `PDF("pdf")` - - - `Optional numLines` - - - `Optional startLine` - - - `Optional totalLines` - - - `JsonValue; type "text_editor_code_execution_view_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_VIEW_RESULT("text_editor_code_execution_view_result")` - - - `class BetaTextEditorCodeExecutionCreateResultBlock:` - - - `boolean isFileUpdate` - - - `JsonValue; type "text_editor_code_execution_create_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_CREATE_RESULT("text_editor_code_execution_create_result")` - - - `class BetaTextEditorCodeExecutionStrReplaceResultBlock:` - - - `Optional> lines` - - - `Optional newLines` - - - `Optional newStart` - - - `Optional oldLines` - - - `Optional oldStart` - - - `JsonValue; type "text_editor_code_execution_str_replace_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_STR_REPLACE_RESULT("text_editor_code_execution_str_replace_result")` - - - `String toolUseId` - - - `JsonValue; type "text_editor_code_execution_tool_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT("text_editor_code_execution_tool_result")` - - - `class BetaToolSearchToolResultBlock:` - - - `Content content` - - - `class BetaToolSearchToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `Optional errorMessage` - - - `JsonValue; type "tool_search_tool_result_error"constant` - - - `TOOL_SEARCH_TOOL_RESULT_ERROR("tool_search_tool_result_error")` - - - `class BetaToolSearchToolSearchResultBlock:` - - - `List toolReferences` - - - `String toolName` - - - `JsonValue; type "tool_reference"constant` - - - `TOOL_REFERENCE("tool_reference")` - - - `JsonValue; type "tool_search_tool_search_result"constant` - - - `TOOL_SEARCH_TOOL_SEARCH_RESULT("tool_search_tool_search_result")` - - - `String toolUseId` - - - `JsonValue; type "tool_search_tool_result"constant` - - - `TOOL_SEARCH_TOOL_RESULT("tool_search_tool_result")` - - - `class BetaMcpToolUseBlock:` - - - `String id` - - - `Input input` - - - `String name` - - The name of the MCP tool - - - `String serverName` - - The name of the MCP server - - - `JsonValue; type "mcp_tool_use"constant` - - - `MCP_TOOL_USE("mcp_tool_use")` - - - `class BetaMcpToolResultBlock:` - - - `Content content` - - - `String` - - - `List` - - - `Optional> citations` - - Citations supporting the text block. - - The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. - - - `class BetaCitationCharLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `Optional fileId` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `Optional fileId` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `Optional fileId` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationsWebSearchResultLocation:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocation:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `boolean isError` - - - `String toolUseId` - - - `JsonValue; type "mcp_tool_result"constant` - - - `MCP_TOOL_RESULT("mcp_tool_result")` - - - `class BetaContainerUploadBlock:` - - Response model for a file uploaded to the container. - - - `String fileId` - - - `JsonValue; type "container_upload"constant` - - - `CONTAINER_UPLOAD("container_upload")` - - - `class BetaCompactionBlock:` - - A compaction block returned when autocompact is triggered. - - When content is None, it indicates the compaction failed to produce a valid - summary (e.g., malformed output from the model). Clients may round-trip - compaction blocks with null content; the server treats them as no-ops. - - - `Optional content` - - Summary of compacted content, or null if compaction failed - - - `JsonValue; type "compaction"constant` - - - `COMPACTION("compaction")` - - - `Optional contextManagement` - - Context management response. - - Information about context management strategies applied during the request. - - - `List appliedEdits` - - List of context management edits that were applied. - - - `class BetaClearToolUses20250919EditResponse:` - - - `long clearedInputTokens` - - Number of input tokens cleared by this edit. - - - `long clearedToolUses` - - Number of tool uses that were cleared. - - - `JsonValue; type "clear_tool_uses_20250919"constant` - - The type of context management edit applied. - - - `CLEAR_TOOL_USES_20250919("clear_tool_uses_20250919")` - - - `class BetaClearThinking20251015EditResponse:` - - - `long clearedInputTokens` - - Number of input tokens cleared by this edit. - - - `long clearedThinkingTurns` - - Number of thinking turns that were cleared. - - - `JsonValue; type "clear_thinking_20251015"constant` - - The type of context management edit applied. - - - `CLEAR_THINKING_20251015("clear_thinking_20251015")` - - - `Model model` - - The model that will complete your prompt. - - See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - - Most intelligent model for building agents and coding - - - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` - - Best combination of speed and intelligence - - - `CLAUDE_HAIKU_4_5("claude-haiku-4-5")` - - Fastest model with near-frontier intelligence - - - `CLAUDE_HAIKU_4_5_20251001("claude-haiku-4-5-20251001")` - - Fastest model with near-frontier intelligence - - - `CLAUDE_OPUS_4_5("claude-opus-4-5")` - - Premium model combining maximum intelligence with practical performance - - - `CLAUDE_OPUS_4_5_20251101("claude-opus-4-5-20251101")` - - Premium model combining maximum intelligence with practical performance - - - `CLAUDE_SONNET_4_5("claude-sonnet-4-5")` - - High-performance model for agents and coding - - - `CLAUDE_SONNET_4_5_20250929("claude-sonnet-4-5-20250929")` - - High-performance model for agents and coding - - - `CLAUDE_OPUS_4_1("claude-opus-4-1")` - - Exceptional model for specialized complex tasks - - - `CLAUDE_OPUS_4_1_20250805("claude-opus-4-1-20250805")` - - Exceptional model for specialized complex tasks - - - `CLAUDE_OPUS_4_0("claude-opus-4-0")` - - Powerful model for complex tasks - - - `CLAUDE_OPUS_4_20250514("claude-opus-4-20250514")` - - Powerful model for complex tasks - - - `CLAUDE_SONNET_4_0("claude-sonnet-4-0")` - - High-performance model with extended thinking - - - `CLAUDE_SONNET_4_20250514("claude-sonnet-4-20250514")` - - High-performance model with extended thinking - - - `CLAUDE_3_HAIKU_20240307("claude-3-haiku-20240307")` - - Fast and cost-effective model - - - `JsonValue; role "assistant"constant` - - Conversational role of the generated message. - - This will always be `"assistant"`. - - - `ASSISTANT("assistant")` - - - `Optional stopDetails` - - Structured information about a refusal. - - - `Optional category` - - The policy category that triggered the refusal. - - `null` when the refusal doesn't map to a named category. - - - `CYBER("cyber")` - - - `BIO("bio")` - - - `Optional explanation` - - Human-readable explanation of the refusal. - - This text is not guaranteed to be stable. `null` when no explanation is available for the category. - - - `JsonValue; type "refusal"constant` - - - `REFUSAL("refusal")` - - - `Optional stopReason` - - The reason that we stopped. - - This may be one the following values: - - * `"end_turn"`: the model reached a natural stopping point - * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum - * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated - * `"tool_use"`: the model invoked one or more tools - * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. - * `"refusal"`: when streaming classifiers intervene to handle potential policy violations - - In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. - - - `END_TURN("end_turn")` - - - `MAX_TOKENS("max_tokens")` - - - `STOP_SEQUENCE("stop_sequence")` - - - `TOOL_USE("tool_use")` - - - `PAUSE_TURN("pause_turn")` - - - `COMPACTION("compaction")` - - - `REFUSAL("refusal")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED("model_context_window_exceeded")` - - - `Optional stopSequence` - - Which custom stop sequence was generated, if any. - - This value will be a non-null string if one of your custom stop sequences was generated. - - - `JsonValue; type "message"constant` - - Object type. - - For Messages, this is always `"message"`. - - - `MESSAGE("message")` - - - `BetaUsage usage` - - Billing and rate-limit usage. - - Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. - - Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. - - For example, `output_tokens` will be non-zero, even for an empty string response from Claude. - - Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `Optional cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `Optional cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `Optional inferenceGeo` - - The geographic region where inference was performed for this request. - - - `long inputTokens` - - The number of input tokens which were used. - - - `Optional> iterations` - - Per-iteration token usage breakdown. - - Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: - - - Determine which iterations exceeded long context thresholds (>=200k tokens) - - Calculate the true context window size from the last iteration - - Understand token accumulation across server-side tool use loops - - - `class BetaMessageIterationUsage:` - - Token usage for a sampling iteration. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `long cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `long cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `long inputTokens` - - The number of input tokens which were used. - - - `long outputTokens` - - The number of output tokens which were used. - - - `JsonValue; type "message"constant` - - Usage for a sampling iteration - - - `MESSAGE("message")` - - - `class BetaCompactionIterationUsage:` - - Token usage for a compaction iteration. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `long cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `long cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `long inputTokens` - - The number of input tokens which were used. - - - `long outputTokens` - - The number of output tokens which were used. - - - `JsonValue; type "compaction"constant` - - Usage for a compaction iteration - - - `COMPACTION("compaction")` - - - `long outputTokens` - - The number of output tokens which were used. - - - `Optional serverToolUse` - - The number of server tool requests. - - - `long webFetchRequests` - - The number of web fetch tool requests. - - - `long webSearchRequests` - - The number of web search tool requests. - - - `Optional serviceTier` - - If the request used the priority, standard, or batch tier. - - - `STANDARD("standard")` - - - `PRIORITY("priority")` - - - `BATCH("batch")` - - - `Optional speed` - - The inference speed mode used for this request. - - - `STANDARD("standard")` - - - `FAST("fast")` - - - `JsonValue; type "succeeded"constant` - - - `SUCCEEDED("succeeded")` - - - `class BetaMessageBatchErroredResult:` - - - `BetaErrorResponse error` - - - `BetaError error` - - - `class BetaInvalidRequestError:` - - - `String message` - - - `JsonValue; type "invalid_request_error"constant` - - - `INVALID_REQUEST_ERROR("invalid_request_error")` - - - `class BetaAuthenticationError:` - - - `String message` - - - `JsonValue; type "authentication_error"constant` - - - `AUTHENTICATION_ERROR("authentication_error")` - - - `class BetaBillingError:` - - - `String message` - - - `JsonValue; type "billing_error"constant` - - - `BILLING_ERROR("billing_error")` - - - `class BetaPermissionError:` - - - `String message` - - - `JsonValue; type "permission_error"constant` - - - `PERMISSION_ERROR("permission_error")` - - - `class BetaNotFoundError:` - - - `String message` - - - `JsonValue; type "not_found_error"constant` - - - `NOT_FOUND_ERROR("not_found_error")` - - - `class BetaRateLimitError:` - - - `String message` - - - `JsonValue; type "rate_limit_error"constant` - - - `RATE_LIMIT_ERROR("rate_limit_error")` - - - `class BetaGatewayTimeoutError:` - - - `String message` - - - `JsonValue; type "timeout_error"constant` - - - `TIMEOUT_ERROR("timeout_error")` - - - `class BetaApiError:` - - - `String message` - - - `JsonValue; type "api_error"constant` - - - `API_ERROR("api_error")` - - - `class BetaOverloadedError:` - - - `String message` - - - `JsonValue; type "overloaded_error"constant` - - - `OVERLOADED_ERROR("overloaded_error")` - - - `Optional requestId` - - - `JsonValue; type "error"constant` - - - `ERROR("error")` - - - `JsonValue; type "errored"constant` - - - `ERRORED("errored")` - - - `class BetaMessageBatchCanceledResult:` - - - `JsonValue; type "canceled"constant` - - - `CANCELED("canceled")` - - - `class BetaMessageBatchExpiredResult:` - - - `JsonValue; type "expired"constant` - - - `EXPIRED("expired")` - -### Beta Message Batch Request Counts - -- `class BetaMessageBatchRequestCounts:` - - - `long canceled` - - Number of requests in the Message Batch that have been canceled. - - This is zero until processing of the entire Message Batch has ended. - - - `long errored` - - Number of requests in the Message Batch that encountered an error. - - This is zero until processing of the entire Message Batch has ended. - - - `long expired` - - Number of requests in the Message Batch that have expired. - - This is zero until processing of the entire Message Batch has ended. - - - `long processing` - - Number of requests in the Message Batch that are processing. - - - `long succeeded` - - Number of requests in the Message Batch that have completed successfully. - - This is zero until processing of the entire Message Batch has ended. - -### Beta Message Batch Result - -- `class BetaMessageBatchResult: A class that can be one of several variants.union` - - Processing result for this request. - - Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration. - - - `class BetaMessageBatchSucceededResult:` - - - `BetaMessage message` - - - `String id` - - Unique object identifier. - - The format and length of IDs may change over time. - - - `Optional container` - - Information about the container used in the request (for the code execution tool) - - - `String id` - - Identifier for the container used in this request - - - `LocalDateTime expiresAt` - - The time at which the container will expire. - - - `Optional> skills` - - Skills loaded in the container - - - `String skillId` - - Skill ID - - - `Type type` - - Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) - - - `ANTHROPIC("anthropic")` - - - `CUSTOM("custom")` - - - `String version` - - Skill version or 'latest' for most recent version - - - `List content` - - Content generated by the model. - - This is an array of content blocks, each of which has a `type` that determines its shape. - - Example: - - ```json - [{"type": "text", "text": "Hi, I'm Claude."}] - ``` - - If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. - - For example, if the input `messages` were: - - ```json - [ - {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, - {"role": "assistant", "content": "The best answer is ("} - ] - ``` - - Then the response `content` might be: - - ```json - [{"type": "text", "text": "B)"}] - ``` - - - `class BetaTextBlock:` - - - `Optional> citations` - - Citations supporting the text block. - - The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. - - - `class BetaCitationCharLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `Optional fileId` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `Optional fileId` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `Optional fileId` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationsWebSearchResultLocation:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocation:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `class BetaThinkingBlock:` - - - `String signature` - - - `String thinking` - - - `JsonValue; type "thinking"constant` - - - `THINKING("thinking")` - - - `class BetaRedactedThinkingBlock:` - - - `String data` - - - `JsonValue; type "redacted_thinking"constant` - - - `REDACTED_THINKING("redacted_thinking")` - - - `class BetaToolUseBlock:` - - - `String id` - - - `Input input` - - - `String name` - - - `JsonValue; type "tool_use"constant` - - - `TOOL_USE("tool_use")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaServerToolUseBlock:` - - - `String id` - - - `Input input` - - - `Name name` - - - `WEB_SEARCH("web_search")` - - - `WEB_FETCH("web_fetch")` - - - `CODE_EXECUTION("code_execution")` - - - `BASH_CODE_EXECUTION("bash_code_execution")` - - - `TEXT_EDITOR_CODE_EXECUTION("text_editor_code_execution")` - - - `TOOL_SEARCH_TOOL_REGEX("tool_search_tool_regex")` - - - `TOOL_SEARCH_TOOL_BM25("tool_search_tool_bm25")` - - - `JsonValue; type "server_tool_use"constant` - - - `SERVER_TOOL_USE("server_tool_use")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaWebSearchToolResultBlock:` - - - `BetaWebSearchToolResultBlockContent content` - - - `class BetaWebSearchToolResultError:` - - - `BetaWebSearchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `QUERY_TOO_LONG("query_too_long")` - - - `REQUEST_TOO_LARGE("request_too_large")` - - - `JsonValue; type "web_search_tool_result_error"constant` - - - `WEB_SEARCH_TOOL_RESULT_ERROR("web_search_tool_result_error")` - - - `List` - - - `String encryptedContent` - - - `Optional pageAge` - - - `String title` - - - `JsonValue; type "web_search_result"constant` - - - `WEB_SEARCH_RESULT("web_search_result")` - - - `String url` - - - `String toolUseId` - - - `JsonValue; type "web_search_tool_result"constant` - - - `WEB_SEARCH_TOOL_RESULT("web_search_tool_result")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaWebFetchToolResultBlock:` - - - `Content content` - - - `class BetaWebFetchToolResultErrorBlock:` - - - `BetaWebFetchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `URL_TOO_LONG("url_too_long")` - - - `URL_NOT_ALLOWED("url_not_allowed")` - - - `URL_NOT_ACCESSIBLE("url_not_accessible")` - - - `UNSUPPORTED_CONTENT_TYPE("unsupported_content_type")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `UNAVAILABLE("unavailable")` - - - `JsonValue; type "web_fetch_tool_result_error"constant` - - - `WEB_FETCH_TOOL_RESULT_ERROR("web_fetch_tool_result_error")` - - - `class BetaWebFetchBlock:` - - - `BetaDocumentBlock content` - - - `Optional citations` - - Citation configuration for the document - - - `boolean enabled` - - - `Source source` - - - `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional title` - - The title of the document - - - `JsonValue; type "document"constant` - - - `DOCUMENT("document")` - - - `Optional retrievedAt` - - ISO 8601 timestamp when the content was retrieved - - - `JsonValue; type "web_fetch_result"constant` - - - `WEB_FETCH_RESULT("web_fetch_result")` - - - `String url` - - Fetched content URL - - - `String toolUseId` - - - `JsonValue; type "web_fetch_tool_result"constant` - - - `WEB_FETCH_TOOL_RESULT("web_fetch_tool_result")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaCodeExecutionToolResultBlock:` - - - `BetaCodeExecutionToolResultBlockContent content` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `class BetaCodeExecutionToolResultError:` - - - `BetaCodeExecutionToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `JsonValue; type "code_execution_tool_result_error"constant` - - - `CODE_EXECUTION_TOOL_RESULT_ERROR("code_execution_tool_result_error")` - - - `class BetaCodeExecutionResultBlock:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "code_execution_result"constant` - - - `CODE_EXECUTION_RESULT("code_execution_result")` - - - `class BetaEncryptedCodeExecutionResultBlock:` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `String encryptedStdout` - - - `long returnCode` - - - `String stderr` - - - `JsonValue; type "encrypted_code_execution_result"constant` - - - `ENCRYPTED_CODE_EXECUTION_RESULT("encrypted_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "code_execution_tool_result"constant` - - - `CODE_EXECUTION_TOOL_RESULT("code_execution_tool_result")` - - - `class BetaBashCodeExecutionToolResultBlock:` - - - `Content content` - - - `class BetaBashCodeExecutionToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `OUTPUT_FILE_TOO_LARGE("output_file_too_large")` - - - `JsonValue; type "bash_code_execution_tool_result_error"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT_ERROR("bash_code_execution_tool_result_error")` - - - `class BetaBashCodeExecutionResultBlock:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "bash_code_execution_output"constant` - - - `BASH_CODE_EXECUTION_OUTPUT("bash_code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "bash_code_execution_result"constant` - - - `BASH_CODE_EXECUTION_RESULT("bash_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "bash_code_execution_tool_result"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT("bash_code_execution_tool_result")` - - - `class BetaTextEditorCodeExecutionToolResultBlock:` - - - `Content content` - - - `class BetaTextEditorCodeExecutionToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `FILE_NOT_FOUND("file_not_found")` - - - `Optional errorMessage` - - - `JsonValue; type "text_editor_code_execution_tool_result_error"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT_ERROR("text_editor_code_execution_tool_result_error")` - - - `class BetaTextEditorCodeExecutionViewResultBlock:` - - - `String content` - - - `FileType fileType` - - - `TEXT("text")` - - - `IMAGE("image")` - - - `PDF("pdf")` - - - `Optional numLines` - - - `Optional startLine` - - - `Optional totalLines` - - - `JsonValue; type "text_editor_code_execution_view_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_VIEW_RESULT("text_editor_code_execution_view_result")` - - - `class BetaTextEditorCodeExecutionCreateResultBlock:` - - - `boolean isFileUpdate` - - - `JsonValue; type "text_editor_code_execution_create_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_CREATE_RESULT("text_editor_code_execution_create_result")` - - - `class BetaTextEditorCodeExecutionStrReplaceResultBlock:` - - - `Optional> lines` - - - `Optional newLines` - - - `Optional newStart` - - - `Optional oldLines` - - - `Optional oldStart` - - - `JsonValue; type "text_editor_code_execution_str_replace_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_STR_REPLACE_RESULT("text_editor_code_execution_str_replace_result")` - - - `String toolUseId` - - - `JsonValue; type "text_editor_code_execution_tool_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT("text_editor_code_execution_tool_result")` - - - `class BetaToolSearchToolResultBlock:` - - - `Content content` - - - `class BetaToolSearchToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `Optional errorMessage` - - - `JsonValue; type "tool_search_tool_result_error"constant` - - - `TOOL_SEARCH_TOOL_RESULT_ERROR("tool_search_tool_result_error")` - - - `class BetaToolSearchToolSearchResultBlock:` - - - `List toolReferences` - - - `String toolName` - - - `JsonValue; type "tool_reference"constant` - - - `TOOL_REFERENCE("tool_reference")` - - - `JsonValue; type "tool_search_tool_search_result"constant` - - - `TOOL_SEARCH_TOOL_SEARCH_RESULT("tool_search_tool_search_result")` - - - `String toolUseId` - - - `JsonValue; type "tool_search_tool_result"constant` - - - `TOOL_SEARCH_TOOL_RESULT("tool_search_tool_result")` - - - `class BetaMcpToolUseBlock:` - - - `String id` - - - `Input input` - - - `String name` - - The name of the MCP tool - - - `String serverName` - - The name of the MCP server - - - `JsonValue; type "mcp_tool_use"constant` - - - `MCP_TOOL_USE("mcp_tool_use")` - - - `class BetaMcpToolResultBlock:` - - - `Content content` - - - `String` - - - `List` - - - `Optional> citations` - - Citations supporting the text block. - - The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. - - - `class BetaCitationCharLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `Optional fileId` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `Optional fileId` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `Optional fileId` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationsWebSearchResultLocation:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocation:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `boolean isError` - - - `String toolUseId` - - - `JsonValue; type "mcp_tool_result"constant` - - - `MCP_TOOL_RESULT("mcp_tool_result")` - - - `class BetaContainerUploadBlock:` - - Response model for a file uploaded to the container. - - - `String fileId` - - - `JsonValue; type "container_upload"constant` - - - `CONTAINER_UPLOAD("container_upload")` - - - `class BetaCompactionBlock:` - - A compaction block returned when autocompact is triggered. - - When content is None, it indicates the compaction failed to produce a valid - summary (e.g., malformed output from the model). Clients may round-trip - compaction blocks with null content; the server treats them as no-ops. - - - `Optional content` - - Summary of compacted content, or null if compaction failed - - - `JsonValue; type "compaction"constant` - - - `COMPACTION("compaction")` - - - `Optional contextManagement` - - Context management response. - - Information about context management strategies applied during the request. - - - `List appliedEdits` - - List of context management edits that were applied. - - - `class BetaClearToolUses20250919EditResponse:` - - - `long clearedInputTokens` - - Number of input tokens cleared by this edit. - - - `long clearedToolUses` - - Number of tool uses that were cleared. - - - `JsonValue; type "clear_tool_uses_20250919"constant` - - The type of context management edit applied. - - - `CLEAR_TOOL_USES_20250919("clear_tool_uses_20250919")` - - - `class BetaClearThinking20251015EditResponse:` - - - `long clearedInputTokens` - - Number of input tokens cleared by this edit. - - - `long clearedThinkingTurns` - - Number of thinking turns that were cleared. - - - `JsonValue; type "clear_thinking_20251015"constant` - - The type of context management edit applied. - - - `CLEAR_THINKING_20251015("clear_thinking_20251015")` - - - `Model model` - - The model that will complete your prompt. - - See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - - Most intelligent model for building agents and coding - - - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` - - Best combination of speed and intelligence - - - `CLAUDE_HAIKU_4_5("claude-haiku-4-5")` - - Fastest model with near-frontier intelligence - - - `CLAUDE_HAIKU_4_5_20251001("claude-haiku-4-5-20251001")` - - Fastest model with near-frontier intelligence - - - `CLAUDE_OPUS_4_5("claude-opus-4-5")` - - Premium model combining maximum intelligence with practical performance - - - `CLAUDE_OPUS_4_5_20251101("claude-opus-4-5-20251101")` - - Premium model combining maximum intelligence with practical performance - - - `CLAUDE_SONNET_4_5("claude-sonnet-4-5")` - - High-performance model for agents and coding - - - `CLAUDE_SONNET_4_5_20250929("claude-sonnet-4-5-20250929")` - - High-performance model for agents and coding - - - `CLAUDE_OPUS_4_1("claude-opus-4-1")` - - Exceptional model for specialized complex tasks - - - `CLAUDE_OPUS_4_1_20250805("claude-opus-4-1-20250805")` - - Exceptional model for specialized complex tasks - - - `CLAUDE_OPUS_4_0("claude-opus-4-0")` - - Powerful model for complex tasks - - - `CLAUDE_OPUS_4_20250514("claude-opus-4-20250514")` - - Powerful model for complex tasks - - - `CLAUDE_SONNET_4_0("claude-sonnet-4-0")` - - High-performance model with extended thinking - - - `CLAUDE_SONNET_4_20250514("claude-sonnet-4-20250514")` - - High-performance model with extended thinking - - - `CLAUDE_3_HAIKU_20240307("claude-3-haiku-20240307")` - - Fast and cost-effective model - - - `JsonValue; role "assistant"constant` - - Conversational role of the generated message. - - This will always be `"assistant"`. - - - `ASSISTANT("assistant")` - - - `Optional stopDetails` - - Structured information about a refusal. - - - `Optional category` - - The policy category that triggered the refusal. - - `null` when the refusal doesn't map to a named category. - - - `CYBER("cyber")` - - - `BIO("bio")` - - - `Optional explanation` - - Human-readable explanation of the refusal. - - This text is not guaranteed to be stable. `null` when no explanation is available for the category. - - - `JsonValue; type "refusal"constant` - - - `REFUSAL("refusal")` - - - `Optional stopReason` - - The reason that we stopped. - - This may be one the following values: - - * `"end_turn"`: the model reached a natural stopping point - * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum - * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated - * `"tool_use"`: the model invoked one or more tools - * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. - * `"refusal"`: when streaming classifiers intervene to handle potential policy violations - - In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. - - - `END_TURN("end_turn")` - - - `MAX_TOKENS("max_tokens")` - - - `STOP_SEQUENCE("stop_sequence")` - - - `TOOL_USE("tool_use")` - - - `PAUSE_TURN("pause_turn")` - - - `COMPACTION("compaction")` - - - `REFUSAL("refusal")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED("model_context_window_exceeded")` - - - `Optional stopSequence` - - Which custom stop sequence was generated, if any. - - This value will be a non-null string if one of your custom stop sequences was generated. - - - `JsonValue; type "message"constant` - - Object type. - - For Messages, this is always `"message"`. - - - `MESSAGE("message")` - - - `BetaUsage usage` - - Billing and rate-limit usage. - - Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. - - Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. - - For example, `output_tokens` will be non-zero, even for an empty string response from Claude. - - Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `Optional cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `Optional cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `Optional inferenceGeo` - - The geographic region where inference was performed for this request. - - - `long inputTokens` - - The number of input tokens which were used. - - - `Optional> iterations` - - Per-iteration token usage breakdown. - - Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: - - - Determine which iterations exceeded long context thresholds (>=200k tokens) - - Calculate the true context window size from the last iteration - - Understand token accumulation across server-side tool use loops - - - `class BetaMessageIterationUsage:` - - Token usage for a sampling iteration. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `long cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `long cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `long inputTokens` - - The number of input tokens which were used. - - - `long outputTokens` - - The number of output tokens which were used. - - - `JsonValue; type "message"constant` - - Usage for a sampling iteration - - - `MESSAGE("message")` - - - `class BetaCompactionIterationUsage:` - - Token usage for a compaction iteration. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `long cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `long cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `long inputTokens` - - The number of input tokens which were used. - - - `long outputTokens` - - The number of output tokens which were used. - - - `JsonValue; type "compaction"constant` - - Usage for a compaction iteration - - - `COMPACTION("compaction")` - - - `long outputTokens` - - The number of output tokens which were used. - - - `Optional serverToolUse` - - The number of server tool requests. - - - `long webFetchRequests` - - The number of web fetch tool requests. - - - `long webSearchRequests` - - The number of web search tool requests. - - - `Optional serviceTier` - - If the request used the priority, standard, or batch tier. - - - `STANDARD("standard")` - - - `PRIORITY("priority")` - - - `BATCH("batch")` - - - `Optional speed` - - The inference speed mode used for this request. - - - `STANDARD("standard")` - - - `FAST("fast")` - - - `JsonValue; type "succeeded"constant` - - - `SUCCEEDED("succeeded")` - - - `class BetaMessageBatchErroredResult:` - - - `BetaErrorResponse error` - - - `BetaError error` - - - `class BetaInvalidRequestError:` - - - `String message` - - - `JsonValue; type "invalid_request_error"constant` - - - `INVALID_REQUEST_ERROR("invalid_request_error")` - - - `class BetaAuthenticationError:` - - - `String message` - - - `JsonValue; type "authentication_error"constant` - - - `AUTHENTICATION_ERROR("authentication_error")` - - - `class BetaBillingError:` - - - `String message` - - - `JsonValue; type "billing_error"constant` - - - `BILLING_ERROR("billing_error")` - - - `class BetaPermissionError:` - - - `String message` - - - `JsonValue; type "permission_error"constant` - - - `PERMISSION_ERROR("permission_error")` - - - `class BetaNotFoundError:` - - - `String message` - - - `JsonValue; type "not_found_error"constant` - - - `NOT_FOUND_ERROR("not_found_error")` - - - `class BetaRateLimitError:` - - - `String message` - - - `JsonValue; type "rate_limit_error"constant` - - - `RATE_LIMIT_ERROR("rate_limit_error")` - - - `class BetaGatewayTimeoutError:` - - - `String message` - - - `JsonValue; type "timeout_error"constant` - - - `TIMEOUT_ERROR("timeout_error")` - - - `class BetaApiError:` - - - `String message` - - - `JsonValue; type "api_error"constant` - - - `API_ERROR("api_error")` - - - `class BetaOverloadedError:` - - - `String message` - - - `JsonValue; type "overloaded_error"constant` - - - `OVERLOADED_ERROR("overloaded_error")` - - - `Optional requestId` - - - `JsonValue; type "error"constant` - - - `ERROR("error")` - - - `JsonValue; type "errored"constant` - - - `ERRORED("errored")` - - - `class BetaMessageBatchCanceledResult:` - - - `JsonValue; type "canceled"constant` - - - `CANCELED("canceled")` - - - `class BetaMessageBatchExpiredResult:` - - - `JsonValue; type "expired"constant` - - - `EXPIRED("expired")` - -### Beta Message Batch Succeeded Result - -- `class BetaMessageBatchSucceededResult:` - - - `BetaMessage message` - - - `String id` - - Unique object identifier. - - The format and length of IDs may change over time. - - - `Optional container` - - Information about the container used in the request (for the code execution tool) - - - `String id` - - Identifier for the container used in this request - - - `LocalDateTime expiresAt` - - The time at which the container will expire. - - - `Optional> skills` - - Skills loaded in the container - - - `String skillId` - - Skill ID - - - `Type type` - - Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) - - - `ANTHROPIC("anthropic")` - - - `CUSTOM("custom")` - - - `String version` - - Skill version or 'latest' for most recent version - - - `List content` - - Content generated by the model. - - This is an array of content blocks, each of which has a `type` that determines its shape. - - Example: - - ```json - [{"type": "text", "text": "Hi, I'm Claude."}] - ``` - - If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. - - For example, if the input `messages` were: - - ```json - [ - {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, - {"role": "assistant", "content": "The best answer is ("} - ] - ``` - - Then the response `content` might be: - - ```json - [{"type": "text", "text": "B)"}] - ``` - - - `class BetaTextBlock:` - - - `Optional> citations` - - Citations supporting the text block. - - The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. - - - `class BetaCitationCharLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `Optional fileId` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `Optional fileId` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `Optional fileId` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationsWebSearchResultLocation:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocation:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `class BetaThinkingBlock:` - - - `String signature` - - - `String thinking` - - - `JsonValue; type "thinking"constant` - - - `THINKING("thinking")` - - - `class BetaRedactedThinkingBlock:` - - - `String data` - - - `JsonValue; type "redacted_thinking"constant` - - - `REDACTED_THINKING("redacted_thinking")` - - - `class BetaToolUseBlock:` - - - `String id` - - - `Input input` - - - `String name` - - - `JsonValue; type "tool_use"constant` - - - `TOOL_USE("tool_use")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaServerToolUseBlock:` - - - `String id` - - - `Input input` - - - `Name name` - - - `WEB_SEARCH("web_search")` - - - `WEB_FETCH("web_fetch")` - - - `CODE_EXECUTION("code_execution")` - - - `BASH_CODE_EXECUTION("bash_code_execution")` - - - `TEXT_EDITOR_CODE_EXECUTION("text_editor_code_execution")` - - - `TOOL_SEARCH_TOOL_REGEX("tool_search_tool_regex")` - - - `TOOL_SEARCH_TOOL_BM25("tool_search_tool_bm25")` - - - `JsonValue; type "server_tool_use"constant` - - - `SERVER_TOOL_USE("server_tool_use")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaWebSearchToolResultBlock:` - - - `BetaWebSearchToolResultBlockContent content` - - - `class BetaWebSearchToolResultError:` - - - `BetaWebSearchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `QUERY_TOO_LONG("query_too_long")` - - - `REQUEST_TOO_LARGE("request_too_large")` - - - `JsonValue; type "web_search_tool_result_error"constant` - - - `WEB_SEARCH_TOOL_RESULT_ERROR("web_search_tool_result_error")` - - - `List` - - - `String encryptedContent` - - - `Optional pageAge` - - - `String title` - - - `JsonValue; type "web_search_result"constant` - - - `WEB_SEARCH_RESULT("web_search_result")` - - - `String url` - - - `String toolUseId` - - - `JsonValue; type "web_search_tool_result"constant` - - - `WEB_SEARCH_TOOL_RESULT("web_search_tool_result")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaWebFetchToolResultBlock:` - - - `Content content` - - - `class BetaWebFetchToolResultErrorBlock:` - - - `BetaWebFetchToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `URL_TOO_LONG("url_too_long")` - - - `URL_NOT_ALLOWED("url_not_allowed")` - - - `URL_NOT_ACCESSIBLE("url_not_accessible")` - - - `UNSUPPORTED_CONTENT_TYPE("unsupported_content_type")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `MAX_USES_EXCEEDED("max_uses_exceeded")` - - - `UNAVAILABLE("unavailable")` - - - `JsonValue; type "web_fetch_tool_result_error"constant` - - - `WEB_FETCH_TOOL_RESULT_ERROR("web_fetch_tool_result_error")` - - - `class BetaWebFetchBlock:` - - - `BetaDocumentBlock content` - - - `Optional citations` - - Citation configuration for the document - - - `boolean enabled` - - - `Source source` - - - `class BetaBase64PdfSource:` - - - `String data` - - - `JsonValue; mediaType "application/pdf"constant` - - - `APPLICATION_PDF("application/pdf")` - - - `JsonValue; type "base64"constant` - - - `BASE64("base64")` - - - `class BetaPlainTextSource:` - - - `String data` - - - `JsonValue; mediaType "text/plain"constant` - - - `TEXT_PLAIN("text/plain")` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `Optional title` - - The title of the document - - - `JsonValue; type "document"constant` - - - `DOCUMENT("document")` - - - `Optional retrievedAt` - - ISO 8601 timestamp when the content was retrieved - - - `JsonValue; type "web_fetch_result"constant` - - - `WEB_FETCH_RESULT("web_fetch_result")` - - - `String url` - - Fetched content URL - - - `String toolUseId` - - - `JsonValue; type "web_fetch_tool_result"constant` - - - `WEB_FETCH_TOOL_RESULT("web_fetch_tool_result")` - - - `Optional caller` - - Tool invocation directly from the model. - - - `class BetaDirectCaller:` - - Tool invocation directly from the model. - - - `JsonValue; type "direct"constant` - - - `DIRECT("direct")` - - - `class BetaServerToolCaller:` - - Tool invocation generated by a server-side tool. - - - `String toolId` - - - `JsonValue; type "code_execution_20250825"constant` - - - `CODE_EXECUTION_20250825("code_execution_20250825")` - - - `class BetaServerToolCaller20260120:` - - - `String toolId` - - - `JsonValue; type "code_execution_20260120"constant` - - - `CODE_EXECUTION_20260120("code_execution_20260120")` - - - `class BetaCodeExecutionToolResultBlock:` - - - `BetaCodeExecutionToolResultBlockContent content` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `class BetaCodeExecutionToolResultError:` - - - `BetaCodeExecutionToolResultErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `JsonValue; type "code_execution_tool_result_error"constant` - - - `CODE_EXECUTION_TOOL_RESULT_ERROR("code_execution_tool_result_error")` - - - `class BetaCodeExecutionResultBlock:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "code_execution_result"constant` - - - `CODE_EXECUTION_RESULT("code_execution_result")` - - - `class BetaEncryptedCodeExecutionResultBlock:` - - Code execution result with encrypted stdout for PFC + web_search results. - - - `List content` - - - `String fileId` - - - `JsonValue; type "code_execution_output"constant` - - - `CODE_EXECUTION_OUTPUT("code_execution_output")` - - - `String encryptedStdout` - - - `long returnCode` - - - `String stderr` - - - `JsonValue; type "encrypted_code_execution_result"constant` - - - `ENCRYPTED_CODE_EXECUTION_RESULT("encrypted_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "code_execution_tool_result"constant` - - - `CODE_EXECUTION_TOOL_RESULT("code_execution_tool_result")` - - - `class BetaBashCodeExecutionToolResultBlock:` - - - `Content content` - - - `class BetaBashCodeExecutionToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `OUTPUT_FILE_TOO_LARGE("output_file_too_large")` - - - `JsonValue; type "bash_code_execution_tool_result_error"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT_ERROR("bash_code_execution_tool_result_error")` - - - `class BetaBashCodeExecutionResultBlock:` - - - `List content` - - - `String fileId` - - - `JsonValue; type "bash_code_execution_output"constant` - - - `BASH_CODE_EXECUTION_OUTPUT("bash_code_execution_output")` - - - `long returnCode` - - - `String stderr` - - - `String stdout` - - - `JsonValue; type "bash_code_execution_result"constant` - - - `BASH_CODE_EXECUTION_RESULT("bash_code_execution_result")` - - - `String toolUseId` - - - `JsonValue; type "bash_code_execution_tool_result"constant` - - - `BASH_CODE_EXECUTION_TOOL_RESULT("bash_code_execution_tool_result")` - - - `class BetaTextEditorCodeExecutionToolResultBlock:` - - - `Content content` - - - `class BetaTextEditorCodeExecutionToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `FILE_NOT_FOUND("file_not_found")` - - - `Optional errorMessage` - - - `JsonValue; type "text_editor_code_execution_tool_result_error"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT_ERROR("text_editor_code_execution_tool_result_error")` - - - `class BetaTextEditorCodeExecutionViewResultBlock:` - - - `String content` - - - `FileType fileType` - - - `TEXT("text")` - - - `IMAGE("image")` - - - `PDF("pdf")` - - - `Optional numLines` - - - `Optional startLine` - - - `Optional totalLines` - - - `JsonValue; type "text_editor_code_execution_view_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_VIEW_RESULT("text_editor_code_execution_view_result")` - - - `class BetaTextEditorCodeExecutionCreateResultBlock:` - - - `boolean isFileUpdate` - - - `JsonValue; type "text_editor_code_execution_create_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_CREATE_RESULT("text_editor_code_execution_create_result")` - - - `class BetaTextEditorCodeExecutionStrReplaceResultBlock:` - - - `Optional> lines` - - - `Optional newLines` - - - `Optional newStart` - - - `Optional oldLines` - - - `Optional oldStart` - - - `JsonValue; type "text_editor_code_execution_str_replace_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_STR_REPLACE_RESULT("text_editor_code_execution_str_replace_result")` - - - `String toolUseId` - - - `JsonValue; type "text_editor_code_execution_tool_result"constant` - - - `TEXT_EDITOR_CODE_EXECUTION_TOOL_RESULT("text_editor_code_execution_tool_result")` - - - `class BetaToolSearchToolResultBlock:` - - - `Content content` - - - `class BetaToolSearchToolResultError:` - - - `ErrorCode errorCode` - - - `INVALID_TOOL_INPUT("invalid_tool_input")` - - - `UNAVAILABLE("unavailable")` - - - `TOO_MANY_REQUESTS("too_many_requests")` - - - `EXECUTION_TIME_EXCEEDED("execution_time_exceeded")` - - - `Optional errorMessage` - - - `JsonValue; type "tool_search_tool_result_error"constant` - - - `TOOL_SEARCH_TOOL_RESULT_ERROR("tool_search_tool_result_error")` - - - `class BetaToolSearchToolSearchResultBlock:` - - - `List toolReferences` - - - `String toolName` - - - `JsonValue; type "tool_reference"constant` - - - `TOOL_REFERENCE("tool_reference")` - - - `JsonValue; type "tool_search_tool_search_result"constant` - - - `TOOL_SEARCH_TOOL_SEARCH_RESULT("tool_search_tool_search_result")` - - - `String toolUseId` - - - `JsonValue; type "tool_search_tool_result"constant` - - - `TOOL_SEARCH_TOOL_RESULT("tool_search_tool_result")` - - - `class BetaMcpToolUseBlock:` - - - `String id` - - - `Input input` - - - `String name` - - The name of the MCP tool - - - `String serverName` - - The name of the MCP server - - - `JsonValue; type "mcp_tool_use"constant` - - - `MCP_TOOL_USE("mcp_tool_use")` - - - `class BetaMcpToolResultBlock:` - - - `Content content` - - - `String` - - - `List` - - - `Optional> citations` - - Citations supporting the text block. - - The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. - - - `class BetaCitationCharLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endCharIndex` - - - `Optional fileId` - - - `long startCharIndex` - - - `JsonValue; type "char_location"constant` - - - `CHAR_LOCATION("char_location")` - - - `class BetaCitationPageLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endPageNumber` - - - `Optional fileId` - - - `long startPageNumber` - - - `JsonValue; type "page_location"constant` - - - `PAGE_LOCATION("page_location")` - - - `class BetaCitationContentBlockLocation:` - - - `String citedText` - - - `long documentIndex` - - - `Optional documentTitle` - - - `long endBlockIndex` - - - `Optional fileId` - - - `long startBlockIndex` - - - `JsonValue; type "content_block_location"constant` - - - `CONTENT_BLOCK_LOCATION("content_block_location")` - - - `class BetaCitationsWebSearchResultLocation:` - - - `String citedText` - - - `String encryptedIndex` - - - `Optional title` - - - `JsonValue; type "web_search_result_location"constant` - - - `WEB_SEARCH_RESULT_LOCATION("web_search_result_location")` - - - `String url` - - - `class BetaCitationSearchResultLocation:` - - - `String citedText` - - - `long endBlockIndex` - - - `long searchResultIndex` - - - `String source` - - - `long startBlockIndex` - - - `Optional title` - - - `JsonValue; type "search_result_location"constant` - - - `SEARCH_RESULT_LOCATION("search_result_location")` - - - `String text` - - - `JsonValue; type "text"constant` - - - `TEXT("text")` - - - `boolean isError` - - - `String toolUseId` - - - `JsonValue; type "mcp_tool_result"constant` - - - `MCP_TOOL_RESULT("mcp_tool_result")` - - - `class BetaContainerUploadBlock:` - - Response model for a file uploaded to the container. - - - `String fileId` - - - `JsonValue; type "container_upload"constant` - - - `CONTAINER_UPLOAD("container_upload")` - - - `class BetaCompactionBlock:` - - A compaction block returned when autocompact is triggered. - - When content is None, it indicates the compaction failed to produce a valid - summary (e.g., malformed output from the model). Clients may round-trip - compaction blocks with null content; the server treats them as no-ops. - - - `Optional content` - - Summary of compacted content, or null if compaction failed - - - `JsonValue; type "compaction"constant` - - - `COMPACTION("compaction")` - - - `Optional contextManagement` - - Context management response. - - Information about context management strategies applied during the request. - - - `List appliedEdits` - - List of context management edits that were applied. - - - `class BetaClearToolUses20250919EditResponse:` - - - `long clearedInputTokens` - - Number of input tokens cleared by this edit. - - - `long clearedToolUses` - - Number of tool uses that were cleared. - - - `JsonValue; type "clear_tool_uses_20250919"constant` - - The type of context management edit applied. - - - `CLEAR_TOOL_USES_20250919("clear_tool_uses_20250919")` - - - `class BetaClearThinking20251015EditResponse:` - - - `long clearedInputTokens` - - Number of input tokens cleared by this edit. - - - `long clearedThinkingTurns` - - Number of thinking turns that were cleared. - - - `JsonValue; type "clear_thinking_20251015"constant` - - The type of context management edit applied. - - - `CLEAR_THINKING_20251015("clear_thinking_20251015")` - - - `Model model` - - The model that will complete your prompt. - - See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - - Most intelligent model for building agents and coding - - - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` - - Best combination of speed and intelligence - - - `CLAUDE_HAIKU_4_5("claude-haiku-4-5")` - - Fastest model with near-frontier intelligence - - - `CLAUDE_HAIKU_4_5_20251001("claude-haiku-4-5-20251001")` - - Fastest model with near-frontier intelligence - - - `CLAUDE_OPUS_4_5("claude-opus-4-5")` - - Premium model combining maximum intelligence with practical performance - - - `CLAUDE_OPUS_4_5_20251101("claude-opus-4-5-20251101")` - - Premium model combining maximum intelligence with practical performance - - - `CLAUDE_SONNET_4_5("claude-sonnet-4-5")` - - High-performance model for agents and coding - - - `CLAUDE_SONNET_4_5_20250929("claude-sonnet-4-5-20250929")` - - High-performance model for agents and coding - - - `CLAUDE_OPUS_4_1("claude-opus-4-1")` - - Exceptional model for specialized complex tasks - - - `CLAUDE_OPUS_4_1_20250805("claude-opus-4-1-20250805")` - - Exceptional model for specialized complex tasks - - - `CLAUDE_OPUS_4_0("claude-opus-4-0")` - - Powerful model for complex tasks - - - `CLAUDE_OPUS_4_20250514("claude-opus-4-20250514")` - - Powerful model for complex tasks - - - `CLAUDE_SONNET_4_0("claude-sonnet-4-0")` - - High-performance model with extended thinking - - - `CLAUDE_SONNET_4_20250514("claude-sonnet-4-20250514")` - - High-performance model with extended thinking - - - `CLAUDE_3_HAIKU_20240307("claude-3-haiku-20240307")` - - Fast and cost-effective model - - - `JsonValue; role "assistant"constant` - - Conversational role of the generated message. - - This will always be `"assistant"`. - - - `ASSISTANT("assistant")` - - - `Optional stopDetails` - - Structured information about a refusal. - - - `Optional category` - - The policy category that triggered the refusal. - - `null` when the refusal doesn't map to a named category. - - - `CYBER("cyber")` - - - `BIO("bio")` - - - `Optional explanation` - - Human-readable explanation of the refusal. - - This text is not guaranteed to be stable. `null` when no explanation is available for the category. - - - `JsonValue; type "refusal"constant` - - - `REFUSAL("refusal")` - - - `Optional stopReason` - - The reason that we stopped. - - This may be one the following values: - - * `"end_turn"`: the model reached a natural stopping point - * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum - * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated - * `"tool_use"`: the model invoked one or more tools - * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. - * `"refusal"`: when streaming classifiers intervene to handle potential policy violations - - In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. - - - `END_TURN("end_turn")` - - - `MAX_TOKENS("max_tokens")` - - - `STOP_SEQUENCE("stop_sequence")` - - - `TOOL_USE("tool_use")` - - - `PAUSE_TURN("pause_turn")` - - - `COMPACTION("compaction")` - - - `REFUSAL("refusal")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED("model_context_window_exceeded")` - - - `Optional stopSequence` - - Which custom stop sequence was generated, if any. - - This value will be a non-null string if one of your custom stop sequences was generated. - - - `JsonValue; type "message"constant` - - Object type. - - For Messages, this is always `"message"`. - - - `MESSAGE("message")` - - - `BetaUsage usage` - - Billing and rate-limit usage. - - Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. - - Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. - - For example, `output_tokens` will be non-zero, even for an empty string response from Claude. - - Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `Optional cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `Optional cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `Optional inferenceGeo` - - The geographic region where inference was performed for this request. - - - `long inputTokens` - - The number of input tokens which were used. - - - `Optional> iterations` - - Per-iteration token usage breakdown. - - Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to: - - - Determine which iterations exceeded long context thresholds (>=200k tokens) - - Calculate the true context window size from the last iteration - - Understand token accumulation across server-side tool use loops - - - `class BetaMessageIterationUsage:` - - Token usage for a sampling iteration. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `long cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `long cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `long inputTokens` - - The number of input tokens which were used. - - - `long outputTokens` - - The number of output tokens which were used. - - - `JsonValue; type "message"constant` - - Usage for a sampling iteration - - - `MESSAGE("message")` - - - `class BetaCompactionIterationUsage:` - - Token usage for a compaction iteration. - - - `Optional cacheCreation` - - Breakdown of cached tokens by TTL - - - `long ephemeral1hInputTokens` - - The number of input tokens used to create the 1 hour cache entry. - - - `long ephemeral5mInputTokens` - - The number of input tokens used to create the 5 minute cache entry. - - - `long cacheCreationInputTokens` - - The number of input tokens used to create the cache entry. - - - `long cacheReadInputTokens` - - The number of input tokens read from the cache. - - - `long inputTokens` - - The number of input tokens which were used. - - - `long outputTokens` - - The number of output tokens which were used. - - - `JsonValue; type "compaction"constant` - - Usage for a compaction iteration - - - `COMPACTION("compaction")` - - - `long outputTokens` - - The number of output tokens which were used. - - - `Optional serverToolUse` - - The number of server tool requests. - - - `long webFetchRequests` - - The number of web fetch tool requests. - - - `long webSearchRequests` - - The number of web search tool requests. - - - `Optional serviceTier` - - If the request used the priority, standard, or batch tier. - - - `STANDARD("standard")` - - - `PRIORITY("priority")` - - - `BATCH("batch")` - - - `Optional speed` - - The inference speed mode used for this request. - - - `STANDARD("standard")` - - - `FAST("fast")` - - - `JsonValue; type "succeeded"constant` - - - `SUCCEEDED("succeeded")` - -# Files - -## Upload - -`FileMetadata beta().files().upload(FileUploadParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` - -**post** `/v1/files` - -Upload File - -### Parameters - -- `FileUploadParams params` - - - `Optional> betas` - - Optional header to specify the beta version(s) you want to use. - - - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` - - - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` - - - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` - - - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` - - - `PDFS_2024_09_25("pdfs-2024-09-25")` - - - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` - - - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` - - - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` - - - `FILES_API_2025_04_14("files-api-2025-04-14")` - - - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` - - - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` - - - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` - - - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` - - - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` - - - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` - - - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` - - - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` - - - `SKILLS_2025_10_02("skills-2025-10-02")` - - - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` - - - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - - - `String file` - - The file to upload - -### Returns - -- `class FileMetadata:` - - - `String id` - - Unique object identifier. - - The format and length of IDs may change over time. - - - `LocalDateTime createdAt` - - RFC 3339 datetime string representing when the file was created. - - - `String filename` - - Original filename of the uploaded file. - - - `String mimeType` - - MIME type of the file. - - - `long sizeBytes` - - Size of the file in bytes. - - - `JsonValue; type "file"constant` - - Object type. - - For files, this is always `"file"`. - - - `FILE("file")` - - - `Optional downloadable` - - Whether the file can be downloaded. - -### Example - -```java -package com.anthropic.example; - -import com.anthropic.client.AnthropicClient; -import com.anthropic.client.okhttp.AnthropicOkHttpClient; -import com.anthropic.models.beta.files.FileMetadata; -import com.anthropic.models.beta.files.FileUploadParams; -import java.io.ByteArrayInputStream; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - AnthropicClient client = AnthropicOkHttpClient.fromEnv(); - - FileUploadParams params = FileUploadParams.builder() - .file(new ByteArrayInputStream("Example data".getBytes())) - .build(); - FileMetadata fileMetadata = client.beta().files().upload(params); - } -} -``` - -## List - -`FileListPage beta().files().list(FileListParamsparams = FileListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` - -**get** `/v1/files` - -List Files - -### Parameters - -- `FileListParams params` - - - `Optional afterId` - - ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object. - - - `Optional beforeId` - - ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object. - - - `Optional limit` - - Number of items to return per page. - - Defaults to `20`. Ranges from `1` to `1000`. - - - `Optional> betas` - - Optional header to specify the beta version(s) you want to use. - - - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` - - - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` - - - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` - - - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` - - - `PDFS_2024_09_25("pdfs-2024-09-25")` - - - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` - - - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` - - - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` - - - `FILES_API_2025_04_14("files-api-2025-04-14")` - - - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` - - - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` - - - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` - - - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` - - - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` - - - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` - - - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` - - - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` - - - `SKILLS_2025_10_02("skills-2025-10-02")` - - - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` - - - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - -### Returns - -- `class FileMetadata:` - - - `String id` - - Unique object identifier. - - The format and length of IDs may change over time. - - - `LocalDateTime createdAt` - - RFC 3339 datetime string representing when the file was created. - - - `String filename` - - Original filename of the uploaded file. - - - `String mimeType` - - MIME type of the file. - - - `long sizeBytes` - - Size of the file in bytes. - - - `JsonValue; type "file"constant` - - Object type. - - For files, this is always `"file"`. - - - `FILE("file")` - - - `Optional downloadable` - - Whether the file can be downloaded. - -### Example - -```java -package com.anthropic.example; - -import com.anthropic.client.AnthropicClient; -import com.anthropic.client.okhttp.AnthropicOkHttpClient; -import com.anthropic.models.beta.files.FileListPage; -import com.anthropic.models.beta.files.FileListParams; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - AnthropicClient client = AnthropicOkHttpClient.fromEnv(); - - FileListPage page = client.beta().files().list(); - } -} -``` - -## Download - -`HttpResponse beta().files().download(FileDownloadParamsparams = FileDownloadParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` - -**get** `/v1/files/{file_id}/content` - -Download File - -### Parameters - -- `FileDownloadParams params` - - - `Optional fileId` - - ID of the File. - - - `Optional> betas` - - Optional header to specify the beta version(s) you want to use. - - - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` - - - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` - - - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` - - - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` - - - `PDFS_2024_09_25("pdfs-2024-09-25")` - - - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` - - - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` - - - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` - - - `FILES_API_2025_04_14("files-api-2025-04-14")` - - - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` - - - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` - - - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` - - - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` - - - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` - - - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` - - - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` - - - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` - - - `SKILLS_2025_10_02("skills-2025-10-02")` - - - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` - - - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - -### Example - -```java -package com.anthropic.example; - -import com.anthropic.client.AnthropicClient; -import com.anthropic.client.okhttp.AnthropicOkHttpClient; -import com.anthropic.core.http.HttpResponse; -import com.anthropic.models.beta.files.FileDownloadParams; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - AnthropicClient client = AnthropicOkHttpClient.fromEnv(); - - HttpResponse response = client.beta().files().download("file_id"); - } -} -``` - -## Retrieve Metadata - -`FileMetadata beta().files().retrieveMetadata(FileRetrieveMetadataParamsparams = FileRetrieveMetadataParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` - -**get** `/v1/files/{file_id}` - -Get File Metadata - -### Parameters - -- `FileRetrieveMetadataParams params` - - - `Optional fileId` - - ID of the File. - - - `Optional> betas` - - Optional header to specify the beta version(s) you want to use. - - - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` - - - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` - - - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` - - - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` - - - `PDFS_2024_09_25("pdfs-2024-09-25")` - - - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` - - - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` - - - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` - - - `FILES_API_2025_04_14("files-api-2025-04-14")` - - - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` - - - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` - - - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` - - - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` - - - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` - - - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` - - - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` - - - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` - - - `SKILLS_2025_10_02("skills-2025-10-02")` - - - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` - - - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - -### Returns - -- `class FileMetadata:` - - - `String id` - - Unique object identifier. - - The format and length of IDs may change over time. - - - `LocalDateTime createdAt` - - RFC 3339 datetime string representing when the file was created. - - - `String filename` - - Original filename of the uploaded file. - - - `String mimeType` - - MIME type of the file. - - - `long sizeBytes` - - Size of the file in bytes. - - - `JsonValue; type "file"constant` - - Object type. - - For files, this is always `"file"`. - - - `FILE("file")` - - - `Optional downloadable` - - Whether the file can be downloaded. - -### Example - -```java -package com.anthropic.example; - -import com.anthropic.client.AnthropicClient; -import com.anthropic.client.okhttp.AnthropicOkHttpClient; -import com.anthropic.models.beta.files.FileMetadata; -import com.anthropic.models.beta.files.FileRetrieveMetadataParams; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - AnthropicClient client = AnthropicOkHttpClient.fromEnv(); - - FileMetadata fileMetadata = client.beta().files().retrieveMetadata("file_id"); - } -} -``` - -## Delete - -`DeletedFile beta().files().delete(FileDeleteParamsparams = FileDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` - -**delete** `/v1/files/{file_id}` - -Delete File - -### Parameters - -- `FileDeleteParams params` - - - `Optional fileId` - - ID of the File. - - - `Optional> betas` - - Optional header to specify the beta version(s) you want to use. - - - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` - - - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` - - - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` - - - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` - - - `PDFS_2024_09_25("pdfs-2024-09-25")` - - - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` - - - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` - - - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` - - - `FILES_API_2025_04_14("files-api-2025-04-14")` - - - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` - - - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` - - - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` - - - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` - - - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` - - - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` - - - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` - - - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` - - - `SKILLS_2025_10_02("skills-2025-10-02")` - - - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` - - - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - -### Returns - -- `class DeletedFile:` - - - `String id` - - ID of the deleted file. - - - `Optional type` - - Deleted object type. - - For file deletion, this is always `"file_deleted"`. - - - `FILE_DELETED("file_deleted")` - -### Example - -```java -package com.anthropic.example; - -import com.anthropic.client.AnthropicClient; -import com.anthropic.client.okhttp.AnthropicOkHttpClient; -import com.anthropic.models.beta.files.DeletedFile; -import com.anthropic.models.beta.files.FileDeleteParams; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - AnthropicClient client = AnthropicOkHttpClient.fromEnv(); - - DeletedFile deletedFile = client.beta().files().delete("file_id"); - } -} -``` - -## Domain Types - -### Deleted File - -- `class DeletedFile:` - - - `String id` - - ID of the deleted file. - - - `Optional type` - - Deleted object type. - - For file deletion, this is always `"file_deleted"`. - - - `FILE_DELETED("file_deleted")` - -### File Metadata - -- `class FileMetadata:` - - - `String id` - - Unique object identifier. - - The format and length of IDs may change over time. - - - `LocalDateTime createdAt` - - RFC 3339 datetime string representing when the file was created. - - - `String filename` - - Original filename of the uploaded file. - - - `String mimeType` - - MIME type of the file. - - - `long sizeBytes` - - Size of the file in bytes. - - - `JsonValue; type "file"constant` - - Object type. - - For files, this is always `"file"`. - - - `FILE("file")` - - - `Optional downloadable` - - Whether the file can be downloaded. - -# Skills - -## Create - -`SkillCreateResponse beta().skills().create(SkillCreateParamsparams = SkillCreateParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` - -**post** `/v1/skills` - -Create Skill - -### Parameters - -- `SkillCreateParams params` - - - `Optional> betas` - - Optional header to specify the beta version(s) you want to use. - - - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` - - - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` - - - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` - - - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` - - - `PDFS_2024_09_25("pdfs-2024-09-25")` - - - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` - - - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` - - - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` - - - `FILES_API_2025_04_14("files-api-2025-04-14")` - - - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` - - - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` - - - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` - - - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` - - - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` - - - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` - - - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` - - - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` - - - `SKILLS_2025_10_02("skills-2025-10-02")` - - - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` - - - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - - - `Optional displayTitle` - - Display title for the skill. - - This is a human-readable label that is not included in the prompt sent to the model. - - - `Optional> files` - - Files to upload for the skill. - - All files must be in the same top-level directory and must include a SKILL.md file at the root of that directory. - -### Returns - -- `class SkillCreateResponse:` - - - `String id` - - Unique identifier for the skill. - - The format and length of IDs may change over time. - - - `String createdAt` - - ISO 8601 timestamp of when the skill was created. - - - `Optional displayTitle` - - Display title for the skill. - - This is a human-readable label that is not included in the prompt sent to the model. - - - `Optional latestVersion` - - The latest version identifier for the skill. - - This represents the most recent version of the skill that has been created. - - - `String source` - - Source of the skill. - - This may be one of the following values: - - * `"custom"`: the skill was created by a user - * `"anthropic"`: the skill was created by Anthropic - - - `String type` - - Object type. - - For Skills, this is always `"skill"`. - - - `String updatedAt` - - ISO 8601 timestamp of when the skill was last updated. - -### Example - -```java -package com.anthropic.example; - -import com.anthropic.client.AnthropicClient; -import com.anthropic.client.okhttp.AnthropicOkHttpClient; -import com.anthropic.models.beta.skills.SkillCreateParams; -import com.anthropic.models.beta.skills.SkillCreateResponse; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - AnthropicClient client = AnthropicOkHttpClient.fromEnv(); - - SkillCreateResponse skill = client.beta().skills().create(); - } -} -``` - -## List - -`SkillListPage beta().skills().list(SkillListParamsparams = SkillListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` - -**get** `/v1/skills` - -List Skills - -### Parameters - -- `SkillListParams params` - - - `Optional limit` - - Number of results to return per page. - - Maximum value is 100. Defaults to 20. - - - `Optional page` - - Pagination token for fetching a specific page of results. - - Pass the value from a previous response's `next_page` field to get the next page of results. - - - `Optional source` - - Filter skills by source. - - If provided, only skills from the specified source will be returned: - - * `"custom"`: only return user-created skills - * `"anthropic"`: only return Anthropic-created skills - - - `Optional> betas` - - Optional header to specify the beta version(s) you want to use. - - - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` - - - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` - - - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` - - - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` - - - `PDFS_2024_09_25("pdfs-2024-09-25")` - - - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` - - - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` - - - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` - - - `FILES_API_2025_04_14("files-api-2025-04-14")` - - - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` - - - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` - - - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` - - - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` - - - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` - - - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` - - - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` - - - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` - - - `SKILLS_2025_10_02("skills-2025-10-02")` - - - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` - - - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - -### Returns - -- `class SkillListResponse:` - - - `String id` - - Unique identifier for the skill. - - The format and length of IDs may change over time. - - - `String createdAt` - - ISO 8601 timestamp of when the skill was created. - - - `Optional displayTitle` - - Display title for the skill. - - This is a human-readable label that is not included in the prompt sent to the model. - - - `Optional latestVersion` - - The latest version identifier for the skill. - - This represents the most recent version of the skill that has been created. - - - `String source` - - Source of the skill. - - This may be one of the following values: - - * `"custom"`: the skill was created by a user - * `"anthropic"`: the skill was created by Anthropic - - - `String type` - - Object type. - - For Skills, this is always `"skill"`. - - - `String updatedAt` - - ISO 8601 timestamp of when the skill was last updated. - -### Example - -```java -package com.anthropic.example; - -import com.anthropic.client.AnthropicClient; -import com.anthropic.client.okhttp.AnthropicOkHttpClient; -import com.anthropic.models.beta.skills.SkillListPage; -import com.anthropic.models.beta.skills.SkillListParams; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - AnthropicClient client = AnthropicOkHttpClient.fromEnv(); - - SkillListPage page = client.beta().skills().list(); - } -} -``` - -## Retrieve - -`SkillRetrieveResponse beta().skills().retrieve(SkillRetrieveParamsparams = SkillRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` - -**get** `/v1/skills/{skill_id}` - -Get Skill - -### Parameters - -- `SkillRetrieveParams params` - - - `Optional skillId` - - Unique identifier for the skill. - - The format and length of IDs may change over time. - - - `Optional> betas` - - Optional header to specify the beta version(s) you want to use. - - - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` - - - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` - - - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` - - - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` - - - `PDFS_2024_09_25("pdfs-2024-09-25")` - - - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` - - - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` - - - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` - - - `FILES_API_2025_04_14("files-api-2025-04-14")` - - - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` - - - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` - - - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` - - - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` - - - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` - - - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` - - - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` - - - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` - - - `SKILLS_2025_10_02("skills-2025-10-02")` - - - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` - - - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - -### Returns - -- `class SkillRetrieveResponse:` - - - `String id` - - Unique identifier for the skill. - - The format and length of IDs may change over time. - - - `String createdAt` - - ISO 8601 timestamp of when the skill was created. - - - `Optional displayTitle` - - Display title for the skill. - - This is a human-readable label that is not included in the prompt sent to the model. - - - `Optional latestVersion` - - The latest version identifier for the skill. - - This represents the most recent version of the skill that has been created. - - - `String source` - - Source of the skill. - - This may be one of the following values: - - * `"custom"`: the skill was created by a user - * `"anthropic"`: the skill was created by Anthropic - - - `String type` - - Object type. - - For Skills, this is always `"skill"`. - - - `String updatedAt` - - ISO 8601 timestamp of when the skill was last updated. - -### Example - -```java -package com.anthropic.example; - -import com.anthropic.client.AnthropicClient; -import com.anthropic.client.okhttp.AnthropicOkHttpClient; -import com.anthropic.models.beta.skills.SkillRetrieveParams; -import com.anthropic.models.beta.skills.SkillRetrieveResponse; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - AnthropicClient client = AnthropicOkHttpClient.fromEnv(); - - SkillRetrieveResponse skill = client.beta().skills().retrieve("skill_id"); - } -} -``` - -## Delete - -`SkillDeleteResponse beta().skills().delete(SkillDeleteParamsparams = SkillDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` - -**delete** `/v1/skills/{skill_id}` - -Delete Skill - -### Parameters - -- `SkillDeleteParams params` - - - `Optional skillId` - - Unique identifier for the skill. - - The format and length of IDs may change over time. - - - `Optional> betas` - - Optional header to specify the beta version(s) you want to use. - - - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` - - - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` - - - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` - - - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` - - - `PDFS_2024_09_25("pdfs-2024-09-25")` - - - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` - - - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` - - - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` - - - `FILES_API_2025_04_14("files-api-2025-04-14")` - - - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` - - - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` - - - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` - - - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` - - - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` - - - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` - - - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` - - - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` - - - `SKILLS_2025_10_02("skills-2025-10-02")` - - - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` - - - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - -### Returns - -- `class SkillDeleteResponse:` - - - `String id` - - Unique identifier for the skill. - - The format and length of IDs may change over time. - - - `String type` - - Deleted object type. - - For Skills, this is always `"skill_deleted"`. - -### Example - -```java -package com.anthropic.example; - -import com.anthropic.client.AnthropicClient; -import com.anthropic.client.okhttp.AnthropicOkHttpClient; -import com.anthropic.models.beta.skills.SkillDeleteParams; -import com.anthropic.models.beta.skills.SkillDeleteResponse; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - AnthropicClient client = AnthropicOkHttpClient.fromEnv(); - - SkillDeleteResponse skill = client.beta().skills().delete("skill_id"); - } -} -``` - -# Versions - -## Create - -`VersionCreateResponse beta().skills().versions().create(VersionCreateParamsparams = VersionCreateParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` - -**post** `/v1/skills/{skill_id}/versions` - -Create Skill Version - -### Parameters - -- `VersionCreateParams params` - - - `Optional skillId` - - Unique identifier for the skill. - - The format and length of IDs may change over time. - - - `Optional> betas` - - Optional header to specify the beta version(s) you want to use. - - - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` - - - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` - - - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` - - - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` - - - `PDFS_2024_09_25("pdfs-2024-09-25")` - - - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` - - - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` - - - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` - - - `FILES_API_2025_04_14("files-api-2025-04-14")` - - - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` - - - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` - - - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` - - - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` - - - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` - - - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` - - - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` - - - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` - - - `SKILLS_2025_10_02("skills-2025-10-02")` - - - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` - - - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - - - `Optional> files` - - Files to upload for the skill. - - All files must be in the same top-level directory and must include a SKILL.md file at the root of that directory. - -### Returns - -- `class VersionCreateResponse:` - - - `String id` - - Unique identifier for the skill version. - - The format and length of IDs may change over time. - - - `String createdAt` - - ISO 8601 timestamp of when the skill version was created. - - - `String description` - - Description of the skill version. - - This is extracted from the SKILL.md file in the skill upload. - - - `String directory` - - Directory name of the skill version. - - This is the top-level directory name that was extracted from the uploaded files. - - - `String name` - - Human-readable name of the skill version. - - This is extracted from the SKILL.md file in the skill upload. - - - `String skillId` - - Identifier for the skill that this version belongs to. - - - `String type` - - Object type. - - For Skill Versions, this is always `"skill_version"`. - - - `String version` - - Version identifier for the skill. - - Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). - -### Example - -```java -package com.anthropic.example; - -import com.anthropic.client.AnthropicClient; -import com.anthropic.client.okhttp.AnthropicOkHttpClient; -import com.anthropic.models.beta.skills.versions.VersionCreateParams; -import com.anthropic.models.beta.skills.versions.VersionCreateResponse; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - AnthropicClient client = AnthropicOkHttpClient.fromEnv(); - - VersionCreateResponse version = client.beta().skills().versions().create("skill_id"); - } -} -``` - -## List - -`VersionListPage beta().skills().versions().list(VersionListParamsparams = VersionListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` - -**get** `/v1/skills/{skill_id}/versions` - -List Skill Versions - -### Parameters - -- `VersionListParams params` - - - `Optional skillId` - - Unique identifier for the skill. - - The format and length of IDs may change over time. - - - `Optional limit` - - Number of items to return per page. - - Defaults to `20`. Ranges from `1` to `1000`. - - - `Optional page` - - Optionally set to the `next_page` token from the previous response. - - - `Optional> betas` - - Optional header to specify the beta version(s) you want to use. - - - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` - - - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` - - - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` - - - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` - - - `PDFS_2024_09_25("pdfs-2024-09-25")` - - - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` - - - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` - - - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` - - - `FILES_API_2025_04_14("files-api-2025-04-14")` - - - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` - - - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` - - - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` - - - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` - - - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` - - - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` - - - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` - - - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` - - - `SKILLS_2025_10_02("skills-2025-10-02")` - - - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` - - - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - -### Returns - -- `class VersionListResponse:` - - - `String id` - - Unique identifier for the skill version. - - The format and length of IDs may change over time. - - - `String createdAt` - - ISO 8601 timestamp of when the skill version was created. - - - `String description` - - Description of the skill version. - - This is extracted from the SKILL.md file in the skill upload. - - - `String directory` - - Directory name of the skill version. - - This is the top-level directory name that was extracted from the uploaded files. - - - `String name` - - Human-readable name of the skill version. - - This is extracted from the SKILL.md file in the skill upload. - - - `String skillId` - - Identifier for the skill that this version belongs to. - - - `String type` - - Object type. - - For Skill Versions, this is always `"skill_version"`. - - - `String version` - - Version identifier for the skill. - - Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). - -### Example - -```java -package com.anthropic.example; - -import com.anthropic.client.AnthropicClient; -import com.anthropic.client.okhttp.AnthropicOkHttpClient; -import com.anthropic.models.beta.skills.versions.VersionListPage; -import com.anthropic.models.beta.skills.versions.VersionListParams; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - AnthropicClient client = AnthropicOkHttpClient.fromEnv(); - - VersionListPage page = client.beta().skills().versions().list("skill_id"); - } -} -``` - -## Retrieve - -`VersionRetrieveResponse beta().skills().versions().retrieve(VersionRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` - -**get** `/v1/skills/{skill_id}/versions/{version}` - -Get Skill Version - -### Parameters - -- `VersionRetrieveParams params` - - - `String skillId` - - Unique identifier for the skill. - - The format and length of IDs may change over time. - - - `Optional version` - - Version identifier for the skill. - - Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). - - - `Optional> betas` - - Optional header to specify the beta version(s) you want to use. - - - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` - - - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` - - - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` - - - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` - - - `PDFS_2024_09_25("pdfs-2024-09-25")` - - - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` - - - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` - - - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` - - - `FILES_API_2025_04_14("files-api-2025-04-14")` - - - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` - - - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` - - - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` - - - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` - - - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` - - - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` - - - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` - - - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` - - - `SKILLS_2025_10_02("skills-2025-10-02")` - - - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` - - - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - -### Returns - -- `class VersionRetrieveResponse:` - - - `String id` - - Unique identifier for the skill version. - - The format and length of IDs may change over time. - - - `String createdAt` - - ISO 8601 timestamp of when the skill version was created. - - - `String description` - - Description of the skill version. - - This is extracted from the SKILL.md file in the skill upload. - - - `String directory` - - Directory name of the skill version. - - This is the top-level directory name that was extracted from the uploaded files. - - - `String name` - - Human-readable name of the skill version. - - This is extracted from the SKILL.md file in the skill upload. - - - `String skillId` - - Identifier for the skill that this version belongs to. - - - `String type` - - Object type. - - For Skill Versions, this is always `"skill_version"`. - - - `String version` - - Version identifier for the skill. - - Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). - -### Example - -```java -package com.anthropic.example; - -import com.anthropic.client.AnthropicClient; -import com.anthropic.client.okhttp.AnthropicOkHttpClient; -import com.anthropic.models.beta.skills.versions.VersionRetrieveParams; -import com.anthropic.models.beta.skills.versions.VersionRetrieveResponse; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - AnthropicClient client = AnthropicOkHttpClient.fromEnv(); - - VersionRetrieveParams params = VersionRetrieveParams.builder() - .skillId("skill_id") - .version("version") - .build(); - VersionRetrieveResponse version = client.beta().skills().versions().retrieve(params); - } -} -``` - -## Delete - -`VersionDeleteResponse beta().skills().versions().delete(VersionDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` - -**delete** `/v1/skills/{skill_id}/versions/{version}` - -Delete Skill Version - -### Parameters - -- `VersionDeleteParams params` - - - `String skillId` - - Unique identifier for the skill. - - The format and length of IDs may change over time. - - - `Optional version` - - Version identifier for the skill. - - Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). - - - `Optional> betas` - - Optional header to specify the beta version(s) you want to use. - - - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` - - - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` - - - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` - - - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` - - - `PDFS_2024_09_25("pdfs-2024-09-25")` - - - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` - - - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` - - - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` - - - `FILES_API_2025_04_14("files-api-2025-04-14")` - - - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` - - - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` - - - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` - - - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` - - - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` - - - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` - - - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` - - - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` - - - `SKILLS_2025_10_02("skills-2025-10-02")` - - - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` - - - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - -### Returns - -- `class VersionDeleteResponse:` - - - `String id` - - Version identifier for the skill. - - Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). - - - `String type` - - Deleted object type. - - For Skill Versions, this is always `"skill_version_deleted"`. - -### Example - -```java -package com.anthropic.example; - -import com.anthropic.client.AnthropicClient; -import com.anthropic.client.okhttp.AnthropicOkHttpClient; -import com.anthropic.models.beta.skills.versions.VersionDeleteParams; -import com.anthropic.models.beta.skills.versions.VersionDeleteResponse; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - AnthropicClient client = AnthropicOkHttpClient.fromEnv(); - - VersionDeleteParams params = VersionDeleteParams.builder() - .skillId("skill_id") - .version("version") - .build(); - VersionDeleteResponse version = client.beta().skills().versions().delete(params); - } -} -``` - -# User Profiles - -## Create - -`BetaUserProfile beta().userProfiles().create(UserProfileCreateParamsparams = UserProfileCreateParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` - -**post** `/v1/user_profiles` - -Create User Profile - -### Parameters - -- `UserProfileCreateParams params` - - - `Optional> betas` - - Optional header to specify the beta version(s) you want to use. - - - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` - - - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` - - - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` - - - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` - - - `PDFS_2024_09_25("pdfs-2024-09-25")` - - - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` - - - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` - - - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` - - - `FILES_API_2025_04_14("files-api-2025-04-14")` - - - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` - - - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` - - - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` - - - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` - - - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` - - - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` - - - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` - - - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` - - - `SKILLS_2025_10_02("skills-2025-10-02")` - - - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` - - - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - - - `Optional externalId` - - - `Optional metadata` - - Free-form key-value data to attach to this user profile. Maximum 16 keys, with keys up to 64 characters and values up to 512 characters. Values must be non-empty strings. - -### Returns - -- `class BetaUserProfile:` - - - `String id` - - - `LocalDateTime createdAt` - - A timestamp in RFC 3339 format - - - `Metadata metadata` - - - `TrustGrants trustGrants` - - - `String status` - - - `String type` - - - `LocalDateTime updatedAt` - - A timestamp in RFC 3339 format - - - `Optional externalId` - -### Example - -```java -package com.anthropic.example; - -import com.anthropic.client.AnthropicClient; -import com.anthropic.client.okhttp.AnthropicOkHttpClient; -import com.anthropic.models.beta.userprofiles.BetaUserProfile; -import com.anthropic.models.beta.userprofiles.UserProfileCreateParams; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - AnthropicClient client = AnthropicOkHttpClient.fromEnv(); - - BetaUserProfile betaUserProfile = client.beta().userProfiles().create(); - } -} -``` - -## List - -`UserProfileListPage beta().userProfiles().list(UserProfileListParamsparams = UserProfileListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` - -**get** `/v1/user_profiles` - -List User Profiles - -### Parameters - -- `UserProfileListParams params` - - - `Optional limit` - - Query parameter for limit - - - `Optional order` - - Query parameter for order - - - `ASC("asc")` - - - `DESC("desc")` - - - `Optional page` - - Query parameter for page - - - `Optional> betas` - - Optional header to specify the beta version(s) you want to use. - - - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` - - - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` - - - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` - - - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` - - - `PDFS_2024_09_25("pdfs-2024-09-25")` - - - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` - - - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` - - - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` - - - `FILES_API_2025_04_14("files-api-2025-04-14")` - - - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` - - - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` - - - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` - - - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` - - - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` - - - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` - - - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` - - - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` - - - `SKILLS_2025_10_02("skills-2025-10-02")` - - - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` - - - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - -### Returns - -- `class BetaUserProfile:` - - - `String id` - - - `LocalDateTime createdAt` - - A timestamp in RFC 3339 format - - - `Metadata metadata` - - - `TrustGrants trustGrants` - - - `String status` - - - `String type` - - - `LocalDateTime updatedAt` - - A timestamp in RFC 3339 format - - - `Optional externalId` - -### Example - -```java -package com.anthropic.example; - -import com.anthropic.client.AnthropicClient; -import com.anthropic.client.okhttp.AnthropicOkHttpClient; -import com.anthropic.models.beta.userprofiles.UserProfileListPage; -import com.anthropic.models.beta.userprofiles.UserProfileListParams; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - AnthropicClient client = AnthropicOkHttpClient.fromEnv(); - - UserProfileListPage page = client.beta().userProfiles().list(); - } -} -``` - -## Retrieve - -`BetaUserProfile beta().userProfiles().retrieve(UserProfileRetrieveParamsparams = UserProfileRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` - -**get** `/v1/user_profiles/{id}` - -Get User Profile - -### Parameters - -- `UserProfileRetrieveParams params` - - - `Optional id` - - - `Optional> betas` - - Optional header to specify the beta version(s) you want to use. - - - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` - - - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` - - - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` - - - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` - - - `PDFS_2024_09_25("pdfs-2024-09-25")` - - - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` - - - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` - - - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` - - - `FILES_API_2025_04_14("files-api-2025-04-14")` - - - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` - - - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` - - - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` - - - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` - - - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` - - - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` - - - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` - - - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` - - - `SKILLS_2025_10_02("skills-2025-10-02")` - - - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` - - - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - -### Returns - -- `class BetaUserProfile:` - - - `String id` - - - `LocalDateTime createdAt` - - A timestamp in RFC 3339 format - - - `Metadata metadata` - - - `TrustGrants trustGrants` - - - `String status` - - - `String type` - - - `LocalDateTime updatedAt` - - A timestamp in RFC 3339 format - - - `Optional externalId` - -### Example - -```java -package com.anthropic.example; - -import com.anthropic.client.AnthropicClient; -import com.anthropic.client.okhttp.AnthropicOkHttpClient; -import com.anthropic.models.beta.userprofiles.BetaUserProfile; -import com.anthropic.models.beta.userprofiles.UserProfileRetrieveParams; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - AnthropicClient client = AnthropicOkHttpClient.fromEnv(); - - BetaUserProfile betaUserProfile = client.beta().userProfiles().retrieve("id"); - } -} -``` - -## Update - -`BetaUserProfile beta().userProfiles().update(UserProfileUpdateParamsparams = UserProfileUpdateParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` - -**post** `/v1/user_profiles/{id}` - -Update User Profile - -### Parameters - -- `UserProfileUpdateParams params` - - - `Optional id` - - - `Optional> betas` - - Optional header to specify the beta version(s) you want to use. - - - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` - - - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` - - - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` - - - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` - - - `PDFS_2024_09_25("pdfs-2024-09-25")` - - - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` - - - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` - - - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` - - - `FILES_API_2025_04_14("files-api-2025-04-14")` - - - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` - - - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` - - - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` - - - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` - - - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` - - - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` - - - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` - - - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` - - - `SKILLS_2025_10_02("skills-2025-10-02")` - - - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` - - - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - - - `Optional externalId` - - - `Optional metadata` - - Key-value pairs to merge into the stored metadata. Keys provided overwrite existing values. To remove a key, set its value to an empty string. Keys not provided are left unchanged. Maximum 16 keys, with keys up to 64 characters and values up to 512 characters. - -### Returns - -- `class BetaUserProfile:` - - - `String id` - - - `LocalDateTime createdAt` - - A timestamp in RFC 3339 format - - - `Metadata metadata` - - - `TrustGrants trustGrants` - - - `String status` - - - `String type` - - - `LocalDateTime updatedAt` - - A timestamp in RFC 3339 format - - - `Optional externalId` - -### Example - -```java -package com.anthropic.example; - -import com.anthropic.client.AnthropicClient; -import com.anthropic.client.okhttp.AnthropicOkHttpClient; -import com.anthropic.models.beta.userprofiles.BetaUserProfile; -import com.anthropic.models.beta.userprofiles.UserProfileUpdateParams; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - AnthropicClient client = AnthropicOkHttpClient.fromEnv(); - - BetaUserProfile betaUserProfile = client.beta().userProfiles().update("id"); - } -} -``` - -## Create Enrollment URL - -`BetaUserProfileEnrollmentUrl beta().userProfiles().createEnrollmentUrl(UserProfileCreateEnrollmentUrlParamsparams = UserProfileCreateEnrollmentUrlParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` - -**post** `/v1/user_profiles/{id}/enrollment_url` - -Create Enrollment URL - -### Parameters - -- `UserProfileCreateEnrollmentUrlParams params` - - - `Optional id` - - - `Optional> betas` - - Optional header to specify the beta version(s) you want to use. - - - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` - - - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` - - - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` - - - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` - - - `PDFS_2024_09_25("pdfs-2024-09-25")` - - - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` - - - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` - - - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` - - - `FILES_API_2025_04_14("files-api-2025-04-14")` - - - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` - - - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` - - - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` - - - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` - - - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` - - - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` - - - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` - - - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` - - - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` - - - `SKILLS_2025_10_02("skills-2025-10-02")` - - - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` - - - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - -### Returns - -- `class BetaUserProfileEnrollmentUrl:` - - - `LocalDateTime expiresAt` - - A timestamp in RFC 3339 format - - - `String type` - - - `String url` - -### Example - -```java -package com.anthropic.example; - -import com.anthropic.client.AnthropicClient; -import com.anthropic.client.okhttp.AnthropicOkHttpClient; -import com.anthropic.models.beta.userprofiles.BetaUserProfileEnrollmentUrl; -import com.anthropic.models.beta.userprofiles.UserProfileCreateEnrollmentUrlParams; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - AnthropicClient client = AnthropicOkHttpClient.fromEnv(); - - BetaUserProfileEnrollmentUrl betaUserProfileEnrollmentUrl = client.beta().userProfiles().createEnrollmentUrl("id"); - } -} -``` - -## Domain Types - -### Beta User Profile - -- `class BetaUserProfile:` - - - `String id` - - - `LocalDateTime createdAt` - - A timestamp in RFC 3339 format - - - `Metadata metadata` - - - `TrustGrants trustGrants` - - - `String status` - - - `String type` - - - `LocalDateTime updatedAt` - - A timestamp in RFC 3339 format - - - `Optional externalId` - -### Beta User Profile Enrollment URL - -- `class BetaUserProfileEnrollmentUrl:` - - - `LocalDateTime expiresAt` - - A timestamp in RFC 3339 format - - - `String type` - - - `String url` - -### Beta User Profile Trust Grant - -- `class BetaUserProfileTrustGrant:` - - - `String status` +Not Found - Claude API Docs
                                                                                              \ No newline at end of file diff --git a/content/en/api/java/beta/agents.md b/content/en/api/java/beta/agents.md new file mode 100644 index 000000000..6036c1e1e --- /dev/null +++ b/content/en/api/java/beta/agents.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                \ No newline at end of file diff --git a/content/en/api/java/beta/agents/archive.md b/content/en/api/java/beta/agents/archive.md new file mode 100644 index 000000000..c4899b5fa --- /dev/null +++ b/content/en/api/java/beta/agents/archive.md @@ -0,0 +1,370 @@ +## Archive + +`BetaManagedAgentsAgent beta().agents().archive(AgentArchiveParamsparams = AgentArchiveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/agents/{agent_id}/archive` + +Archive Agent + +### Parameters + +- `AgentArchiveParams params` + + - `Optional agentId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsAgent:` + + A Managed Agents `agent`. + + - `String id` + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `Optional description` + + - `List mcpServers` + + - `String name` + + - `Type type` + + - `URL("url")` + + - `String url` + + - `Metadata metadata` + + - `BetaManagedAgentsModelConfig model` + + Model identifier and configuration. + + - `BetaManagedAgentsModel id` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` + + Most intelligent model for building agents and coding + + - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` + + Best combination of speed and intelligence + + - `CLAUDE_HAIKU_4_5("claude-haiku-4-5")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_HAIKU_4_5_20251001("claude-haiku-4-5-20251001")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_OPUS_4_5("claude-opus-4-5")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_OPUS_4_5_20251101("claude-opus-4-5-20251101")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_SONNET_4_5("claude-sonnet-4-5")` + + High-performance model for agents and coding + + - `CLAUDE_SONNET_4_5_20250929("claude-sonnet-4-5-20250929")` + + High-performance model for agents and coding + + - `Optional speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `STANDARD("standard")` + + - `FAST("fast")` + + - `String name` + + - `List skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `String skillId` + + - `Type type` + + - `ANTHROPIC("anthropic")` + + - `String version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `String skillId` + + - `Type type` + + - `CUSTOM("custom")` + + - `String version` + + - `Optional system` + + - `List tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `List configs` + + - `boolean enabled` + + - `Name name` + + Built-in agent tool identifier. + + - `BASH("bash")` + + - `EDIT("edit")` + + - `READ("read")` + + - `WRITE("write")` + + - `GLOB("glob")` + + - `GREP("grep")` + + - `WEB_FETCH("web_fetch")` + + - `WEB_SEARCH("web_search")` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsAgentToolsetDefaultConfig defaultConfig` + + Resolved default configuration for agent tools. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `Type type` + + - `AGENT_TOOLSET_20260401("agent_toolset_20260401")` + + - `class BetaManagedAgentsMcpToolset:` + + - `List configs` + + - `boolean enabled` + + - `String name` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsMcpToolsetDefaultConfig defaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `String mcpServerName` + + - `Type type` + + - `MCP_TOOLSET("mcp_toolset")` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `String description` + + - `BetaManagedAgentsCustomToolInputSchema inputSchema` + + JSON Schema for custom tool input parameters. + + - `Optional properties` + + JSON Schema properties defining the tool's input parameters. + + - `Optional> required` + + List of required property names. + + - `Optional type` + + Must be 'object' for tool input schemas. + + - `OBJECT("object")` + + - `String name` + + - `Type type` + + - `CUSTOM("custom")` + + - `Type type` + + - `AGENT("agent")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `long version` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.agents.AgentArchiveParams; +import com.anthropic.models.beta.agents.BetaManagedAgentsAgent; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BetaManagedAgentsAgent betaManagedAgentsAgent = client.beta().agents().archive("agent_011CZkYpogX7uDKUyvBTophP"); + } +} +``` diff --git a/content/en/api/java/beta/agents/create.md b/content/en/api/java/beta/agents/create.md new file mode 100644 index 000000000..103817a7f --- /dev/null +++ b/content/en/api/java/beta/agents/create.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                  \ No newline at end of file diff --git a/content/en/api/java/beta/agents/list.md b/content/en/api/java/beta/agents/list.md new file mode 100644 index 000000000..8b527699f --- /dev/null +++ b/content/en/api/java/beta/agents/list.md @@ -0,0 +1,388 @@ +## List + +`AgentListPage beta().agents().list(AgentListParamsparams = AgentListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/agents` + +List Agents + +### Parameters + +- `AgentListParams params` + + - `Optional createdAtGte` + + Return agents created at or after this time (inclusive). + + - `Optional createdAtLte` + + Return agents created at or before this time (inclusive). + + - `Optional includeArchived` + + Include archived agents in results. Defaults to false. + + - `Optional limit` + + Maximum results per page. Default 20, maximum 100. + + - `Optional page` + + Opaque pagination cursor from a previous response. + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsAgent:` + + A Managed Agents `agent`. + + - `String id` + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `Optional description` + + - `List mcpServers` + + - `String name` + + - `Type type` + + - `URL("url")` + + - `String url` + + - `Metadata metadata` + + - `BetaManagedAgentsModelConfig model` + + Model identifier and configuration. + + - `BetaManagedAgentsModel id` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` + + Most intelligent model for building agents and coding + + - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` + + Best combination of speed and intelligence + + - `CLAUDE_HAIKU_4_5("claude-haiku-4-5")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_HAIKU_4_5_20251001("claude-haiku-4-5-20251001")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_OPUS_4_5("claude-opus-4-5")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_OPUS_4_5_20251101("claude-opus-4-5-20251101")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_SONNET_4_5("claude-sonnet-4-5")` + + High-performance model for agents and coding + + - `CLAUDE_SONNET_4_5_20250929("claude-sonnet-4-5-20250929")` + + High-performance model for agents and coding + + - `Optional speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `STANDARD("standard")` + + - `FAST("fast")` + + - `String name` + + - `List skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `String skillId` + + - `Type type` + + - `ANTHROPIC("anthropic")` + + - `String version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `String skillId` + + - `Type type` + + - `CUSTOM("custom")` + + - `String version` + + - `Optional system` + + - `List tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `List configs` + + - `boolean enabled` + + - `Name name` + + Built-in agent tool identifier. + + - `BASH("bash")` + + - `EDIT("edit")` + + - `READ("read")` + + - `WRITE("write")` + + - `GLOB("glob")` + + - `GREP("grep")` + + - `WEB_FETCH("web_fetch")` + + - `WEB_SEARCH("web_search")` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsAgentToolsetDefaultConfig defaultConfig` + + Resolved default configuration for agent tools. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `Type type` + + - `AGENT_TOOLSET_20260401("agent_toolset_20260401")` + + - `class BetaManagedAgentsMcpToolset:` + + - `List configs` + + - `boolean enabled` + + - `String name` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsMcpToolsetDefaultConfig defaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `String mcpServerName` + + - `Type type` + + - `MCP_TOOLSET("mcp_toolset")` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `String description` + + - `BetaManagedAgentsCustomToolInputSchema inputSchema` + + JSON Schema for custom tool input parameters. + + - `Optional properties` + + JSON Schema properties defining the tool's input parameters. + + - `Optional> required` + + List of required property names. + + - `Optional type` + + Must be 'object' for tool input schemas. + + - `OBJECT("object")` + + - `String name` + + - `Type type` + + - `CUSTOM("custom")` + + - `Type type` + + - `AGENT("agent")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `long version` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.agents.AgentListPage; +import com.anthropic.models.beta.agents.AgentListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + AgentListPage page = client.beta().agents().list(); + } +} +``` diff --git a/content/en/api/java/beta/agents/retrieve.md b/content/en/api/java/beta/agents/retrieve.md new file mode 100644 index 000000000..a91147c50 --- /dev/null +++ b/content/en/api/java/beta/agents/retrieve.md @@ -0,0 +1,374 @@ +## Retrieve + +`BetaManagedAgentsAgent beta().agents().retrieve(AgentRetrieveParamsparams = AgentRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/agents/{agent_id}` + +Get Agent + +### Parameters + +- `AgentRetrieveParams params` + + - `Optional agentId` + + - `Optional version` + + Agent version. Omit for the most recent version. Must be at least 1 if specified. + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsAgent:` + + A Managed Agents `agent`. + + - `String id` + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `Optional description` + + - `List mcpServers` + + - `String name` + + - `Type type` + + - `URL("url")` + + - `String url` + + - `Metadata metadata` + + - `BetaManagedAgentsModelConfig model` + + Model identifier and configuration. + + - `BetaManagedAgentsModel id` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` + + Most intelligent model for building agents and coding + + - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` + + Best combination of speed and intelligence + + - `CLAUDE_HAIKU_4_5("claude-haiku-4-5")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_HAIKU_4_5_20251001("claude-haiku-4-5-20251001")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_OPUS_4_5("claude-opus-4-5")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_OPUS_4_5_20251101("claude-opus-4-5-20251101")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_SONNET_4_5("claude-sonnet-4-5")` + + High-performance model for agents and coding + + - `CLAUDE_SONNET_4_5_20250929("claude-sonnet-4-5-20250929")` + + High-performance model for agents and coding + + - `Optional speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `STANDARD("standard")` + + - `FAST("fast")` + + - `String name` + + - `List skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `String skillId` + + - `Type type` + + - `ANTHROPIC("anthropic")` + + - `String version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `String skillId` + + - `Type type` + + - `CUSTOM("custom")` + + - `String version` + + - `Optional system` + + - `List tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `List configs` + + - `boolean enabled` + + - `Name name` + + Built-in agent tool identifier. + + - `BASH("bash")` + + - `EDIT("edit")` + + - `READ("read")` + + - `WRITE("write")` + + - `GLOB("glob")` + + - `GREP("grep")` + + - `WEB_FETCH("web_fetch")` + + - `WEB_SEARCH("web_search")` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsAgentToolsetDefaultConfig defaultConfig` + + Resolved default configuration for agent tools. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `Type type` + + - `AGENT_TOOLSET_20260401("agent_toolset_20260401")` + + - `class BetaManagedAgentsMcpToolset:` + + - `List configs` + + - `boolean enabled` + + - `String name` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsMcpToolsetDefaultConfig defaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `String mcpServerName` + + - `Type type` + + - `MCP_TOOLSET("mcp_toolset")` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `String description` + + - `BetaManagedAgentsCustomToolInputSchema inputSchema` + + JSON Schema for custom tool input parameters. + + - `Optional properties` + + JSON Schema properties defining the tool's input parameters. + + - `Optional> required` + + List of required property names. + + - `Optional type` + + Must be 'object' for tool input schemas. + + - `OBJECT("object")` + + - `String name` + + - `Type type` + + - `CUSTOM("custom")` + + - `Type type` + + - `AGENT("agent")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `long version` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.agents.AgentRetrieveParams; +import com.anthropic.models.beta.agents.BetaManagedAgentsAgent; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BetaManagedAgentsAgent betaManagedAgentsAgent = client.beta().agents().retrieve("agent_011CZkYpogX7uDKUyvBTophP"); + } +} +``` diff --git a/content/en/api/java/beta/agents/update.md b/content/en/api/java/beta/agents/update.md new file mode 100644 index 000000000..84d32cff9 --- /dev/null +++ b/content/en/api/java/beta/agents/update.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                    \ No newline at end of file diff --git a/content/en/api/java/beta/agents/versions.md b/content/en/api/java/beta/agents/versions.md new file mode 100644 index 000000000..bf2a18b61 --- /dev/null +++ b/content/en/api/java/beta/agents/versions.md @@ -0,0 +1,380 @@ +# Versions + +## List + +`VersionListPage beta().agents().versions().list(VersionListParamsparams = VersionListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/agents/{agent_id}/versions` + +List Agent Versions + +### Parameters + +- `VersionListParams params` + + - `Optional agentId` + + - `Optional limit` + + Maximum results per page. Default 20, maximum 100. + + - `Optional page` + + Opaque pagination cursor. + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsAgent:` + + A Managed Agents `agent`. + + - `String id` + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `Optional description` + + - `List mcpServers` + + - `String name` + + - `Type type` + + - `URL("url")` + + - `String url` + + - `Metadata metadata` + + - `BetaManagedAgentsModelConfig model` + + Model identifier and configuration. + + - `BetaManagedAgentsModel id` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` + + Most intelligent model for building agents and coding + + - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` + + Best combination of speed and intelligence + + - `CLAUDE_HAIKU_4_5("claude-haiku-4-5")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_HAIKU_4_5_20251001("claude-haiku-4-5-20251001")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_OPUS_4_5("claude-opus-4-5")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_OPUS_4_5_20251101("claude-opus-4-5-20251101")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_SONNET_4_5("claude-sonnet-4-5")` + + High-performance model for agents and coding + + - `CLAUDE_SONNET_4_5_20250929("claude-sonnet-4-5-20250929")` + + High-performance model for agents and coding + + - `Optional speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `STANDARD("standard")` + + - `FAST("fast")` + + - `String name` + + - `List skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `String skillId` + + - `Type type` + + - `ANTHROPIC("anthropic")` + + - `String version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `String skillId` + + - `Type type` + + - `CUSTOM("custom")` + + - `String version` + + - `Optional system` + + - `List tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `List configs` + + - `boolean enabled` + + - `Name name` + + Built-in agent tool identifier. + + - `BASH("bash")` + + - `EDIT("edit")` + + - `READ("read")` + + - `WRITE("write")` + + - `GLOB("glob")` + + - `GREP("grep")` + + - `WEB_FETCH("web_fetch")` + + - `WEB_SEARCH("web_search")` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsAgentToolsetDefaultConfig defaultConfig` + + Resolved default configuration for agent tools. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `Type type` + + - `AGENT_TOOLSET_20260401("agent_toolset_20260401")` + + - `class BetaManagedAgentsMcpToolset:` + + - `List configs` + + - `boolean enabled` + + - `String name` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsMcpToolsetDefaultConfig defaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `String mcpServerName` + + - `Type type` + + - `MCP_TOOLSET("mcp_toolset")` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `String description` + + - `BetaManagedAgentsCustomToolInputSchema inputSchema` + + JSON Schema for custom tool input parameters. + + - `Optional properties` + + JSON Schema properties defining the tool's input parameters. + + - `Optional> required` + + List of required property names. + + - `Optional type` + + Must be 'object' for tool input schemas. + + - `OBJECT("object")` + + - `String name` + + - `Type type` + + - `CUSTOM("custom")` + + - `Type type` + + - `AGENT("agent")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `long version` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.agents.versions.VersionListPage; +import com.anthropic.models.beta.agents.versions.VersionListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + VersionListPage page = client.beta().agents().versions().list("agent_011CZkYpogX7uDKUyvBTophP"); + } +} +``` diff --git a/content/en/api/java/beta/agents/versions/list.md b/content/en/api/java/beta/agents/versions/list.md new file mode 100644 index 000000000..224c3c229 --- /dev/null +++ b/content/en/api/java/beta/agents/versions/list.md @@ -0,0 +1,378 @@ +## List + +`VersionListPage beta().agents().versions().list(VersionListParamsparams = VersionListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/agents/{agent_id}/versions` + +List Agent Versions + +### Parameters + +- `VersionListParams params` + + - `Optional agentId` + + - `Optional limit` + + Maximum results per page. Default 20, maximum 100. + + - `Optional page` + + Opaque pagination cursor. + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsAgent:` + + A Managed Agents `agent`. + + - `String id` + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `Optional description` + + - `List mcpServers` + + - `String name` + + - `Type type` + + - `URL("url")` + + - `String url` + + - `Metadata metadata` + + - `BetaManagedAgentsModelConfig model` + + Model identifier and configuration. + + - `BetaManagedAgentsModel id` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` + + Most intelligent model for building agents and coding + + - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` + + Best combination of speed and intelligence + + - `CLAUDE_HAIKU_4_5("claude-haiku-4-5")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_HAIKU_4_5_20251001("claude-haiku-4-5-20251001")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_OPUS_4_5("claude-opus-4-5")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_OPUS_4_5_20251101("claude-opus-4-5-20251101")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_SONNET_4_5("claude-sonnet-4-5")` + + High-performance model for agents and coding + + - `CLAUDE_SONNET_4_5_20250929("claude-sonnet-4-5-20250929")` + + High-performance model for agents and coding + + - `Optional speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `STANDARD("standard")` + + - `FAST("fast")` + + - `String name` + + - `List skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `String skillId` + + - `Type type` + + - `ANTHROPIC("anthropic")` + + - `String version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `String skillId` + + - `Type type` + + - `CUSTOM("custom")` + + - `String version` + + - `Optional system` + + - `List tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `List configs` + + - `boolean enabled` + + - `Name name` + + Built-in agent tool identifier. + + - `BASH("bash")` + + - `EDIT("edit")` + + - `READ("read")` + + - `WRITE("write")` + + - `GLOB("glob")` + + - `GREP("grep")` + + - `WEB_FETCH("web_fetch")` + + - `WEB_SEARCH("web_search")` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsAgentToolsetDefaultConfig defaultConfig` + + Resolved default configuration for agent tools. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `Type type` + + - `AGENT_TOOLSET_20260401("agent_toolset_20260401")` + + - `class BetaManagedAgentsMcpToolset:` + + - `List configs` + + - `boolean enabled` + + - `String name` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsMcpToolsetDefaultConfig defaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `String mcpServerName` + + - `Type type` + + - `MCP_TOOLSET("mcp_toolset")` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `String description` + + - `BetaManagedAgentsCustomToolInputSchema inputSchema` + + JSON Schema for custom tool input parameters. + + - `Optional properties` + + JSON Schema properties defining the tool's input parameters. + + - `Optional> required` + + List of required property names. + + - `Optional type` + + Must be 'object' for tool input schemas. + + - `OBJECT("object")` + + - `String name` + + - `Type type` + + - `CUSTOM("custom")` + + - `Type type` + + - `AGENT("agent")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `long version` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.agents.versions.VersionListPage; +import com.anthropic.models.beta.agents.versions.VersionListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + VersionListPage page = client.beta().agents().versions().list("agent_011CZkYpogX7uDKUyvBTophP"); + } +} +``` diff --git a/content/en/api/java/beta/environments.md b/content/en/api/java/beta/environments.md new file mode 100644 index 000000000..73933ebbd --- /dev/null +++ b/content/en/api/java/beta/environments.md @@ -0,0 +1,1599 @@ +# Environments + +## Create + +`BetaEnvironment beta().environments().create(EnvironmentCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/environments` + +Create a new environment with the specified configuration. + +### Parameters + +- `EnvironmentCreateParams params` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + + - `String name` + + Human-readable name for the environment + + - `Optional config` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `Optional description` + + Optional description of the environment + + - `Optional metadata` + + User-provided metadata key-value pairs + +### Returns + +- `class BetaEnvironment:` + + Unified Environment resource for both cloud and BYOC environments. + + - `String id` + + Environment identifier (e.g., 'env_...') + + - `Optional archivedAt` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `BetaCloudConfig config` + + `cloud` environment configuration. + + - `Networking networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonValue; type "unrestricted"constant` + + Network policy type + + - `UNRESTRICTED("unrestricted")` + + - `class BetaLimitedNetwork:` + + Limited network access. + + - `boolean allowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `boolean allowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `List allowedHosts` + + Specifies domains the container can reach. + + - `JsonValue; type "limited"constant` + + Network policy type + + - `LIMITED("limited")` + + - `BetaPackages packages` + + Package manager configuration. + + - `List apt` + + Ubuntu/Debian packages to install + + - `List cargo` + + Rust packages to install + + - `List gem` + + Ruby packages to install + + - `List go` + + Go packages to install + + - `List npm` + + Node.js packages to install + + - `List pip` + + Python packages to install + + - `Optional type` + + Package configuration type + + - `PACKAGES("packages")` + + - `JsonValue; type "cloud"constant` + + Environment type + + - `CLOUD("cloud")` + + - `String createdAt` + + RFC 3339 timestamp when environment was created + + - `String description` + + User-provided description for the environment + + - `Metadata metadata` + + User-provided metadata key-value pairs + + - `String name` + + Human-readable name for the environment + + - `JsonValue; type "environment"constant` + + The type of object (always 'environment') + + - `ENVIRONMENT("environment")` + + - `String updatedAt` + + RFC 3339 timestamp when environment was last updated + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.environments.BetaEnvironment; +import com.anthropic.models.beta.environments.EnvironmentCreateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + EnvironmentCreateParams params = EnvironmentCreateParams.builder() + .name("python-data-analysis") + .build(); + BetaEnvironment betaEnvironment = client.beta().environments().create(params); + } +} +``` + +## List + +`EnvironmentListPage beta().environments().list(EnvironmentListParamsparams = EnvironmentListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/environments` + +List environments with pagination support. + +### Parameters + +- `EnvironmentListParams params` + + - `Optional includeArchived` + + Include archived environments in the response + + - `Optional limit` + + Maximum number of environments to return + + - `Optional page` + + Opaque cursor from previous response for pagination. Pass the `next_page` value from the previous response. + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaEnvironment:` + + Unified Environment resource for both cloud and BYOC environments. + + - `String id` + + Environment identifier (e.g., 'env_...') + + - `Optional archivedAt` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `BetaCloudConfig config` + + `cloud` environment configuration. + + - `Networking networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonValue; type "unrestricted"constant` + + Network policy type + + - `UNRESTRICTED("unrestricted")` + + - `class BetaLimitedNetwork:` + + Limited network access. + + - `boolean allowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `boolean allowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `List allowedHosts` + + Specifies domains the container can reach. + + - `JsonValue; type "limited"constant` + + Network policy type + + - `LIMITED("limited")` + + - `BetaPackages packages` + + Package manager configuration. + + - `List apt` + + Ubuntu/Debian packages to install + + - `List cargo` + + Rust packages to install + + - `List gem` + + Ruby packages to install + + - `List go` + + Go packages to install + + - `List npm` + + Node.js packages to install + + - `List pip` + + Python packages to install + + - `Optional type` + + Package configuration type + + - `PACKAGES("packages")` + + - `JsonValue; type "cloud"constant` + + Environment type + + - `CLOUD("cloud")` + + - `String createdAt` + + RFC 3339 timestamp when environment was created + + - `String description` + + User-provided description for the environment + + - `Metadata metadata` + + User-provided metadata key-value pairs + + - `String name` + + Human-readable name for the environment + + - `JsonValue; type "environment"constant` + + The type of object (always 'environment') + + - `ENVIRONMENT("environment")` + + - `String updatedAt` + + RFC 3339 timestamp when environment was last updated + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.environments.EnvironmentListPage; +import com.anthropic.models.beta.environments.EnvironmentListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + EnvironmentListPage page = client.beta().environments().list(); + } +} +``` + +## Retrieve + +`BetaEnvironment beta().environments().retrieve(EnvironmentRetrieveParamsparams = EnvironmentRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/environments/{environment_id}` + +Retrieve a specific environment by ID. + +### Parameters + +- `EnvironmentRetrieveParams params` + + - `Optional environmentId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaEnvironment:` + + Unified Environment resource for both cloud and BYOC environments. + + - `String id` + + Environment identifier (e.g., 'env_...') + + - `Optional archivedAt` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `BetaCloudConfig config` + + `cloud` environment configuration. + + - `Networking networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonValue; type "unrestricted"constant` + + Network policy type + + - `UNRESTRICTED("unrestricted")` + + - `class BetaLimitedNetwork:` + + Limited network access. + + - `boolean allowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `boolean allowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `List allowedHosts` + + Specifies domains the container can reach. + + - `JsonValue; type "limited"constant` + + Network policy type + + - `LIMITED("limited")` + + - `BetaPackages packages` + + Package manager configuration. + + - `List apt` + + Ubuntu/Debian packages to install + + - `List cargo` + + Rust packages to install + + - `List gem` + + Ruby packages to install + + - `List go` + + Go packages to install + + - `List npm` + + Node.js packages to install + + - `List pip` + + Python packages to install + + - `Optional type` + + Package configuration type + + - `PACKAGES("packages")` + + - `JsonValue; type "cloud"constant` + + Environment type + + - `CLOUD("cloud")` + + - `String createdAt` + + RFC 3339 timestamp when environment was created + + - `String description` + + User-provided description for the environment + + - `Metadata metadata` + + User-provided metadata key-value pairs + + - `String name` + + Human-readable name for the environment + + - `JsonValue; type "environment"constant` + + The type of object (always 'environment') + + - `ENVIRONMENT("environment")` + + - `String updatedAt` + + RFC 3339 timestamp when environment was last updated + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.environments.BetaEnvironment; +import com.anthropic.models.beta.environments.EnvironmentRetrieveParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BetaEnvironment betaEnvironment = client.beta().environments().retrieve("env_011CZkZ9X2dpNyB7HsEFoRfW"); + } +} +``` + +## Update + +`BetaEnvironment beta().environments().update(EnvironmentUpdateParamsparams = EnvironmentUpdateParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/environments/{environment_id}` + +Update an existing environment's configuration. + +### Parameters + +- `EnvironmentUpdateParams params` + + - `Optional environmentId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + + - `Optional config` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `Optional description` + + Updated description of the environment + + - `Optional metadata` + + User-provided metadata key-value pairs. Set a value to null or empty string to delete the key. + + - `Optional name` + + Updated name for the environment + +### Returns + +- `class BetaEnvironment:` + + Unified Environment resource for both cloud and BYOC environments. + + - `String id` + + Environment identifier (e.g., 'env_...') + + - `Optional archivedAt` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `BetaCloudConfig config` + + `cloud` environment configuration. + + - `Networking networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonValue; type "unrestricted"constant` + + Network policy type + + - `UNRESTRICTED("unrestricted")` + + - `class BetaLimitedNetwork:` + + Limited network access. + + - `boolean allowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `boolean allowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `List allowedHosts` + + Specifies domains the container can reach. + + - `JsonValue; type "limited"constant` + + Network policy type + + - `LIMITED("limited")` + + - `BetaPackages packages` + + Package manager configuration. + + - `List apt` + + Ubuntu/Debian packages to install + + - `List cargo` + + Rust packages to install + + - `List gem` + + Ruby packages to install + + - `List go` + + Go packages to install + + - `List npm` + + Node.js packages to install + + - `List pip` + + Python packages to install + + - `Optional type` + + Package configuration type + + - `PACKAGES("packages")` + + - `JsonValue; type "cloud"constant` + + Environment type + + - `CLOUD("cloud")` + + - `String createdAt` + + RFC 3339 timestamp when environment was created + + - `String description` + + User-provided description for the environment + + - `Metadata metadata` + + User-provided metadata key-value pairs + + - `String name` + + Human-readable name for the environment + + - `JsonValue; type "environment"constant` + + The type of object (always 'environment') + + - `ENVIRONMENT("environment")` + + - `String updatedAt` + + RFC 3339 timestamp when environment was last updated + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.environments.BetaEnvironment; +import com.anthropic.models.beta.environments.EnvironmentUpdateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BetaEnvironment betaEnvironment = client.beta().environments().update("env_011CZkZ9X2dpNyB7HsEFoRfW"); + } +} +``` + +## Delete + +`BetaEnvironmentDeleteResponse beta().environments().delete(EnvironmentDeleteParamsparams = EnvironmentDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**delete** `/v1/environments/{environment_id}` + +Delete an environment by ID. Returns a confirmation of the deletion. + +### Parameters + +- `EnvironmentDeleteParams params` + + - `Optional environmentId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaEnvironmentDeleteResponse:` + + Response after deleting an environment. + + - `String id` + + Environment identifier + + - `JsonValue; type "environment_deleted"constant` + + The type of response + + - `ENVIRONMENT_DELETED("environment_deleted")` + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.environments.BetaEnvironmentDeleteResponse; +import com.anthropic.models.beta.environments.EnvironmentDeleteParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BetaEnvironmentDeleteResponse betaEnvironmentDeleteResponse = client.beta().environments().delete("env_011CZkZ9X2dpNyB7HsEFoRfW"); + } +} +``` + +## Archive + +`BetaEnvironment beta().environments().archive(EnvironmentArchiveParamsparams = EnvironmentArchiveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/environments/{environment_id}/archive` + +Archive an environment by ID. Archived environments cannot be used to create new sessions. + +### Parameters + +- `EnvironmentArchiveParams params` + + - `Optional environmentId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaEnvironment:` + + Unified Environment resource for both cloud and BYOC environments. + + - `String id` + + Environment identifier (e.g., 'env_...') + + - `Optional archivedAt` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `BetaCloudConfig config` + + `cloud` environment configuration. + + - `Networking networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonValue; type "unrestricted"constant` + + Network policy type + + - `UNRESTRICTED("unrestricted")` + + - `class BetaLimitedNetwork:` + + Limited network access. + + - `boolean allowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `boolean allowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `List allowedHosts` + + Specifies domains the container can reach. + + - `JsonValue; type "limited"constant` + + Network policy type + + - `LIMITED("limited")` + + - `BetaPackages packages` + + Package manager configuration. + + - `List apt` + + Ubuntu/Debian packages to install + + - `List cargo` + + Rust packages to install + + - `List gem` + + Ruby packages to install + + - `List go` + + Go packages to install + + - `List npm` + + Node.js packages to install + + - `List pip` + + Python packages to install + + - `Optional type` + + Package configuration type + + - `PACKAGES("packages")` + + - `JsonValue; type "cloud"constant` + + Environment type + + - `CLOUD("cloud")` + + - `String createdAt` + + RFC 3339 timestamp when environment was created + + - `String description` + + User-provided description for the environment + + - `Metadata metadata` + + User-provided metadata key-value pairs + + - `String name` + + Human-readable name for the environment + + - `JsonValue; type "environment"constant` + + The type of object (always 'environment') + + - `ENVIRONMENT("environment")` + + - `String updatedAt` + + RFC 3339 timestamp when environment was last updated + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.environments.BetaEnvironment; +import com.anthropic.models.beta.environments.EnvironmentArchiveParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BetaEnvironment betaEnvironment = client.beta().environments().archive("env_011CZkZ9X2dpNyB7HsEFoRfW"); + } +} +``` + +## Domain Types + +### Beta Cloud Config + +- `class BetaCloudConfig:` + + `cloud` environment configuration. + + - `Networking networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonValue; type "unrestricted"constant` + + Network policy type + + - `UNRESTRICTED("unrestricted")` + + - `class BetaLimitedNetwork:` + + Limited network access. + + - `boolean allowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `boolean allowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `List allowedHosts` + + Specifies domains the container can reach. + + - `JsonValue; type "limited"constant` + + Network policy type + + - `LIMITED("limited")` + + - `BetaPackages packages` + + Package manager configuration. + + - `List apt` + + Ubuntu/Debian packages to install + + - `List cargo` + + Rust packages to install + + - `List gem` + + Ruby packages to install + + - `List go` + + Go packages to install + + - `List npm` + + Node.js packages to install + + - `List pip` + + Python packages to install + + - `Optional type` + + Package configuration type + + - `PACKAGES("packages")` + + - `JsonValue; type "cloud"constant` + + Environment type + + - `CLOUD("cloud")` + +### Beta Cloud Config Params + +- `class BetaCloudConfigParams:` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `JsonValue; type "cloud"constant` + + Environment type + + - `CLOUD("cloud")` + + - `Optional networking` + + Network configuration policy. Omit on update to preserve the existing value. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonValue; type "unrestricted"constant` + + Network policy type + + - `UNRESTRICTED("unrestricted")` + + - `class BetaLimitedNetworkParams:` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `JsonValue; type "limited"constant` + + Network policy type + + - `LIMITED("limited")` + + - `Optional allowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `Optional allowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `Optional> allowedHosts` + + Specifies domains the container can reach. + + - `Optional packages` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `Optional> apt` + + Ubuntu/Debian packages to install + + - `Optional> cargo` + + Rust packages to install + + - `Optional> gem` + + Ruby packages to install + + - `Optional> go` + + Go packages to install + + - `Optional> npm` + + Node.js packages to install + + - `Optional> pip` + + Python packages to install + + - `Optional type` + + Package configuration type + + - `PACKAGES("packages")` + +### Beta Environment + +- `class BetaEnvironment:` + + Unified Environment resource for both cloud and BYOC environments. + + - `String id` + + Environment identifier (e.g., 'env_...') + + - `Optional archivedAt` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `BetaCloudConfig config` + + `cloud` environment configuration. + + - `Networking networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonValue; type "unrestricted"constant` + + Network policy type + + - `UNRESTRICTED("unrestricted")` + + - `class BetaLimitedNetwork:` + + Limited network access. + + - `boolean allowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `boolean allowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `List allowedHosts` + + Specifies domains the container can reach. + + - `JsonValue; type "limited"constant` + + Network policy type + + - `LIMITED("limited")` + + - `BetaPackages packages` + + Package manager configuration. + + - `List apt` + + Ubuntu/Debian packages to install + + - `List cargo` + + Rust packages to install + + - `List gem` + + Ruby packages to install + + - `List go` + + Go packages to install + + - `List npm` + + Node.js packages to install + + - `List pip` + + Python packages to install + + - `Optional type` + + Package configuration type + + - `PACKAGES("packages")` + + - `JsonValue; type "cloud"constant` + + Environment type + + - `CLOUD("cloud")` + + - `String createdAt` + + RFC 3339 timestamp when environment was created + + - `String description` + + User-provided description for the environment + + - `Metadata metadata` + + User-provided metadata key-value pairs + + - `String name` + + Human-readable name for the environment + + - `JsonValue; type "environment"constant` + + The type of object (always 'environment') + + - `ENVIRONMENT("environment")` + + - `String updatedAt` + + RFC 3339 timestamp when environment was last updated + +### Beta Environment Delete Response + +- `class BetaEnvironmentDeleteResponse:` + + Response after deleting an environment. + + - `String id` + + Environment identifier + + - `JsonValue; type "environment_deleted"constant` + + The type of response + + - `ENVIRONMENT_DELETED("environment_deleted")` + +### Beta Limited Network + +- `class BetaLimitedNetwork:` + + Limited network access. + + - `boolean allowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `boolean allowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `List allowedHosts` + + Specifies domains the container can reach. + + - `JsonValue; type "limited"constant` + + Network policy type + + - `LIMITED("limited")` + +### Beta Limited Network Params + +- `class BetaLimitedNetworkParams:` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `JsonValue; type "limited"constant` + + Network policy type + + - `LIMITED("limited")` + + - `Optional allowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `Optional allowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `Optional> allowedHosts` + + Specifies domains the container can reach. + +### Beta Packages + +- `class BetaPackages:` + + Packages (and their versions) available in this environment. + + - `List apt` + + Ubuntu/Debian packages to install + + - `List cargo` + + Rust packages to install + + - `List gem` + + Ruby packages to install + + - `List go` + + Go packages to install + + - `List npm` + + Node.js packages to install + + - `List pip` + + Python packages to install + + - `Optional type` + + Package configuration type + + - `PACKAGES("packages")` + +### Beta Packages Params + +- `class BetaPackagesParams:` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `Optional> apt` + + Ubuntu/Debian packages to install + + - `Optional> cargo` + + Rust packages to install + + - `Optional> gem` + + Ruby packages to install + + - `Optional> go` + + Go packages to install + + - `Optional> npm` + + Node.js packages to install + + - `Optional> pip` + + Python packages to install + + - `Optional type` + + Package configuration type + + - `PACKAGES("packages")` + +### Beta Unrestricted Network + +- `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonValue; type "unrestricted"constant` + + Network policy type + + - `UNRESTRICTED("unrestricted")` diff --git a/content/en/api/java/beta/environments/archive.md b/content/en/api/java/beta/environments/archive.md new file mode 100644 index 000000000..9ff8399ad --- /dev/null +++ b/content/en/api/java/beta/environments/archive.md @@ -0,0 +1,200 @@ +## Archive + +`BetaEnvironment beta().environments().archive(EnvironmentArchiveParamsparams = EnvironmentArchiveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/environments/{environment_id}/archive` + +Archive an environment by ID. Archived environments cannot be used to create new sessions. + +### Parameters + +- `EnvironmentArchiveParams params` + + - `Optional environmentId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaEnvironment:` + + Unified Environment resource for both cloud and BYOC environments. + + - `String id` + + Environment identifier (e.g., 'env_...') + + - `Optional archivedAt` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `BetaCloudConfig config` + + `cloud` environment configuration. + + - `Networking networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonValue; type "unrestricted"constant` + + Network policy type + + - `UNRESTRICTED("unrestricted")` + + - `class BetaLimitedNetwork:` + + Limited network access. + + - `boolean allowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `boolean allowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `List allowedHosts` + + Specifies domains the container can reach. + + - `JsonValue; type "limited"constant` + + Network policy type + + - `LIMITED("limited")` + + - `BetaPackages packages` + + Package manager configuration. + + - `List apt` + + Ubuntu/Debian packages to install + + - `List cargo` + + Rust packages to install + + - `List gem` + + Ruby packages to install + + - `List go` + + Go packages to install + + - `List npm` + + Node.js packages to install + + - `List pip` + + Python packages to install + + - `Optional type` + + Package configuration type + + - `PACKAGES("packages")` + + - `JsonValue; type "cloud"constant` + + Environment type + + - `CLOUD("cloud")` + + - `String createdAt` + + RFC 3339 timestamp when environment was created + + - `String description` + + User-provided description for the environment + + - `Metadata metadata` + + User-provided metadata key-value pairs + + - `String name` + + Human-readable name for the environment + + - `JsonValue; type "environment"constant` + + The type of object (always 'environment') + + - `ENVIRONMENT("environment")` + + - `String updatedAt` + + RFC 3339 timestamp when environment was last updated + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.environments.BetaEnvironment; +import com.anthropic.models.beta.environments.EnvironmentArchiveParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BetaEnvironment betaEnvironment = client.beta().environments().archive("env_011CZkZ9X2dpNyB7HsEFoRfW"); + } +} +``` diff --git a/content/en/api/java/beta/environments/create.md b/content/en/api/java/beta/environments/create.md new file mode 100644 index 000000000..556f8571d --- /dev/null +++ b/content/en/api/java/beta/environments/create.md @@ -0,0 +1,220 @@ +## Create + +`BetaEnvironment beta().environments().create(EnvironmentCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/environments` + +Create a new environment with the specified configuration. + +### Parameters + +- `EnvironmentCreateParams params` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + + - `String name` + + Human-readable name for the environment + + - `Optional config` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `Optional description` + + Optional description of the environment + + - `Optional metadata` + + User-provided metadata key-value pairs + +### Returns + +- `class BetaEnvironment:` + + Unified Environment resource for both cloud and BYOC environments. + + - `String id` + + Environment identifier (e.g., 'env_...') + + - `Optional archivedAt` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `BetaCloudConfig config` + + `cloud` environment configuration. + + - `Networking networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonValue; type "unrestricted"constant` + + Network policy type + + - `UNRESTRICTED("unrestricted")` + + - `class BetaLimitedNetwork:` + + Limited network access. + + - `boolean allowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `boolean allowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `List allowedHosts` + + Specifies domains the container can reach. + + - `JsonValue; type "limited"constant` + + Network policy type + + - `LIMITED("limited")` + + - `BetaPackages packages` + + Package manager configuration. + + - `List apt` + + Ubuntu/Debian packages to install + + - `List cargo` + + Rust packages to install + + - `List gem` + + Ruby packages to install + + - `List go` + + Go packages to install + + - `List npm` + + Node.js packages to install + + - `List pip` + + Python packages to install + + - `Optional type` + + Package configuration type + + - `PACKAGES("packages")` + + - `JsonValue; type "cloud"constant` + + Environment type + + - `CLOUD("cloud")` + + - `String createdAt` + + RFC 3339 timestamp when environment was created + + - `String description` + + User-provided description for the environment + + - `Metadata metadata` + + User-provided metadata key-value pairs + + - `String name` + + Human-readable name for the environment + + - `JsonValue; type "environment"constant` + + The type of object (always 'environment') + + - `ENVIRONMENT("environment")` + + - `String updatedAt` + + RFC 3339 timestamp when environment was last updated + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.environments.BetaEnvironment; +import com.anthropic.models.beta.environments.EnvironmentCreateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + EnvironmentCreateParams params = EnvironmentCreateParams.builder() + .name("python-data-analysis") + .build(); + BetaEnvironment betaEnvironment = client.beta().environments().create(params); + } +} +``` diff --git a/content/en/api/java/beta/environments/delete.md b/content/en/api/java/beta/environments/delete.md new file mode 100644 index 000000000..b1aa151e1 --- /dev/null +++ b/content/en/api/java/beta/environments/delete.md @@ -0,0 +1,96 @@ +## Delete + +`BetaEnvironmentDeleteResponse beta().environments().delete(EnvironmentDeleteParamsparams = EnvironmentDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**delete** `/v1/environments/{environment_id}` + +Delete an environment by ID. Returns a confirmation of the deletion. + +### Parameters + +- `EnvironmentDeleteParams params` + + - `Optional environmentId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaEnvironmentDeleteResponse:` + + Response after deleting an environment. + + - `String id` + + Environment identifier + + - `JsonValue; type "environment_deleted"constant` + + The type of response + + - `ENVIRONMENT_DELETED("environment_deleted")` + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.environments.BetaEnvironmentDeleteResponse; +import com.anthropic.models.beta.environments.EnvironmentDeleteParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BetaEnvironmentDeleteResponse betaEnvironmentDeleteResponse = client.beta().environments().delete("env_011CZkZ9X2dpNyB7HsEFoRfW"); + } +} +``` diff --git a/content/en/api/java/beta/environments/list.md b/content/en/api/java/beta/environments/list.md new file mode 100644 index 000000000..b966ced84 --- /dev/null +++ b/content/en/api/java/beta/environments/list.md @@ -0,0 +1,210 @@ +## List + +`EnvironmentListPage beta().environments().list(EnvironmentListParamsparams = EnvironmentListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/environments` + +List environments with pagination support. + +### Parameters + +- `EnvironmentListParams params` + + - `Optional includeArchived` + + Include archived environments in the response + + - `Optional limit` + + Maximum number of environments to return + + - `Optional page` + + Opaque cursor from previous response for pagination. Pass the `next_page` value from the previous response. + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaEnvironment:` + + Unified Environment resource for both cloud and BYOC environments. + + - `String id` + + Environment identifier (e.g., 'env_...') + + - `Optional archivedAt` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `BetaCloudConfig config` + + `cloud` environment configuration. + + - `Networking networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonValue; type "unrestricted"constant` + + Network policy type + + - `UNRESTRICTED("unrestricted")` + + - `class BetaLimitedNetwork:` + + Limited network access. + + - `boolean allowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `boolean allowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `List allowedHosts` + + Specifies domains the container can reach. + + - `JsonValue; type "limited"constant` + + Network policy type + + - `LIMITED("limited")` + + - `BetaPackages packages` + + Package manager configuration. + + - `List apt` + + Ubuntu/Debian packages to install + + - `List cargo` + + Rust packages to install + + - `List gem` + + Ruby packages to install + + - `List go` + + Go packages to install + + - `List npm` + + Node.js packages to install + + - `List pip` + + Python packages to install + + - `Optional type` + + Package configuration type + + - `PACKAGES("packages")` + + - `JsonValue; type "cloud"constant` + + Environment type + + - `CLOUD("cloud")` + + - `String createdAt` + + RFC 3339 timestamp when environment was created + + - `String description` + + User-provided description for the environment + + - `Metadata metadata` + + User-provided metadata key-value pairs + + - `String name` + + Human-readable name for the environment + + - `JsonValue; type "environment"constant` + + The type of object (always 'environment') + + - `ENVIRONMENT("environment")` + + - `String updatedAt` + + RFC 3339 timestamp when environment was last updated + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.environments.EnvironmentListPage; +import com.anthropic.models.beta.environments.EnvironmentListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + EnvironmentListPage page = client.beta().environments().list(); + } +} +``` diff --git a/content/en/api/java/beta/environments/retrieve.md b/content/en/api/java/beta/environments/retrieve.md new file mode 100644 index 000000000..54f17f1c1 --- /dev/null +++ b/content/en/api/java/beta/environments/retrieve.md @@ -0,0 +1,200 @@ +## Retrieve + +`BetaEnvironment beta().environments().retrieve(EnvironmentRetrieveParamsparams = EnvironmentRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/environments/{environment_id}` + +Retrieve a specific environment by ID. + +### Parameters + +- `EnvironmentRetrieveParams params` + + - `Optional environmentId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaEnvironment:` + + Unified Environment resource for both cloud and BYOC environments. + + - `String id` + + Environment identifier (e.g., 'env_...') + + - `Optional archivedAt` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `BetaCloudConfig config` + + `cloud` environment configuration. + + - `Networking networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonValue; type "unrestricted"constant` + + Network policy type + + - `UNRESTRICTED("unrestricted")` + + - `class BetaLimitedNetwork:` + + Limited network access. + + - `boolean allowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `boolean allowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `List allowedHosts` + + Specifies domains the container can reach. + + - `JsonValue; type "limited"constant` + + Network policy type + + - `LIMITED("limited")` + + - `BetaPackages packages` + + Package manager configuration. + + - `List apt` + + Ubuntu/Debian packages to install + + - `List cargo` + + Rust packages to install + + - `List gem` + + Ruby packages to install + + - `List go` + + Go packages to install + + - `List npm` + + Node.js packages to install + + - `List pip` + + Python packages to install + + - `Optional type` + + Package configuration type + + - `PACKAGES("packages")` + + - `JsonValue; type "cloud"constant` + + Environment type + + - `CLOUD("cloud")` + + - `String createdAt` + + RFC 3339 timestamp when environment was created + + - `String description` + + User-provided description for the environment + + - `Metadata metadata` + + User-provided metadata key-value pairs + + - `String name` + + Human-readable name for the environment + + - `JsonValue; type "environment"constant` + + The type of object (always 'environment') + + - `ENVIRONMENT("environment")` + + - `String updatedAt` + + RFC 3339 timestamp when environment was last updated + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.environments.BetaEnvironment; +import com.anthropic.models.beta.environments.EnvironmentRetrieveParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BetaEnvironment betaEnvironment = client.beta().environments().retrieve("env_011CZkZ9X2dpNyB7HsEFoRfW"); + } +} +``` diff --git a/content/en/api/java/beta/environments/update.md b/content/en/api/java/beta/environments/update.md new file mode 100644 index 000000000..a857919fc --- /dev/null +++ b/content/en/api/java/beta/environments/update.md @@ -0,0 +1,219 @@ +## Update + +`BetaEnvironment beta().environments().update(EnvironmentUpdateParamsparams = EnvironmentUpdateParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/environments/{environment_id}` + +Update an existing environment's configuration. + +### Parameters + +- `EnvironmentUpdateParams params` + + - `Optional environmentId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + + - `Optional config` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `Optional description` + + Updated description of the environment + + - `Optional metadata` + + User-provided metadata key-value pairs. Set a value to null or empty string to delete the key. + + - `Optional name` + + Updated name for the environment + +### Returns + +- `class BetaEnvironment:` + + Unified Environment resource for both cloud and BYOC environments. + + - `String id` + + Environment identifier (e.g., 'env_...') + + - `Optional archivedAt` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `BetaCloudConfig config` + + `cloud` environment configuration. + + - `Networking networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork:` + + Unrestricted network access. + + - `JsonValue; type "unrestricted"constant` + + Network policy type + + - `UNRESTRICTED("unrestricted")` + + - `class BetaLimitedNetwork:` + + Limited network access. + + - `boolean allowMcpServers` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `boolean allowPackageManagers` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `List allowedHosts` + + Specifies domains the container can reach. + + - `JsonValue; type "limited"constant` + + Network policy type + + - `LIMITED("limited")` + + - `BetaPackages packages` + + Package manager configuration. + + - `List apt` + + Ubuntu/Debian packages to install + + - `List cargo` + + Rust packages to install + + - `List gem` + + Ruby packages to install + + - `List go` + + Go packages to install + + - `List npm` + + Node.js packages to install + + - `List pip` + + Python packages to install + + - `Optional type` + + Package configuration type + + - `PACKAGES("packages")` + + - `JsonValue; type "cloud"constant` + + Environment type + + - `CLOUD("cloud")` + + - `String createdAt` + + RFC 3339 timestamp when environment was created + + - `String description` + + User-provided description for the environment + + - `Metadata metadata` + + User-provided metadata key-value pairs + + - `String name` + + Human-readable name for the environment + + - `JsonValue; type "environment"constant` + + The type of object (always 'environment') + + - `ENVIRONMENT("environment")` + + - `String updatedAt` + + RFC 3339 timestamp when environment was last updated + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.environments.BetaEnvironment; +import com.anthropic.models.beta.environments.EnvironmentUpdateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BetaEnvironment betaEnvironment = client.beta().environments().update("env_011CZkZ9X2dpNyB7HsEFoRfW"); + } +} +``` diff --git a/content/en/api/java/beta/files.md b/content/en/api/java/beta/files.md index 2095aef2a..c978e0660 100644 --- a/content/en/api/java/beta/files.md +++ b/content/en/api/java/beta/files.md @@ -58,8 +58,6 @@ Upload File - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - - `String file` The file to upload @@ -102,6 +100,20 @@ Upload File Whether the file can be downloaded. + - `Optional scope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `String id` + + The ID of the scoping resource (e.g., the session ID). + + - `JsonValue; type "session"constant` + + The type of scope (e.g., `"session"`). + + - `SESSION("session")` + ### Example ```java @@ -153,6 +165,10 @@ List Files Defaults to `20`. Ranges from `1` to `1000`. + - `Optional scopeId` + + Filter by scope ID. Only returns files associated with the specified scope (e.g., a session ID). + - `Optional> betas` Optional header to specify the beta version(s) you want to use. @@ -199,8 +215,6 @@ List Files - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class FileMetadata:` @@ -239,6 +253,20 @@ List Files Whether the file can be downloaded. + - `Optional scope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `String id` + + The ID of the scoping resource (e.g., the session ID). + + - `JsonValue; type "session"constant` + + The type of scope (e.g., `"session"`). + + - `SESSION("session")` + ### Example ```java @@ -322,8 +350,6 @@ Download File - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Example ```java @@ -407,8 +433,6 @@ Get File Metadata - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class FileMetadata:` @@ -447,6 +471,20 @@ Get File Metadata Whether the file can be downloaded. + - `Optional scope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `String id` + + The ID of the scoping resource (e.g., the session ID). + + - `JsonValue; type "session"constant` + + The type of scope (e.g., `"session"`). + + - `SESSION("session")` + ### Example ```java @@ -530,8 +568,6 @@ Delete File - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class DeletedFile:` @@ -571,6 +607,20 @@ public final class Main { ## Domain Types +### Beta File Scope + +- `class BetaFileScope:` + + - `String id` + + The ID of the scoping resource (e.g., the session ID). + + - `JsonValue; type "session"constant` + + The type of scope (e.g., `"session"`). + + - `SESSION("session")` + ### Deleted File - `class DeletedFile:` @@ -624,3 +674,17 @@ public final class Main { - `Optional downloadable` Whether the file can be downloaded. + + - `Optional scope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `String id` + + The ID of the scoping resource (e.g., the session ID). + + - `JsonValue; type "session"constant` + + The type of scope (e.g., `"session"`). + + - `SESSION("session")` diff --git a/content/en/api/java/beta/files/delete.md b/content/en/api/java/beta/files/delete.md index c9243603b..646c1a038 100644 --- a/content/en/api/java/beta/files/delete.md +++ b/content/en/api/java/beta/files/delete.md @@ -60,8 +60,6 @@ Delete File - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class DeletedFile:` diff --git a/content/en/api/java/beta/files/download.md b/content/en/api/java/beta/files/download.md index 297868e59..579a40707 100644 --- a/content/en/api/java/beta/files/download.md +++ b/content/en/api/java/beta/files/download.md @@ -60,8 +60,6 @@ Download File - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Example ```java diff --git a/content/en/api/java/beta/files/list.md b/content/en/api/java/beta/files/list.md index 1af8c1548..6a514b0bc 100644 --- a/content/en/api/java/beta/files/list.md +++ b/content/en/api/java/beta/files/list.md @@ -24,6 +24,10 @@ List Files Defaults to `20`. Ranges from `1` to `1000`. + - `Optional scopeId` + + Filter by scope ID. Only returns files associated with the specified scope (e.g., a session ID). + - `Optional> betas` Optional header to specify the beta version(s) you want to use. @@ -70,8 +74,6 @@ List Files - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class FileMetadata:` @@ -110,6 +112,20 @@ List Files Whether the file can be downloaded. + - `Optional scope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `String id` + + The ID of the scoping resource (e.g., the session ID). + + - `JsonValue; type "session"constant` + + The type of scope (e.g., `"session"`). + + - `SESSION("session")` + ### Example ```java diff --git a/content/en/api/java/beta/files/retrieve_metadata.md b/content/en/api/java/beta/files/retrieve_metadata.md index 1571dd4dc..ce21ac088 100644 --- a/content/en/api/java/beta/files/retrieve_metadata.md +++ b/content/en/api/java/beta/files/retrieve_metadata.md @@ -60,8 +60,6 @@ Get File Metadata - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class FileMetadata:` @@ -100,6 +98,20 @@ Get File Metadata Whether the file can be downloaded. + - `Optional scope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `String id` + + The ID of the scoping resource (e.g., the session ID). + + - `JsonValue; type "session"constant` + + The type of scope (e.g., `"session"`). + + - `SESSION("session")` + ### Example ```java diff --git a/content/en/api/java/beta/files/upload.md b/content/en/api/java/beta/files/upload.md index ab1fc2461..d7f6ab166 100644 --- a/content/en/api/java/beta/files/upload.md +++ b/content/en/api/java/beta/files/upload.md @@ -56,8 +56,6 @@ Upload File - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - - `String file` The file to upload @@ -100,6 +98,20 @@ Upload File Whether the file can be downloaded. + - `Optional scope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `String id` + + The ID of the scoping resource (e.g., the session ID). + + - `JsonValue; type "session"constant` + + The type of scope (e.g., `"session"`). + + - `SESSION("session")` + ### Example ```java diff --git a/content/en/api/java/beta/messages.md b/content/en/api/java/beta/messages.md index 3d48ad2db..17c03194a 100644 --- a/content/en/api/java/beta/messages.md +++ b/content/en/api/java/beta/messages.md @@ -62,8 +62,6 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - - `long maxTokens` The maximum number of tokens to generate before stopping. @@ -4383,10 +4381,6 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en Recommended for advanced use cases only. You usually only need to use `temperature`. - - `Optional userProfileId` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - ### Returns - `class BetaMessage:` @@ -5310,9 +5304,13 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` @@ -5696,8 +5694,6 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - - `List messages` Input messages. @@ -17064,9 +17060,13 @@ public final class Main { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` @@ -22400,9 +22400,13 @@ public final class Main { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` @@ -23636,9 +23640,13 @@ public final class Main { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` @@ -32215,8 +32223,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - - `List requests` List of requests for prompt completion. Each is an individual request to create a Message. @@ -34818,9 +34824,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` @@ -36887,10 +36897,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Recommended for advanced use cases only. You usually only need to use `temperature`. - - `Optional userProfileId` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - ### Returns - `class BetaMessageBatch:` @@ -37077,8 +37083,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class BetaMessageBatch:` @@ -37264,8 +37268,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class BetaMessageBatch:` @@ -37443,8 +37445,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class BetaMessageBatch:` @@ -37622,8 +37622,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class BetaDeletedMessageBatch:` @@ -37727,8 +37725,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class BetaMessageBatchIndividualResponse:` @@ -38670,9 +38666,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` @@ -40248,9 +40248,13 @@ public final class Main { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` @@ -41612,9 +41616,13 @@ public final class Main { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` @@ -42938,9 +42946,13 @@ public final class Main { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` diff --git a/content/en/api/java/beta/messages/batches.md b/content/en/api/java/beta/messages/batches.md index b740b9435..d63f91abd 100644 --- a/content/en/api/java/beta/messages/batches.md +++ b/content/en/api/java/beta/messages/batches.md @@ -62,8 +62,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - - `List requests` List of requests for prompt completion. Each is an individual request to create a Message. @@ -2665,9 +2663,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` @@ -4734,10 +4736,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Recommended for advanced use cases only. You usually only need to use `temperature`. - - `Optional userProfileId` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - ### Returns - `class BetaMessageBatch:` @@ -4924,8 +4922,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class BetaMessageBatch:` @@ -5111,8 +5107,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class BetaMessageBatch:` @@ -5290,8 +5284,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class BetaMessageBatch:` @@ -5469,8 +5461,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class BetaDeletedMessageBatch:` @@ -5574,8 +5564,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class BetaMessageBatchIndividualResponse:` @@ -6517,9 +6505,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` @@ -8095,9 +8087,13 @@ public final class Main { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` @@ -9459,9 +9455,13 @@ public final class Main { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` @@ -10785,9 +10785,13 @@ public final class Main { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` diff --git a/content/en/api/java/beta/messages/batches/cancel.md b/content/en/api/java/beta/messages/batches/cancel.md index ec363bede..1b607e6e4 100644 --- a/content/en/api/java/beta/messages/batches/cancel.md +++ b/content/en/api/java/beta/messages/batches/cancel.md @@ -64,8 +64,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class BetaMessageBatch:` diff --git a/content/en/api/java/beta/messages/batches/create.md b/content/en/api/java/beta/messages/batches/create.md index 100ea7d26..c8663745d 100644 --- a/content/en/api/java/beta/messages/batches/create.md +++ b/content/en/api/java/beta/messages/batches/create.md @@ -60,8 +60,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - - `List requests` List of requests for prompt completion. Each is an individual request to create a Message. @@ -2663,9 +2661,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` @@ -4732,10 +4734,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Recommended for advanced use cases only. You usually only need to use `temperature`. - - `Optional userProfileId` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - ### Returns - `class BetaMessageBatch:` diff --git a/content/en/api/java/beta/messages/batches/delete.md b/content/en/api/java/beta/messages/batches/delete.md index cd99d4b22..13cddf7f8 100644 --- a/content/en/api/java/beta/messages/batches/delete.md +++ b/content/en/api/java/beta/messages/batches/delete.md @@ -64,8 +64,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class BetaDeletedMessageBatch:` diff --git a/content/en/api/java/beta/messages/batches/list.md b/content/en/api/java/beta/messages/batches/list.md index 5401a87bf..3ed88581d 100644 --- a/content/en/api/java/beta/messages/batches/list.md +++ b/content/en/api/java/beta/messages/batches/list.md @@ -72,8 +72,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class BetaMessageBatch:` diff --git a/content/en/api/java/beta/messages/batches/results.md b/content/en/api/java/beta/messages/batches/results.md index b9c88de2f..114845086 100644 --- a/content/en/api/java/beta/messages/batches/results.md +++ b/content/en/api/java/beta/messages/batches/results.md @@ -64,8 +64,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class BetaMessageBatchIndividualResponse:` @@ -1007,9 +1005,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` diff --git a/content/en/api/java/beta/messages/batches/retrieve.md b/content/en/api/java/beta/messages/batches/retrieve.md index bb4b2b5c7..70f5f10d6 100644 --- a/content/en/api/java/beta/messages/batches/retrieve.md +++ b/content/en/api/java/beta/messages/batches/retrieve.md @@ -62,8 +62,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class BetaMessageBatch:` diff --git a/content/en/api/java/beta/messages/count_tokens.md b/content/en/api/java/beta/messages/count_tokens.md index 7c9750a5a..4733632fb 100644 --- a/content/en/api/java/beta/messages/count_tokens.md +++ b/content/en/api/java/beta/messages/count_tokens.md @@ -60,8 +60,6 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - - `List messages` Input messages. diff --git a/content/en/api/java/beta/messages/create.md b/content/en/api/java/beta/messages/create.md index 1612fdc4c..b19957602 100644 --- a/content/en/api/java/beta/messages/create.md +++ b/content/en/api/java/beta/messages/create.md @@ -60,8 +60,6 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - - `long maxTokens` The maximum number of tokens to generate before stopping. @@ -4381,10 +4379,6 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en Recommended for advanced use cases only. You usually only need to use `temperature`. - - `Optional userProfileId` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - ### Returns - `class BetaMessage:` @@ -5308,9 +5302,13 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` diff --git a/content/en/api/java/beta/models.md b/content/en/api/java/beta/models.md index 78ad71410..8c48829f8 100644 --- a/content/en/api/java/beta/models.md +++ b/content/en/api/java/beta/models.md @@ -74,8 +74,6 @@ The Models API response can be used to determine which models are available for - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class BetaModelInfo:` @@ -345,8 +343,6 @@ The Models API response can be used to determine information about a specific mo - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class BetaModelInfo:` diff --git a/content/en/api/java/beta/models/list.md b/content/en/api/java/beta/models/list.md index 537fdcb7a..fec35f078 100644 --- a/content/en/api/java/beta/models/list.md +++ b/content/en/api/java/beta/models/list.md @@ -72,8 +72,6 @@ The Models API response can be used to determine which models are available for - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class BetaModelInfo:` diff --git a/content/en/api/java/beta/models/retrieve.md b/content/en/api/java/beta/models/retrieve.md index 3943adfe2..7297cbe97 100644 --- a/content/en/api/java/beta/models/retrieve.md +++ b/content/en/api/java/beta/models/retrieve.md @@ -62,8 +62,6 @@ The Models API response can be used to determine information about a specific mo - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class BetaModelInfo:` diff --git a/content/en/api/java/beta/sessions.md b/content/en/api/java/beta/sessions.md new file mode 100644 index 000000000..d31e6a986 --- /dev/null +++ b/content/en/api/java/beta/sessions.md @@ -0,0 +1,14129 @@ +# Sessions + +## Create + +`BetaManagedAgentsSession beta().sessions().create(SessionCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/sessions` + +Create Session + +### Parameters + +- `SessionCreateParams params` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + + - `Agent agent` + + Agent identifier. Accepts the `agent` ID string, which pins the latest version for the session, or an `agent` object with both id and version specified. + + - `String` + + - `class BetaManagedAgentsAgentParams:` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `String id` + + The `agent` ID. + + - `Type type` + + - `AGENT("agent")` + + - `Optional version` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + + - `String environmentId` + + ID of the `environment` defining the container configuration for this session. + + - `Optional metadata` + + Arbitrary key-value metadata attached to the session. + + - `Optional> resources` + + Resources (e.g. repositories, files) to mount into the session's container. + + - `class BetaManagedAgentsGitHubRepositoryResourceParams:` + + Mount a GitHub repository into the session's container. + + - `String authorizationToken` + + GitHub authorization token used to clone the repository. + + - `Type type` + + - `GITHUB_REPOSITORY("github_repository")` + + - `String url` + + Github URL of the repository + + - `Optional checkout` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `class BetaManagedAgentsBranchCheckout:` + + - `String name` + + Branch name to check out. + + - `Type type` + + - `BRANCH("branch")` + + - `class BetaManagedAgentsCommitCheckout:` + + - `String sha` + + Full commit SHA to check out. + + - `Type type` + + - `COMMIT("commit")` + + - `Optional mountPath` + + Mount path in the container. Defaults to `/workspace/`. + + - `class BetaManagedAgentsFileResourceParams:` + + Mount a file uploaded via the Files API into the session. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Optional mountPath` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + + - `Optional title` + + Human-readable session title. + + - `Optional> vaultIds` + + Vault IDs for stored credentials the agent can use during the session. + +### Returns + +- `class BetaManagedAgentsSession:` + + A Managed Agents `session`. + + - `String id` + + - `BetaManagedAgentsSessionAgent agent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `String id` + + - `Optional description` + + - `List mcpServers` + + - `String name` + + - `Type type` + + - `URL("url")` + + - `String url` + + - `BetaManagedAgentsModelConfig model` + + Model identifier and configuration. + + - `BetaManagedAgentsModel id` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` + + Most intelligent model for building agents and coding + + - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` + + Best combination of speed and intelligence + + - `CLAUDE_HAIKU_4_5("claude-haiku-4-5")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_HAIKU_4_5_20251001("claude-haiku-4-5-20251001")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_OPUS_4_5("claude-opus-4-5")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_OPUS_4_5_20251101("claude-opus-4-5-20251101")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_SONNET_4_5("claude-sonnet-4-5")` + + High-performance model for agents and coding + + - `CLAUDE_SONNET_4_5_20250929("claude-sonnet-4-5-20250929")` + + High-performance model for agents and coding + + - `Optional speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `STANDARD("standard")` + + - `FAST("fast")` + + - `String name` + + - `List skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `String skillId` + + - `Type type` + + - `ANTHROPIC("anthropic")` + + - `String version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `String skillId` + + - `Type type` + + - `CUSTOM("custom")` + + - `String version` + + - `Optional system` + + - `List tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `List configs` + + - `boolean enabled` + + - `Name name` + + Built-in agent tool identifier. + + - `BASH("bash")` + + - `EDIT("edit")` + + - `READ("read")` + + - `WRITE("write")` + + - `GLOB("glob")` + + - `GREP("grep")` + + - `WEB_FETCH("web_fetch")` + + - `WEB_SEARCH("web_search")` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsAgentToolsetDefaultConfig defaultConfig` + + Resolved default configuration for agent tools. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `Type type` + + - `AGENT_TOOLSET_20260401("agent_toolset_20260401")` + + - `class BetaManagedAgentsMcpToolset:` + + - `List configs` + + - `boolean enabled` + + - `String name` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsMcpToolsetDefaultConfig defaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `String mcpServerName` + + - `Type type` + + - `MCP_TOOLSET("mcp_toolset")` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `String description` + + - `BetaManagedAgentsCustomToolInputSchema inputSchema` + + JSON Schema for custom tool input parameters. + + - `Optional properties` + + JSON Schema properties defining the tool's input parameters. + + - `Optional> required` + + List of required property names. + + - `Optional type` + + Must be 'object' for tool input schemas. + + - `OBJECT("object")` + + - `String name` + + - `Type type` + + - `CUSTOM("custom")` + + - `Type type` + + - `AGENT("agent")` + + - `long version` + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String environmentId` + + - `Metadata metadata` + + - `List resources` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String mountPath` + + - `Type type` + + - `GITHUB_REPOSITORY("github_repository")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String url` + + - `Optional checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `String name` + + Branch name to check out. + + - `Type type` + + - `BRANCH("branch")` + + - `class BetaManagedAgentsCommitCheckout:` + + - `String sha` + + Full commit SHA to check out. + + - `Type type` + + - `COMMIT("commit")` + + - `class BetaManagedAgentsFileResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String fileId` + + - `String mountPath` + + - `Type type` + + - `FILE("file")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsSessionStats stats` + + Timing statistics for a session. + + - `Optional activeSeconds` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `Optional durationSeconds` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `Status status` + + SessionStatus enum + + - `RESCHEDULING("rescheduling")` + + - `RUNNING("running")` + + - `IDLE("idle")` + + - `TERMINATED("terminated")` + + - `Optional title` + + - `Type type` + + - `SESSION("session")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsSessionUsage usage` + + Cumulative token usage for a session across all turns. + + - `Optional cacheCreation` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Optional ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Optional ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + + - `Optional cacheReadInputTokens` + + Total tokens read from prompt cache. + + - `Optional inputTokens` + + Total input tokens consumed across all turns. + + - `Optional outputTokens` + + Total output tokens generated across all turns. + + - `List vaultIds` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.sessions.BetaManagedAgentsSession; +import com.anthropic.models.beta.sessions.SessionCreateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + SessionCreateParams params = SessionCreateParams.builder() + .agent("agent_011CZkYpogX7uDKUyvBTophP") + .environmentId("env_011CZkZ9X2dpNyB7HsEFoRfW") + .build(); + BetaManagedAgentsSession betaManagedAgentsSession = client.beta().sessions().create(params); + } +} +``` + +## List + +`SessionListPage beta().sessions().list(SessionListParamsparams = SessionListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/sessions` + +List Sessions + +### Parameters + +- `SessionListParams params` + + - `Optional agentId` + + Filter sessions created with this agent ID. + + - `Optional agentVersion` + + Filter by agent version. Only applies when agent_id is also set. + + - `Optional createdAtGt` + + Return sessions created after this time (exclusive). + + - `Optional createdAtGte` + + Return sessions created at or after this time (inclusive). + + - `Optional createdAtLt` + + Return sessions created before this time (exclusive). + + - `Optional createdAtLte` + + Return sessions created at or before this time (inclusive). + + - `Optional includeArchived` + + When true, includes archived sessions. Default: false (exclude archived). + + - `Optional limit` + + Maximum number of results to return. + + - `Optional order` + + Sort direction for results, ordered by created_at. Defaults to desc (newest first). + + - `ASC("asc")` + + - `DESC("desc")` + + - `Optional page` + + Opaque pagination cursor from a previous response's next_page. + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsSession:` + + A Managed Agents `session`. + + - `String id` + + - `BetaManagedAgentsSessionAgent agent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `String id` + + - `Optional description` + + - `List mcpServers` + + - `String name` + + - `Type type` + + - `URL("url")` + + - `String url` + + - `BetaManagedAgentsModelConfig model` + + Model identifier and configuration. + + - `BetaManagedAgentsModel id` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` + + Most intelligent model for building agents and coding + + - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` + + Best combination of speed and intelligence + + - `CLAUDE_HAIKU_4_5("claude-haiku-4-5")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_HAIKU_4_5_20251001("claude-haiku-4-5-20251001")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_OPUS_4_5("claude-opus-4-5")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_OPUS_4_5_20251101("claude-opus-4-5-20251101")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_SONNET_4_5("claude-sonnet-4-5")` + + High-performance model for agents and coding + + - `CLAUDE_SONNET_4_5_20250929("claude-sonnet-4-5-20250929")` + + High-performance model for agents and coding + + - `Optional speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `STANDARD("standard")` + + - `FAST("fast")` + + - `String name` + + - `List skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `String skillId` + + - `Type type` + + - `ANTHROPIC("anthropic")` + + - `String version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `String skillId` + + - `Type type` + + - `CUSTOM("custom")` + + - `String version` + + - `Optional system` + + - `List tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `List configs` + + - `boolean enabled` + + - `Name name` + + Built-in agent tool identifier. + + - `BASH("bash")` + + - `EDIT("edit")` + + - `READ("read")` + + - `WRITE("write")` + + - `GLOB("glob")` + + - `GREP("grep")` + + - `WEB_FETCH("web_fetch")` + + - `WEB_SEARCH("web_search")` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsAgentToolsetDefaultConfig defaultConfig` + + Resolved default configuration for agent tools. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `Type type` + + - `AGENT_TOOLSET_20260401("agent_toolset_20260401")` + + - `class BetaManagedAgentsMcpToolset:` + + - `List configs` + + - `boolean enabled` + + - `String name` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsMcpToolsetDefaultConfig defaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `String mcpServerName` + + - `Type type` + + - `MCP_TOOLSET("mcp_toolset")` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `String description` + + - `BetaManagedAgentsCustomToolInputSchema inputSchema` + + JSON Schema for custom tool input parameters. + + - `Optional properties` + + JSON Schema properties defining the tool's input parameters. + + - `Optional> required` + + List of required property names. + + - `Optional type` + + Must be 'object' for tool input schemas. + + - `OBJECT("object")` + + - `String name` + + - `Type type` + + - `CUSTOM("custom")` + + - `Type type` + + - `AGENT("agent")` + + - `long version` + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String environmentId` + + - `Metadata metadata` + + - `List resources` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String mountPath` + + - `Type type` + + - `GITHUB_REPOSITORY("github_repository")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String url` + + - `Optional checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `String name` + + Branch name to check out. + + - `Type type` + + - `BRANCH("branch")` + + - `class BetaManagedAgentsCommitCheckout:` + + - `String sha` + + Full commit SHA to check out. + + - `Type type` + + - `COMMIT("commit")` + + - `class BetaManagedAgentsFileResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String fileId` + + - `String mountPath` + + - `Type type` + + - `FILE("file")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsSessionStats stats` + + Timing statistics for a session. + + - `Optional activeSeconds` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `Optional durationSeconds` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `Status status` + + SessionStatus enum + + - `RESCHEDULING("rescheduling")` + + - `RUNNING("running")` + + - `IDLE("idle")` + + - `TERMINATED("terminated")` + + - `Optional title` + + - `Type type` + + - `SESSION("session")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsSessionUsage usage` + + Cumulative token usage for a session across all turns. + + - `Optional cacheCreation` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Optional ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Optional ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + + - `Optional cacheReadInputTokens` + + Total tokens read from prompt cache. + + - `Optional inputTokens` + + Total input tokens consumed across all turns. + + - `Optional outputTokens` + + Total output tokens generated across all turns. + + - `List vaultIds` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.sessions.SessionListPage; +import com.anthropic.models.beta.sessions.SessionListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + SessionListPage page = client.beta().sessions().list(); + } +} +``` + +## Retrieve + +`BetaManagedAgentsSession beta().sessions().retrieve(SessionRetrieveParamsparams = SessionRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/sessions/{session_id}` + +Get Session + +### Parameters + +- `SessionRetrieveParams params` + + - `Optional sessionId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsSession:` + + A Managed Agents `session`. + + - `String id` + + - `BetaManagedAgentsSessionAgent agent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `String id` + + - `Optional description` + + - `List mcpServers` + + - `String name` + + - `Type type` + + - `URL("url")` + + - `String url` + + - `BetaManagedAgentsModelConfig model` + + Model identifier and configuration. + + - `BetaManagedAgentsModel id` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` + + Most intelligent model for building agents and coding + + - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` + + Best combination of speed and intelligence + + - `CLAUDE_HAIKU_4_5("claude-haiku-4-5")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_HAIKU_4_5_20251001("claude-haiku-4-5-20251001")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_OPUS_4_5("claude-opus-4-5")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_OPUS_4_5_20251101("claude-opus-4-5-20251101")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_SONNET_4_5("claude-sonnet-4-5")` + + High-performance model for agents and coding + + - `CLAUDE_SONNET_4_5_20250929("claude-sonnet-4-5-20250929")` + + High-performance model for agents and coding + + - `Optional speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `STANDARD("standard")` + + - `FAST("fast")` + + - `String name` + + - `List skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `String skillId` + + - `Type type` + + - `ANTHROPIC("anthropic")` + + - `String version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `String skillId` + + - `Type type` + + - `CUSTOM("custom")` + + - `String version` + + - `Optional system` + + - `List tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `List configs` + + - `boolean enabled` + + - `Name name` + + Built-in agent tool identifier. + + - `BASH("bash")` + + - `EDIT("edit")` + + - `READ("read")` + + - `WRITE("write")` + + - `GLOB("glob")` + + - `GREP("grep")` + + - `WEB_FETCH("web_fetch")` + + - `WEB_SEARCH("web_search")` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsAgentToolsetDefaultConfig defaultConfig` + + Resolved default configuration for agent tools. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `Type type` + + - `AGENT_TOOLSET_20260401("agent_toolset_20260401")` + + - `class BetaManagedAgentsMcpToolset:` + + - `List configs` + + - `boolean enabled` + + - `String name` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsMcpToolsetDefaultConfig defaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `String mcpServerName` + + - `Type type` + + - `MCP_TOOLSET("mcp_toolset")` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `String description` + + - `BetaManagedAgentsCustomToolInputSchema inputSchema` + + JSON Schema for custom tool input parameters. + + - `Optional properties` + + JSON Schema properties defining the tool's input parameters. + + - `Optional> required` + + List of required property names. + + - `Optional type` + + Must be 'object' for tool input schemas. + + - `OBJECT("object")` + + - `String name` + + - `Type type` + + - `CUSTOM("custom")` + + - `Type type` + + - `AGENT("agent")` + + - `long version` + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String environmentId` + + - `Metadata metadata` + + - `List resources` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String mountPath` + + - `Type type` + + - `GITHUB_REPOSITORY("github_repository")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String url` + + - `Optional checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `String name` + + Branch name to check out. + + - `Type type` + + - `BRANCH("branch")` + + - `class BetaManagedAgentsCommitCheckout:` + + - `String sha` + + Full commit SHA to check out. + + - `Type type` + + - `COMMIT("commit")` + + - `class BetaManagedAgentsFileResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String fileId` + + - `String mountPath` + + - `Type type` + + - `FILE("file")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsSessionStats stats` + + Timing statistics for a session. + + - `Optional activeSeconds` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `Optional durationSeconds` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `Status status` + + SessionStatus enum + + - `RESCHEDULING("rescheduling")` + + - `RUNNING("running")` + + - `IDLE("idle")` + + - `TERMINATED("terminated")` + + - `Optional title` + + - `Type type` + + - `SESSION("session")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsSessionUsage usage` + + Cumulative token usage for a session across all turns. + + - `Optional cacheCreation` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Optional ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Optional ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + + - `Optional cacheReadInputTokens` + + Total tokens read from prompt cache. + + - `Optional inputTokens` + + Total input tokens consumed across all turns. + + - `Optional outputTokens` + + Total output tokens generated across all turns. + + - `List vaultIds` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.sessions.BetaManagedAgentsSession; +import com.anthropic.models.beta.sessions.SessionRetrieveParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BetaManagedAgentsSession betaManagedAgentsSession = client.beta().sessions().retrieve("sesn_011CZkZAtmR3yMPDzynEDxu7"); + } +} +``` + +## Update + +`BetaManagedAgentsSession beta().sessions().update(SessionUpdateParamsparams = SessionUpdateParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/sessions/{session_id}` + +Update Session + +### Parameters + +- `SessionUpdateParams params` + + - `Optional sessionId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + + - `Optional metadata` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. + + - `Optional title` + + Human-readable session title. + + - `Optional> vaultIds` + + Vault IDs (`vlt_*`) to attach to the session. Not yet supported; requests setting this field are rejected. Reserved for future use. + +### Returns + +- `class BetaManagedAgentsSession:` + + A Managed Agents `session`. + + - `String id` + + - `BetaManagedAgentsSessionAgent agent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `String id` + + - `Optional description` + + - `List mcpServers` + + - `String name` + + - `Type type` + + - `URL("url")` + + - `String url` + + - `BetaManagedAgentsModelConfig model` + + Model identifier and configuration. + + - `BetaManagedAgentsModel id` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` + + Most intelligent model for building agents and coding + + - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` + + Best combination of speed and intelligence + + - `CLAUDE_HAIKU_4_5("claude-haiku-4-5")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_HAIKU_4_5_20251001("claude-haiku-4-5-20251001")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_OPUS_4_5("claude-opus-4-5")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_OPUS_4_5_20251101("claude-opus-4-5-20251101")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_SONNET_4_5("claude-sonnet-4-5")` + + High-performance model for agents and coding + + - `CLAUDE_SONNET_4_5_20250929("claude-sonnet-4-5-20250929")` + + High-performance model for agents and coding + + - `Optional speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `STANDARD("standard")` + + - `FAST("fast")` + + - `String name` + + - `List skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `String skillId` + + - `Type type` + + - `ANTHROPIC("anthropic")` + + - `String version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `String skillId` + + - `Type type` + + - `CUSTOM("custom")` + + - `String version` + + - `Optional system` + + - `List tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `List configs` + + - `boolean enabled` + + - `Name name` + + Built-in agent tool identifier. + + - `BASH("bash")` + + - `EDIT("edit")` + + - `READ("read")` + + - `WRITE("write")` + + - `GLOB("glob")` + + - `GREP("grep")` + + - `WEB_FETCH("web_fetch")` + + - `WEB_SEARCH("web_search")` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsAgentToolsetDefaultConfig defaultConfig` + + Resolved default configuration for agent tools. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `Type type` + + - `AGENT_TOOLSET_20260401("agent_toolset_20260401")` + + - `class BetaManagedAgentsMcpToolset:` + + - `List configs` + + - `boolean enabled` + + - `String name` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsMcpToolsetDefaultConfig defaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `String mcpServerName` + + - `Type type` + + - `MCP_TOOLSET("mcp_toolset")` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `String description` + + - `BetaManagedAgentsCustomToolInputSchema inputSchema` + + JSON Schema for custom tool input parameters. + + - `Optional properties` + + JSON Schema properties defining the tool's input parameters. + + - `Optional> required` + + List of required property names. + + - `Optional type` + + Must be 'object' for tool input schemas. + + - `OBJECT("object")` + + - `String name` + + - `Type type` + + - `CUSTOM("custom")` + + - `Type type` + + - `AGENT("agent")` + + - `long version` + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String environmentId` + + - `Metadata metadata` + + - `List resources` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String mountPath` + + - `Type type` + + - `GITHUB_REPOSITORY("github_repository")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String url` + + - `Optional checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `String name` + + Branch name to check out. + + - `Type type` + + - `BRANCH("branch")` + + - `class BetaManagedAgentsCommitCheckout:` + + - `String sha` + + Full commit SHA to check out. + + - `Type type` + + - `COMMIT("commit")` + + - `class BetaManagedAgentsFileResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String fileId` + + - `String mountPath` + + - `Type type` + + - `FILE("file")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsSessionStats stats` + + Timing statistics for a session. + + - `Optional activeSeconds` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `Optional durationSeconds` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `Status status` + + SessionStatus enum + + - `RESCHEDULING("rescheduling")` + + - `RUNNING("running")` + + - `IDLE("idle")` + + - `TERMINATED("terminated")` + + - `Optional title` + + - `Type type` + + - `SESSION("session")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsSessionUsage usage` + + Cumulative token usage for a session across all turns. + + - `Optional cacheCreation` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Optional ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Optional ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + + - `Optional cacheReadInputTokens` + + Total tokens read from prompt cache. + + - `Optional inputTokens` + + Total input tokens consumed across all turns. + + - `Optional outputTokens` + + Total output tokens generated across all turns. + + - `List vaultIds` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.sessions.BetaManagedAgentsSession; +import com.anthropic.models.beta.sessions.SessionUpdateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BetaManagedAgentsSession betaManagedAgentsSession = client.beta().sessions().update("sesn_011CZkZAtmR3yMPDzynEDxu7"); + } +} +``` + +## Delete + +`BetaManagedAgentsDeletedSession beta().sessions().delete(SessionDeleteParamsparams = SessionDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**delete** `/v1/sessions/{session_id}` + +Delete Session + +### Parameters + +- `SessionDeleteParams params` + + - `Optional sessionId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsDeletedSession:` + + Confirmation that a `session` has been permanently deleted. + + - `String id` + + - `Type type` + + - `SESSION_DELETED("session_deleted")` + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.sessions.BetaManagedAgentsDeletedSession; +import com.anthropic.models.beta.sessions.SessionDeleteParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BetaManagedAgentsDeletedSession betaManagedAgentsDeletedSession = client.beta().sessions().delete("sesn_011CZkZAtmR3yMPDzynEDxu7"); + } +} +``` + +## Archive + +`BetaManagedAgentsSession beta().sessions().archive(SessionArchiveParamsparams = SessionArchiveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/sessions/{session_id}/archive` + +Archive Session + +### Parameters + +- `SessionArchiveParams params` + + - `Optional sessionId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsSession:` + + A Managed Agents `session`. + + - `String id` + + - `BetaManagedAgentsSessionAgent agent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `String id` + + - `Optional description` + + - `List mcpServers` + + - `String name` + + - `Type type` + + - `URL("url")` + + - `String url` + + - `BetaManagedAgentsModelConfig model` + + Model identifier and configuration. + + - `BetaManagedAgentsModel id` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` + + Most intelligent model for building agents and coding + + - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` + + Best combination of speed and intelligence + + - `CLAUDE_HAIKU_4_5("claude-haiku-4-5")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_HAIKU_4_5_20251001("claude-haiku-4-5-20251001")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_OPUS_4_5("claude-opus-4-5")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_OPUS_4_5_20251101("claude-opus-4-5-20251101")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_SONNET_4_5("claude-sonnet-4-5")` + + High-performance model for agents and coding + + - `CLAUDE_SONNET_4_5_20250929("claude-sonnet-4-5-20250929")` + + High-performance model for agents and coding + + - `Optional speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `STANDARD("standard")` + + - `FAST("fast")` + + - `String name` + + - `List skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `String skillId` + + - `Type type` + + - `ANTHROPIC("anthropic")` + + - `String version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `String skillId` + + - `Type type` + + - `CUSTOM("custom")` + + - `String version` + + - `Optional system` + + - `List tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `List configs` + + - `boolean enabled` + + - `Name name` + + Built-in agent tool identifier. + + - `BASH("bash")` + + - `EDIT("edit")` + + - `READ("read")` + + - `WRITE("write")` + + - `GLOB("glob")` + + - `GREP("grep")` + + - `WEB_FETCH("web_fetch")` + + - `WEB_SEARCH("web_search")` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsAgentToolsetDefaultConfig defaultConfig` + + Resolved default configuration for agent tools. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `Type type` + + - `AGENT_TOOLSET_20260401("agent_toolset_20260401")` + + - `class BetaManagedAgentsMcpToolset:` + + - `List configs` + + - `boolean enabled` + + - `String name` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsMcpToolsetDefaultConfig defaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `String mcpServerName` + + - `Type type` + + - `MCP_TOOLSET("mcp_toolset")` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `String description` + + - `BetaManagedAgentsCustomToolInputSchema inputSchema` + + JSON Schema for custom tool input parameters. + + - `Optional properties` + + JSON Schema properties defining the tool's input parameters. + + - `Optional> required` + + List of required property names. + + - `Optional type` + + Must be 'object' for tool input schemas. + + - `OBJECT("object")` + + - `String name` + + - `Type type` + + - `CUSTOM("custom")` + + - `Type type` + + - `AGENT("agent")` + + - `long version` + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String environmentId` + + - `Metadata metadata` + + - `List resources` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String mountPath` + + - `Type type` + + - `GITHUB_REPOSITORY("github_repository")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String url` + + - `Optional checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `String name` + + Branch name to check out. + + - `Type type` + + - `BRANCH("branch")` + + - `class BetaManagedAgentsCommitCheckout:` + + - `String sha` + + Full commit SHA to check out. + + - `Type type` + + - `COMMIT("commit")` + + - `class BetaManagedAgentsFileResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String fileId` + + - `String mountPath` + + - `Type type` + + - `FILE("file")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsSessionStats stats` + + Timing statistics for a session. + + - `Optional activeSeconds` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `Optional durationSeconds` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `Status status` + + SessionStatus enum + + - `RESCHEDULING("rescheduling")` + + - `RUNNING("running")` + + - `IDLE("idle")` + + - `TERMINATED("terminated")` + + - `Optional title` + + - `Type type` + + - `SESSION("session")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsSessionUsage usage` + + Cumulative token usage for a session across all turns. + + - `Optional cacheCreation` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Optional ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Optional ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + + - `Optional cacheReadInputTokens` + + Total tokens read from prompt cache. + + - `Optional inputTokens` + + Total input tokens consumed across all turns. + + - `Optional outputTokens` + + Total output tokens generated across all turns. + + - `List vaultIds` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.sessions.BetaManagedAgentsSession; +import com.anthropic.models.beta.sessions.SessionArchiveParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BetaManagedAgentsSession betaManagedAgentsSession = client.beta().sessions().archive("sesn_011CZkZAtmR3yMPDzynEDxu7"); + } +} +``` + +## Domain Types + +### Beta Managed Agents Agent Params + +- `class BetaManagedAgentsAgentParams:` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `String id` + + The `agent` ID. + + - `Type type` + + - `AGENT("agent")` + + - `Optional version` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + +### Beta Managed Agents Branch Checkout + +- `class BetaManagedAgentsBranchCheckout:` + + - `String name` + + Branch name to check out. + + - `Type type` + + - `BRANCH("branch")` + +### Beta Managed Agents Cache Creation Usage + +- `class BetaManagedAgentsCacheCreationUsage:` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Optional ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Optional ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + +### Beta Managed Agents Commit Checkout + +- `class BetaManagedAgentsCommitCheckout:` + + - `String sha` + + Full commit SHA to check out. + + - `Type type` + + - `COMMIT("commit")` + +### Beta Managed Agents Deleted Session + +- `class BetaManagedAgentsDeletedSession:` + + Confirmation that a `session` has been permanently deleted. + + - `String id` + + - `Type type` + + - `SESSION_DELETED("session_deleted")` + +### Beta Managed Agents File Resource Params + +- `class BetaManagedAgentsFileResourceParams:` + + Mount a file uploaded via the Files API into the session. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Optional mountPath` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +### Beta Managed Agents GitHub Repository Resource Params + +- `class BetaManagedAgentsGitHubRepositoryResourceParams:` + + Mount a GitHub repository into the session's container. + + - `String authorizationToken` + + GitHub authorization token used to clone the repository. + + - `Type type` + + - `GITHUB_REPOSITORY("github_repository")` + + - `String url` + + Github URL of the repository + + - `Optional checkout` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `class BetaManagedAgentsBranchCheckout:` + + - `String name` + + Branch name to check out. + + - `Type type` + + - `BRANCH("branch")` + + - `class BetaManagedAgentsCommitCheckout:` + + - `String sha` + + Full commit SHA to check out. + + - `Type type` + + - `COMMIT("commit")` + + - `Optional mountPath` + + Mount path in the container. Defaults to `/workspace/`. + +### Beta Managed Agents Session + +- `class BetaManagedAgentsSession:` + + A Managed Agents `session`. + + - `String id` + + - `BetaManagedAgentsSessionAgent agent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `String id` + + - `Optional description` + + - `List mcpServers` + + - `String name` + + - `Type type` + + - `URL("url")` + + - `String url` + + - `BetaManagedAgentsModelConfig model` + + Model identifier and configuration. + + - `BetaManagedAgentsModel id` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` + + Most intelligent model for building agents and coding + + - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` + + Best combination of speed and intelligence + + - `CLAUDE_HAIKU_4_5("claude-haiku-4-5")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_HAIKU_4_5_20251001("claude-haiku-4-5-20251001")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_OPUS_4_5("claude-opus-4-5")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_OPUS_4_5_20251101("claude-opus-4-5-20251101")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_SONNET_4_5("claude-sonnet-4-5")` + + High-performance model for agents and coding + + - `CLAUDE_SONNET_4_5_20250929("claude-sonnet-4-5-20250929")` + + High-performance model for agents and coding + + - `Optional speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `STANDARD("standard")` + + - `FAST("fast")` + + - `String name` + + - `List skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `String skillId` + + - `Type type` + + - `ANTHROPIC("anthropic")` + + - `String version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `String skillId` + + - `Type type` + + - `CUSTOM("custom")` + + - `String version` + + - `Optional system` + + - `List tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `List configs` + + - `boolean enabled` + + - `Name name` + + Built-in agent tool identifier. + + - `BASH("bash")` + + - `EDIT("edit")` + + - `READ("read")` + + - `WRITE("write")` + + - `GLOB("glob")` + + - `GREP("grep")` + + - `WEB_FETCH("web_fetch")` + + - `WEB_SEARCH("web_search")` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsAgentToolsetDefaultConfig defaultConfig` + + Resolved default configuration for agent tools. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `Type type` + + - `AGENT_TOOLSET_20260401("agent_toolset_20260401")` + + - `class BetaManagedAgentsMcpToolset:` + + - `List configs` + + - `boolean enabled` + + - `String name` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsMcpToolsetDefaultConfig defaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `String mcpServerName` + + - `Type type` + + - `MCP_TOOLSET("mcp_toolset")` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `String description` + + - `BetaManagedAgentsCustomToolInputSchema inputSchema` + + JSON Schema for custom tool input parameters. + + - `Optional properties` + + JSON Schema properties defining the tool's input parameters. + + - `Optional> required` + + List of required property names. + + - `Optional type` + + Must be 'object' for tool input schemas. + + - `OBJECT("object")` + + - `String name` + + - `Type type` + + - `CUSTOM("custom")` + + - `Type type` + + - `AGENT("agent")` + + - `long version` + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String environmentId` + + - `Metadata metadata` + + - `List resources` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String mountPath` + + - `Type type` + + - `GITHUB_REPOSITORY("github_repository")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String url` + + - `Optional checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `String name` + + Branch name to check out. + + - `Type type` + + - `BRANCH("branch")` + + - `class BetaManagedAgentsCommitCheckout:` + + - `String sha` + + Full commit SHA to check out. + + - `Type type` + + - `COMMIT("commit")` + + - `class BetaManagedAgentsFileResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String fileId` + + - `String mountPath` + + - `Type type` + + - `FILE("file")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsSessionStats stats` + + Timing statistics for a session. + + - `Optional activeSeconds` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `Optional durationSeconds` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `Status status` + + SessionStatus enum + + - `RESCHEDULING("rescheduling")` + + - `RUNNING("running")` + + - `IDLE("idle")` + + - `TERMINATED("terminated")` + + - `Optional title` + + - `Type type` + + - `SESSION("session")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsSessionUsage usage` + + Cumulative token usage for a session across all turns. + + - `Optional cacheCreation` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Optional ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Optional ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + + - `Optional cacheReadInputTokens` + + Total tokens read from prompt cache. + + - `Optional inputTokens` + + Total input tokens consumed across all turns. + + - `Optional outputTokens` + + Total output tokens generated across all turns. + + - `List vaultIds` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Beta Managed Agents Session Agent + +- `class BetaManagedAgentsSessionAgent:` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `String id` + + - `Optional description` + + - `List mcpServers` + + - `String name` + + - `Type type` + + - `URL("url")` + + - `String url` + + - `BetaManagedAgentsModelConfig model` + + Model identifier and configuration. + + - `BetaManagedAgentsModel id` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` + + Most intelligent model for building agents and coding + + - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` + + Best combination of speed and intelligence + + - `CLAUDE_HAIKU_4_5("claude-haiku-4-5")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_HAIKU_4_5_20251001("claude-haiku-4-5-20251001")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_OPUS_4_5("claude-opus-4-5")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_OPUS_4_5_20251101("claude-opus-4-5-20251101")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_SONNET_4_5("claude-sonnet-4-5")` + + High-performance model for agents and coding + + - `CLAUDE_SONNET_4_5_20250929("claude-sonnet-4-5-20250929")` + + High-performance model for agents and coding + + - `Optional speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `STANDARD("standard")` + + - `FAST("fast")` + + - `String name` + + - `List skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `String skillId` + + - `Type type` + + - `ANTHROPIC("anthropic")` + + - `String version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `String skillId` + + - `Type type` + + - `CUSTOM("custom")` + + - `String version` + + - `Optional system` + + - `List tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `List configs` + + - `boolean enabled` + + - `Name name` + + Built-in agent tool identifier. + + - `BASH("bash")` + + - `EDIT("edit")` + + - `READ("read")` + + - `WRITE("write")` + + - `GLOB("glob")` + + - `GREP("grep")` + + - `WEB_FETCH("web_fetch")` + + - `WEB_SEARCH("web_search")` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsAgentToolsetDefaultConfig defaultConfig` + + Resolved default configuration for agent tools. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `Type type` + + - `AGENT_TOOLSET_20260401("agent_toolset_20260401")` + + - `class BetaManagedAgentsMcpToolset:` + + - `List configs` + + - `boolean enabled` + + - `String name` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsMcpToolsetDefaultConfig defaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `String mcpServerName` + + - `Type type` + + - `MCP_TOOLSET("mcp_toolset")` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `String description` + + - `BetaManagedAgentsCustomToolInputSchema inputSchema` + + JSON Schema for custom tool input parameters. + + - `Optional properties` + + JSON Schema properties defining the tool's input parameters. + + - `Optional> required` + + List of required property names. + + - `Optional type` + + Must be 'object' for tool input schemas. + + - `OBJECT("object")` + + - `String name` + + - `Type type` + + - `CUSTOM("custom")` + + - `Type type` + + - `AGENT("agent")` + + - `long version` + +### Beta Managed Agents Session Stats + +- `class BetaManagedAgentsSessionStats:` + + Timing statistics for a session. + + - `Optional activeSeconds` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `Optional durationSeconds` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + +### Beta Managed Agents Session Usage + +- `class BetaManagedAgentsSessionUsage:` + + Cumulative token usage for a session across all turns. + + - `Optional cacheCreation` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Optional ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Optional ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + + - `Optional cacheReadInputTokens` + + Total tokens read from prompt cache. + + - `Optional inputTokens` + + Total input tokens consumed across all turns. + + - `Optional outputTokens` + + Total output tokens generated across all turns. + +# Events + +## List + +`EventListPage beta().sessions().events().list(EventListParamsparams = EventListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/sessions/{session_id}/events` + +List Events + +### Parameters + +- `EventListParams params` + + - `Optional sessionId` + + - `Optional limit` + + Query parameter for limit + + - `Optional order` + + Sort direction for results, ordered by created_at. Defaults to asc (chronological). + + - `ASC("asc")` + + - `DESC("desc")` + + - `Optional page` + + Opaque pagination cursor from a previous response's next_page. + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsSessionEvent: A class that can be one of several variants.union` + + Union type for all event types in a session. + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `String id` + + Unique identifier for this event. + + - `List content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Type type` + + - `USER_MESSAGE("user.message")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `String id` + + Unique identifier for this event. + + - `Type type` + + - `USER_INTERRUPT("user.interrupt")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `String id` + + Unique identifier for this event. + + - `Result result` + + UserToolConfirmationResult enum + + - `ALLOW("allow")` + + - `DENY("deny")` + + - `String toolUseId` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_TOOL_CONFIRMATION("user.tool_confirmation")` + + - `Optional denyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `String id` + + Unique identifier for this event. + + - `String customToolUseId` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_CUSTOM_TOOL_RESULT("user.custom_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent:` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String name` + + Name of the custom tool being called. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_CUSTOM_TOOL_USE("agent.custom_tool_use")` + + - `class BetaManagedAgentsAgentMessageEvent:` + + An agent response event in the session conversation. + + - `String id` + + Unique identifier for this event. + + - `List content` + + Array of text blocks comprising the agent response. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MESSAGE("agent.message")` + + - `class BetaManagedAgentsAgentThinkingEvent:` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_THINKING("agent.thinking")` + + - `class BetaManagedAgentsAgentMcpToolUseEvent:` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String mcpServerName` + + Name of the MCP server providing the tool. + + - `String name` + + Name of the MCP tool being used. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MCP_TOOL_USE("agent.mcp_tool_use")` + + - `Optional evaluatedPermission` + + AgentEvaluatedPermission enum + + - `ALLOW("allow")` + + - `ASK("ask")` + + - `DENY("deny")` + + - `class BetaManagedAgentsAgentMcpToolResultEvent:` + + Event representing the result of an MCP tool execution. + + - `String id` + + Unique identifier for this event. + + - `String mcpToolUseId` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MCP_TOOL_RESULT("agent.mcp_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent:` + + Event emitted when the agent invokes a built-in agent tool. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String name` + + Name of the agent tool being used. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_TOOL_USE("agent.tool_use")` + + - `Optional evaluatedPermission` + + AgentEvaluatedPermission enum + + - `ALLOW("allow")` + + - `ASK("ask")` + + - `DENY("deny")` + + - `class BetaManagedAgentsAgentToolResultEvent:` + + Event representing the result of an agent tool execution. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `String toolUseId` + + The id of the `agent.tool_use` event this result corresponds to. + + - `Type type` + + - `AGENT_TOOL_RESULT("agent.tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent:` + + Indicates that context compaction (summarization) occurred during the session. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_THREAD_CONTEXT_COMPACTED("agent.thread_context_compacted")` + + - `class BetaManagedAgentsSessionErrorEvent:` + + An error event indicating a problem occurred during session execution. + + - `String id` + + Unique identifier for this event. + + - `Error error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `UNKNOWN_ERROR("unknown_error")` + + - `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_OVERLOADED_ERROR("model_overloaded_error")` + + - `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_RATE_LIMITED_ERROR("model_rate_limited_error")` + + - `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_REQUEST_FAILED_ERROR("model_request_failed_error")` + + - `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `String mcpServerName` + + Name of the MCP server that failed to connect. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MCP_CONNECTION_FAILED_ERROR("mcp_connection_failed_error")` + + - `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `String mcpServerName` + + Name of the MCP server that failed authentication. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MCP_AUTHENTICATION_FAILED_ERROR("mcp_authentication_failed_error")` + + - `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `BILLING_ERROR("billing_error")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_ERROR("session.error")` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent:` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_RESCHEDULED("session.status_rescheduled")` + + - `class BetaManagedAgentsSessionStatusRunningEvent:` + + Indicates the session is actively running and the agent is working. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_RUNNING("session.status_running")` + + - `class BetaManagedAgentsSessionStatusIdleEvent:` + + Indicates the agent has paused and is awaiting user input. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `StopReason stopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type type` + + - `END_TURN("end_turn")` + + - `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `List eventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type type` + + - `REQUIRES_ACTION("requires_action")` + + - `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type type` + + - `RETRIES_EXHAUSTED("retries_exhausted")` + + - `Type type` + + - `SESSION_STATUS_IDLE("session.status_idle")` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent:` + + Indicates the session has terminated, either due to an error or completion. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_TERMINATED("session.status_terminated")` + + - `class BetaManagedAgentsSpanModelRequestStartEvent:` + + Emitted when a model request is initiated by the agent. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SPAN_MODEL_REQUEST_START("span.model_request_start")` + + - `class BetaManagedAgentsSpanModelRequestEndEvent:` + + Emitted when a model request completes. + + - `String id` + + Unique identifier for this event. + + - `Optional isError` + + Whether the model request resulted in an error. + + - `String modelRequestStartId` + + The id of the corresponding `span.model_request_start` event. + + - `BetaManagedAgentsSpanModelUsage modelUsage` + + Token usage for a single model request. + + - `long cacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `long cacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `long inputTokens` + + Input tokens consumed by this request. + + - `long outputTokens` + + Output tokens generated by this request. + + - `Optional speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `STANDARD("standard")` + + - `FAST("fast")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SPAN_MODEL_REQUEST_END("span.model_request_end")` + + - `class BetaManagedAgentsSessionDeletedEvent:` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_DELETED("session.deleted")` + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.sessions.events.EventListPage; +import com.anthropic.models.beta.sessions.events.EventListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + EventListPage page = client.beta().sessions().events().list("sesn_011CZkZAtmR3yMPDzynEDxu7"); + } +} +``` + +## Send + +`BetaManagedAgentsSendSessionEvents beta().sessions().events().send(EventSendParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/sessions/{session_id}/events` + +Send Events + +### Parameters + +- `EventSendParams params` + + - `Optional sessionId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + + - `List events` + + Events to send to the `session`. + + - `class BetaManagedAgentsUserMessageEventParams:` + + Parameters for sending a user message to the session. + + - `List content` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Type type` + + - `USER_MESSAGE("user.message")` + + - `class BetaManagedAgentsUserInterruptEventParams:` + + Parameters for sending an interrupt to pause the agent. + + - `Type type` + + - `USER_INTERRUPT("user.interrupt")` + + - `class BetaManagedAgentsUserToolConfirmationEventParams:` + + Parameters for confirming or denying a tool execution request. + + - `Result result` + + UserToolConfirmationResult enum + + - `ALLOW("allow")` + + - `DENY("deny")` + + - `String toolUseId` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_TOOL_CONFIRMATION("user.tool_confirmation")` + + - `Optional denyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `class BetaManagedAgentsUserCustomToolResultEventParams:` + + Parameters for providing the result of a custom tool execution. + + - `String customToolUseId` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_CUSTOM_TOOL_RESULT("user.custom_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + +### Returns + +- `class BetaManagedAgentsSendSessionEvents:` + + Events that were successfully sent to the session. + + - `Optional> data` + + Sent events + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `String id` + + Unique identifier for this event. + + - `List content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Type type` + + - `USER_MESSAGE("user.message")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `String id` + + Unique identifier for this event. + + - `Type type` + + - `USER_INTERRUPT("user.interrupt")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `String id` + + Unique identifier for this event. + + - `Result result` + + UserToolConfirmationResult enum + + - `ALLOW("allow")` + + - `DENY("deny")` + + - `String toolUseId` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_TOOL_CONFIRMATION("user.tool_confirmation")` + + - `Optional denyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `String id` + + Unique identifier for this event. + + - `String customToolUseId` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_CUSTOM_TOOL_RESULT("user.custom_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.sessions.events.BetaManagedAgentsSendSessionEvents; +import com.anthropic.models.beta.sessions.events.BetaManagedAgentsTextBlock; +import com.anthropic.models.beta.sessions.events.BetaManagedAgentsUserMessageEventParams; +import com.anthropic.models.beta.sessions.events.EventSendParams; +import java.util.List; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + EventSendParams params = EventSendParams.builder() + .sessionId("sesn_011CZkZAtmR3yMPDzynEDxu7") + .addUserMessageEvent(List.of(BetaManagedAgentsUserMessageEventParams.Content.ofText(BetaManagedAgentsTextBlock.builder() + .text("Where is my order #1234?") + .type(BetaManagedAgentsTextBlock.Type.TEXT) + .build()))) + .build(); + BetaManagedAgentsSendSessionEvents betaManagedAgentsSendSessionEvents = client.beta().sessions().events().send(params); + } +} +``` + +## Stream + +`BetaManagedAgentsStreamSessionEvents beta().sessions().events().streamStreaming(EventStreamParamsparams = EventStreamParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/sessions/{session_id}/events/stream` + +Stream Events + +### Parameters + +- `EventStreamParams params` + + - `Optional sessionId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsStreamSessionEvents: A class that can be one of several variants.union` + + Server-sent event in the session stream. + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `String id` + + Unique identifier for this event. + + - `List content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Type type` + + - `USER_MESSAGE("user.message")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `String id` + + Unique identifier for this event. + + - `Type type` + + - `USER_INTERRUPT("user.interrupt")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `String id` + + Unique identifier for this event. + + - `Result result` + + UserToolConfirmationResult enum + + - `ALLOW("allow")` + + - `DENY("deny")` + + - `String toolUseId` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_TOOL_CONFIRMATION("user.tool_confirmation")` + + - `Optional denyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `String id` + + Unique identifier for this event. + + - `String customToolUseId` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_CUSTOM_TOOL_RESULT("user.custom_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent:` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String name` + + Name of the custom tool being called. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_CUSTOM_TOOL_USE("agent.custom_tool_use")` + + - `class BetaManagedAgentsAgentMessageEvent:` + + An agent response event in the session conversation. + + - `String id` + + Unique identifier for this event. + + - `List content` + + Array of text blocks comprising the agent response. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MESSAGE("agent.message")` + + - `class BetaManagedAgentsAgentThinkingEvent:` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_THINKING("agent.thinking")` + + - `class BetaManagedAgentsAgentMcpToolUseEvent:` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String mcpServerName` + + Name of the MCP server providing the tool. + + - `String name` + + Name of the MCP tool being used. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MCP_TOOL_USE("agent.mcp_tool_use")` + + - `Optional evaluatedPermission` + + AgentEvaluatedPermission enum + + - `ALLOW("allow")` + + - `ASK("ask")` + + - `DENY("deny")` + + - `class BetaManagedAgentsAgentMcpToolResultEvent:` + + Event representing the result of an MCP tool execution. + + - `String id` + + Unique identifier for this event. + + - `String mcpToolUseId` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MCP_TOOL_RESULT("agent.mcp_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent:` + + Event emitted when the agent invokes a built-in agent tool. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String name` + + Name of the agent tool being used. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_TOOL_USE("agent.tool_use")` + + - `Optional evaluatedPermission` + + AgentEvaluatedPermission enum + + - `ALLOW("allow")` + + - `ASK("ask")` + + - `DENY("deny")` + + - `class BetaManagedAgentsAgentToolResultEvent:` + + Event representing the result of an agent tool execution. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `String toolUseId` + + The id of the `agent.tool_use` event this result corresponds to. + + - `Type type` + + - `AGENT_TOOL_RESULT("agent.tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent:` + + Indicates that context compaction (summarization) occurred during the session. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_THREAD_CONTEXT_COMPACTED("agent.thread_context_compacted")` + + - `class BetaManagedAgentsSessionErrorEvent:` + + An error event indicating a problem occurred during session execution. + + - `String id` + + Unique identifier for this event. + + - `Error error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `UNKNOWN_ERROR("unknown_error")` + + - `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_OVERLOADED_ERROR("model_overloaded_error")` + + - `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_RATE_LIMITED_ERROR("model_rate_limited_error")` + + - `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_REQUEST_FAILED_ERROR("model_request_failed_error")` + + - `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `String mcpServerName` + + Name of the MCP server that failed to connect. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MCP_CONNECTION_FAILED_ERROR("mcp_connection_failed_error")` + + - `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `String mcpServerName` + + Name of the MCP server that failed authentication. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MCP_AUTHENTICATION_FAILED_ERROR("mcp_authentication_failed_error")` + + - `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `BILLING_ERROR("billing_error")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_ERROR("session.error")` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent:` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_RESCHEDULED("session.status_rescheduled")` + + - `class BetaManagedAgentsSessionStatusRunningEvent:` + + Indicates the session is actively running and the agent is working. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_RUNNING("session.status_running")` + + - `class BetaManagedAgentsSessionStatusIdleEvent:` + + Indicates the agent has paused and is awaiting user input. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `StopReason stopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type type` + + - `END_TURN("end_turn")` + + - `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `List eventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type type` + + - `REQUIRES_ACTION("requires_action")` + + - `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type type` + + - `RETRIES_EXHAUSTED("retries_exhausted")` + + - `Type type` + + - `SESSION_STATUS_IDLE("session.status_idle")` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent:` + + Indicates the session has terminated, either due to an error or completion. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_TERMINATED("session.status_terminated")` + + - `class BetaManagedAgentsSpanModelRequestStartEvent:` + + Emitted when a model request is initiated by the agent. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SPAN_MODEL_REQUEST_START("span.model_request_start")` + + - `class BetaManagedAgentsSpanModelRequestEndEvent:` + + Emitted when a model request completes. + + - `String id` + + Unique identifier for this event. + + - `Optional isError` + + Whether the model request resulted in an error. + + - `String modelRequestStartId` + + The id of the corresponding `span.model_request_start` event. + + - `BetaManagedAgentsSpanModelUsage modelUsage` + + Token usage for a single model request. + + - `long cacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `long cacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `long inputTokens` + + Input tokens consumed by this request. + + - `long outputTokens` + + Output tokens generated by this request. + + - `Optional speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `STANDARD("standard")` + + - `FAST("fast")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SPAN_MODEL_REQUEST_END("span.model_request_end")` + + - `class BetaManagedAgentsSessionDeletedEvent:` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_DELETED("session.deleted")` + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.core.http.StreamResponse; +import com.anthropic.models.beta.sessions.events.BetaManagedAgentsStreamSessionEvents; +import com.anthropic.models.beta.sessions.events.EventStreamParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + StreamResponse betaManagedAgentsStreamSessionEvents = client.beta().sessions().events().streamStreaming("sesn_011CZkZAtmR3yMPDzynEDxu7"); + } +} +``` + +## Domain Types + +### Beta Managed Agents Agent Custom Tool Use Event + +- `class BetaManagedAgentsAgentCustomToolUseEvent:` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String name` + + Name of the custom tool being called. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_CUSTOM_TOOL_USE("agent.custom_tool_use")` + +### Beta Managed Agents Agent MCP Tool Result Event + +- `class BetaManagedAgentsAgentMcpToolResultEvent:` + + Event representing the result of an MCP tool execution. + + - `String id` + + Unique identifier for this event. + + - `String mcpToolUseId` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MCP_TOOL_RESULT("agent.mcp_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent MCP Tool Use Event + +- `class BetaManagedAgentsAgentMcpToolUseEvent:` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String mcpServerName` + + Name of the MCP server providing the tool. + + - `String name` + + Name of the MCP tool being used. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MCP_TOOL_USE("agent.mcp_tool_use")` + + - `Optional evaluatedPermission` + + AgentEvaluatedPermission enum + + - `ALLOW("allow")` + + - `ASK("ask")` + + - `DENY("deny")` + +### Beta Managed Agents Agent Message Event + +- `class BetaManagedAgentsAgentMessageEvent:` + + An agent response event in the session conversation. + + - `String id` + + Unique identifier for this event. + + - `List content` + + Array of text blocks comprising the agent response. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MESSAGE("agent.message")` + +### Beta Managed Agents Agent Thinking Event + +- `class BetaManagedAgentsAgentThinkingEvent:` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_THINKING("agent.thinking")` + +### Beta Managed Agents Agent Thread Context Compacted Event + +- `class BetaManagedAgentsAgentThreadContextCompactedEvent:` + + Indicates that context compaction (summarization) occurred during the session. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_THREAD_CONTEXT_COMPACTED("agent.thread_context_compacted")` + +### Beta Managed Agents Agent Tool Result Event + +- `class BetaManagedAgentsAgentToolResultEvent:` + + Event representing the result of an agent tool execution. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `String toolUseId` + + The id of the `agent.tool_use` event this result corresponds to. + + - `Type type` + + - `AGENT_TOOL_RESULT("agent.tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent Tool Use Event + +- `class BetaManagedAgentsAgentToolUseEvent:` + + Event emitted when the agent invokes a built-in agent tool. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String name` + + Name of the agent tool being used. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_TOOL_USE("agent.tool_use")` + + - `Optional evaluatedPermission` + + AgentEvaluatedPermission enum + + - `ALLOW("allow")` + + - `ASK("ask")` + + - `DENY("deny")` + +### Beta Managed Agents Base64 Document Source + +- `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + +### Beta Managed Agents Base64 Image Source + +- `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + +### Beta Managed Agents Billing Error + +- `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `BILLING_ERROR("billing_error")` + +### Beta Managed Agents Document Block + +- `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + +### Beta Managed Agents Event Params + +- `class BetaManagedAgentsEventParams: A class that can be one of several variants.union` + + Union type for event parameters that can be sent to a session. + + - `class BetaManagedAgentsUserMessageEventParams:` + + Parameters for sending a user message to the session. + + - `List content` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Type type` + + - `USER_MESSAGE("user.message")` + + - `class BetaManagedAgentsUserInterruptEventParams:` + + Parameters for sending an interrupt to pause the agent. + + - `Type type` + + - `USER_INTERRUPT("user.interrupt")` + + - `class BetaManagedAgentsUserToolConfirmationEventParams:` + + Parameters for confirming or denying a tool execution request. + + - `Result result` + + UserToolConfirmationResult enum + + - `ALLOW("allow")` + + - `DENY("deny")` + + - `String toolUseId` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_TOOL_CONFIRMATION("user.tool_confirmation")` + + - `Optional denyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `class BetaManagedAgentsUserCustomToolResultEventParams:` + + Parameters for providing the result of a custom tool execution. + + - `String customToolUseId` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_CUSTOM_TOOL_RESULT("user.custom_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents File Document Source + +- `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + +### Beta Managed Agents File Image Source + +- `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + +### Beta Managed Agents Image Block + +- `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + +### Beta Managed Agents MCP Authentication Failed Error + +- `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `String mcpServerName` + + Name of the MCP server that failed authentication. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MCP_AUTHENTICATION_FAILED_ERROR("mcp_authentication_failed_error")` + +### Beta Managed Agents MCP Connection Failed Error + +- `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `String mcpServerName` + + Name of the MCP server that failed to connect. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MCP_CONNECTION_FAILED_ERROR("mcp_connection_failed_error")` + +### Beta Managed Agents Model Overloaded Error + +- `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_OVERLOADED_ERROR("model_overloaded_error")` + +### Beta Managed Agents Model Rate Limited Error + +- `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_RATE_LIMITED_ERROR("model_rate_limited_error")` + +### Beta Managed Agents Model Request Failed Error + +- `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_REQUEST_FAILED_ERROR("model_request_failed_error")` + +### Beta Managed Agents Plain Text Document Source + +- `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + +### Beta Managed Agents Retry Status Exhausted + +- `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + +### Beta Managed Agents Retry Status Retrying + +- `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + +### Beta Managed Agents Retry Status Terminal + +- `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + +### Beta Managed Agents Send Session Events + +- `class BetaManagedAgentsSendSessionEvents:` + + Events that were successfully sent to the session. + + - `Optional> data` + + Sent events + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `String id` + + Unique identifier for this event. + + - `List content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Type type` + + - `USER_MESSAGE("user.message")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `String id` + + Unique identifier for this event. + + - `Type type` + + - `USER_INTERRUPT("user.interrupt")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `String id` + + Unique identifier for this event. + + - `Result result` + + UserToolConfirmationResult enum + + - `ALLOW("allow")` + + - `DENY("deny")` + + - `String toolUseId` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_TOOL_CONFIRMATION("user.tool_confirmation")` + + - `Optional denyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `String id` + + Unique identifier for this event. + + - `String customToolUseId` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_CUSTOM_TOOL_RESULT("user.custom_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + +### Beta Managed Agents Session Deleted Event + +- `class BetaManagedAgentsSessionDeletedEvent:` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_DELETED("session.deleted")` + +### Beta Managed Agents Session End Turn + +- `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type type` + + - `END_TURN("end_turn")` + +### Beta Managed Agents Session Error Event + +- `class BetaManagedAgentsSessionErrorEvent:` + + An error event indicating a problem occurred during session execution. + + - `String id` + + Unique identifier for this event. + + - `Error error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `UNKNOWN_ERROR("unknown_error")` + + - `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_OVERLOADED_ERROR("model_overloaded_error")` + + - `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_RATE_LIMITED_ERROR("model_rate_limited_error")` + + - `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_REQUEST_FAILED_ERROR("model_request_failed_error")` + + - `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `String mcpServerName` + + Name of the MCP server that failed to connect. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MCP_CONNECTION_FAILED_ERROR("mcp_connection_failed_error")` + + - `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `String mcpServerName` + + Name of the MCP server that failed authentication. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MCP_AUTHENTICATION_FAILED_ERROR("mcp_authentication_failed_error")` + + - `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `BILLING_ERROR("billing_error")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_ERROR("session.error")` + +### Beta Managed Agents Session Event + +- `class BetaManagedAgentsSessionEvent: A class that can be one of several variants.union` + + Union type for all event types in a session. + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `String id` + + Unique identifier for this event. + + - `List content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Type type` + + - `USER_MESSAGE("user.message")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `String id` + + Unique identifier for this event. + + - `Type type` + + - `USER_INTERRUPT("user.interrupt")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `String id` + + Unique identifier for this event. + + - `Result result` + + UserToolConfirmationResult enum + + - `ALLOW("allow")` + + - `DENY("deny")` + + - `String toolUseId` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_TOOL_CONFIRMATION("user.tool_confirmation")` + + - `Optional denyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `String id` + + Unique identifier for this event. + + - `String customToolUseId` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_CUSTOM_TOOL_RESULT("user.custom_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent:` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String name` + + Name of the custom tool being called. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_CUSTOM_TOOL_USE("agent.custom_tool_use")` + + - `class BetaManagedAgentsAgentMessageEvent:` + + An agent response event in the session conversation. + + - `String id` + + Unique identifier for this event. + + - `List content` + + Array of text blocks comprising the agent response. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MESSAGE("agent.message")` + + - `class BetaManagedAgentsAgentThinkingEvent:` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_THINKING("agent.thinking")` + + - `class BetaManagedAgentsAgentMcpToolUseEvent:` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String mcpServerName` + + Name of the MCP server providing the tool. + + - `String name` + + Name of the MCP tool being used. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MCP_TOOL_USE("agent.mcp_tool_use")` + + - `Optional evaluatedPermission` + + AgentEvaluatedPermission enum + + - `ALLOW("allow")` + + - `ASK("ask")` + + - `DENY("deny")` + + - `class BetaManagedAgentsAgentMcpToolResultEvent:` + + Event representing the result of an MCP tool execution. + + - `String id` + + Unique identifier for this event. + + - `String mcpToolUseId` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MCP_TOOL_RESULT("agent.mcp_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent:` + + Event emitted when the agent invokes a built-in agent tool. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String name` + + Name of the agent tool being used. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_TOOL_USE("agent.tool_use")` + + - `Optional evaluatedPermission` + + AgentEvaluatedPermission enum + + - `ALLOW("allow")` + + - `ASK("ask")` + + - `DENY("deny")` + + - `class BetaManagedAgentsAgentToolResultEvent:` + + Event representing the result of an agent tool execution. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `String toolUseId` + + The id of the `agent.tool_use` event this result corresponds to. + + - `Type type` + + - `AGENT_TOOL_RESULT("agent.tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent:` + + Indicates that context compaction (summarization) occurred during the session. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_THREAD_CONTEXT_COMPACTED("agent.thread_context_compacted")` + + - `class BetaManagedAgentsSessionErrorEvent:` + + An error event indicating a problem occurred during session execution. + + - `String id` + + Unique identifier for this event. + + - `Error error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `UNKNOWN_ERROR("unknown_error")` + + - `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_OVERLOADED_ERROR("model_overloaded_error")` + + - `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_RATE_LIMITED_ERROR("model_rate_limited_error")` + + - `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_REQUEST_FAILED_ERROR("model_request_failed_error")` + + - `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `String mcpServerName` + + Name of the MCP server that failed to connect. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MCP_CONNECTION_FAILED_ERROR("mcp_connection_failed_error")` + + - `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `String mcpServerName` + + Name of the MCP server that failed authentication. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MCP_AUTHENTICATION_FAILED_ERROR("mcp_authentication_failed_error")` + + - `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `BILLING_ERROR("billing_error")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_ERROR("session.error")` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent:` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_RESCHEDULED("session.status_rescheduled")` + + - `class BetaManagedAgentsSessionStatusRunningEvent:` + + Indicates the session is actively running and the agent is working. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_RUNNING("session.status_running")` + + - `class BetaManagedAgentsSessionStatusIdleEvent:` + + Indicates the agent has paused and is awaiting user input. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `StopReason stopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type type` + + - `END_TURN("end_turn")` + + - `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `List eventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type type` + + - `REQUIRES_ACTION("requires_action")` + + - `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type type` + + - `RETRIES_EXHAUSTED("retries_exhausted")` + + - `Type type` + + - `SESSION_STATUS_IDLE("session.status_idle")` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent:` + + Indicates the session has terminated, either due to an error or completion. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_TERMINATED("session.status_terminated")` + + - `class BetaManagedAgentsSpanModelRequestStartEvent:` + + Emitted when a model request is initiated by the agent. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SPAN_MODEL_REQUEST_START("span.model_request_start")` + + - `class BetaManagedAgentsSpanModelRequestEndEvent:` + + Emitted when a model request completes. + + - `String id` + + Unique identifier for this event. + + - `Optional isError` + + Whether the model request resulted in an error. + + - `String modelRequestStartId` + + The id of the corresponding `span.model_request_start` event. + + - `BetaManagedAgentsSpanModelUsage modelUsage` + + Token usage for a single model request. + + - `long cacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `long cacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `long inputTokens` + + Input tokens consumed by this request. + + - `long outputTokens` + + Output tokens generated by this request. + + - `Optional speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `STANDARD("standard")` + + - `FAST("fast")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SPAN_MODEL_REQUEST_END("span.model_request_end")` + + - `class BetaManagedAgentsSessionDeletedEvent:` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_DELETED("session.deleted")` + +### Beta Managed Agents Session Requires Action + +- `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `List eventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type type` + + - `REQUIRES_ACTION("requires_action")` + +### Beta Managed Agents Session Retries Exhausted + +- `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type type` + + - `RETRIES_EXHAUSTED("retries_exhausted")` + +### Beta Managed Agents Session Status Idle Event + +- `class BetaManagedAgentsSessionStatusIdleEvent:` + + Indicates the agent has paused and is awaiting user input. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `StopReason stopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type type` + + - `END_TURN("end_turn")` + + - `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `List eventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type type` + + - `REQUIRES_ACTION("requires_action")` + + - `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type type` + + - `RETRIES_EXHAUSTED("retries_exhausted")` + + - `Type type` + + - `SESSION_STATUS_IDLE("session.status_idle")` + +### Beta Managed Agents Session Status Rescheduled Event + +- `class BetaManagedAgentsSessionStatusRescheduledEvent:` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_RESCHEDULED("session.status_rescheduled")` + +### Beta Managed Agents Session Status Running Event + +- `class BetaManagedAgentsSessionStatusRunningEvent:` + + Indicates the session is actively running and the agent is working. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_RUNNING("session.status_running")` + +### Beta Managed Agents Session Status Terminated Event + +- `class BetaManagedAgentsSessionStatusTerminatedEvent:` + + Indicates the session has terminated, either due to an error or completion. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_TERMINATED("session.status_terminated")` + +### Beta Managed Agents Span Model Request End Event + +- `class BetaManagedAgentsSpanModelRequestEndEvent:` + + Emitted when a model request completes. + + - `String id` + + Unique identifier for this event. + + - `Optional isError` + + Whether the model request resulted in an error. + + - `String modelRequestStartId` + + The id of the corresponding `span.model_request_start` event. + + - `BetaManagedAgentsSpanModelUsage modelUsage` + + Token usage for a single model request. + + - `long cacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `long cacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `long inputTokens` + + Input tokens consumed by this request. + + - `long outputTokens` + + Output tokens generated by this request. + + - `Optional speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `STANDARD("standard")` + + - `FAST("fast")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SPAN_MODEL_REQUEST_END("span.model_request_end")` + +### Beta Managed Agents Span Model Request Start Event + +- `class BetaManagedAgentsSpanModelRequestStartEvent:` + + Emitted when a model request is initiated by the agent. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SPAN_MODEL_REQUEST_START("span.model_request_start")` + +### Beta Managed Agents Span Model Usage + +- `class BetaManagedAgentsSpanModelUsage:` + + Token usage for a single model request. + + - `long cacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `long cacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `long inputTokens` + + Input tokens consumed by this request. + + - `long outputTokens` + + Output tokens generated by this request. + + - `Optional speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `STANDARD("standard")` + + - `FAST("fast")` + +### Beta Managed Agents Stream Session Events + +- `class BetaManagedAgentsStreamSessionEvents: A class that can be one of several variants.union` + + Server-sent event in the session stream. + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `String id` + + Unique identifier for this event. + + - `List content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Type type` + + - `USER_MESSAGE("user.message")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `String id` + + Unique identifier for this event. + + - `Type type` + + - `USER_INTERRUPT("user.interrupt")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `String id` + + Unique identifier for this event. + + - `Result result` + + UserToolConfirmationResult enum + + - `ALLOW("allow")` + + - `DENY("deny")` + + - `String toolUseId` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_TOOL_CONFIRMATION("user.tool_confirmation")` + + - `Optional denyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `String id` + + Unique identifier for this event. + + - `String customToolUseId` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_CUSTOM_TOOL_RESULT("user.custom_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent:` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String name` + + Name of the custom tool being called. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_CUSTOM_TOOL_USE("agent.custom_tool_use")` + + - `class BetaManagedAgentsAgentMessageEvent:` + + An agent response event in the session conversation. + + - `String id` + + Unique identifier for this event. + + - `List content` + + Array of text blocks comprising the agent response. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MESSAGE("agent.message")` + + - `class BetaManagedAgentsAgentThinkingEvent:` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_THINKING("agent.thinking")` + + - `class BetaManagedAgentsAgentMcpToolUseEvent:` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String mcpServerName` + + Name of the MCP server providing the tool. + + - `String name` + + Name of the MCP tool being used. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MCP_TOOL_USE("agent.mcp_tool_use")` + + - `Optional evaluatedPermission` + + AgentEvaluatedPermission enum + + - `ALLOW("allow")` + + - `ASK("ask")` + + - `DENY("deny")` + + - `class BetaManagedAgentsAgentMcpToolResultEvent:` + + Event representing the result of an MCP tool execution. + + - `String id` + + Unique identifier for this event. + + - `String mcpToolUseId` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MCP_TOOL_RESULT("agent.mcp_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent:` + + Event emitted when the agent invokes a built-in agent tool. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String name` + + Name of the agent tool being used. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_TOOL_USE("agent.tool_use")` + + - `Optional evaluatedPermission` + + AgentEvaluatedPermission enum + + - `ALLOW("allow")` + + - `ASK("ask")` + + - `DENY("deny")` + + - `class BetaManagedAgentsAgentToolResultEvent:` + + Event representing the result of an agent tool execution. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `String toolUseId` + + The id of the `agent.tool_use` event this result corresponds to. + + - `Type type` + + - `AGENT_TOOL_RESULT("agent.tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent:` + + Indicates that context compaction (summarization) occurred during the session. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_THREAD_CONTEXT_COMPACTED("agent.thread_context_compacted")` + + - `class BetaManagedAgentsSessionErrorEvent:` + + An error event indicating a problem occurred during session execution. + + - `String id` + + Unique identifier for this event. + + - `Error error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `UNKNOWN_ERROR("unknown_error")` + + - `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_OVERLOADED_ERROR("model_overloaded_error")` + + - `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_RATE_LIMITED_ERROR("model_rate_limited_error")` + + - `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_REQUEST_FAILED_ERROR("model_request_failed_error")` + + - `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `String mcpServerName` + + Name of the MCP server that failed to connect. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MCP_CONNECTION_FAILED_ERROR("mcp_connection_failed_error")` + + - `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `String mcpServerName` + + Name of the MCP server that failed authentication. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MCP_AUTHENTICATION_FAILED_ERROR("mcp_authentication_failed_error")` + + - `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `BILLING_ERROR("billing_error")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_ERROR("session.error")` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent:` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_RESCHEDULED("session.status_rescheduled")` + + - `class BetaManagedAgentsSessionStatusRunningEvent:` + + Indicates the session is actively running and the agent is working. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_RUNNING("session.status_running")` + + - `class BetaManagedAgentsSessionStatusIdleEvent:` + + Indicates the agent has paused and is awaiting user input. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `StopReason stopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type type` + + - `END_TURN("end_turn")` + + - `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `List eventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type type` + + - `REQUIRES_ACTION("requires_action")` + + - `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type type` + + - `RETRIES_EXHAUSTED("retries_exhausted")` + + - `Type type` + + - `SESSION_STATUS_IDLE("session.status_idle")` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent:` + + Indicates the session has terminated, either due to an error or completion. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_TERMINATED("session.status_terminated")` + + - `class BetaManagedAgentsSpanModelRequestStartEvent:` + + Emitted when a model request is initiated by the agent. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SPAN_MODEL_REQUEST_START("span.model_request_start")` + + - `class BetaManagedAgentsSpanModelRequestEndEvent:` + + Emitted when a model request completes. + + - `String id` + + Unique identifier for this event. + + - `Optional isError` + + Whether the model request resulted in an error. + + - `String modelRequestStartId` + + The id of the corresponding `span.model_request_start` event. + + - `BetaManagedAgentsSpanModelUsage modelUsage` + + Token usage for a single model request. + + - `long cacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `long cacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `long inputTokens` + + Input tokens consumed by this request. + + - `long outputTokens` + + Output tokens generated by this request. + + - `Optional speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `STANDARD("standard")` + + - `FAST("fast")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SPAN_MODEL_REQUEST_END("span.model_request_end")` + + - `class BetaManagedAgentsSessionDeletedEvent:` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_DELETED("session.deleted")` + +### Beta Managed Agents Text Block + +- `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + +### Beta Managed Agents Unknown Error + +- `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `UNKNOWN_ERROR("unknown_error")` + +### Beta Managed Agents URL Document Source + +- `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + +### Beta Managed Agents URL Image Source + +- `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + +### Beta Managed Agents User Custom Tool Result Event + +- `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `String id` + + Unique identifier for this event. + + - `String customToolUseId` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_CUSTOM_TOOL_RESULT("user.custom_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Custom Tool Result Event Params + +- `class BetaManagedAgentsUserCustomToolResultEventParams:` + + Parameters for providing the result of a custom tool execution. + + - `String customToolUseId` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_CUSTOM_TOOL_RESULT("user.custom_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents User Interrupt Event + +- `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `String id` + + Unique identifier for this event. + + - `Type type` + + - `USER_INTERRUPT("user.interrupt")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Interrupt Event Params + +- `class BetaManagedAgentsUserInterruptEventParams:` + + Parameters for sending an interrupt to pause the agent. + + - `Type type` + + - `USER_INTERRUPT("user.interrupt")` + +### Beta Managed Agents User Message Event + +- `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `String id` + + Unique identifier for this event. + + - `List content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Type type` + + - `USER_MESSAGE("user.message")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Message Event Params + +- `class BetaManagedAgentsUserMessageEventParams:` + + Parameters for sending a user message to the session. + + - `List content` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Type type` + + - `USER_MESSAGE("user.message")` + +### Beta Managed Agents User Tool Confirmation Event + +- `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `String id` + + Unique identifier for this event. + + - `Result result` + + UserToolConfirmationResult enum + + - `ALLOW("allow")` + + - `DENY("deny")` + + - `String toolUseId` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_TOOL_CONFIRMATION("user.tool_confirmation")` + + - `Optional denyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Tool Confirmation Event Params + +- `class BetaManagedAgentsUserToolConfirmationEventParams:` + + Parameters for confirming or denying a tool execution request. + + - `Result result` + + UserToolConfirmationResult enum + + - `ALLOW("allow")` + + - `DENY("deny")` + + - `String toolUseId` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_TOOL_CONFIRMATION("user.tool_confirmation")` + + - `Optional denyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + +# Resources + +## Add + +`BetaManagedAgentsFileResource beta().sessions().resources().add(ResourceAddParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/sessions/{session_id}/resources` + +Add Session Resource + +### Parameters + +- `ResourceAddParams params` + + - `Optional sessionId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + + - `BetaManagedAgentsFileResourceParams betaManagedAgentsFileResourceParams` + + Mount a file uploaded via the Files API into the session. + +### Returns + +- `class BetaManagedAgentsFileResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String fileId` + + - `String mountPath` + + - `Type type` + + - `FILE("file")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.sessions.BetaManagedAgentsFileResourceParams; +import com.anthropic.models.beta.sessions.resources.BetaManagedAgentsFileResource; +import com.anthropic.models.beta.sessions.resources.ResourceAddParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + ResourceAddParams params = ResourceAddParams.builder() + .sessionId("sesn_011CZkZAtmR3yMPDzynEDxu7") + .betaManagedAgentsFileResourceParams(BetaManagedAgentsFileResourceParams.builder() + .fileId("file_011CNha8iCJcU1wXNR6q4V8w") + .type(BetaManagedAgentsFileResourceParams.Type.FILE) + .build()) + .build(); + BetaManagedAgentsFileResource betaManagedAgentsFileResource = client.beta().sessions().resources().add(params); + } +} +``` + +## List + +`ResourceListPage beta().sessions().resources().list(ResourceListParamsparams = ResourceListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/sessions/{session_id}/resources` + +List Session Resources + +### Parameters + +- `ResourceListParams params` + + - `Optional sessionId` + + - `Optional limit` + + Maximum number of resources to return per page (max 1000). If omitted, returns all resources. + + - `Optional page` + + Opaque cursor from a previous response's next_page field. + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsSessionResource: A class that can be one of several variants.union` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String mountPath` + + - `Type type` + + - `GITHUB_REPOSITORY("github_repository")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String url` + + - `Optional checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `String name` + + Branch name to check out. + + - `Type type` + + - `BRANCH("branch")` + + - `class BetaManagedAgentsCommitCheckout:` + + - `String sha` + + Full commit SHA to check out. + + - `Type type` + + - `COMMIT("commit")` + + - `class BetaManagedAgentsFileResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String fileId` + + - `String mountPath` + + - `Type type` + + - `FILE("file")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.sessions.resources.ResourceListPage; +import com.anthropic.models.beta.sessions.resources.ResourceListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + ResourceListPage page = client.beta().sessions().resources().list("sesn_011CZkZAtmR3yMPDzynEDxu7"); + } +} +``` + +## Retrieve + +`ResourceRetrieveResponse beta().sessions().resources().retrieve(ResourceRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/sessions/{session_id}/resources/{resource_id}` + +Get Session Resource + +### Parameters + +- `ResourceRetrieveParams params` + + - `String sessionId` + + - `Optional resourceId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class ResourceRetrieveResponse: A class that can be one of several variants.union` + + The requested session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String mountPath` + + - `Type type` + + - `GITHUB_REPOSITORY("github_repository")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String url` + + - `Optional checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `String name` + + Branch name to check out. + + - `Type type` + + - `BRANCH("branch")` + + - `class BetaManagedAgentsCommitCheckout:` + + - `String sha` + + Full commit SHA to check out. + + - `Type type` + + - `COMMIT("commit")` + + - `class BetaManagedAgentsFileResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String fileId` + + - `String mountPath` + + - `Type type` + + - `FILE("file")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.sessions.resources.ResourceRetrieveParams; +import com.anthropic.models.beta.sessions.resources.ResourceRetrieveResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + ResourceRetrieveParams params = ResourceRetrieveParams.builder() + .sessionId("sesn_011CZkZAtmR3yMPDzynEDxu7") + .resourceId("sesrsc_011CZkZBJq5dWxk9fVLNcPht") + .build(); + ResourceRetrieveResponse resource = client.beta().sessions().resources().retrieve(params); + } +} +``` + +## Update + +`ResourceUpdateResponse beta().sessions().resources().update(ResourceUpdateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/sessions/{session_id}/resources/{resource_id}` + +Update Session Resource + +### Parameters + +- `ResourceUpdateParams params` + + - `String sessionId` + + - `Optional resourceId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + + - `String authorizationToken` + + New authorization token for the resource. Currently only `github_repository` resources support token rotation. + +### Returns + +- `class ResourceUpdateResponse: A class that can be one of several variants.union` + + The updated session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String mountPath` + + - `Type type` + + - `GITHUB_REPOSITORY("github_repository")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String url` + + - `Optional checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `String name` + + Branch name to check out. + + - `Type type` + + - `BRANCH("branch")` + + - `class BetaManagedAgentsCommitCheckout:` + + - `String sha` + + Full commit SHA to check out. + + - `Type type` + + - `COMMIT("commit")` + + - `class BetaManagedAgentsFileResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String fileId` + + - `String mountPath` + + - `Type type` + + - `FILE("file")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.sessions.resources.ResourceUpdateParams; +import com.anthropic.models.beta.sessions.resources.ResourceUpdateResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + ResourceUpdateParams params = ResourceUpdateParams.builder() + .sessionId("sesn_011CZkZAtmR3yMPDzynEDxu7") + .resourceId("sesrsc_011CZkZBJq5dWxk9fVLNcPht") + .authorizationToken("ghp_exampletoken") + .build(); + ResourceUpdateResponse resource = client.beta().sessions().resources().update(params); + } +} +``` + +## Delete + +`BetaManagedAgentsDeleteSessionResource beta().sessions().resources().delete(ResourceDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**delete** `/v1/sessions/{session_id}/resources/{resource_id}` + +Delete Session Resource + +### Parameters + +- `ResourceDeleteParams params` + + - `String sessionId` + + - `Optional resourceId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsDeleteSessionResource:` + + Confirmation of resource deletion. + + - `String id` + + - `Type type` + + - `SESSION_RESOURCE_DELETED("session_resource_deleted")` + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.sessions.resources.BetaManagedAgentsDeleteSessionResource; +import com.anthropic.models.beta.sessions.resources.ResourceDeleteParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + ResourceDeleteParams params = ResourceDeleteParams.builder() + .sessionId("sesn_011CZkZAtmR3yMPDzynEDxu7") + .resourceId("sesrsc_011CZkZBJq5dWxk9fVLNcPht") + .build(); + BetaManagedAgentsDeleteSessionResource betaManagedAgentsDeleteSessionResource = client.beta().sessions().resources().delete(params); + } +} +``` + +## Domain Types + +### Beta Managed Agents Delete Session Resource + +- `class BetaManagedAgentsDeleteSessionResource:` + + Confirmation of resource deletion. + + - `String id` + + - `Type type` + + - `SESSION_RESOURCE_DELETED("session_resource_deleted")` + +### Beta Managed Agents File Resource + +- `class BetaManagedAgentsFileResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String fileId` + + - `String mountPath` + + - `Type type` + + - `FILE("file")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + +### Beta Managed Agents GitHub Repository Resource + +- `class BetaManagedAgentsGitHubRepositoryResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String mountPath` + + - `Type type` + + - `GITHUB_REPOSITORY("github_repository")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String url` + + - `Optional checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `String name` + + Branch name to check out. + + - `Type type` + + - `BRANCH("branch")` + + - `class BetaManagedAgentsCommitCheckout:` + + - `String sha` + + Full commit SHA to check out. + + - `Type type` + + - `COMMIT("commit")` + +### Beta Managed Agents Session Resource + +- `class BetaManagedAgentsSessionResource: A class that can be one of several variants.union` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String mountPath` + + - `Type type` + + - `GITHUB_REPOSITORY("github_repository")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String url` + + - `Optional checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `String name` + + Branch name to check out. + + - `Type type` + + - `BRANCH("branch")` + + - `class BetaManagedAgentsCommitCheckout:` + + - `String sha` + + Full commit SHA to check out. + + - `Type type` + + - `COMMIT("commit")` + + - `class BetaManagedAgentsFileResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String fileId` + + - `String mountPath` + + - `Type type` + + - `FILE("file")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format diff --git a/content/en/api/java/beta/sessions/archive.md b/content/en/api/java/beta/sessions/archive.md new file mode 100644 index 000000000..572b614e0 --- /dev/null +++ b/content/en/api/java/beta/sessions/archive.md @@ -0,0 +1,502 @@ +## Archive + +`BetaManagedAgentsSession beta().sessions().archive(SessionArchiveParamsparams = SessionArchiveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/sessions/{session_id}/archive` + +Archive Session + +### Parameters + +- `SessionArchiveParams params` + + - `Optional sessionId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsSession:` + + A Managed Agents `session`. + + - `String id` + + - `BetaManagedAgentsSessionAgent agent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `String id` + + - `Optional description` + + - `List mcpServers` + + - `String name` + + - `Type type` + + - `URL("url")` + + - `String url` + + - `BetaManagedAgentsModelConfig model` + + Model identifier and configuration. + + - `BetaManagedAgentsModel id` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` + + Most intelligent model for building agents and coding + + - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` + + Best combination of speed and intelligence + + - `CLAUDE_HAIKU_4_5("claude-haiku-4-5")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_HAIKU_4_5_20251001("claude-haiku-4-5-20251001")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_OPUS_4_5("claude-opus-4-5")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_OPUS_4_5_20251101("claude-opus-4-5-20251101")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_SONNET_4_5("claude-sonnet-4-5")` + + High-performance model for agents and coding + + - `CLAUDE_SONNET_4_5_20250929("claude-sonnet-4-5-20250929")` + + High-performance model for agents and coding + + - `Optional speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `STANDARD("standard")` + + - `FAST("fast")` + + - `String name` + + - `List skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `String skillId` + + - `Type type` + + - `ANTHROPIC("anthropic")` + + - `String version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `String skillId` + + - `Type type` + + - `CUSTOM("custom")` + + - `String version` + + - `Optional system` + + - `List tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `List configs` + + - `boolean enabled` + + - `Name name` + + Built-in agent tool identifier. + + - `BASH("bash")` + + - `EDIT("edit")` + + - `READ("read")` + + - `WRITE("write")` + + - `GLOB("glob")` + + - `GREP("grep")` + + - `WEB_FETCH("web_fetch")` + + - `WEB_SEARCH("web_search")` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsAgentToolsetDefaultConfig defaultConfig` + + Resolved default configuration for agent tools. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `Type type` + + - `AGENT_TOOLSET_20260401("agent_toolset_20260401")` + + - `class BetaManagedAgentsMcpToolset:` + + - `List configs` + + - `boolean enabled` + + - `String name` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsMcpToolsetDefaultConfig defaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `String mcpServerName` + + - `Type type` + + - `MCP_TOOLSET("mcp_toolset")` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `String description` + + - `BetaManagedAgentsCustomToolInputSchema inputSchema` + + JSON Schema for custom tool input parameters. + + - `Optional properties` + + JSON Schema properties defining the tool's input parameters. + + - `Optional> required` + + List of required property names. + + - `Optional type` + + Must be 'object' for tool input schemas. + + - `OBJECT("object")` + + - `String name` + + - `Type type` + + - `CUSTOM("custom")` + + - `Type type` + + - `AGENT("agent")` + + - `long version` + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String environmentId` + + - `Metadata metadata` + + - `List resources` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String mountPath` + + - `Type type` + + - `GITHUB_REPOSITORY("github_repository")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String url` + + - `Optional checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `String name` + + Branch name to check out. + + - `Type type` + + - `BRANCH("branch")` + + - `class BetaManagedAgentsCommitCheckout:` + + - `String sha` + + Full commit SHA to check out. + + - `Type type` + + - `COMMIT("commit")` + + - `class BetaManagedAgentsFileResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String fileId` + + - `String mountPath` + + - `Type type` + + - `FILE("file")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsSessionStats stats` + + Timing statistics for a session. + + - `Optional activeSeconds` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `Optional durationSeconds` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `Status status` + + SessionStatus enum + + - `RESCHEDULING("rescheduling")` + + - `RUNNING("running")` + + - `IDLE("idle")` + + - `TERMINATED("terminated")` + + - `Optional title` + + - `Type type` + + - `SESSION("session")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsSessionUsage usage` + + Cumulative token usage for a session across all turns. + + - `Optional cacheCreation` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Optional ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Optional ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + + - `Optional cacheReadInputTokens` + + Total tokens read from prompt cache. + + - `Optional inputTokens` + + Total input tokens consumed across all turns. + + - `Optional outputTokens` + + Total output tokens generated across all turns. + + - `List vaultIds` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.sessions.BetaManagedAgentsSession; +import com.anthropic.models.beta.sessions.SessionArchiveParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BetaManagedAgentsSession betaManagedAgentsSession = client.beta().sessions().archive("sesn_011CZkZAtmR3yMPDzynEDxu7"); + } +} +``` diff --git a/content/en/api/java/beta/sessions/create.md b/content/en/api/java/beta/sessions/create.md new file mode 100644 index 000000000..c529119c6 --- /dev/null +++ b/content/en/api/java/beta/sessions/create.md @@ -0,0 +1,606 @@ +## Create + +`BetaManagedAgentsSession beta().sessions().create(SessionCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/sessions` + +Create Session + +### Parameters + +- `SessionCreateParams params` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + + - `Agent agent` + + Agent identifier. Accepts the `agent` ID string, which pins the latest version for the session, or an `agent` object with both id and version specified. + + - `String` + + - `class BetaManagedAgentsAgentParams:` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `String id` + + The `agent` ID. + + - `Type type` + + - `AGENT("agent")` + + - `Optional version` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + + - `String environmentId` + + ID of the `environment` defining the container configuration for this session. + + - `Optional metadata` + + Arbitrary key-value metadata attached to the session. + + - `Optional> resources` + + Resources (e.g. repositories, files) to mount into the session's container. + + - `class BetaManagedAgentsGitHubRepositoryResourceParams:` + + Mount a GitHub repository into the session's container. + + - `String authorizationToken` + + GitHub authorization token used to clone the repository. + + - `Type type` + + - `GITHUB_REPOSITORY("github_repository")` + + - `String url` + + Github URL of the repository + + - `Optional checkout` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `class BetaManagedAgentsBranchCheckout:` + + - `String name` + + Branch name to check out. + + - `Type type` + + - `BRANCH("branch")` + + - `class BetaManagedAgentsCommitCheckout:` + + - `String sha` + + Full commit SHA to check out. + + - `Type type` + + - `COMMIT("commit")` + + - `Optional mountPath` + + Mount path in the container. Defaults to `/workspace/`. + + - `class BetaManagedAgentsFileResourceParams:` + + Mount a file uploaded via the Files API into the session. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Optional mountPath` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + + - `Optional title` + + Human-readable session title. + + - `Optional> vaultIds` + + Vault IDs for stored credentials the agent can use during the session. + +### Returns + +- `class BetaManagedAgentsSession:` + + A Managed Agents `session`. + + - `String id` + + - `BetaManagedAgentsSessionAgent agent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `String id` + + - `Optional description` + + - `List mcpServers` + + - `String name` + + - `Type type` + + - `URL("url")` + + - `String url` + + - `BetaManagedAgentsModelConfig model` + + Model identifier and configuration. + + - `BetaManagedAgentsModel id` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` + + Most intelligent model for building agents and coding + + - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` + + Best combination of speed and intelligence + + - `CLAUDE_HAIKU_4_5("claude-haiku-4-5")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_HAIKU_4_5_20251001("claude-haiku-4-5-20251001")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_OPUS_4_5("claude-opus-4-5")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_OPUS_4_5_20251101("claude-opus-4-5-20251101")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_SONNET_4_5("claude-sonnet-4-5")` + + High-performance model for agents and coding + + - `CLAUDE_SONNET_4_5_20250929("claude-sonnet-4-5-20250929")` + + High-performance model for agents and coding + + - `Optional speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `STANDARD("standard")` + + - `FAST("fast")` + + - `String name` + + - `List skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `String skillId` + + - `Type type` + + - `ANTHROPIC("anthropic")` + + - `String version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `String skillId` + + - `Type type` + + - `CUSTOM("custom")` + + - `String version` + + - `Optional system` + + - `List tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `List configs` + + - `boolean enabled` + + - `Name name` + + Built-in agent tool identifier. + + - `BASH("bash")` + + - `EDIT("edit")` + + - `READ("read")` + + - `WRITE("write")` + + - `GLOB("glob")` + + - `GREP("grep")` + + - `WEB_FETCH("web_fetch")` + + - `WEB_SEARCH("web_search")` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsAgentToolsetDefaultConfig defaultConfig` + + Resolved default configuration for agent tools. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `Type type` + + - `AGENT_TOOLSET_20260401("agent_toolset_20260401")` + + - `class BetaManagedAgentsMcpToolset:` + + - `List configs` + + - `boolean enabled` + + - `String name` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsMcpToolsetDefaultConfig defaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `String mcpServerName` + + - `Type type` + + - `MCP_TOOLSET("mcp_toolset")` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `String description` + + - `BetaManagedAgentsCustomToolInputSchema inputSchema` + + JSON Schema for custom tool input parameters. + + - `Optional properties` + + JSON Schema properties defining the tool's input parameters. + + - `Optional> required` + + List of required property names. + + - `Optional type` + + Must be 'object' for tool input schemas. + + - `OBJECT("object")` + + - `String name` + + - `Type type` + + - `CUSTOM("custom")` + + - `Type type` + + - `AGENT("agent")` + + - `long version` + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String environmentId` + + - `Metadata metadata` + + - `List resources` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String mountPath` + + - `Type type` + + - `GITHUB_REPOSITORY("github_repository")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String url` + + - `Optional checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `String name` + + Branch name to check out. + + - `Type type` + + - `BRANCH("branch")` + + - `class BetaManagedAgentsCommitCheckout:` + + - `String sha` + + Full commit SHA to check out. + + - `Type type` + + - `COMMIT("commit")` + + - `class BetaManagedAgentsFileResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String fileId` + + - `String mountPath` + + - `Type type` + + - `FILE("file")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsSessionStats stats` + + Timing statistics for a session. + + - `Optional activeSeconds` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `Optional durationSeconds` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `Status status` + + SessionStatus enum + + - `RESCHEDULING("rescheduling")` + + - `RUNNING("running")` + + - `IDLE("idle")` + + - `TERMINATED("terminated")` + + - `Optional title` + + - `Type type` + + - `SESSION("session")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsSessionUsage usage` + + Cumulative token usage for a session across all turns. + + - `Optional cacheCreation` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Optional ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Optional ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + + - `Optional cacheReadInputTokens` + + Total tokens read from prompt cache. + + - `Optional inputTokens` + + Total input tokens consumed across all turns. + + - `Optional outputTokens` + + Total output tokens generated across all turns. + + - `List vaultIds` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.sessions.BetaManagedAgentsSession; +import com.anthropic.models.beta.sessions.SessionCreateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + SessionCreateParams params = SessionCreateParams.builder() + .agent("agent_011CZkYpogX7uDKUyvBTophP") + .environmentId("env_011CZkZ9X2dpNyB7HsEFoRfW") + .build(); + BetaManagedAgentsSession betaManagedAgentsSession = client.beta().sessions().create(params); + } +} +``` diff --git a/content/en/api/java/beta/sessions/delete.md b/content/en/api/java/beta/sessions/delete.md new file mode 100644 index 000000000..5ae4533d0 --- /dev/null +++ b/content/en/api/java/beta/sessions/delete.md @@ -0,0 +1,92 @@ +## Delete + +`BetaManagedAgentsDeletedSession beta().sessions().delete(SessionDeleteParamsparams = SessionDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**delete** `/v1/sessions/{session_id}` + +Delete Session + +### Parameters + +- `SessionDeleteParams params` + + - `Optional sessionId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsDeletedSession:` + + Confirmation that a `session` has been permanently deleted. + + - `String id` + + - `Type type` + + - `SESSION_DELETED("session_deleted")` + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.sessions.BetaManagedAgentsDeletedSession; +import com.anthropic.models.beta.sessions.SessionDeleteParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BetaManagedAgentsDeletedSession betaManagedAgentsDeletedSession = client.beta().sessions().delete("sesn_011CZkZAtmR3yMPDzynEDxu7"); + } +} +``` diff --git a/content/en/api/java/beta/sessions/events.md b/content/en/api/java/beta/sessions/events.md new file mode 100644 index 000000000..3cb0b412f --- /dev/null +++ b/content/en/api/java/beta/sessions/events.md @@ -0,0 +1,9655 @@ +# Events + +## List + +`EventListPage beta().sessions().events().list(EventListParamsparams = EventListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/sessions/{session_id}/events` + +List Events + +### Parameters + +- `EventListParams params` + + - `Optional sessionId` + + - `Optional limit` + + Query parameter for limit + + - `Optional order` + + Sort direction for results, ordered by created_at. Defaults to asc (chronological). + + - `ASC("asc")` + + - `DESC("desc")` + + - `Optional page` + + Opaque pagination cursor from a previous response's next_page. + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsSessionEvent: A class that can be one of several variants.union` + + Union type for all event types in a session. + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `String id` + + Unique identifier for this event. + + - `List content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Type type` + + - `USER_MESSAGE("user.message")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `String id` + + Unique identifier for this event. + + - `Type type` + + - `USER_INTERRUPT("user.interrupt")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `String id` + + Unique identifier for this event. + + - `Result result` + + UserToolConfirmationResult enum + + - `ALLOW("allow")` + + - `DENY("deny")` + + - `String toolUseId` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_TOOL_CONFIRMATION("user.tool_confirmation")` + + - `Optional denyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `String id` + + Unique identifier for this event. + + - `String customToolUseId` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_CUSTOM_TOOL_RESULT("user.custom_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent:` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String name` + + Name of the custom tool being called. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_CUSTOM_TOOL_USE("agent.custom_tool_use")` + + - `class BetaManagedAgentsAgentMessageEvent:` + + An agent response event in the session conversation. + + - `String id` + + Unique identifier for this event. + + - `List content` + + Array of text blocks comprising the agent response. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MESSAGE("agent.message")` + + - `class BetaManagedAgentsAgentThinkingEvent:` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_THINKING("agent.thinking")` + + - `class BetaManagedAgentsAgentMcpToolUseEvent:` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String mcpServerName` + + Name of the MCP server providing the tool. + + - `String name` + + Name of the MCP tool being used. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MCP_TOOL_USE("agent.mcp_tool_use")` + + - `Optional evaluatedPermission` + + AgentEvaluatedPermission enum + + - `ALLOW("allow")` + + - `ASK("ask")` + + - `DENY("deny")` + + - `class BetaManagedAgentsAgentMcpToolResultEvent:` + + Event representing the result of an MCP tool execution. + + - `String id` + + Unique identifier for this event. + + - `String mcpToolUseId` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MCP_TOOL_RESULT("agent.mcp_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent:` + + Event emitted when the agent invokes a built-in agent tool. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String name` + + Name of the agent tool being used. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_TOOL_USE("agent.tool_use")` + + - `Optional evaluatedPermission` + + AgentEvaluatedPermission enum + + - `ALLOW("allow")` + + - `ASK("ask")` + + - `DENY("deny")` + + - `class BetaManagedAgentsAgentToolResultEvent:` + + Event representing the result of an agent tool execution. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `String toolUseId` + + The id of the `agent.tool_use` event this result corresponds to. + + - `Type type` + + - `AGENT_TOOL_RESULT("agent.tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent:` + + Indicates that context compaction (summarization) occurred during the session. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_THREAD_CONTEXT_COMPACTED("agent.thread_context_compacted")` + + - `class BetaManagedAgentsSessionErrorEvent:` + + An error event indicating a problem occurred during session execution. + + - `String id` + + Unique identifier for this event. + + - `Error error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `UNKNOWN_ERROR("unknown_error")` + + - `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_OVERLOADED_ERROR("model_overloaded_error")` + + - `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_RATE_LIMITED_ERROR("model_rate_limited_error")` + + - `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_REQUEST_FAILED_ERROR("model_request_failed_error")` + + - `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `String mcpServerName` + + Name of the MCP server that failed to connect. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MCP_CONNECTION_FAILED_ERROR("mcp_connection_failed_error")` + + - `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `String mcpServerName` + + Name of the MCP server that failed authentication. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MCP_AUTHENTICATION_FAILED_ERROR("mcp_authentication_failed_error")` + + - `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `BILLING_ERROR("billing_error")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_ERROR("session.error")` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent:` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_RESCHEDULED("session.status_rescheduled")` + + - `class BetaManagedAgentsSessionStatusRunningEvent:` + + Indicates the session is actively running and the agent is working. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_RUNNING("session.status_running")` + + - `class BetaManagedAgentsSessionStatusIdleEvent:` + + Indicates the agent has paused and is awaiting user input. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `StopReason stopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type type` + + - `END_TURN("end_turn")` + + - `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `List eventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type type` + + - `REQUIRES_ACTION("requires_action")` + + - `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type type` + + - `RETRIES_EXHAUSTED("retries_exhausted")` + + - `Type type` + + - `SESSION_STATUS_IDLE("session.status_idle")` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent:` + + Indicates the session has terminated, either due to an error or completion. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_TERMINATED("session.status_terminated")` + + - `class BetaManagedAgentsSpanModelRequestStartEvent:` + + Emitted when a model request is initiated by the agent. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SPAN_MODEL_REQUEST_START("span.model_request_start")` + + - `class BetaManagedAgentsSpanModelRequestEndEvent:` + + Emitted when a model request completes. + + - `String id` + + Unique identifier for this event. + + - `Optional isError` + + Whether the model request resulted in an error. + + - `String modelRequestStartId` + + The id of the corresponding `span.model_request_start` event. + + - `BetaManagedAgentsSpanModelUsage modelUsage` + + Token usage for a single model request. + + - `long cacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `long cacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `long inputTokens` + + Input tokens consumed by this request. + + - `long outputTokens` + + Output tokens generated by this request. + + - `Optional speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `STANDARD("standard")` + + - `FAST("fast")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SPAN_MODEL_REQUEST_END("span.model_request_end")` + + - `class BetaManagedAgentsSessionDeletedEvent:` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_DELETED("session.deleted")` + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.sessions.events.EventListPage; +import com.anthropic.models.beta.sessions.events.EventListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + EventListPage page = client.beta().sessions().events().list("sesn_011CZkZAtmR3yMPDzynEDxu7"); + } +} +``` + +## Send + +`BetaManagedAgentsSendSessionEvents beta().sessions().events().send(EventSendParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/sessions/{session_id}/events` + +Send Events + +### Parameters + +- `EventSendParams params` + + - `Optional sessionId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + + - `List events` + + Events to send to the `session`. + + - `class BetaManagedAgentsUserMessageEventParams:` + + Parameters for sending a user message to the session. + + - `List content` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Type type` + + - `USER_MESSAGE("user.message")` + + - `class BetaManagedAgentsUserInterruptEventParams:` + + Parameters for sending an interrupt to pause the agent. + + - `Type type` + + - `USER_INTERRUPT("user.interrupt")` + + - `class BetaManagedAgentsUserToolConfirmationEventParams:` + + Parameters for confirming or denying a tool execution request. + + - `Result result` + + UserToolConfirmationResult enum + + - `ALLOW("allow")` + + - `DENY("deny")` + + - `String toolUseId` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_TOOL_CONFIRMATION("user.tool_confirmation")` + + - `Optional denyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `class BetaManagedAgentsUserCustomToolResultEventParams:` + + Parameters for providing the result of a custom tool execution. + + - `String customToolUseId` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_CUSTOM_TOOL_RESULT("user.custom_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + +### Returns + +- `class BetaManagedAgentsSendSessionEvents:` + + Events that were successfully sent to the session. + + - `Optional> data` + + Sent events + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `String id` + + Unique identifier for this event. + + - `List content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Type type` + + - `USER_MESSAGE("user.message")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `String id` + + Unique identifier for this event. + + - `Type type` + + - `USER_INTERRUPT("user.interrupt")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `String id` + + Unique identifier for this event. + + - `Result result` + + UserToolConfirmationResult enum + + - `ALLOW("allow")` + + - `DENY("deny")` + + - `String toolUseId` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_TOOL_CONFIRMATION("user.tool_confirmation")` + + - `Optional denyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `String id` + + Unique identifier for this event. + + - `String customToolUseId` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_CUSTOM_TOOL_RESULT("user.custom_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.sessions.events.BetaManagedAgentsSendSessionEvents; +import com.anthropic.models.beta.sessions.events.BetaManagedAgentsTextBlock; +import com.anthropic.models.beta.sessions.events.BetaManagedAgentsUserMessageEventParams; +import com.anthropic.models.beta.sessions.events.EventSendParams; +import java.util.List; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + EventSendParams params = EventSendParams.builder() + .sessionId("sesn_011CZkZAtmR3yMPDzynEDxu7") + .addUserMessageEvent(List.of(BetaManagedAgentsUserMessageEventParams.Content.ofText(BetaManagedAgentsTextBlock.builder() + .text("Where is my order #1234?") + .type(BetaManagedAgentsTextBlock.Type.TEXT) + .build()))) + .build(); + BetaManagedAgentsSendSessionEvents betaManagedAgentsSendSessionEvents = client.beta().sessions().events().send(params); + } +} +``` + +## Stream + +`BetaManagedAgentsStreamSessionEvents beta().sessions().events().streamStreaming(EventStreamParamsparams = EventStreamParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/sessions/{session_id}/events/stream` + +Stream Events + +### Parameters + +- `EventStreamParams params` + + - `Optional sessionId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsStreamSessionEvents: A class that can be one of several variants.union` + + Server-sent event in the session stream. + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `String id` + + Unique identifier for this event. + + - `List content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Type type` + + - `USER_MESSAGE("user.message")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `String id` + + Unique identifier for this event. + + - `Type type` + + - `USER_INTERRUPT("user.interrupt")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `String id` + + Unique identifier for this event. + + - `Result result` + + UserToolConfirmationResult enum + + - `ALLOW("allow")` + + - `DENY("deny")` + + - `String toolUseId` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_TOOL_CONFIRMATION("user.tool_confirmation")` + + - `Optional denyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `String id` + + Unique identifier for this event. + + - `String customToolUseId` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_CUSTOM_TOOL_RESULT("user.custom_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent:` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String name` + + Name of the custom tool being called. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_CUSTOM_TOOL_USE("agent.custom_tool_use")` + + - `class BetaManagedAgentsAgentMessageEvent:` + + An agent response event in the session conversation. + + - `String id` + + Unique identifier for this event. + + - `List content` + + Array of text blocks comprising the agent response. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MESSAGE("agent.message")` + + - `class BetaManagedAgentsAgentThinkingEvent:` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_THINKING("agent.thinking")` + + - `class BetaManagedAgentsAgentMcpToolUseEvent:` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String mcpServerName` + + Name of the MCP server providing the tool. + + - `String name` + + Name of the MCP tool being used. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MCP_TOOL_USE("agent.mcp_tool_use")` + + - `Optional evaluatedPermission` + + AgentEvaluatedPermission enum + + - `ALLOW("allow")` + + - `ASK("ask")` + + - `DENY("deny")` + + - `class BetaManagedAgentsAgentMcpToolResultEvent:` + + Event representing the result of an MCP tool execution. + + - `String id` + + Unique identifier for this event. + + - `String mcpToolUseId` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MCP_TOOL_RESULT("agent.mcp_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent:` + + Event emitted when the agent invokes a built-in agent tool. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String name` + + Name of the agent tool being used. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_TOOL_USE("agent.tool_use")` + + - `Optional evaluatedPermission` + + AgentEvaluatedPermission enum + + - `ALLOW("allow")` + + - `ASK("ask")` + + - `DENY("deny")` + + - `class BetaManagedAgentsAgentToolResultEvent:` + + Event representing the result of an agent tool execution. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `String toolUseId` + + The id of the `agent.tool_use` event this result corresponds to. + + - `Type type` + + - `AGENT_TOOL_RESULT("agent.tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent:` + + Indicates that context compaction (summarization) occurred during the session. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_THREAD_CONTEXT_COMPACTED("agent.thread_context_compacted")` + + - `class BetaManagedAgentsSessionErrorEvent:` + + An error event indicating a problem occurred during session execution. + + - `String id` + + Unique identifier for this event. + + - `Error error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `UNKNOWN_ERROR("unknown_error")` + + - `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_OVERLOADED_ERROR("model_overloaded_error")` + + - `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_RATE_LIMITED_ERROR("model_rate_limited_error")` + + - `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_REQUEST_FAILED_ERROR("model_request_failed_error")` + + - `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `String mcpServerName` + + Name of the MCP server that failed to connect. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MCP_CONNECTION_FAILED_ERROR("mcp_connection_failed_error")` + + - `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `String mcpServerName` + + Name of the MCP server that failed authentication. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MCP_AUTHENTICATION_FAILED_ERROR("mcp_authentication_failed_error")` + + - `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `BILLING_ERROR("billing_error")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_ERROR("session.error")` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent:` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_RESCHEDULED("session.status_rescheduled")` + + - `class BetaManagedAgentsSessionStatusRunningEvent:` + + Indicates the session is actively running and the agent is working. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_RUNNING("session.status_running")` + + - `class BetaManagedAgentsSessionStatusIdleEvent:` + + Indicates the agent has paused and is awaiting user input. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `StopReason stopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type type` + + - `END_TURN("end_turn")` + + - `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `List eventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type type` + + - `REQUIRES_ACTION("requires_action")` + + - `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type type` + + - `RETRIES_EXHAUSTED("retries_exhausted")` + + - `Type type` + + - `SESSION_STATUS_IDLE("session.status_idle")` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent:` + + Indicates the session has terminated, either due to an error or completion. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_TERMINATED("session.status_terminated")` + + - `class BetaManagedAgentsSpanModelRequestStartEvent:` + + Emitted when a model request is initiated by the agent. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SPAN_MODEL_REQUEST_START("span.model_request_start")` + + - `class BetaManagedAgentsSpanModelRequestEndEvent:` + + Emitted when a model request completes. + + - `String id` + + Unique identifier for this event. + + - `Optional isError` + + Whether the model request resulted in an error. + + - `String modelRequestStartId` + + The id of the corresponding `span.model_request_start` event. + + - `BetaManagedAgentsSpanModelUsage modelUsage` + + Token usage for a single model request. + + - `long cacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `long cacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `long inputTokens` + + Input tokens consumed by this request. + + - `long outputTokens` + + Output tokens generated by this request. + + - `Optional speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `STANDARD("standard")` + + - `FAST("fast")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SPAN_MODEL_REQUEST_END("span.model_request_end")` + + - `class BetaManagedAgentsSessionDeletedEvent:` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_DELETED("session.deleted")` + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.core.http.StreamResponse; +import com.anthropic.models.beta.sessions.events.BetaManagedAgentsStreamSessionEvents; +import com.anthropic.models.beta.sessions.events.EventStreamParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + StreamResponse betaManagedAgentsStreamSessionEvents = client.beta().sessions().events().streamStreaming("sesn_011CZkZAtmR3yMPDzynEDxu7"); + } +} +``` + +## Domain Types + +### Beta Managed Agents Agent Custom Tool Use Event + +- `class BetaManagedAgentsAgentCustomToolUseEvent:` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String name` + + Name of the custom tool being called. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_CUSTOM_TOOL_USE("agent.custom_tool_use")` + +### Beta Managed Agents Agent MCP Tool Result Event + +- `class BetaManagedAgentsAgentMcpToolResultEvent:` + + Event representing the result of an MCP tool execution. + + - `String id` + + Unique identifier for this event. + + - `String mcpToolUseId` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MCP_TOOL_RESULT("agent.mcp_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent MCP Tool Use Event + +- `class BetaManagedAgentsAgentMcpToolUseEvent:` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String mcpServerName` + + Name of the MCP server providing the tool. + + - `String name` + + Name of the MCP tool being used. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MCP_TOOL_USE("agent.mcp_tool_use")` + + - `Optional evaluatedPermission` + + AgentEvaluatedPermission enum + + - `ALLOW("allow")` + + - `ASK("ask")` + + - `DENY("deny")` + +### Beta Managed Agents Agent Message Event + +- `class BetaManagedAgentsAgentMessageEvent:` + + An agent response event in the session conversation. + + - `String id` + + Unique identifier for this event. + + - `List content` + + Array of text blocks comprising the agent response. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MESSAGE("agent.message")` + +### Beta Managed Agents Agent Thinking Event + +- `class BetaManagedAgentsAgentThinkingEvent:` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_THINKING("agent.thinking")` + +### Beta Managed Agents Agent Thread Context Compacted Event + +- `class BetaManagedAgentsAgentThreadContextCompactedEvent:` + + Indicates that context compaction (summarization) occurred during the session. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_THREAD_CONTEXT_COMPACTED("agent.thread_context_compacted")` + +### Beta Managed Agents Agent Tool Result Event + +- `class BetaManagedAgentsAgentToolResultEvent:` + + Event representing the result of an agent tool execution. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `String toolUseId` + + The id of the `agent.tool_use` event this result corresponds to. + + - `Type type` + + - `AGENT_TOOL_RESULT("agent.tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent Tool Use Event + +- `class BetaManagedAgentsAgentToolUseEvent:` + + Event emitted when the agent invokes a built-in agent tool. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String name` + + Name of the agent tool being used. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_TOOL_USE("agent.tool_use")` + + - `Optional evaluatedPermission` + + AgentEvaluatedPermission enum + + - `ALLOW("allow")` + + - `ASK("ask")` + + - `DENY("deny")` + +### Beta Managed Agents Base64 Document Source + +- `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + +### Beta Managed Agents Base64 Image Source + +- `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + +### Beta Managed Agents Billing Error + +- `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `BILLING_ERROR("billing_error")` + +### Beta Managed Agents Document Block + +- `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + +### Beta Managed Agents Event Params + +- `class BetaManagedAgentsEventParams: A class that can be one of several variants.union` + + Union type for event parameters that can be sent to a session. + + - `class BetaManagedAgentsUserMessageEventParams:` + + Parameters for sending a user message to the session. + + - `List content` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Type type` + + - `USER_MESSAGE("user.message")` + + - `class BetaManagedAgentsUserInterruptEventParams:` + + Parameters for sending an interrupt to pause the agent. + + - `Type type` + + - `USER_INTERRUPT("user.interrupt")` + + - `class BetaManagedAgentsUserToolConfirmationEventParams:` + + Parameters for confirming or denying a tool execution request. + + - `Result result` + + UserToolConfirmationResult enum + + - `ALLOW("allow")` + + - `DENY("deny")` + + - `String toolUseId` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_TOOL_CONFIRMATION("user.tool_confirmation")` + + - `Optional denyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `class BetaManagedAgentsUserCustomToolResultEventParams:` + + Parameters for providing the result of a custom tool execution. + + - `String customToolUseId` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_CUSTOM_TOOL_RESULT("user.custom_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents File Document Source + +- `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + +### Beta Managed Agents File Image Source + +- `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + +### Beta Managed Agents Image Block + +- `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + +### Beta Managed Agents MCP Authentication Failed Error + +- `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `String mcpServerName` + + Name of the MCP server that failed authentication. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MCP_AUTHENTICATION_FAILED_ERROR("mcp_authentication_failed_error")` + +### Beta Managed Agents MCP Connection Failed Error + +- `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `String mcpServerName` + + Name of the MCP server that failed to connect. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MCP_CONNECTION_FAILED_ERROR("mcp_connection_failed_error")` + +### Beta Managed Agents Model Overloaded Error + +- `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_OVERLOADED_ERROR("model_overloaded_error")` + +### Beta Managed Agents Model Rate Limited Error + +- `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_RATE_LIMITED_ERROR("model_rate_limited_error")` + +### Beta Managed Agents Model Request Failed Error + +- `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_REQUEST_FAILED_ERROR("model_request_failed_error")` + +### Beta Managed Agents Plain Text Document Source + +- `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + +### Beta Managed Agents Retry Status Exhausted + +- `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + +### Beta Managed Agents Retry Status Retrying + +- `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + +### Beta Managed Agents Retry Status Terminal + +- `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + +### Beta Managed Agents Send Session Events + +- `class BetaManagedAgentsSendSessionEvents:` + + Events that were successfully sent to the session. + + - `Optional> data` + + Sent events + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `String id` + + Unique identifier for this event. + + - `List content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Type type` + + - `USER_MESSAGE("user.message")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `String id` + + Unique identifier for this event. + + - `Type type` + + - `USER_INTERRUPT("user.interrupt")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `String id` + + Unique identifier for this event. + + - `Result result` + + UserToolConfirmationResult enum + + - `ALLOW("allow")` + + - `DENY("deny")` + + - `String toolUseId` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_TOOL_CONFIRMATION("user.tool_confirmation")` + + - `Optional denyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `String id` + + Unique identifier for this event. + + - `String customToolUseId` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_CUSTOM_TOOL_RESULT("user.custom_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + +### Beta Managed Agents Session Deleted Event + +- `class BetaManagedAgentsSessionDeletedEvent:` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_DELETED("session.deleted")` + +### Beta Managed Agents Session End Turn + +- `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type type` + + - `END_TURN("end_turn")` + +### Beta Managed Agents Session Error Event + +- `class BetaManagedAgentsSessionErrorEvent:` + + An error event indicating a problem occurred during session execution. + + - `String id` + + Unique identifier for this event. + + - `Error error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `UNKNOWN_ERROR("unknown_error")` + + - `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_OVERLOADED_ERROR("model_overloaded_error")` + + - `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_RATE_LIMITED_ERROR("model_rate_limited_error")` + + - `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_REQUEST_FAILED_ERROR("model_request_failed_error")` + + - `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `String mcpServerName` + + Name of the MCP server that failed to connect. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MCP_CONNECTION_FAILED_ERROR("mcp_connection_failed_error")` + + - `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `String mcpServerName` + + Name of the MCP server that failed authentication. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MCP_AUTHENTICATION_FAILED_ERROR("mcp_authentication_failed_error")` + + - `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `BILLING_ERROR("billing_error")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_ERROR("session.error")` + +### Beta Managed Agents Session Event + +- `class BetaManagedAgentsSessionEvent: A class that can be one of several variants.union` + + Union type for all event types in a session. + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `String id` + + Unique identifier for this event. + + - `List content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Type type` + + - `USER_MESSAGE("user.message")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `String id` + + Unique identifier for this event. + + - `Type type` + + - `USER_INTERRUPT("user.interrupt")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `String id` + + Unique identifier for this event. + + - `Result result` + + UserToolConfirmationResult enum + + - `ALLOW("allow")` + + - `DENY("deny")` + + - `String toolUseId` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_TOOL_CONFIRMATION("user.tool_confirmation")` + + - `Optional denyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `String id` + + Unique identifier for this event. + + - `String customToolUseId` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_CUSTOM_TOOL_RESULT("user.custom_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent:` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String name` + + Name of the custom tool being called. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_CUSTOM_TOOL_USE("agent.custom_tool_use")` + + - `class BetaManagedAgentsAgentMessageEvent:` + + An agent response event in the session conversation. + + - `String id` + + Unique identifier for this event. + + - `List content` + + Array of text blocks comprising the agent response. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MESSAGE("agent.message")` + + - `class BetaManagedAgentsAgentThinkingEvent:` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_THINKING("agent.thinking")` + + - `class BetaManagedAgentsAgentMcpToolUseEvent:` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String mcpServerName` + + Name of the MCP server providing the tool. + + - `String name` + + Name of the MCP tool being used. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MCP_TOOL_USE("agent.mcp_tool_use")` + + - `Optional evaluatedPermission` + + AgentEvaluatedPermission enum + + - `ALLOW("allow")` + + - `ASK("ask")` + + - `DENY("deny")` + + - `class BetaManagedAgentsAgentMcpToolResultEvent:` + + Event representing the result of an MCP tool execution. + + - `String id` + + Unique identifier for this event. + + - `String mcpToolUseId` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MCP_TOOL_RESULT("agent.mcp_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent:` + + Event emitted when the agent invokes a built-in agent tool. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String name` + + Name of the agent tool being used. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_TOOL_USE("agent.tool_use")` + + - `Optional evaluatedPermission` + + AgentEvaluatedPermission enum + + - `ALLOW("allow")` + + - `ASK("ask")` + + - `DENY("deny")` + + - `class BetaManagedAgentsAgentToolResultEvent:` + + Event representing the result of an agent tool execution. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `String toolUseId` + + The id of the `agent.tool_use` event this result corresponds to. + + - `Type type` + + - `AGENT_TOOL_RESULT("agent.tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent:` + + Indicates that context compaction (summarization) occurred during the session. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_THREAD_CONTEXT_COMPACTED("agent.thread_context_compacted")` + + - `class BetaManagedAgentsSessionErrorEvent:` + + An error event indicating a problem occurred during session execution. + + - `String id` + + Unique identifier for this event. + + - `Error error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `UNKNOWN_ERROR("unknown_error")` + + - `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_OVERLOADED_ERROR("model_overloaded_error")` + + - `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_RATE_LIMITED_ERROR("model_rate_limited_error")` + + - `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_REQUEST_FAILED_ERROR("model_request_failed_error")` + + - `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `String mcpServerName` + + Name of the MCP server that failed to connect. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MCP_CONNECTION_FAILED_ERROR("mcp_connection_failed_error")` + + - `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `String mcpServerName` + + Name of the MCP server that failed authentication. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MCP_AUTHENTICATION_FAILED_ERROR("mcp_authentication_failed_error")` + + - `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `BILLING_ERROR("billing_error")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_ERROR("session.error")` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent:` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_RESCHEDULED("session.status_rescheduled")` + + - `class BetaManagedAgentsSessionStatusRunningEvent:` + + Indicates the session is actively running and the agent is working. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_RUNNING("session.status_running")` + + - `class BetaManagedAgentsSessionStatusIdleEvent:` + + Indicates the agent has paused and is awaiting user input. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `StopReason stopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type type` + + - `END_TURN("end_turn")` + + - `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `List eventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type type` + + - `REQUIRES_ACTION("requires_action")` + + - `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type type` + + - `RETRIES_EXHAUSTED("retries_exhausted")` + + - `Type type` + + - `SESSION_STATUS_IDLE("session.status_idle")` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent:` + + Indicates the session has terminated, either due to an error or completion. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_TERMINATED("session.status_terminated")` + + - `class BetaManagedAgentsSpanModelRequestStartEvent:` + + Emitted when a model request is initiated by the agent. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SPAN_MODEL_REQUEST_START("span.model_request_start")` + + - `class BetaManagedAgentsSpanModelRequestEndEvent:` + + Emitted when a model request completes. + + - `String id` + + Unique identifier for this event. + + - `Optional isError` + + Whether the model request resulted in an error. + + - `String modelRequestStartId` + + The id of the corresponding `span.model_request_start` event. + + - `BetaManagedAgentsSpanModelUsage modelUsage` + + Token usage for a single model request. + + - `long cacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `long cacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `long inputTokens` + + Input tokens consumed by this request. + + - `long outputTokens` + + Output tokens generated by this request. + + - `Optional speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `STANDARD("standard")` + + - `FAST("fast")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SPAN_MODEL_REQUEST_END("span.model_request_end")` + + - `class BetaManagedAgentsSessionDeletedEvent:` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_DELETED("session.deleted")` + +### Beta Managed Agents Session Requires Action + +- `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `List eventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type type` + + - `REQUIRES_ACTION("requires_action")` + +### Beta Managed Agents Session Retries Exhausted + +- `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type type` + + - `RETRIES_EXHAUSTED("retries_exhausted")` + +### Beta Managed Agents Session Status Idle Event + +- `class BetaManagedAgentsSessionStatusIdleEvent:` + + Indicates the agent has paused and is awaiting user input. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `StopReason stopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type type` + + - `END_TURN("end_turn")` + + - `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `List eventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type type` + + - `REQUIRES_ACTION("requires_action")` + + - `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type type` + + - `RETRIES_EXHAUSTED("retries_exhausted")` + + - `Type type` + + - `SESSION_STATUS_IDLE("session.status_idle")` + +### Beta Managed Agents Session Status Rescheduled Event + +- `class BetaManagedAgentsSessionStatusRescheduledEvent:` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_RESCHEDULED("session.status_rescheduled")` + +### Beta Managed Agents Session Status Running Event + +- `class BetaManagedAgentsSessionStatusRunningEvent:` + + Indicates the session is actively running and the agent is working. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_RUNNING("session.status_running")` + +### Beta Managed Agents Session Status Terminated Event + +- `class BetaManagedAgentsSessionStatusTerminatedEvent:` + + Indicates the session has terminated, either due to an error or completion. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_TERMINATED("session.status_terminated")` + +### Beta Managed Agents Span Model Request End Event + +- `class BetaManagedAgentsSpanModelRequestEndEvent:` + + Emitted when a model request completes. + + - `String id` + + Unique identifier for this event. + + - `Optional isError` + + Whether the model request resulted in an error. + + - `String modelRequestStartId` + + The id of the corresponding `span.model_request_start` event. + + - `BetaManagedAgentsSpanModelUsage modelUsage` + + Token usage for a single model request. + + - `long cacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `long cacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `long inputTokens` + + Input tokens consumed by this request. + + - `long outputTokens` + + Output tokens generated by this request. + + - `Optional speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `STANDARD("standard")` + + - `FAST("fast")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SPAN_MODEL_REQUEST_END("span.model_request_end")` + +### Beta Managed Agents Span Model Request Start Event + +- `class BetaManagedAgentsSpanModelRequestStartEvent:` + + Emitted when a model request is initiated by the agent. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SPAN_MODEL_REQUEST_START("span.model_request_start")` + +### Beta Managed Agents Span Model Usage + +- `class BetaManagedAgentsSpanModelUsage:` + + Token usage for a single model request. + + - `long cacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `long cacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `long inputTokens` + + Input tokens consumed by this request. + + - `long outputTokens` + + Output tokens generated by this request. + + - `Optional speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `STANDARD("standard")` + + - `FAST("fast")` + +### Beta Managed Agents Stream Session Events + +- `class BetaManagedAgentsStreamSessionEvents: A class that can be one of several variants.union` + + Server-sent event in the session stream. + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `String id` + + Unique identifier for this event. + + - `List content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Type type` + + - `USER_MESSAGE("user.message")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `String id` + + Unique identifier for this event. + + - `Type type` + + - `USER_INTERRUPT("user.interrupt")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `String id` + + Unique identifier for this event. + + - `Result result` + + UserToolConfirmationResult enum + + - `ALLOW("allow")` + + - `DENY("deny")` + + - `String toolUseId` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_TOOL_CONFIRMATION("user.tool_confirmation")` + + - `Optional denyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `String id` + + Unique identifier for this event. + + - `String customToolUseId` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_CUSTOM_TOOL_RESULT("user.custom_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent:` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String name` + + Name of the custom tool being called. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_CUSTOM_TOOL_USE("agent.custom_tool_use")` + + - `class BetaManagedAgentsAgentMessageEvent:` + + An agent response event in the session conversation. + + - `String id` + + Unique identifier for this event. + + - `List content` + + Array of text blocks comprising the agent response. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MESSAGE("agent.message")` + + - `class BetaManagedAgentsAgentThinkingEvent:` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_THINKING("agent.thinking")` + + - `class BetaManagedAgentsAgentMcpToolUseEvent:` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String mcpServerName` + + Name of the MCP server providing the tool. + + - `String name` + + Name of the MCP tool being used. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MCP_TOOL_USE("agent.mcp_tool_use")` + + - `Optional evaluatedPermission` + + AgentEvaluatedPermission enum + + - `ALLOW("allow")` + + - `ASK("ask")` + + - `DENY("deny")` + + - `class BetaManagedAgentsAgentMcpToolResultEvent:` + + Event representing the result of an MCP tool execution. + + - `String id` + + Unique identifier for this event. + + - `String mcpToolUseId` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MCP_TOOL_RESULT("agent.mcp_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent:` + + Event emitted when the agent invokes a built-in agent tool. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String name` + + Name of the agent tool being used. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_TOOL_USE("agent.tool_use")` + + - `Optional evaluatedPermission` + + AgentEvaluatedPermission enum + + - `ALLOW("allow")` + + - `ASK("ask")` + + - `DENY("deny")` + + - `class BetaManagedAgentsAgentToolResultEvent:` + + Event representing the result of an agent tool execution. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `String toolUseId` + + The id of the `agent.tool_use` event this result corresponds to. + + - `Type type` + + - `AGENT_TOOL_RESULT("agent.tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent:` + + Indicates that context compaction (summarization) occurred during the session. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_THREAD_CONTEXT_COMPACTED("agent.thread_context_compacted")` + + - `class BetaManagedAgentsSessionErrorEvent:` + + An error event indicating a problem occurred during session execution. + + - `String id` + + Unique identifier for this event. + + - `Error error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `UNKNOWN_ERROR("unknown_error")` + + - `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_OVERLOADED_ERROR("model_overloaded_error")` + + - `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_RATE_LIMITED_ERROR("model_rate_limited_error")` + + - `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_REQUEST_FAILED_ERROR("model_request_failed_error")` + + - `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `String mcpServerName` + + Name of the MCP server that failed to connect. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MCP_CONNECTION_FAILED_ERROR("mcp_connection_failed_error")` + + - `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `String mcpServerName` + + Name of the MCP server that failed authentication. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MCP_AUTHENTICATION_FAILED_ERROR("mcp_authentication_failed_error")` + + - `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `BILLING_ERROR("billing_error")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_ERROR("session.error")` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent:` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_RESCHEDULED("session.status_rescheduled")` + + - `class BetaManagedAgentsSessionStatusRunningEvent:` + + Indicates the session is actively running and the agent is working. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_RUNNING("session.status_running")` + + - `class BetaManagedAgentsSessionStatusIdleEvent:` + + Indicates the agent has paused and is awaiting user input. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `StopReason stopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type type` + + - `END_TURN("end_turn")` + + - `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `List eventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type type` + + - `REQUIRES_ACTION("requires_action")` + + - `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type type` + + - `RETRIES_EXHAUSTED("retries_exhausted")` + + - `Type type` + + - `SESSION_STATUS_IDLE("session.status_idle")` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent:` + + Indicates the session has terminated, either due to an error or completion. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_TERMINATED("session.status_terminated")` + + - `class BetaManagedAgentsSpanModelRequestStartEvent:` + + Emitted when a model request is initiated by the agent. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SPAN_MODEL_REQUEST_START("span.model_request_start")` + + - `class BetaManagedAgentsSpanModelRequestEndEvent:` + + Emitted when a model request completes. + + - `String id` + + Unique identifier for this event. + + - `Optional isError` + + Whether the model request resulted in an error. + + - `String modelRequestStartId` + + The id of the corresponding `span.model_request_start` event. + + - `BetaManagedAgentsSpanModelUsage modelUsage` + + Token usage for a single model request. + + - `long cacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `long cacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `long inputTokens` + + Input tokens consumed by this request. + + - `long outputTokens` + + Output tokens generated by this request. + + - `Optional speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `STANDARD("standard")` + + - `FAST("fast")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SPAN_MODEL_REQUEST_END("span.model_request_end")` + + - `class BetaManagedAgentsSessionDeletedEvent:` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_DELETED("session.deleted")` + +### Beta Managed Agents Text Block + +- `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + +### Beta Managed Agents Unknown Error + +- `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `UNKNOWN_ERROR("unknown_error")` + +### Beta Managed Agents URL Document Source + +- `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + +### Beta Managed Agents URL Image Source + +- `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + +### Beta Managed Agents User Custom Tool Result Event + +- `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `String id` + + Unique identifier for this event. + + - `String customToolUseId` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_CUSTOM_TOOL_RESULT("user.custom_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Custom Tool Result Event Params + +- `class BetaManagedAgentsUserCustomToolResultEventParams:` + + Parameters for providing the result of a custom tool execution. + + - `String customToolUseId` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_CUSTOM_TOOL_RESULT("user.custom_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents User Interrupt Event + +- `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `String id` + + Unique identifier for this event. + + - `Type type` + + - `USER_INTERRUPT("user.interrupt")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Interrupt Event Params + +- `class BetaManagedAgentsUserInterruptEventParams:` + + Parameters for sending an interrupt to pause the agent. + + - `Type type` + + - `USER_INTERRUPT("user.interrupt")` + +### Beta Managed Agents User Message Event + +- `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `String id` + + Unique identifier for this event. + + - `List content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Type type` + + - `USER_MESSAGE("user.message")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Message Event Params + +- `class BetaManagedAgentsUserMessageEventParams:` + + Parameters for sending a user message to the session. + + - `List content` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Type type` + + - `USER_MESSAGE("user.message")` + +### Beta Managed Agents User Tool Confirmation Event + +- `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `String id` + + Unique identifier for this event. + + - `Result result` + + UserToolConfirmationResult enum + + - `ALLOW("allow")` + + - `DENY("deny")` + + - `String toolUseId` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_TOOL_CONFIRMATION("user.tool_confirmation")` + + - `Optional denyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Tool Confirmation Event Params + +- `class BetaManagedAgentsUserToolConfirmationEventParams:` + + Parameters for confirming or denying a tool execution request. + + - `Result result` + + UserToolConfirmationResult enum + + - `ALLOW("allow")` + + - `DENY("deny")` + + - `String toolUseId` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_TOOL_CONFIRMATION("user.tool_confirmation")` + + - `Optional denyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. diff --git a/content/en/api/java/beta/sessions/events/list.md b/content/en/api/java/beta/sessions/events/list.md new file mode 100644 index 000000000..38b46ec1f --- /dev/null +++ b/content/en/api/java/beta/sessions/events/list.md @@ -0,0 +1,1466 @@ +## List + +`EventListPage beta().sessions().events().list(EventListParamsparams = EventListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/sessions/{session_id}/events` + +List Events + +### Parameters + +- `EventListParams params` + + - `Optional sessionId` + + - `Optional limit` + + Query parameter for limit + + - `Optional order` + + Sort direction for results, ordered by created_at. Defaults to asc (chronological). + + - `ASC("asc")` + + - `DESC("desc")` + + - `Optional page` + + Opaque pagination cursor from a previous response's next_page. + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsSessionEvent: A class that can be one of several variants.union` + + Union type for all event types in a session. + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `String id` + + Unique identifier for this event. + + - `List content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Type type` + + - `USER_MESSAGE("user.message")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `String id` + + Unique identifier for this event. + + - `Type type` + + - `USER_INTERRUPT("user.interrupt")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `String id` + + Unique identifier for this event. + + - `Result result` + + UserToolConfirmationResult enum + + - `ALLOW("allow")` + + - `DENY("deny")` + + - `String toolUseId` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_TOOL_CONFIRMATION("user.tool_confirmation")` + + - `Optional denyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `String id` + + Unique identifier for this event. + + - `String customToolUseId` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_CUSTOM_TOOL_RESULT("user.custom_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent:` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String name` + + Name of the custom tool being called. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_CUSTOM_TOOL_USE("agent.custom_tool_use")` + + - `class BetaManagedAgentsAgentMessageEvent:` + + An agent response event in the session conversation. + + - `String id` + + Unique identifier for this event. + + - `List content` + + Array of text blocks comprising the agent response. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MESSAGE("agent.message")` + + - `class BetaManagedAgentsAgentThinkingEvent:` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_THINKING("agent.thinking")` + + - `class BetaManagedAgentsAgentMcpToolUseEvent:` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String mcpServerName` + + Name of the MCP server providing the tool. + + - `String name` + + Name of the MCP tool being used. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MCP_TOOL_USE("agent.mcp_tool_use")` + + - `Optional evaluatedPermission` + + AgentEvaluatedPermission enum + + - `ALLOW("allow")` + + - `ASK("ask")` + + - `DENY("deny")` + + - `class BetaManagedAgentsAgentMcpToolResultEvent:` + + Event representing the result of an MCP tool execution. + + - `String id` + + Unique identifier for this event. + + - `String mcpToolUseId` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MCP_TOOL_RESULT("agent.mcp_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent:` + + Event emitted when the agent invokes a built-in agent tool. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String name` + + Name of the agent tool being used. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_TOOL_USE("agent.tool_use")` + + - `Optional evaluatedPermission` + + AgentEvaluatedPermission enum + + - `ALLOW("allow")` + + - `ASK("ask")` + + - `DENY("deny")` + + - `class BetaManagedAgentsAgentToolResultEvent:` + + Event representing the result of an agent tool execution. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `String toolUseId` + + The id of the `agent.tool_use` event this result corresponds to. + + - `Type type` + + - `AGENT_TOOL_RESULT("agent.tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent:` + + Indicates that context compaction (summarization) occurred during the session. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_THREAD_CONTEXT_COMPACTED("agent.thread_context_compacted")` + + - `class BetaManagedAgentsSessionErrorEvent:` + + An error event indicating a problem occurred during session execution. + + - `String id` + + Unique identifier for this event. + + - `Error error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `UNKNOWN_ERROR("unknown_error")` + + - `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_OVERLOADED_ERROR("model_overloaded_error")` + + - `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_RATE_LIMITED_ERROR("model_rate_limited_error")` + + - `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_REQUEST_FAILED_ERROR("model_request_failed_error")` + + - `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `String mcpServerName` + + Name of the MCP server that failed to connect. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MCP_CONNECTION_FAILED_ERROR("mcp_connection_failed_error")` + + - `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `String mcpServerName` + + Name of the MCP server that failed authentication. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MCP_AUTHENTICATION_FAILED_ERROR("mcp_authentication_failed_error")` + + - `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `BILLING_ERROR("billing_error")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_ERROR("session.error")` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent:` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_RESCHEDULED("session.status_rescheduled")` + + - `class BetaManagedAgentsSessionStatusRunningEvent:` + + Indicates the session is actively running and the agent is working. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_RUNNING("session.status_running")` + + - `class BetaManagedAgentsSessionStatusIdleEvent:` + + Indicates the agent has paused and is awaiting user input. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `StopReason stopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type type` + + - `END_TURN("end_turn")` + + - `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `List eventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type type` + + - `REQUIRES_ACTION("requires_action")` + + - `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type type` + + - `RETRIES_EXHAUSTED("retries_exhausted")` + + - `Type type` + + - `SESSION_STATUS_IDLE("session.status_idle")` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent:` + + Indicates the session has terminated, either due to an error or completion. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_TERMINATED("session.status_terminated")` + + - `class BetaManagedAgentsSpanModelRequestStartEvent:` + + Emitted when a model request is initiated by the agent. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SPAN_MODEL_REQUEST_START("span.model_request_start")` + + - `class BetaManagedAgentsSpanModelRequestEndEvent:` + + Emitted when a model request completes. + + - `String id` + + Unique identifier for this event. + + - `Optional isError` + + Whether the model request resulted in an error. + + - `String modelRequestStartId` + + The id of the corresponding `span.model_request_start` event. + + - `BetaManagedAgentsSpanModelUsage modelUsage` + + Token usage for a single model request. + + - `long cacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `long cacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `long inputTokens` + + Input tokens consumed by this request. + + - `long outputTokens` + + Output tokens generated by this request. + + - `Optional speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `STANDARD("standard")` + + - `FAST("fast")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SPAN_MODEL_REQUEST_END("span.model_request_end")` + + - `class BetaManagedAgentsSessionDeletedEvent:` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_DELETED("session.deleted")` + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.sessions.events.EventListPage; +import com.anthropic.models.beta.sessions.events.EventListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + EventListPage page = client.beta().sessions().events().list("sesn_011CZkZAtmR3yMPDzynEDxu7"); + } +} +``` diff --git a/content/en/api/java/beta/sessions/events/send.md b/content/en/api/java/beta/sessions/events/send.md new file mode 100644 index 000000000..5b8ace3e3 --- /dev/null +++ b/content/en/api/java/beta/sessions/events/send.md @@ -0,0 +1,832 @@ +## Send + +`BetaManagedAgentsSendSessionEvents beta().sessions().events().send(EventSendParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/sessions/{session_id}/events` + +Send Events + +### Parameters + +- `EventSendParams params` + + - `Optional sessionId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + + - `List events` + + Events to send to the `session`. + + - `class BetaManagedAgentsUserMessageEventParams:` + + Parameters for sending a user message to the session. + + - `List content` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Type type` + + - `USER_MESSAGE("user.message")` + + - `class BetaManagedAgentsUserInterruptEventParams:` + + Parameters for sending an interrupt to pause the agent. + + - `Type type` + + - `USER_INTERRUPT("user.interrupt")` + + - `class BetaManagedAgentsUserToolConfirmationEventParams:` + + Parameters for confirming or denying a tool execution request. + + - `Result result` + + UserToolConfirmationResult enum + + - `ALLOW("allow")` + + - `DENY("deny")` + + - `String toolUseId` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_TOOL_CONFIRMATION("user.tool_confirmation")` + + - `Optional denyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `class BetaManagedAgentsUserCustomToolResultEventParams:` + + Parameters for providing the result of a custom tool execution. + + - `String customToolUseId` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_CUSTOM_TOOL_RESULT("user.custom_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + +### Returns + +- `class BetaManagedAgentsSendSessionEvents:` + + Events that were successfully sent to the session. + + - `Optional> data` + + Sent events + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `String id` + + Unique identifier for this event. + + - `List content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Type type` + + - `USER_MESSAGE("user.message")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `String id` + + Unique identifier for this event. + + - `Type type` + + - `USER_INTERRUPT("user.interrupt")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `String id` + + Unique identifier for this event. + + - `Result result` + + UserToolConfirmationResult enum + + - `ALLOW("allow")` + + - `DENY("deny")` + + - `String toolUseId` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_TOOL_CONFIRMATION("user.tool_confirmation")` + + - `Optional denyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `String id` + + Unique identifier for this event. + + - `String customToolUseId` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_CUSTOM_TOOL_RESULT("user.custom_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.sessions.events.BetaManagedAgentsSendSessionEvents; +import com.anthropic.models.beta.sessions.events.BetaManagedAgentsTextBlock; +import com.anthropic.models.beta.sessions.events.BetaManagedAgentsUserMessageEventParams; +import com.anthropic.models.beta.sessions.events.EventSendParams; +import java.util.List; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + EventSendParams params = EventSendParams.builder() + .sessionId("sesn_011CZkZAtmR3yMPDzynEDxu7") + .addUserMessageEvent(List.of(BetaManagedAgentsUserMessageEventParams.Content.ofText(BetaManagedAgentsTextBlock.builder() + .text("Where is my order #1234?") + .type(BetaManagedAgentsTextBlock.Type.TEXT) + .build()))) + .build(); + BetaManagedAgentsSendSessionEvents betaManagedAgentsSendSessionEvents = client.beta().sessions().events().send(params); + } +} +``` diff --git a/content/en/api/java/beta/sessions/events/stream.md b/content/en/api/java/beta/sessions/events/stream.md new file mode 100644 index 000000000..7cc23147e --- /dev/null +++ b/content/en/api/java/beta/sessions/events/stream.md @@ -0,0 +1,1451 @@ +## Stream + +`BetaManagedAgentsStreamSessionEvents beta().sessions().events().streamStreaming(EventStreamParamsparams = EventStreamParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/sessions/{session_id}/events/stream` + +Stream Events + +### Parameters + +- `EventStreamParams params` + + - `Optional sessionId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsStreamSessionEvents: A class that can be one of several variants.union` + + Server-sent event in the session stream. + + - `class BetaManagedAgentsUserMessageEvent:` + + A user message event in the session conversation. + + - `String id` + + Unique identifier for this event. + + - `List content` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Type type` + + - `USER_MESSAGE("user.message")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent:` + + An interrupt event that pauses agent execution and returns control to the user. + + - `String id` + + Unique identifier for this event. + + - `Type type` + + - `USER_INTERRUPT("user.interrupt")` + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent:` + + A tool confirmation event that approves or denies a pending tool execution. + + - `String id` + + Unique identifier for this event. + + - `Result result` + + UserToolConfirmationResult enum + + - `ALLOW("allow")` + + - `DENY("deny")` + + - `String toolUseId` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_TOOL_CONFIRMATION("user.tool_confirmation")` + + - `Optional denyMessage` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent:` + + Event sent by the client providing the result of a custom tool execution. + + - `String id` + + Unique identifier for this event. + + - `String customToolUseId` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `Type type` + + - `USER_CUSTOM_TOOL_RESULT("user.custom_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `Optional processedAt` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent:` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String name` + + Name of the custom tool being called. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_CUSTOM_TOOL_USE("agent.custom_tool_use")` + + - `class BetaManagedAgentsAgentMessageEvent:` + + An agent response event in the session conversation. + + - `String id` + + Unique identifier for this event. + + - `List content` + + Array of text blocks comprising the agent response. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MESSAGE("agent.message")` + + - `class BetaManagedAgentsAgentThinkingEvent:` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_THINKING("agent.thinking")` + + - `class BetaManagedAgentsAgentMcpToolUseEvent:` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String mcpServerName` + + Name of the MCP server providing the tool. + + - `String name` + + Name of the MCP tool being used. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MCP_TOOL_USE("agent.mcp_tool_use")` + + - `Optional evaluatedPermission` + + AgentEvaluatedPermission enum + + - `ALLOW("allow")` + + - `ASK("ask")` + + - `DENY("deny")` + + - `class BetaManagedAgentsAgentMcpToolResultEvent:` + + Event representing the result of an MCP tool execution. + + - `String id` + + Unique identifier for this event. + + - `String mcpToolUseId` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_MCP_TOOL_RESULT("agent.mcp_tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent:` + + Event emitted when the agent invokes a built-in agent tool. + + - `String id` + + Unique identifier for this event. + + - `Input input` + + Input parameters for the tool call. + + - `String name` + + Name of the agent tool being used. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_TOOL_USE("agent.tool_use")` + + - `Optional evaluatedPermission` + + AgentEvaluatedPermission enum + + - `ALLOW("allow")` + + - `ASK("ask")` + + - `DENY("deny")` + + - `class BetaManagedAgentsAgentToolResultEvent:` + + Event representing the result of an agent tool execution. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `String toolUseId` + + The id of the `agent.tool_use` event this result corresponds to. + + - `Type type` + + - `AGENT_TOOL_RESULT("agent.tool_result")` + + - `Optional> content` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock:` + + Regular text content. + + - `String text` + + The text content. + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsImageBlock:` + + Image content specified directly as base64 data or as a reference via a URL. + + - `Source source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource:` + + Base64-encoded image data. + + - `String data` + + Base64-encoded image data. + + - `String mediaType` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsUrlImageSource:` + + Image referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource:` + + Image referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `IMAGE("image")` + + - `class BetaManagedAgentsDocumentBlock:` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `Source source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource:` + + Base64-encoded document data. + + - `String data` + + Base64-encoded document data. + + - `String mediaType` + + MIME type of the document (e.g., "application/pdf"). + + - `Type type` + + - `BASE64("base64")` + + - `class BetaManagedAgentsPlainTextDocumentSource:` + + Plain text document content. + + - `String data` + + The plain text content. + + - `MediaType mediaType` + + MIME type of the text content. Must be "text/plain". + + - `TEXT_PLAIN("text/plain")` + + - `Type type` + + - `TEXT("text")` + + - `class BetaManagedAgentsUrlDocumentSource:` + + Document referenced by URL. + + - `Type type` + + - `URL("url")` + + - `String url` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource:` + + Document referenced by file ID. + + - `String fileId` + + ID of a previously uploaded file. + + - `Type type` + + - `FILE("file")` + + - `Type type` + + - `DOCUMENT("document")` + + - `Optional context` + + Additional context about the document for the model. + + - `Optional title` + + The title of the document. + + - `Optional isError` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent:` + + Indicates that context compaction (summarization) occurred during the session. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `AGENT_THREAD_CONTEXT_COMPACTED("agent.thread_context_compacted")` + + - `class BetaManagedAgentsSessionErrorEvent:` + + An error event indicating a problem occurred during session execution. + + - `String id` + + Unique identifier for this event. + + - `Error error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError:` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `UNKNOWN_ERROR("unknown_error")` + + - `class BetaManagedAgentsModelOverloadedError:` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_OVERLOADED_ERROR("model_overloaded_error")` + + - `class BetaManagedAgentsModelRateLimitedError:` + + The model request was rate-limited. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_RATE_LIMITED_ERROR("model_rate_limited_error")` + + - `class BetaManagedAgentsModelRequestFailedError:` + + A model request failed for a reason other than overload or rate-limiting. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MODEL_REQUEST_FAILED_ERROR("model_request_failed_error")` + + - `class BetaManagedAgentsMcpConnectionFailedError:` + + Failed to connect to an MCP server. + + - `String mcpServerName` + + Name of the MCP server that failed to connect. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MCP_CONNECTION_FAILED_ERROR("mcp_connection_failed_error")` + + - `class BetaManagedAgentsMcpAuthenticationFailedError:` + + Authentication to an MCP server failed. + + - `String mcpServerName` + + Name of the MCP server that failed authentication. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `MCP_AUTHENTICATION_FAILED_ERROR("mcp_authentication_failed_error")` + + - `class BetaManagedAgentsBillingError:` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `String message` + + Human-readable error description. + + - `RetryStatus retryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying:` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `Type type` + + - `RETRYING("retrying")` + + - `class BetaManagedAgentsRetryStatusExhausted:` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `Type type` + + - `EXHAUSTED("exhausted")` + + - `class BetaManagedAgentsRetryStatusTerminal:` + + The session encountered a terminal error and will transition to `terminated` state. + + - `Type type` + + - `TERMINAL("terminal")` + + - `Type type` + + - `BILLING_ERROR("billing_error")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_ERROR("session.error")` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent:` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_RESCHEDULED("session.status_rescheduled")` + + - `class BetaManagedAgentsSessionStatusRunningEvent:` + + Indicates the session is actively running and the agent is working. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_RUNNING("session.status_running")` + + - `class BetaManagedAgentsSessionStatusIdleEvent:` + + Indicates the agent has paused and is awaiting user input. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `StopReason stopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn:` + + The agent completed its turn naturally and is ready for the next user message. + + - `Type type` + + - `END_TURN("end_turn")` + + - `class BetaManagedAgentsSessionRequiresAction:` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `List eventIds` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `Type type` + + - `REQUIRES_ACTION("requires_action")` + + - `class BetaManagedAgentsSessionRetriesExhausted:` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `Type type` + + - `RETRIES_EXHAUSTED("retries_exhausted")` + + - `Type type` + + - `SESSION_STATUS_IDLE("session.status_idle")` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent:` + + Indicates the session has terminated, either due to an error or completion. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_STATUS_TERMINATED("session.status_terminated")` + + - `class BetaManagedAgentsSpanModelRequestStartEvent:` + + Emitted when a model request is initiated by the agent. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SPAN_MODEL_REQUEST_START("span.model_request_start")` + + - `class BetaManagedAgentsSpanModelRequestEndEvent:` + + Emitted when a model request completes. + + - `String id` + + Unique identifier for this event. + + - `Optional isError` + + Whether the model request resulted in an error. + + - `String modelRequestStartId` + + The id of the corresponding `span.model_request_start` event. + + - `BetaManagedAgentsSpanModelUsage modelUsage` + + Token usage for a single model request. + + - `long cacheCreationInputTokens` + + Tokens used to create prompt cache in this request. + + - `long cacheReadInputTokens` + + Tokens read from prompt cache in this request. + + - `long inputTokens` + + Input tokens consumed by this request. + + - `long outputTokens` + + Output tokens generated by this request. + + - `Optional speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `STANDARD("standard")` + + - `FAST("fast")` + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SPAN_MODEL_REQUEST_END("span.model_request_end")` + + - `class BetaManagedAgentsSessionDeletedEvent:` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `String id` + + Unique identifier for this event. + + - `LocalDateTime processedAt` + + A timestamp in RFC 3339 format + + - `Type type` + + - `SESSION_DELETED("session.deleted")` + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.core.http.StreamResponse; +import com.anthropic.models.beta.sessions.events.BetaManagedAgentsStreamSessionEvents; +import com.anthropic.models.beta.sessions.events.EventStreamParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + StreamResponse betaManagedAgentsStreamSessionEvents = client.beta().sessions().events().streamStreaming("sesn_011CZkZAtmR3yMPDzynEDxu7"); + } +} +``` diff --git a/content/en/api/java/beta/sessions/list.md b/content/en/api/java/beta/sessions/list.md new file mode 100644 index 000000000..e9b9576bd --- /dev/null +++ b/content/en/api/java/beta/sessions/list.md @@ -0,0 +1,544 @@ +## List + +`SessionListPage beta().sessions().list(SessionListParamsparams = SessionListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/sessions` + +List Sessions + +### Parameters + +- `SessionListParams params` + + - `Optional agentId` + + Filter sessions created with this agent ID. + + - `Optional agentVersion` + + Filter by agent version. Only applies when agent_id is also set. + + - `Optional createdAtGt` + + Return sessions created after this time (exclusive). + + - `Optional createdAtGte` + + Return sessions created at or after this time (inclusive). + + - `Optional createdAtLt` + + Return sessions created before this time (exclusive). + + - `Optional createdAtLte` + + Return sessions created at or before this time (inclusive). + + - `Optional includeArchived` + + When true, includes archived sessions. Default: false (exclude archived). + + - `Optional limit` + + Maximum number of results to return. + + - `Optional order` + + Sort direction for results, ordered by created_at. Defaults to desc (newest first). + + - `ASC("asc")` + + - `DESC("desc")` + + - `Optional page` + + Opaque pagination cursor from a previous response's next_page. + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsSession:` + + A Managed Agents `session`. + + - `String id` + + - `BetaManagedAgentsSessionAgent agent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `String id` + + - `Optional description` + + - `List mcpServers` + + - `String name` + + - `Type type` + + - `URL("url")` + + - `String url` + + - `BetaManagedAgentsModelConfig model` + + Model identifier and configuration. + + - `BetaManagedAgentsModel id` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` + + Most intelligent model for building agents and coding + + - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` + + Best combination of speed and intelligence + + - `CLAUDE_HAIKU_4_5("claude-haiku-4-5")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_HAIKU_4_5_20251001("claude-haiku-4-5-20251001")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_OPUS_4_5("claude-opus-4-5")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_OPUS_4_5_20251101("claude-opus-4-5-20251101")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_SONNET_4_5("claude-sonnet-4-5")` + + High-performance model for agents and coding + + - `CLAUDE_SONNET_4_5_20250929("claude-sonnet-4-5-20250929")` + + High-performance model for agents and coding + + - `Optional speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `STANDARD("standard")` + + - `FAST("fast")` + + - `String name` + + - `List skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `String skillId` + + - `Type type` + + - `ANTHROPIC("anthropic")` + + - `String version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `String skillId` + + - `Type type` + + - `CUSTOM("custom")` + + - `String version` + + - `Optional system` + + - `List tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `List configs` + + - `boolean enabled` + + - `Name name` + + Built-in agent tool identifier. + + - `BASH("bash")` + + - `EDIT("edit")` + + - `READ("read")` + + - `WRITE("write")` + + - `GLOB("glob")` + + - `GREP("grep")` + + - `WEB_FETCH("web_fetch")` + + - `WEB_SEARCH("web_search")` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsAgentToolsetDefaultConfig defaultConfig` + + Resolved default configuration for agent tools. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `Type type` + + - `AGENT_TOOLSET_20260401("agent_toolset_20260401")` + + - `class BetaManagedAgentsMcpToolset:` + + - `List configs` + + - `boolean enabled` + + - `String name` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsMcpToolsetDefaultConfig defaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `String mcpServerName` + + - `Type type` + + - `MCP_TOOLSET("mcp_toolset")` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `String description` + + - `BetaManagedAgentsCustomToolInputSchema inputSchema` + + JSON Schema for custom tool input parameters. + + - `Optional properties` + + JSON Schema properties defining the tool's input parameters. + + - `Optional> required` + + List of required property names. + + - `Optional type` + + Must be 'object' for tool input schemas. + + - `OBJECT("object")` + + - `String name` + + - `Type type` + + - `CUSTOM("custom")` + + - `Type type` + + - `AGENT("agent")` + + - `long version` + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String environmentId` + + - `Metadata metadata` + + - `List resources` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String mountPath` + + - `Type type` + + - `GITHUB_REPOSITORY("github_repository")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String url` + + - `Optional checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `String name` + + Branch name to check out. + + - `Type type` + + - `BRANCH("branch")` + + - `class BetaManagedAgentsCommitCheckout:` + + - `String sha` + + Full commit SHA to check out. + + - `Type type` + + - `COMMIT("commit")` + + - `class BetaManagedAgentsFileResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String fileId` + + - `String mountPath` + + - `Type type` + + - `FILE("file")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsSessionStats stats` + + Timing statistics for a session. + + - `Optional activeSeconds` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `Optional durationSeconds` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `Status status` + + SessionStatus enum + + - `RESCHEDULING("rescheduling")` + + - `RUNNING("running")` + + - `IDLE("idle")` + + - `TERMINATED("terminated")` + + - `Optional title` + + - `Type type` + + - `SESSION("session")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsSessionUsage usage` + + Cumulative token usage for a session across all turns. + + - `Optional cacheCreation` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Optional ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Optional ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + + - `Optional cacheReadInputTokens` + + Total tokens read from prompt cache. + + - `Optional inputTokens` + + Total input tokens consumed across all turns. + + - `Optional outputTokens` + + Total output tokens generated across all turns. + + - `List vaultIds` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.sessions.SessionListPage; +import com.anthropic.models.beta.sessions.SessionListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + SessionListPage page = client.beta().sessions().list(); + } +} +``` diff --git a/content/en/api/java/beta/sessions/resources.md b/content/en/api/java/beta/sessions/resources.md new file mode 100644 index 000000000..c488b6063 --- /dev/null +++ b/content/en/api/java/beta/sessions/resources.md @@ -0,0 +1,831 @@ +# Resources + +## Add + +`BetaManagedAgentsFileResource beta().sessions().resources().add(ResourceAddParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/sessions/{session_id}/resources` + +Add Session Resource + +### Parameters + +- `ResourceAddParams params` + + - `Optional sessionId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + + - `BetaManagedAgentsFileResourceParams betaManagedAgentsFileResourceParams` + + Mount a file uploaded via the Files API into the session. + +### Returns + +- `class BetaManagedAgentsFileResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String fileId` + + - `String mountPath` + + - `Type type` + + - `FILE("file")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.sessions.BetaManagedAgentsFileResourceParams; +import com.anthropic.models.beta.sessions.resources.BetaManagedAgentsFileResource; +import com.anthropic.models.beta.sessions.resources.ResourceAddParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + ResourceAddParams params = ResourceAddParams.builder() + .sessionId("sesn_011CZkZAtmR3yMPDzynEDxu7") + .betaManagedAgentsFileResourceParams(BetaManagedAgentsFileResourceParams.builder() + .fileId("file_011CNha8iCJcU1wXNR6q4V8w") + .type(BetaManagedAgentsFileResourceParams.Type.FILE) + .build()) + .build(); + BetaManagedAgentsFileResource betaManagedAgentsFileResource = client.beta().sessions().resources().add(params); + } +} +``` + +## List + +`ResourceListPage beta().sessions().resources().list(ResourceListParamsparams = ResourceListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/sessions/{session_id}/resources` + +List Session Resources + +### Parameters + +- `ResourceListParams params` + + - `Optional sessionId` + + - `Optional limit` + + Maximum number of resources to return per page (max 1000). If omitted, returns all resources. + + - `Optional page` + + Opaque cursor from a previous response's next_page field. + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsSessionResource: A class that can be one of several variants.union` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String mountPath` + + - `Type type` + + - `GITHUB_REPOSITORY("github_repository")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String url` + + - `Optional checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `String name` + + Branch name to check out. + + - `Type type` + + - `BRANCH("branch")` + + - `class BetaManagedAgentsCommitCheckout:` + + - `String sha` + + Full commit SHA to check out. + + - `Type type` + + - `COMMIT("commit")` + + - `class BetaManagedAgentsFileResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String fileId` + + - `String mountPath` + + - `Type type` + + - `FILE("file")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.sessions.resources.ResourceListPage; +import com.anthropic.models.beta.sessions.resources.ResourceListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + ResourceListPage page = client.beta().sessions().resources().list("sesn_011CZkZAtmR3yMPDzynEDxu7"); + } +} +``` + +## Retrieve + +`ResourceRetrieveResponse beta().sessions().resources().retrieve(ResourceRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/sessions/{session_id}/resources/{resource_id}` + +Get Session Resource + +### Parameters + +- `ResourceRetrieveParams params` + + - `String sessionId` + + - `Optional resourceId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class ResourceRetrieveResponse: A class that can be one of several variants.union` + + The requested session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String mountPath` + + - `Type type` + + - `GITHUB_REPOSITORY("github_repository")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String url` + + - `Optional checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `String name` + + Branch name to check out. + + - `Type type` + + - `BRANCH("branch")` + + - `class BetaManagedAgentsCommitCheckout:` + + - `String sha` + + Full commit SHA to check out. + + - `Type type` + + - `COMMIT("commit")` + + - `class BetaManagedAgentsFileResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String fileId` + + - `String mountPath` + + - `Type type` + + - `FILE("file")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.sessions.resources.ResourceRetrieveParams; +import com.anthropic.models.beta.sessions.resources.ResourceRetrieveResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + ResourceRetrieveParams params = ResourceRetrieveParams.builder() + .sessionId("sesn_011CZkZAtmR3yMPDzynEDxu7") + .resourceId("sesrsc_011CZkZBJq5dWxk9fVLNcPht") + .build(); + ResourceRetrieveResponse resource = client.beta().sessions().resources().retrieve(params); + } +} +``` + +## Update + +`ResourceUpdateResponse beta().sessions().resources().update(ResourceUpdateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/sessions/{session_id}/resources/{resource_id}` + +Update Session Resource + +### Parameters + +- `ResourceUpdateParams params` + + - `String sessionId` + + - `Optional resourceId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + + - `String authorizationToken` + + New authorization token for the resource. Currently only `github_repository` resources support token rotation. + +### Returns + +- `class ResourceUpdateResponse: A class that can be one of several variants.union` + + The updated session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String mountPath` + + - `Type type` + + - `GITHUB_REPOSITORY("github_repository")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String url` + + - `Optional checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `String name` + + Branch name to check out. + + - `Type type` + + - `BRANCH("branch")` + + - `class BetaManagedAgentsCommitCheckout:` + + - `String sha` + + Full commit SHA to check out. + + - `Type type` + + - `COMMIT("commit")` + + - `class BetaManagedAgentsFileResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String fileId` + + - `String mountPath` + + - `Type type` + + - `FILE("file")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.sessions.resources.ResourceUpdateParams; +import com.anthropic.models.beta.sessions.resources.ResourceUpdateResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + ResourceUpdateParams params = ResourceUpdateParams.builder() + .sessionId("sesn_011CZkZAtmR3yMPDzynEDxu7") + .resourceId("sesrsc_011CZkZBJq5dWxk9fVLNcPht") + .authorizationToken("ghp_exampletoken") + .build(); + ResourceUpdateResponse resource = client.beta().sessions().resources().update(params); + } +} +``` + +## Delete + +`BetaManagedAgentsDeleteSessionResource beta().sessions().resources().delete(ResourceDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**delete** `/v1/sessions/{session_id}/resources/{resource_id}` + +Delete Session Resource + +### Parameters + +- `ResourceDeleteParams params` + + - `String sessionId` + + - `Optional resourceId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsDeleteSessionResource:` + + Confirmation of resource deletion. + + - `String id` + + - `Type type` + + - `SESSION_RESOURCE_DELETED("session_resource_deleted")` + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.sessions.resources.BetaManagedAgentsDeleteSessionResource; +import com.anthropic.models.beta.sessions.resources.ResourceDeleteParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + ResourceDeleteParams params = ResourceDeleteParams.builder() + .sessionId("sesn_011CZkZAtmR3yMPDzynEDxu7") + .resourceId("sesrsc_011CZkZBJq5dWxk9fVLNcPht") + .build(); + BetaManagedAgentsDeleteSessionResource betaManagedAgentsDeleteSessionResource = client.beta().sessions().resources().delete(params); + } +} +``` + +## Domain Types + +### Beta Managed Agents Delete Session Resource + +- `class BetaManagedAgentsDeleteSessionResource:` + + Confirmation of resource deletion. + + - `String id` + + - `Type type` + + - `SESSION_RESOURCE_DELETED("session_resource_deleted")` + +### Beta Managed Agents File Resource + +- `class BetaManagedAgentsFileResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String fileId` + + - `String mountPath` + + - `Type type` + + - `FILE("file")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + +### Beta Managed Agents GitHub Repository Resource + +- `class BetaManagedAgentsGitHubRepositoryResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String mountPath` + + - `Type type` + + - `GITHUB_REPOSITORY("github_repository")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String url` + + - `Optional checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `String name` + + Branch name to check out. + + - `Type type` + + - `BRANCH("branch")` + + - `class BetaManagedAgentsCommitCheckout:` + + - `String sha` + + Full commit SHA to check out. + + - `Type type` + + - `COMMIT("commit")` + +### Beta Managed Agents Session Resource + +- `class BetaManagedAgentsSessionResource: A class that can be one of several variants.union` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String mountPath` + + - `Type type` + + - `GITHUB_REPOSITORY("github_repository")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String url` + + - `Optional checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `String name` + + Branch name to check out. + + - `Type type` + + - `BRANCH("branch")` + + - `class BetaManagedAgentsCommitCheckout:` + + - `String sha` + + Full commit SHA to check out. + + - `Type type` + + - `COMMIT("commit")` + + - `class BetaManagedAgentsFileResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String fileId` + + - `String mountPath` + + - `Type type` + + - `FILE("file")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format diff --git a/content/en/api/java/beta/sessions/resources/add.md b/content/en/api/java/beta/sessions/resources/add.md new file mode 100644 index 000000000..6110a9aa4 --- /dev/null +++ b/content/en/api/java/beta/sessions/resources/add.md @@ -0,0 +1,114 @@ +## Add + +`BetaManagedAgentsFileResource beta().sessions().resources().add(ResourceAddParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/sessions/{session_id}/resources` + +Add Session Resource + +### Parameters + +- `ResourceAddParams params` + + - `Optional sessionId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + + - `BetaManagedAgentsFileResourceParams betaManagedAgentsFileResourceParams` + + Mount a file uploaded via the Files API into the session. + +### Returns + +- `class BetaManagedAgentsFileResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String fileId` + + - `String mountPath` + + - `Type type` + + - `FILE("file")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.sessions.BetaManagedAgentsFileResourceParams; +import com.anthropic.models.beta.sessions.resources.BetaManagedAgentsFileResource; +import com.anthropic.models.beta.sessions.resources.ResourceAddParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + ResourceAddParams params = ResourceAddParams.builder() + .sessionId("sesn_011CZkZAtmR3yMPDzynEDxu7") + .betaManagedAgentsFileResourceParams(BetaManagedAgentsFileResourceParams.builder() + .fileId("file_011CNha8iCJcU1wXNR6q4V8w") + .type(BetaManagedAgentsFileResourceParams.Type.FILE) + .build()) + .build(); + BetaManagedAgentsFileResource betaManagedAgentsFileResource = client.beta().sessions().resources().add(params); + } +} +``` diff --git a/content/en/api/java/beta/sessions/resources/delete.md b/content/en/api/java/beta/sessions/resources/delete.md new file mode 100644 index 000000000..b178bb2f0 --- /dev/null +++ b/content/en/api/java/beta/sessions/resources/delete.md @@ -0,0 +1,98 @@ +## Delete + +`BetaManagedAgentsDeleteSessionResource beta().sessions().resources().delete(ResourceDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**delete** `/v1/sessions/{session_id}/resources/{resource_id}` + +Delete Session Resource + +### Parameters + +- `ResourceDeleteParams params` + + - `String sessionId` + + - `Optional resourceId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsDeleteSessionResource:` + + Confirmation of resource deletion. + + - `String id` + + - `Type type` + + - `SESSION_RESOURCE_DELETED("session_resource_deleted")` + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.sessions.resources.BetaManagedAgentsDeleteSessionResource; +import com.anthropic.models.beta.sessions.resources.ResourceDeleteParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + ResourceDeleteParams params = ResourceDeleteParams.builder() + .sessionId("sesn_011CZkZAtmR3yMPDzynEDxu7") + .resourceId("sesrsc_011CZkZBJq5dWxk9fVLNcPht") + .build(); + BetaManagedAgentsDeleteSessionResource betaManagedAgentsDeleteSessionResource = client.beta().sessions().resources().delete(params); + } +} +``` diff --git a/content/en/api/java/beta/sessions/resources/list.md b/content/en/api/java/beta/sessions/resources/list.md new file mode 100644 index 000000000..fe790f31c --- /dev/null +++ b/content/en/api/java/beta/sessions/resources/list.md @@ -0,0 +1,154 @@ +## List + +`ResourceListPage beta().sessions().resources().list(ResourceListParamsparams = ResourceListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/sessions/{session_id}/resources` + +List Session Resources + +### Parameters + +- `ResourceListParams params` + + - `Optional sessionId` + + - `Optional limit` + + Maximum number of resources to return per page (max 1000). If omitted, returns all resources. + + - `Optional page` + + Opaque cursor from a previous response's next_page field. + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsSessionResource: A class that can be one of several variants.union` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String mountPath` + + - `Type type` + + - `GITHUB_REPOSITORY("github_repository")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String url` + + - `Optional checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `String name` + + Branch name to check out. + + - `Type type` + + - `BRANCH("branch")` + + - `class BetaManagedAgentsCommitCheckout:` + + - `String sha` + + Full commit SHA to check out. + + - `Type type` + + - `COMMIT("commit")` + + - `class BetaManagedAgentsFileResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String fileId` + + - `String mountPath` + + - `Type type` + + - `FILE("file")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.sessions.resources.ResourceListPage; +import com.anthropic.models.beta.sessions.resources.ResourceListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + ResourceListPage page = client.beta().sessions().resources().list("sesn_011CZkZAtmR3yMPDzynEDxu7"); + } +} +``` diff --git a/content/en/api/java/beta/sessions/resources/retrieve.md b/content/en/api/java/beta/sessions/resources/retrieve.md new file mode 100644 index 000000000..25bb09482 --- /dev/null +++ b/content/en/api/java/beta/sessions/resources/retrieve.md @@ -0,0 +1,154 @@ +## Retrieve + +`ResourceRetrieveResponse beta().sessions().resources().retrieve(ResourceRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/sessions/{session_id}/resources/{resource_id}` + +Get Session Resource + +### Parameters + +- `ResourceRetrieveParams params` + + - `String sessionId` + + - `Optional resourceId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class ResourceRetrieveResponse: A class that can be one of several variants.union` + + The requested session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String mountPath` + + - `Type type` + + - `GITHUB_REPOSITORY("github_repository")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String url` + + - `Optional checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `String name` + + Branch name to check out. + + - `Type type` + + - `BRANCH("branch")` + + - `class BetaManagedAgentsCommitCheckout:` + + - `String sha` + + Full commit SHA to check out. + + - `Type type` + + - `COMMIT("commit")` + + - `class BetaManagedAgentsFileResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String fileId` + + - `String mountPath` + + - `Type type` + + - `FILE("file")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.sessions.resources.ResourceRetrieveParams; +import com.anthropic.models.beta.sessions.resources.ResourceRetrieveResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + ResourceRetrieveParams params = ResourceRetrieveParams.builder() + .sessionId("sesn_011CZkZAtmR3yMPDzynEDxu7") + .resourceId("sesrsc_011CZkZBJq5dWxk9fVLNcPht") + .build(); + ResourceRetrieveResponse resource = client.beta().sessions().resources().retrieve(params); + } +} +``` diff --git a/content/en/api/java/beta/sessions/resources/update.md b/content/en/api/java/beta/sessions/resources/update.md new file mode 100644 index 000000000..05ec8648f --- /dev/null +++ b/content/en/api/java/beta/sessions/resources/update.md @@ -0,0 +1,159 @@ +## Update + +`ResourceUpdateResponse beta().sessions().resources().update(ResourceUpdateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/sessions/{session_id}/resources/{resource_id}` + +Update Session Resource + +### Parameters + +- `ResourceUpdateParams params` + + - `String sessionId` + + - `Optional resourceId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + + - `String authorizationToken` + + New authorization token for the resource. Currently only `github_repository` resources support token rotation. + +### Returns + +- `class ResourceUpdateResponse: A class that can be one of several variants.union` + + The updated session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String mountPath` + + - `Type type` + + - `GITHUB_REPOSITORY("github_repository")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String url` + + - `Optional checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `String name` + + Branch name to check out. + + - `Type type` + + - `BRANCH("branch")` + + - `class BetaManagedAgentsCommitCheckout:` + + - `String sha` + + Full commit SHA to check out. + + - `Type type` + + - `COMMIT("commit")` + + - `class BetaManagedAgentsFileResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String fileId` + + - `String mountPath` + + - `Type type` + + - `FILE("file")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.sessions.resources.ResourceUpdateParams; +import com.anthropic.models.beta.sessions.resources.ResourceUpdateResponse; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + ResourceUpdateParams params = ResourceUpdateParams.builder() + .sessionId("sesn_011CZkZAtmR3yMPDzynEDxu7") + .resourceId("sesrsc_011CZkZBJq5dWxk9fVLNcPht") + .authorizationToken("ghp_exampletoken") + .build(); + ResourceUpdateResponse resource = client.beta().sessions().resources().update(params); + } +} +``` diff --git a/content/en/api/java/beta/sessions/retrieve.md b/content/en/api/java/beta/sessions/retrieve.md new file mode 100644 index 000000000..6f469400f --- /dev/null +++ b/content/en/api/java/beta/sessions/retrieve.md @@ -0,0 +1,502 @@ +## Retrieve + +`BetaManagedAgentsSession beta().sessions().retrieve(SessionRetrieveParamsparams = SessionRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/sessions/{session_id}` + +Get Session + +### Parameters + +- `SessionRetrieveParams params` + + - `Optional sessionId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsSession:` + + A Managed Agents `session`. + + - `String id` + + - `BetaManagedAgentsSessionAgent agent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `String id` + + - `Optional description` + + - `List mcpServers` + + - `String name` + + - `Type type` + + - `URL("url")` + + - `String url` + + - `BetaManagedAgentsModelConfig model` + + Model identifier and configuration. + + - `BetaManagedAgentsModel id` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` + + Most intelligent model for building agents and coding + + - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` + + Best combination of speed and intelligence + + - `CLAUDE_HAIKU_4_5("claude-haiku-4-5")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_HAIKU_4_5_20251001("claude-haiku-4-5-20251001")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_OPUS_4_5("claude-opus-4-5")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_OPUS_4_5_20251101("claude-opus-4-5-20251101")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_SONNET_4_5("claude-sonnet-4-5")` + + High-performance model for agents and coding + + - `CLAUDE_SONNET_4_5_20250929("claude-sonnet-4-5-20250929")` + + High-performance model for agents and coding + + - `Optional speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `STANDARD("standard")` + + - `FAST("fast")` + + - `String name` + + - `List skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `String skillId` + + - `Type type` + + - `ANTHROPIC("anthropic")` + + - `String version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `String skillId` + + - `Type type` + + - `CUSTOM("custom")` + + - `String version` + + - `Optional system` + + - `List tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `List configs` + + - `boolean enabled` + + - `Name name` + + Built-in agent tool identifier. + + - `BASH("bash")` + + - `EDIT("edit")` + + - `READ("read")` + + - `WRITE("write")` + + - `GLOB("glob")` + + - `GREP("grep")` + + - `WEB_FETCH("web_fetch")` + + - `WEB_SEARCH("web_search")` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsAgentToolsetDefaultConfig defaultConfig` + + Resolved default configuration for agent tools. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `Type type` + + - `AGENT_TOOLSET_20260401("agent_toolset_20260401")` + + - `class BetaManagedAgentsMcpToolset:` + + - `List configs` + + - `boolean enabled` + + - `String name` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsMcpToolsetDefaultConfig defaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `String mcpServerName` + + - `Type type` + + - `MCP_TOOLSET("mcp_toolset")` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `String description` + + - `BetaManagedAgentsCustomToolInputSchema inputSchema` + + JSON Schema for custom tool input parameters. + + - `Optional properties` + + JSON Schema properties defining the tool's input parameters. + + - `Optional> required` + + List of required property names. + + - `Optional type` + + Must be 'object' for tool input schemas. + + - `OBJECT("object")` + + - `String name` + + - `Type type` + + - `CUSTOM("custom")` + + - `Type type` + + - `AGENT("agent")` + + - `long version` + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String environmentId` + + - `Metadata metadata` + + - `List resources` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String mountPath` + + - `Type type` + + - `GITHUB_REPOSITORY("github_repository")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String url` + + - `Optional checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `String name` + + Branch name to check out. + + - `Type type` + + - `BRANCH("branch")` + + - `class BetaManagedAgentsCommitCheckout:` + + - `String sha` + + Full commit SHA to check out. + + - `Type type` + + - `COMMIT("commit")` + + - `class BetaManagedAgentsFileResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String fileId` + + - `String mountPath` + + - `Type type` + + - `FILE("file")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsSessionStats stats` + + Timing statistics for a session. + + - `Optional activeSeconds` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `Optional durationSeconds` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `Status status` + + SessionStatus enum + + - `RESCHEDULING("rescheduling")` + + - `RUNNING("running")` + + - `IDLE("idle")` + + - `TERMINATED("terminated")` + + - `Optional title` + + - `Type type` + + - `SESSION("session")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsSessionUsage usage` + + Cumulative token usage for a session across all turns. + + - `Optional cacheCreation` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Optional ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Optional ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + + - `Optional cacheReadInputTokens` + + Total tokens read from prompt cache. + + - `Optional inputTokens` + + Total input tokens consumed across all turns. + + - `Optional outputTokens` + + Total output tokens generated across all turns. + + - `List vaultIds` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.sessions.BetaManagedAgentsSession; +import com.anthropic.models.beta.sessions.SessionRetrieveParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BetaManagedAgentsSession betaManagedAgentsSession = client.beta().sessions().retrieve("sesn_011CZkZAtmR3yMPDzynEDxu7"); + } +} +``` diff --git a/content/en/api/java/beta/sessions/update.md b/content/en/api/java/beta/sessions/update.md new file mode 100644 index 000000000..b09a9343f --- /dev/null +++ b/content/en/api/java/beta/sessions/update.md @@ -0,0 +1,514 @@ +## Update + +`BetaManagedAgentsSession beta().sessions().update(SessionUpdateParamsparams = SessionUpdateParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/sessions/{session_id}` + +Update Session + +### Parameters + +- `SessionUpdateParams params` + + - `Optional sessionId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + + - `Optional metadata` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. + + - `Optional title` + + Human-readable session title. + + - `Optional> vaultIds` + + Vault IDs (`vlt_*`) to attach to the session. Not yet supported; requests setting this field are rejected. Reserved for future use. + +### Returns + +- `class BetaManagedAgentsSession:` + + A Managed Agents `session`. + + - `String id` + + - `BetaManagedAgentsSessionAgent agent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `String id` + + - `Optional description` + + - `List mcpServers` + + - `String name` + + - `Type type` + + - `URL("url")` + + - `String url` + + - `BetaManagedAgentsModelConfig model` + + Model identifier and configuration. + + - `BetaManagedAgentsModel id` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` + + Most intelligent model for building agents and coding + + - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` + + Best combination of speed and intelligence + + - `CLAUDE_HAIKU_4_5("claude-haiku-4-5")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_HAIKU_4_5_20251001("claude-haiku-4-5-20251001")` + + Fastest model with near-frontier intelligence + + - `CLAUDE_OPUS_4_5("claude-opus-4-5")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_OPUS_4_5_20251101("claude-opus-4-5-20251101")` + + Premium model combining maximum intelligence with practical performance + + - `CLAUDE_SONNET_4_5("claude-sonnet-4-5")` + + High-performance model for agents and coding + + - `CLAUDE_SONNET_4_5_20250929("claude-sonnet-4-5-20250929")` + + High-performance model for agents and coding + + - `Optional speed` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `STANDARD("standard")` + + - `FAST("fast")` + + - `String name` + + - `List skills` + + - `class BetaManagedAgentsAnthropicSkill:` + + A resolved Anthropic-managed skill. + + - `String skillId` + + - `Type type` + + - `ANTHROPIC("anthropic")` + + - `String version` + + - `class BetaManagedAgentsCustomSkill:` + + A resolved user-created custom skill. + + - `String skillId` + + - `Type type` + + - `CUSTOM("custom")` + + - `String version` + + - `Optional system` + + - `List tools` + + - `class BetaManagedAgentsAgentToolset20260401:` + + - `List configs` + + - `boolean enabled` + + - `Name name` + + Built-in agent tool identifier. + + - `BASH("bash")` + + - `EDIT("edit")` + + - `READ("read")` + + - `WRITE("write")` + + - `GLOB("glob")` + + - `GREP("grep")` + + - `WEB_FETCH("web_fetch")` + + - `WEB_SEARCH("web_search")` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsAgentToolsetDefaultConfig defaultConfig` + + Resolved default configuration for agent tools. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `Type type` + + - `AGENT_TOOLSET_20260401("agent_toolset_20260401")` + + - `class BetaManagedAgentsMcpToolset:` + + - `List configs` + + - `boolean enabled` + + - `String name` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `BetaManagedAgentsMcpToolsetDefaultConfig defaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `boolean enabled` + + - `PermissionPolicy permissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy:` + + Tool calls are automatically approved without user confirmation. + + - `Type type` + + - `ALWAYS_ALLOW("always_allow")` + + - `class BetaManagedAgentsAlwaysAskPolicy:` + + Tool calls require user confirmation before execution. + + - `Type type` + + - `ALWAYS_ASK("always_ask")` + + - `String mcpServerName` + + - `Type type` + + - `MCP_TOOLSET("mcp_toolset")` + + - `class BetaManagedAgentsCustomTool:` + + A custom tool as returned in API responses. + + - `String description` + + - `BetaManagedAgentsCustomToolInputSchema inputSchema` + + JSON Schema for custom tool input parameters. + + - `Optional properties` + + JSON Schema properties defining the tool's input parameters. + + - `Optional> required` + + List of required property names. + + - `Optional type` + + Must be 'object' for tool input schemas. + + - `OBJECT("object")` + + - `String name` + + - `Type type` + + - `CUSTOM("custom")` + + - `Type type` + + - `AGENT("agent")` + + - `long version` + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String environmentId` + + - `Metadata metadata` + + - `List resources` + + - `class BetaManagedAgentsGitHubRepositoryResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String mountPath` + + - `Type type` + + - `GITHUB_REPOSITORY("github_repository")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String url` + + - `Optional checkout` + + - `class BetaManagedAgentsBranchCheckout:` + + - `String name` + + Branch name to check out. + + - `Type type` + + - `BRANCH("branch")` + + - `class BetaManagedAgentsCommitCheckout:` + + - `String sha` + + Full commit SHA to check out. + + - `Type type` + + - `COMMIT("commit")` + + - `class BetaManagedAgentsFileResource:` + + - `String id` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String fileId` + + - `String mountPath` + + - `Type type` + + - `FILE("file")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsSessionStats stats` + + Timing statistics for a session. + + - `Optional activeSeconds` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `Optional durationSeconds` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `Status status` + + SessionStatus enum + + - `RESCHEDULING("rescheduling")` + + - `RUNNING("running")` + + - `IDLE("idle")` + + - `TERMINATED("terminated")` + + - `Optional title` + + - `Type type` + + - `SESSION("session")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsSessionUsage usage` + + Cumulative token usage for a session across all turns. + + - `Optional cacheCreation` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `Optional ephemeral1hInputTokens` + + Tokens used to create 1-hour ephemeral cache entries. + + - `Optional ephemeral5mInputTokens` + + Tokens used to create 5-minute ephemeral cache entries. + + - `Optional cacheReadInputTokens` + + Total tokens read from prompt cache. + + - `Optional inputTokens` + + Total input tokens consumed across all turns. + + - `Optional outputTokens` + + Total output tokens generated across all turns. + + - `List vaultIds` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.sessions.BetaManagedAgentsSession; +import com.anthropic.models.beta.sessions.SessionUpdateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BetaManagedAgentsSession betaManagedAgentsSession = client.beta().sessions().update("sesn_011CZkZAtmR3yMPDzynEDxu7"); + } +} +``` diff --git a/content/en/api/java/beta/skills.md b/content/en/api/java/beta/skills.md index 59730d398..283d3d244 100644 --- a/content/en/api/java/beta/skills.md +++ b/content/en/api/java/beta/skills.md @@ -58,8 +58,6 @@ Create Skill - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - - `Optional displayTitle` Display title for the skill. @@ -217,8 +215,6 @@ List Skills - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class SkillListResponse:` @@ -349,8 +345,6 @@ Get Skill - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class SkillRetrieveResponse:` @@ -481,8 +475,6 @@ Delete Skill - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class SkillDeleteResponse:` @@ -586,8 +578,6 @@ Create Skill Version - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - - `Optional> files` Files to upload for the skill. @@ -737,8 +727,6 @@ List Skill Versions - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class VersionListResponse:` @@ -878,8 +866,6 @@ Get Skill Version - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class VersionRetrieveResponse:` @@ -1023,8 +1009,6 @@ Delete Skill Version - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class VersionDeleteResponse:` diff --git a/content/en/api/java/beta/skills/create.md b/content/en/api/java/beta/skills/create.md index f552b64cb..d3950e166 100644 --- a/content/en/api/java/beta/skills/create.md +++ b/content/en/api/java/beta/skills/create.md @@ -56,8 +56,6 @@ Create Skill - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - - `Optional displayTitle` Display title for the skill. diff --git a/content/en/api/java/beta/skills/delete.md b/content/en/api/java/beta/skills/delete.md index 5e811d0f7..d78cd6d85 100644 --- a/content/en/api/java/beta/skills/delete.md +++ b/content/en/api/java/beta/skills/delete.md @@ -62,8 +62,6 @@ Delete Skill - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class SkillDeleteResponse:` diff --git a/content/en/api/java/beta/skills/list.md b/content/en/api/java/beta/skills/list.md index 9bb982240..20c53f2d2 100644 --- a/content/en/api/java/beta/skills/list.md +++ b/content/en/api/java/beta/skills/list.md @@ -77,8 +77,6 @@ List Skills - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class SkillListResponse:` diff --git a/content/en/api/java/beta/skills/retrieve.md b/content/en/api/java/beta/skills/retrieve.md index a18f09b5c..466f7125b 100644 --- a/content/en/api/java/beta/skills/retrieve.md +++ b/content/en/api/java/beta/skills/retrieve.md @@ -62,8 +62,6 @@ Get Skill - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class SkillRetrieveResponse:` diff --git a/content/en/api/java/beta/skills/versions.md b/content/en/api/java/beta/skills/versions.md index f45234940..f8d924efd 100644 --- a/content/en/api/java/beta/skills/versions.md +++ b/content/en/api/java/beta/skills/versions.md @@ -64,8 +64,6 @@ Create Skill Version - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - - `Optional> files` Files to upload for the skill. @@ -215,8 +213,6 @@ List Skill Versions - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class VersionListResponse:` @@ -356,8 +352,6 @@ Get Skill Version - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class VersionRetrieveResponse:` @@ -501,8 +495,6 @@ Delete Skill Version - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class VersionDeleteResponse:` diff --git a/content/en/api/java/beta/skills/versions/create.md b/content/en/api/java/beta/skills/versions/create.md index e15aadc33..d598b6762 100644 --- a/content/en/api/java/beta/skills/versions/create.md +++ b/content/en/api/java/beta/skills/versions/create.md @@ -62,8 +62,6 @@ Create Skill Version - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - - `Optional> files` Files to upload for the skill. diff --git a/content/en/api/java/beta/skills/versions/delete.md b/content/en/api/java/beta/skills/versions/delete.md index 07084e58a..9691e7fc2 100644 --- a/content/en/api/java/beta/skills/versions/delete.md +++ b/content/en/api/java/beta/skills/versions/delete.md @@ -68,8 +68,6 @@ Delete Skill Version - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class VersionDeleteResponse:` diff --git a/content/en/api/java/beta/skills/versions/list.md b/content/en/api/java/beta/skills/versions/list.md index 3eb9722d0..3f8c4b2b4 100644 --- a/content/en/api/java/beta/skills/versions/list.md +++ b/content/en/api/java/beta/skills/versions/list.md @@ -72,8 +72,6 @@ List Skill Versions - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class VersionListResponse:` diff --git a/content/en/api/java/beta/skills/versions/retrieve.md b/content/en/api/java/beta/skills/versions/retrieve.md index da3d7eaae..3d2c694f6 100644 --- a/content/en/api/java/beta/skills/versions/retrieve.md +++ b/content/en/api/java/beta/skills/versions/retrieve.md @@ -68,8 +68,6 @@ Get Skill Version - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class VersionRetrieveResponse:` diff --git a/content/en/api/java/beta/vaults.md b/content/en/api/java/beta/vaults.md new file mode 100644 index 000000000..58c620573 --- /dev/null +++ b/content/en/api/java/beta/vaults.md @@ -0,0 +1,2709 @@ +# Vaults + +## Create + +`BetaManagedAgentsVault beta().vaults().create(VaultCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/vaults` + +Create Vault + +### Parameters + +- `VaultCreateParams params` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + + - `String displayName` + + Human-readable name for the vault. 1-255 characters. + + - `Optional metadata` + + Arbitrary key-value metadata to attach to the vault. + +### Returns + +- `class BetaManagedAgentsVault:` + + A vault that stores credentials for use by agents during sessions. + + - `String id` + + Unique identifier for the vault. + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String displayName` + + Human-readable name for the vault. + + - `Metadata metadata` + + Arbitrary key-value metadata attached to the vault. + + - `Type type` + + - `VAULT("vault")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.vaults.BetaManagedAgentsVault; +import com.anthropic.models.beta.vaults.VaultCreateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + VaultCreateParams params = VaultCreateParams.builder() + .displayName("Example vault") + .build(); + BetaManagedAgentsVault betaManagedAgentsVault = client.beta().vaults().create(params); + } +} +``` + +## List + +`VaultListPage beta().vaults().list(VaultListParamsparams = VaultListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/vaults` + +List Vaults + +### Parameters + +- `VaultListParams params` + + - `Optional includeArchived` + + Whether to include archived vaults in the results. + + - `Optional limit` + + Maximum number of vaults to return per page. Defaults to 20, maximum 100. + + - `Optional page` + + Opaque pagination token from a previous `list_vaults` response. + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsVault:` + + A vault that stores credentials for use by agents during sessions. + + - `String id` + + Unique identifier for the vault. + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String displayName` + + Human-readable name for the vault. + + - `Metadata metadata` + + Arbitrary key-value metadata attached to the vault. + + - `Type type` + + - `VAULT("vault")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.vaults.VaultListPage; +import com.anthropic.models.beta.vaults.VaultListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + VaultListPage page = client.beta().vaults().list(); + } +} +``` + +## Retrieve + +`BetaManagedAgentsVault beta().vaults().retrieve(VaultRetrieveParamsparams = VaultRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/vaults/{vault_id}` + +Get Vault + +### Parameters + +- `VaultRetrieveParams params` + + - `Optional vaultId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsVault:` + + A vault that stores credentials for use by agents during sessions. + + - `String id` + + Unique identifier for the vault. + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String displayName` + + Human-readable name for the vault. + + - `Metadata metadata` + + Arbitrary key-value metadata attached to the vault. + + - `Type type` + + - `VAULT("vault")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.vaults.BetaManagedAgentsVault; +import com.anthropic.models.beta.vaults.VaultRetrieveParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BetaManagedAgentsVault betaManagedAgentsVault = client.beta().vaults().retrieve("vlt_011CZkZDLs7fYzm1hXNPeRjv"); + } +} +``` + +## Update + +`BetaManagedAgentsVault beta().vaults().update(VaultUpdateParamsparams = VaultUpdateParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/vaults/{vault_id}` + +Update Vault + +### Parameters + +- `VaultUpdateParams params` + + - `Optional vaultId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + + - `Optional displayName` + + Updated human-readable name for the vault. 1-255 characters. + + - `Optional metadata` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + +### Returns + +- `class BetaManagedAgentsVault:` + + A vault that stores credentials for use by agents during sessions. + + - `String id` + + Unique identifier for the vault. + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String displayName` + + Human-readable name for the vault. + + - `Metadata metadata` + + Arbitrary key-value metadata attached to the vault. + + - `Type type` + + - `VAULT("vault")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.vaults.BetaManagedAgentsVault; +import com.anthropic.models.beta.vaults.VaultUpdateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BetaManagedAgentsVault betaManagedAgentsVault = client.beta().vaults().update("vlt_011CZkZDLs7fYzm1hXNPeRjv"); + } +} +``` + +## Delete + +`BetaManagedAgentsDeletedVault beta().vaults().delete(VaultDeleteParamsparams = VaultDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**delete** `/v1/vaults/{vault_id}` + +Delete Vault + +### Parameters + +- `VaultDeleteParams params` + + - `Optional vaultId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsDeletedVault:` + + Confirmation of a deleted vault. + + - `String id` + + Unique identifier of the deleted vault. + + - `Type type` + + - `VAULT_DELETED("vault_deleted")` + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.vaults.BetaManagedAgentsDeletedVault; +import com.anthropic.models.beta.vaults.VaultDeleteParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BetaManagedAgentsDeletedVault betaManagedAgentsDeletedVault = client.beta().vaults().delete("vlt_011CZkZDLs7fYzm1hXNPeRjv"); + } +} +``` + +## Archive + +`BetaManagedAgentsVault beta().vaults().archive(VaultArchiveParamsparams = VaultArchiveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/vaults/{vault_id}/archive` + +Archive Vault + +### Parameters + +- `VaultArchiveParams params` + + - `Optional vaultId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsVault:` + + A vault that stores credentials for use by agents during sessions. + + - `String id` + + Unique identifier for the vault. + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String displayName` + + Human-readable name for the vault. + + - `Metadata metadata` + + Arbitrary key-value metadata attached to the vault. + + - `Type type` + + - `VAULT("vault")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.vaults.BetaManagedAgentsVault; +import com.anthropic.models.beta.vaults.VaultArchiveParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BetaManagedAgentsVault betaManagedAgentsVault = client.beta().vaults().archive("vlt_011CZkZDLs7fYzm1hXNPeRjv"); + } +} +``` + +## Domain Types + +### Beta Managed Agents Deleted Vault + +- `class BetaManagedAgentsDeletedVault:` + + Confirmation of a deleted vault. + + - `String id` + + Unique identifier of the deleted vault. + + - `Type type` + + - `VAULT_DELETED("vault_deleted")` + +### Beta Managed Agents Vault + +- `class BetaManagedAgentsVault:` + + A vault that stores credentials for use by agents during sessions. + + - `String id` + + Unique identifier for the vault. + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String displayName` + + Human-readable name for the vault. + + - `Metadata metadata` + + Arbitrary key-value metadata attached to the vault. + + - `Type type` + + - `VAULT("vault")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + +# Credentials + +## Create + +`BetaManagedAgentsCredential beta().vaults().credentials().create(CredentialCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/vaults/{vault_id}/credentials` + +Create Credential + +### Parameters + +- `CredentialCreateParams params` + + - `Optional vaultId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + + - `Auth auth` + + Authentication details for creating a credential. + + - `class BetaManagedAgentsMcpOAuthCreateParams:` + + Parameters for creating an MCP OAuth credential. + + - `String accessToken` + + OAuth access token. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `MCP_OAUTH("mcp_oauth")` + + - `Optional expiresAt` + + A timestamp in RFC 3339 format + + - `Optional refresh` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `String clientId` + + OAuth client ID. + + - `String refreshToken` + + OAuth refresh token. + + - `String tokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth tokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam:` + + Token endpoint requires no client authentication. + + - `Type type` + + - `NONE("none")` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `String clientSecret` + + OAuth client secret. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam:` + + Token endpoint uses POST body authentication with client credentials. + + - `String clientSecret` + + OAuth client secret. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional resource` + + OAuth resource indicator. + + - `Optional scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerCreateParams:` + + Parameters for creating a static bearer token credential. + + - `String token` + + Static bearer token value. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `STATIC_BEARER("static_bearer")` + + - `Optional displayName` + + Human-readable name for the credential. Up to 255 characters. + + - `Optional metadata` + + Arbitrary key-value metadata to attach to the credential. + +### Returns + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `String id` + + Unique identifier for the credential. + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `Auth auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `MCP_OAUTH("mcp_oauth")` + + - `Optional expiresAt` + + A timestamp in RFC 3339 format + + - `Optional refresh` + + OAuth refresh token configuration returned in credential responses. + + - `String clientId` + + OAuth client ID. + + - `String tokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth tokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `Type type` + + - `NONE("none")` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional resource` + + OAuth resource indicator. + + - `Optional scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `STATIC_BEARER("static_bearer")` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `Metadata metadata` + + Arbitrary key-value metadata attached to the credential. + + - `Type type` + + - `VAULT_CREDENTIAL("vault_credential")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String vaultId` + + Identifier of the vault this credential belongs to. + + - `Optional displayName` + + Human-readable name for the credential. + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.vaults.credentials.BetaManagedAgentsCredential; +import com.anthropic.models.beta.vaults.credentials.BetaManagedAgentsStaticBearerCreateParams; +import com.anthropic.models.beta.vaults.credentials.CredentialCreateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + CredentialCreateParams params = CredentialCreateParams.builder() + .vaultId("vlt_011CZkZDLs7fYzm1hXNPeRjv") + .auth(BetaManagedAgentsStaticBearerCreateParams.builder() + .token("bearer_exampletoken") + .mcpServerUrl("https://example-server.modelcontextprotocol.io/sse") + .type(BetaManagedAgentsStaticBearerCreateParams.Type.STATIC_BEARER) + .build()) + .build(); + BetaManagedAgentsCredential betaManagedAgentsCredential = client.beta().vaults().credentials().create(params); + } +} +``` + +## List + +`CredentialListPage beta().vaults().credentials().list(CredentialListParamsparams = CredentialListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/vaults/{vault_id}/credentials` + +List Credentials + +### Parameters + +- `CredentialListParams params` + + - `Optional vaultId` + + - `Optional includeArchived` + + Whether to include archived credentials in the results. + + - `Optional limit` + + Maximum number of credentials to return per page. Defaults to 20, maximum 100. + + - `Optional page` + + Opaque pagination token from a previous `list_credentials` response. + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `String id` + + Unique identifier for the credential. + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `Auth auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `MCP_OAUTH("mcp_oauth")` + + - `Optional expiresAt` + + A timestamp in RFC 3339 format + + - `Optional refresh` + + OAuth refresh token configuration returned in credential responses. + + - `String clientId` + + OAuth client ID. + + - `String tokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth tokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `Type type` + + - `NONE("none")` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional resource` + + OAuth resource indicator. + + - `Optional scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `STATIC_BEARER("static_bearer")` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `Metadata metadata` + + Arbitrary key-value metadata attached to the credential. + + - `Type type` + + - `VAULT_CREDENTIAL("vault_credential")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String vaultId` + + Identifier of the vault this credential belongs to. + + - `Optional displayName` + + Human-readable name for the credential. + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.vaults.credentials.CredentialListPage; +import com.anthropic.models.beta.vaults.credentials.CredentialListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + CredentialListPage page = client.beta().vaults().credentials().list("vlt_011CZkZDLs7fYzm1hXNPeRjv"); + } +} +``` + +## Retrieve + +`BetaManagedAgentsCredential beta().vaults().credentials().retrieve(CredentialRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Get Credential + +### Parameters + +- `CredentialRetrieveParams params` + + - `String vaultId` + + - `Optional credentialId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `String id` + + Unique identifier for the credential. + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `Auth auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `MCP_OAUTH("mcp_oauth")` + + - `Optional expiresAt` + + A timestamp in RFC 3339 format + + - `Optional refresh` + + OAuth refresh token configuration returned in credential responses. + + - `String clientId` + + OAuth client ID. + + - `String tokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth tokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `Type type` + + - `NONE("none")` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional resource` + + OAuth resource indicator. + + - `Optional scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `STATIC_BEARER("static_bearer")` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `Metadata metadata` + + Arbitrary key-value metadata attached to the credential. + + - `Type type` + + - `VAULT_CREDENTIAL("vault_credential")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String vaultId` + + Identifier of the vault this credential belongs to. + + - `Optional displayName` + + Human-readable name for the credential. + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.vaults.credentials.BetaManagedAgentsCredential; +import com.anthropic.models.beta.vaults.credentials.CredentialRetrieveParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + CredentialRetrieveParams params = CredentialRetrieveParams.builder() + .vaultId("vlt_011CZkZDLs7fYzm1hXNPeRjv") + .credentialId("vcrd_011CZkZEMt8gZan2iYOQfSkw") + .build(); + BetaManagedAgentsCredential betaManagedAgentsCredential = client.beta().vaults().credentials().retrieve(params); + } +} +``` + +## Update + +`BetaManagedAgentsCredential beta().vaults().credentials().update(CredentialUpdateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Update Credential + +### Parameters + +- `CredentialUpdateParams params` + + - `String vaultId` + + - `Optional credentialId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + + - `Optional auth` + + Updated authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthUpdateParams:` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `Type type` + + - `MCP_OAUTH("mcp_oauth")` + + - `Optional accessToken` + + Updated OAuth access token. + + - `Optional expiresAt` + + A timestamp in RFC 3339 format + + - `Optional refresh` + + Parameters for updating OAuth refresh token configuration. + + - `Optional refreshToken` + + Updated OAuth refresh token. + + - `Optional scope` + + Updated OAuth scope for the refresh request. + + - `Optional tokenEndpointAuth` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam:` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `Optional clientSecret` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam:` + + Updated POST body authentication parameters for the token endpoint. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional clientSecret` + + Updated OAuth client secret. + + - `class BetaManagedAgentsStaticBearerUpdateParams:` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `Type type` + + - `STATIC_BEARER("static_bearer")` + + - `Optional token` + + Updated static bearer token value. + + - `Optional displayName` + + Updated human-readable name for the credential. 1-255 characters. + + - `Optional metadata` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + +### Returns + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `String id` + + Unique identifier for the credential. + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `Auth auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `MCP_OAUTH("mcp_oauth")` + + - `Optional expiresAt` + + A timestamp in RFC 3339 format + + - `Optional refresh` + + OAuth refresh token configuration returned in credential responses. + + - `String clientId` + + OAuth client ID. + + - `String tokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth tokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `Type type` + + - `NONE("none")` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional resource` + + OAuth resource indicator. + + - `Optional scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `STATIC_BEARER("static_bearer")` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `Metadata metadata` + + Arbitrary key-value metadata attached to the credential. + + - `Type type` + + - `VAULT_CREDENTIAL("vault_credential")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String vaultId` + + Identifier of the vault this credential belongs to. + + - `Optional displayName` + + Human-readable name for the credential. + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.vaults.credentials.BetaManagedAgentsCredential; +import com.anthropic.models.beta.vaults.credentials.CredentialUpdateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + CredentialUpdateParams params = CredentialUpdateParams.builder() + .vaultId("vlt_011CZkZDLs7fYzm1hXNPeRjv") + .credentialId("vcrd_011CZkZEMt8gZan2iYOQfSkw") + .build(); + BetaManagedAgentsCredential betaManagedAgentsCredential = client.beta().vaults().credentials().update(params); + } +} +``` + +## Delete + +`BetaManagedAgentsDeletedCredential beta().vaults().credentials().delete(CredentialDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**delete** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Delete Credential + +### Parameters + +- `CredentialDeleteParams params` + + - `String vaultId` + + - `Optional credentialId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsDeletedCredential:` + + Confirmation of a deleted credential. + + - `String id` + + Unique identifier of the deleted credential. + + - `Type type` + + - `VAULT_CREDENTIAL_DELETED("vault_credential_deleted")` + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.vaults.credentials.BetaManagedAgentsDeletedCredential; +import com.anthropic.models.beta.vaults.credentials.CredentialDeleteParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + CredentialDeleteParams params = CredentialDeleteParams.builder() + .vaultId("vlt_011CZkZDLs7fYzm1hXNPeRjv") + .credentialId("vcrd_011CZkZEMt8gZan2iYOQfSkw") + .build(); + BetaManagedAgentsDeletedCredential betaManagedAgentsDeletedCredential = client.beta().vaults().credentials().delete(params); + } +} +``` + +## Archive + +`BetaManagedAgentsCredential beta().vaults().credentials().archive(CredentialArchiveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}/archive` + +Archive Credential + +### Parameters + +- `CredentialArchiveParams params` + + - `String vaultId` + + - `Optional credentialId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `String id` + + Unique identifier for the credential. + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `Auth auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `MCP_OAUTH("mcp_oauth")` + + - `Optional expiresAt` + + A timestamp in RFC 3339 format + + - `Optional refresh` + + OAuth refresh token configuration returned in credential responses. + + - `String clientId` + + OAuth client ID. + + - `String tokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth tokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `Type type` + + - `NONE("none")` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional resource` + + OAuth resource indicator. + + - `Optional scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `STATIC_BEARER("static_bearer")` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `Metadata metadata` + + Arbitrary key-value metadata attached to the credential. + + - `Type type` + + - `VAULT_CREDENTIAL("vault_credential")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String vaultId` + + Identifier of the vault this credential belongs to. + + - `Optional displayName` + + Human-readable name for the credential. + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.vaults.credentials.BetaManagedAgentsCredential; +import com.anthropic.models.beta.vaults.credentials.CredentialArchiveParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + CredentialArchiveParams params = CredentialArchiveParams.builder() + .vaultId("vlt_011CZkZDLs7fYzm1hXNPeRjv") + .credentialId("vcrd_011CZkZEMt8gZan2iYOQfSkw") + .build(); + BetaManagedAgentsCredential betaManagedAgentsCredential = client.beta().vaults().credentials().archive(params); + } +} +``` + +## Domain Types + +### Beta Managed Agents Credential + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `String id` + + Unique identifier for the credential. + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `Auth auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `MCP_OAUTH("mcp_oauth")` + + - `Optional expiresAt` + + A timestamp in RFC 3339 format + + - `Optional refresh` + + OAuth refresh token configuration returned in credential responses. + + - `String clientId` + + OAuth client ID. + + - `String tokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth tokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `Type type` + + - `NONE("none")` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional resource` + + OAuth resource indicator. + + - `Optional scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `STATIC_BEARER("static_bearer")` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `Metadata metadata` + + Arbitrary key-value metadata attached to the credential. + + - `Type type` + + - `VAULT_CREDENTIAL("vault_credential")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String vaultId` + + Identifier of the vault this credential belongs to. + + - `Optional displayName` + + Human-readable name for the credential. + +### Beta Managed Agents Deleted Credential + +- `class BetaManagedAgentsDeletedCredential:` + + Confirmation of a deleted credential. + + - `String id` + + Unique identifier of the deleted credential. + + - `Type type` + + - `VAULT_CREDENTIAL_DELETED("vault_credential_deleted")` + +### Beta Managed Agents MCP OAuth Auth Response + +- `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `MCP_OAUTH("mcp_oauth")` + + - `Optional expiresAt` + + A timestamp in RFC 3339 format + + - `Optional refresh` + + OAuth refresh token configuration returned in credential responses. + + - `String clientId` + + OAuth client ID. + + - `String tokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth tokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `Type type` + + - `NONE("none")` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional resource` + + OAuth resource indicator. + + - `Optional scope` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Create Params + +- `class BetaManagedAgentsMcpOAuthCreateParams:` + + Parameters for creating an MCP OAuth credential. + + - `String accessToken` + + OAuth access token. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `MCP_OAUTH("mcp_oauth")` + + - `Optional expiresAt` + + A timestamp in RFC 3339 format + + - `Optional refresh` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `String clientId` + + OAuth client ID. + + - `String refreshToken` + + OAuth refresh token. + + - `String tokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth tokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam:` + + Token endpoint requires no client authentication. + + - `Type type` + + - `NONE("none")` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `String clientSecret` + + OAuth client secret. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam:` + + Token endpoint uses POST body authentication with client credentials. + + - `String clientSecret` + + OAuth client secret. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional resource` + + OAuth resource indicator. + + - `Optional scope` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Params + +- `class BetaManagedAgentsMcpOAuthRefreshParams:` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `String clientId` + + OAuth client ID. + + - `String refreshToken` + + OAuth refresh token. + + - `String tokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth tokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam:` + + Token endpoint requires no client authentication. + + - `Type type` + + - `NONE("none")` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `String clientSecret` + + OAuth client secret. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam:` + + Token endpoint uses POST body authentication with client credentials. + + - `String clientSecret` + + OAuth client secret. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional resource` + + OAuth resource indicator. + + - `Optional scope` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Response + +- `class BetaManagedAgentsMcpOAuthRefreshResponse:` + + OAuth refresh token configuration returned in credential responses. + + - `String clientId` + + OAuth client ID. + + - `String tokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth tokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `Type type` + + - `NONE("none")` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional resource` + + OAuth resource indicator. + + - `Optional scope` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Update Params + +- `class BetaManagedAgentsMcpOAuthRefreshUpdateParams:` + + Parameters for updating OAuth refresh token configuration. + + - `Optional refreshToken` + + Updated OAuth refresh token. + + - `Optional scope` + + Updated OAuth scope for the refresh request. + + - `Optional tokenEndpointAuth` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam:` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `Optional clientSecret` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam:` + + Updated POST body authentication parameters for the token endpoint. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional clientSecret` + + Updated OAuth client secret. + +### Beta Managed Agents MCP OAuth Update Params + +- `class BetaManagedAgentsMcpOAuthUpdateParams:` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `Type type` + + - `MCP_OAUTH("mcp_oauth")` + + - `Optional accessToken` + + Updated OAuth access token. + + - `Optional expiresAt` + + A timestamp in RFC 3339 format + + - `Optional refresh` + + Parameters for updating OAuth refresh token configuration. + + - `Optional refreshToken` + + Updated OAuth refresh token. + + - `Optional scope` + + Updated OAuth scope for the refresh request. + + - `Optional tokenEndpointAuth` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam:` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `Optional clientSecret` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam:` + + Updated POST body authentication parameters for the token endpoint. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional clientSecret` + + Updated OAuth client secret. + +### Beta Managed Agents Static Bearer Auth Response + +- `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `STATIC_BEARER("static_bearer")` + +### Beta Managed Agents Static Bearer Create Params + +- `class BetaManagedAgentsStaticBearerCreateParams:` + + Parameters for creating a static bearer token credential. + + - `String token` + + Static bearer token value. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `STATIC_BEARER("static_bearer")` + +### Beta Managed Agents Static Bearer Update Params + +- `class BetaManagedAgentsStaticBearerUpdateParams:` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `Type type` + + - `STATIC_BEARER("static_bearer")` + + - `Optional token` + + Updated static bearer token value. + +### Beta Managed Agents Token Endpoint Auth Basic Param + +- `class BetaManagedAgentsTokenEndpointAuthBasicParam:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `String clientSecret` + + OAuth client secret. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + +### Beta Managed Agents Token Endpoint Auth Basic Response + +- `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + +### Beta Managed Agents Token Endpoint Auth Basic Update Param + +- `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam:` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `Optional clientSecret` + + Updated OAuth client secret. + +### Beta Managed Agents Token Endpoint Auth None Param + +- `class BetaManagedAgentsTokenEndpointAuthNoneParam:` + + Token endpoint requires no client authentication. + + - `Type type` + + - `NONE("none")` + +### Beta Managed Agents Token Endpoint Auth None Response + +- `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `Type type` + + - `NONE("none")` + +### Beta Managed Agents Token Endpoint Auth Post Param + +- `class BetaManagedAgentsTokenEndpointAuthPostParam:` + + Token endpoint uses POST body authentication with client credentials. + + - `String clientSecret` + + OAuth client secret. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + +### Beta Managed Agents Token Endpoint Auth Post Response + +- `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + +### Beta Managed Agents Token Endpoint Auth Post Update Param + +- `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam:` + + Updated POST body authentication parameters for the token endpoint. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional clientSecret` + + Updated OAuth client secret. diff --git a/content/en/api/java/beta/vaults/archive.md b/content/en/api/java/beta/vaults/archive.md new file mode 100644 index 000000000..57e345267 --- /dev/null +++ b/content/en/api/java/beta/vaults/archive.md @@ -0,0 +1,114 @@ +## Archive + +`BetaManagedAgentsVault beta().vaults().archive(VaultArchiveParamsparams = VaultArchiveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/vaults/{vault_id}/archive` + +Archive Vault + +### Parameters + +- `VaultArchiveParams params` + + - `Optional vaultId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsVault:` + + A vault that stores credentials for use by agents during sessions. + + - `String id` + + Unique identifier for the vault. + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String displayName` + + Human-readable name for the vault. + + - `Metadata metadata` + + Arbitrary key-value metadata attached to the vault. + + - `Type type` + + - `VAULT("vault")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.vaults.BetaManagedAgentsVault; +import com.anthropic.models.beta.vaults.VaultArchiveParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BetaManagedAgentsVault betaManagedAgentsVault = client.beta().vaults().archive("vlt_011CZkZDLs7fYzm1hXNPeRjv"); + } +} +``` diff --git a/content/en/api/java/beta/vaults/create.md b/content/en/api/java/beta/vaults/create.md new file mode 100644 index 000000000..94a35dcb5 --- /dev/null +++ b/content/en/api/java/beta/vaults/create.md @@ -0,0 +1,123 @@ +## Create + +`BetaManagedAgentsVault beta().vaults().create(VaultCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/vaults` + +Create Vault + +### Parameters + +- `VaultCreateParams params` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + + - `String displayName` + + Human-readable name for the vault. 1-255 characters. + + - `Optional metadata` + + Arbitrary key-value metadata to attach to the vault. + +### Returns + +- `class BetaManagedAgentsVault:` + + A vault that stores credentials for use by agents during sessions. + + - `String id` + + Unique identifier for the vault. + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String displayName` + + Human-readable name for the vault. + + - `Metadata metadata` + + Arbitrary key-value metadata attached to the vault. + + - `Type type` + + - `VAULT("vault")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.vaults.BetaManagedAgentsVault; +import com.anthropic.models.beta.vaults.VaultCreateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + VaultCreateParams params = VaultCreateParams.builder() + .displayName("Example vault") + .build(); + BetaManagedAgentsVault betaManagedAgentsVault = client.beta().vaults().create(params); + } +} +``` diff --git a/content/en/api/java/beta/vaults/credentials.md b/content/en/api/java/beta/vaults/credentials.md new file mode 100644 index 000000000..5bf1ee7bb --- /dev/null +++ b/content/en/api/java/beta/vaults/credentials.md @@ -0,0 +1,1960 @@ +# Credentials + +## Create + +`BetaManagedAgentsCredential beta().vaults().credentials().create(CredentialCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/vaults/{vault_id}/credentials` + +Create Credential + +### Parameters + +- `CredentialCreateParams params` + + - `Optional vaultId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + + - `Auth auth` + + Authentication details for creating a credential. + + - `class BetaManagedAgentsMcpOAuthCreateParams:` + + Parameters for creating an MCP OAuth credential. + + - `String accessToken` + + OAuth access token. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `MCP_OAUTH("mcp_oauth")` + + - `Optional expiresAt` + + A timestamp in RFC 3339 format + + - `Optional refresh` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `String clientId` + + OAuth client ID. + + - `String refreshToken` + + OAuth refresh token. + + - `String tokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth tokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam:` + + Token endpoint requires no client authentication. + + - `Type type` + + - `NONE("none")` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `String clientSecret` + + OAuth client secret. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam:` + + Token endpoint uses POST body authentication with client credentials. + + - `String clientSecret` + + OAuth client secret. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional resource` + + OAuth resource indicator. + + - `Optional scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerCreateParams:` + + Parameters for creating a static bearer token credential. + + - `String token` + + Static bearer token value. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `STATIC_BEARER("static_bearer")` + + - `Optional displayName` + + Human-readable name for the credential. Up to 255 characters. + + - `Optional metadata` + + Arbitrary key-value metadata to attach to the credential. + +### Returns + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `String id` + + Unique identifier for the credential. + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `Auth auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `MCP_OAUTH("mcp_oauth")` + + - `Optional expiresAt` + + A timestamp in RFC 3339 format + + - `Optional refresh` + + OAuth refresh token configuration returned in credential responses. + + - `String clientId` + + OAuth client ID. + + - `String tokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth tokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `Type type` + + - `NONE("none")` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional resource` + + OAuth resource indicator. + + - `Optional scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `STATIC_BEARER("static_bearer")` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `Metadata metadata` + + Arbitrary key-value metadata attached to the credential. + + - `Type type` + + - `VAULT_CREDENTIAL("vault_credential")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String vaultId` + + Identifier of the vault this credential belongs to. + + - `Optional displayName` + + Human-readable name for the credential. + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.vaults.credentials.BetaManagedAgentsCredential; +import com.anthropic.models.beta.vaults.credentials.BetaManagedAgentsStaticBearerCreateParams; +import com.anthropic.models.beta.vaults.credentials.CredentialCreateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + CredentialCreateParams params = CredentialCreateParams.builder() + .vaultId("vlt_011CZkZDLs7fYzm1hXNPeRjv") + .auth(BetaManagedAgentsStaticBearerCreateParams.builder() + .token("bearer_exampletoken") + .mcpServerUrl("https://example-server.modelcontextprotocol.io/sse") + .type(BetaManagedAgentsStaticBearerCreateParams.Type.STATIC_BEARER) + .build()) + .build(); + BetaManagedAgentsCredential betaManagedAgentsCredential = client.beta().vaults().credentials().create(params); + } +} +``` + +## List + +`CredentialListPage beta().vaults().credentials().list(CredentialListParamsparams = CredentialListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/vaults/{vault_id}/credentials` + +List Credentials + +### Parameters + +- `CredentialListParams params` + + - `Optional vaultId` + + - `Optional includeArchived` + + Whether to include archived credentials in the results. + + - `Optional limit` + + Maximum number of credentials to return per page. Defaults to 20, maximum 100. + + - `Optional page` + + Opaque pagination token from a previous `list_credentials` response. + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `String id` + + Unique identifier for the credential. + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `Auth auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `MCP_OAUTH("mcp_oauth")` + + - `Optional expiresAt` + + A timestamp in RFC 3339 format + + - `Optional refresh` + + OAuth refresh token configuration returned in credential responses. + + - `String clientId` + + OAuth client ID. + + - `String tokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth tokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `Type type` + + - `NONE("none")` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional resource` + + OAuth resource indicator. + + - `Optional scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `STATIC_BEARER("static_bearer")` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `Metadata metadata` + + Arbitrary key-value metadata attached to the credential. + + - `Type type` + + - `VAULT_CREDENTIAL("vault_credential")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String vaultId` + + Identifier of the vault this credential belongs to. + + - `Optional displayName` + + Human-readable name for the credential. + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.vaults.credentials.CredentialListPage; +import com.anthropic.models.beta.vaults.credentials.CredentialListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + CredentialListPage page = client.beta().vaults().credentials().list("vlt_011CZkZDLs7fYzm1hXNPeRjv"); + } +} +``` + +## Retrieve + +`BetaManagedAgentsCredential beta().vaults().credentials().retrieve(CredentialRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Get Credential + +### Parameters + +- `CredentialRetrieveParams params` + + - `String vaultId` + + - `Optional credentialId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `String id` + + Unique identifier for the credential. + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `Auth auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `MCP_OAUTH("mcp_oauth")` + + - `Optional expiresAt` + + A timestamp in RFC 3339 format + + - `Optional refresh` + + OAuth refresh token configuration returned in credential responses. + + - `String clientId` + + OAuth client ID. + + - `String tokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth tokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `Type type` + + - `NONE("none")` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional resource` + + OAuth resource indicator. + + - `Optional scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `STATIC_BEARER("static_bearer")` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `Metadata metadata` + + Arbitrary key-value metadata attached to the credential. + + - `Type type` + + - `VAULT_CREDENTIAL("vault_credential")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String vaultId` + + Identifier of the vault this credential belongs to. + + - `Optional displayName` + + Human-readable name for the credential. + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.vaults.credentials.BetaManagedAgentsCredential; +import com.anthropic.models.beta.vaults.credentials.CredentialRetrieveParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + CredentialRetrieveParams params = CredentialRetrieveParams.builder() + .vaultId("vlt_011CZkZDLs7fYzm1hXNPeRjv") + .credentialId("vcrd_011CZkZEMt8gZan2iYOQfSkw") + .build(); + BetaManagedAgentsCredential betaManagedAgentsCredential = client.beta().vaults().credentials().retrieve(params); + } +} +``` + +## Update + +`BetaManagedAgentsCredential beta().vaults().credentials().update(CredentialUpdateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Update Credential + +### Parameters + +- `CredentialUpdateParams params` + + - `String vaultId` + + - `Optional credentialId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + + - `Optional auth` + + Updated authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthUpdateParams:` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `Type type` + + - `MCP_OAUTH("mcp_oauth")` + + - `Optional accessToken` + + Updated OAuth access token. + + - `Optional expiresAt` + + A timestamp in RFC 3339 format + + - `Optional refresh` + + Parameters for updating OAuth refresh token configuration. + + - `Optional refreshToken` + + Updated OAuth refresh token. + + - `Optional scope` + + Updated OAuth scope for the refresh request. + + - `Optional tokenEndpointAuth` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam:` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `Optional clientSecret` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam:` + + Updated POST body authentication parameters for the token endpoint. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional clientSecret` + + Updated OAuth client secret. + + - `class BetaManagedAgentsStaticBearerUpdateParams:` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `Type type` + + - `STATIC_BEARER("static_bearer")` + + - `Optional token` + + Updated static bearer token value. + + - `Optional displayName` + + Updated human-readable name for the credential. 1-255 characters. + + - `Optional metadata` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + +### Returns + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `String id` + + Unique identifier for the credential. + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `Auth auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `MCP_OAUTH("mcp_oauth")` + + - `Optional expiresAt` + + A timestamp in RFC 3339 format + + - `Optional refresh` + + OAuth refresh token configuration returned in credential responses. + + - `String clientId` + + OAuth client ID. + + - `String tokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth tokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `Type type` + + - `NONE("none")` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional resource` + + OAuth resource indicator. + + - `Optional scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `STATIC_BEARER("static_bearer")` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `Metadata metadata` + + Arbitrary key-value metadata attached to the credential. + + - `Type type` + + - `VAULT_CREDENTIAL("vault_credential")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String vaultId` + + Identifier of the vault this credential belongs to. + + - `Optional displayName` + + Human-readable name for the credential. + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.vaults.credentials.BetaManagedAgentsCredential; +import com.anthropic.models.beta.vaults.credentials.CredentialUpdateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + CredentialUpdateParams params = CredentialUpdateParams.builder() + .vaultId("vlt_011CZkZDLs7fYzm1hXNPeRjv") + .credentialId("vcrd_011CZkZEMt8gZan2iYOQfSkw") + .build(); + BetaManagedAgentsCredential betaManagedAgentsCredential = client.beta().vaults().credentials().update(params); + } +} +``` + +## Delete + +`BetaManagedAgentsDeletedCredential beta().vaults().credentials().delete(CredentialDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**delete** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Delete Credential + +### Parameters + +- `CredentialDeleteParams params` + + - `String vaultId` + + - `Optional credentialId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsDeletedCredential:` + + Confirmation of a deleted credential. + + - `String id` + + Unique identifier of the deleted credential. + + - `Type type` + + - `VAULT_CREDENTIAL_DELETED("vault_credential_deleted")` + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.vaults.credentials.BetaManagedAgentsDeletedCredential; +import com.anthropic.models.beta.vaults.credentials.CredentialDeleteParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + CredentialDeleteParams params = CredentialDeleteParams.builder() + .vaultId("vlt_011CZkZDLs7fYzm1hXNPeRjv") + .credentialId("vcrd_011CZkZEMt8gZan2iYOQfSkw") + .build(); + BetaManagedAgentsDeletedCredential betaManagedAgentsDeletedCredential = client.beta().vaults().credentials().delete(params); + } +} +``` + +## Archive + +`BetaManagedAgentsCredential beta().vaults().credentials().archive(CredentialArchiveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}/archive` + +Archive Credential + +### Parameters + +- `CredentialArchiveParams params` + + - `String vaultId` + + - `Optional credentialId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `String id` + + Unique identifier for the credential. + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `Auth auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `MCP_OAUTH("mcp_oauth")` + + - `Optional expiresAt` + + A timestamp in RFC 3339 format + + - `Optional refresh` + + OAuth refresh token configuration returned in credential responses. + + - `String clientId` + + OAuth client ID. + + - `String tokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth tokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `Type type` + + - `NONE("none")` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional resource` + + OAuth resource indicator. + + - `Optional scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `STATIC_BEARER("static_bearer")` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `Metadata metadata` + + Arbitrary key-value metadata attached to the credential. + + - `Type type` + + - `VAULT_CREDENTIAL("vault_credential")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String vaultId` + + Identifier of the vault this credential belongs to. + + - `Optional displayName` + + Human-readable name for the credential. + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.vaults.credentials.BetaManagedAgentsCredential; +import com.anthropic.models.beta.vaults.credentials.CredentialArchiveParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + CredentialArchiveParams params = CredentialArchiveParams.builder() + .vaultId("vlt_011CZkZDLs7fYzm1hXNPeRjv") + .credentialId("vcrd_011CZkZEMt8gZan2iYOQfSkw") + .build(); + BetaManagedAgentsCredential betaManagedAgentsCredential = client.beta().vaults().credentials().archive(params); + } +} +``` + +## Domain Types + +### Beta Managed Agents Credential + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `String id` + + Unique identifier for the credential. + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `Auth auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `MCP_OAUTH("mcp_oauth")` + + - `Optional expiresAt` + + A timestamp in RFC 3339 format + + - `Optional refresh` + + OAuth refresh token configuration returned in credential responses. + + - `String clientId` + + OAuth client ID. + + - `String tokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth tokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `Type type` + + - `NONE("none")` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional resource` + + OAuth resource indicator. + + - `Optional scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `STATIC_BEARER("static_bearer")` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `Metadata metadata` + + Arbitrary key-value metadata attached to the credential. + + - `Type type` + + - `VAULT_CREDENTIAL("vault_credential")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String vaultId` + + Identifier of the vault this credential belongs to. + + - `Optional displayName` + + Human-readable name for the credential. + +### Beta Managed Agents Deleted Credential + +- `class BetaManagedAgentsDeletedCredential:` + + Confirmation of a deleted credential. + + - `String id` + + Unique identifier of the deleted credential. + + - `Type type` + + - `VAULT_CREDENTIAL_DELETED("vault_credential_deleted")` + +### Beta Managed Agents MCP OAuth Auth Response + +- `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `MCP_OAUTH("mcp_oauth")` + + - `Optional expiresAt` + + A timestamp in RFC 3339 format + + - `Optional refresh` + + OAuth refresh token configuration returned in credential responses. + + - `String clientId` + + OAuth client ID. + + - `String tokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth tokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `Type type` + + - `NONE("none")` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional resource` + + OAuth resource indicator. + + - `Optional scope` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Create Params + +- `class BetaManagedAgentsMcpOAuthCreateParams:` + + Parameters for creating an MCP OAuth credential. + + - `String accessToken` + + OAuth access token. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `MCP_OAUTH("mcp_oauth")` + + - `Optional expiresAt` + + A timestamp in RFC 3339 format + + - `Optional refresh` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `String clientId` + + OAuth client ID. + + - `String refreshToken` + + OAuth refresh token. + + - `String tokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth tokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam:` + + Token endpoint requires no client authentication. + + - `Type type` + + - `NONE("none")` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `String clientSecret` + + OAuth client secret. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam:` + + Token endpoint uses POST body authentication with client credentials. + + - `String clientSecret` + + OAuth client secret. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional resource` + + OAuth resource indicator. + + - `Optional scope` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Params + +- `class BetaManagedAgentsMcpOAuthRefreshParams:` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `String clientId` + + OAuth client ID. + + - `String refreshToken` + + OAuth refresh token. + + - `String tokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth tokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam:` + + Token endpoint requires no client authentication. + + - `Type type` + + - `NONE("none")` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `String clientSecret` + + OAuth client secret. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam:` + + Token endpoint uses POST body authentication with client credentials. + + - `String clientSecret` + + OAuth client secret. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional resource` + + OAuth resource indicator. + + - `Optional scope` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Response + +- `class BetaManagedAgentsMcpOAuthRefreshResponse:` + + OAuth refresh token configuration returned in credential responses. + + - `String clientId` + + OAuth client ID. + + - `String tokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth tokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `Type type` + + - `NONE("none")` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional resource` + + OAuth resource indicator. + + - `Optional scope` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Update Params + +- `class BetaManagedAgentsMcpOAuthRefreshUpdateParams:` + + Parameters for updating OAuth refresh token configuration. + + - `Optional refreshToken` + + Updated OAuth refresh token. + + - `Optional scope` + + Updated OAuth scope for the refresh request. + + - `Optional tokenEndpointAuth` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam:` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `Optional clientSecret` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam:` + + Updated POST body authentication parameters for the token endpoint. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional clientSecret` + + Updated OAuth client secret. + +### Beta Managed Agents MCP OAuth Update Params + +- `class BetaManagedAgentsMcpOAuthUpdateParams:` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `Type type` + + - `MCP_OAUTH("mcp_oauth")` + + - `Optional accessToken` + + Updated OAuth access token. + + - `Optional expiresAt` + + A timestamp in RFC 3339 format + + - `Optional refresh` + + Parameters for updating OAuth refresh token configuration. + + - `Optional refreshToken` + + Updated OAuth refresh token. + + - `Optional scope` + + Updated OAuth scope for the refresh request. + + - `Optional tokenEndpointAuth` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam:` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `Optional clientSecret` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam:` + + Updated POST body authentication parameters for the token endpoint. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional clientSecret` + + Updated OAuth client secret. + +### Beta Managed Agents Static Bearer Auth Response + +- `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `STATIC_BEARER("static_bearer")` + +### Beta Managed Agents Static Bearer Create Params + +- `class BetaManagedAgentsStaticBearerCreateParams:` + + Parameters for creating a static bearer token credential. + + - `String token` + + Static bearer token value. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `STATIC_BEARER("static_bearer")` + +### Beta Managed Agents Static Bearer Update Params + +- `class BetaManagedAgentsStaticBearerUpdateParams:` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `Type type` + + - `STATIC_BEARER("static_bearer")` + + - `Optional token` + + Updated static bearer token value. + +### Beta Managed Agents Token Endpoint Auth Basic Param + +- `class BetaManagedAgentsTokenEndpointAuthBasicParam:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `String clientSecret` + + OAuth client secret. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + +### Beta Managed Agents Token Endpoint Auth Basic Response + +- `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + +### Beta Managed Agents Token Endpoint Auth Basic Update Param + +- `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam:` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `Optional clientSecret` + + Updated OAuth client secret. + +### Beta Managed Agents Token Endpoint Auth None Param + +- `class BetaManagedAgentsTokenEndpointAuthNoneParam:` + + Token endpoint requires no client authentication. + + - `Type type` + + - `NONE("none")` + +### Beta Managed Agents Token Endpoint Auth None Response + +- `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `Type type` + + - `NONE("none")` + +### Beta Managed Agents Token Endpoint Auth Post Param + +- `class BetaManagedAgentsTokenEndpointAuthPostParam:` + + Token endpoint uses POST body authentication with client credentials. + + - `String clientSecret` + + OAuth client secret. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + +### Beta Managed Agents Token Endpoint Auth Post Response + +- `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + +### Beta Managed Agents Token Endpoint Auth Post Update Param + +- `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam:` + + Updated POST body authentication parameters for the token endpoint. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional clientSecret` + + Updated OAuth client secret. diff --git a/content/en/api/java/beta/vaults/credentials/archive.md b/content/en/api/java/beta/vaults/credentials/archive.md new file mode 100644 index 000000000..733f5f8f1 --- /dev/null +++ b/content/en/api/java/beta/vaults/credentials/archive.md @@ -0,0 +1,204 @@ +## Archive + +`BetaManagedAgentsCredential beta().vaults().credentials().archive(CredentialArchiveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}/archive` + +Archive Credential + +### Parameters + +- `CredentialArchiveParams params` + + - `String vaultId` + + - `Optional credentialId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `String id` + + Unique identifier for the credential. + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `Auth auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `MCP_OAUTH("mcp_oauth")` + + - `Optional expiresAt` + + A timestamp in RFC 3339 format + + - `Optional refresh` + + OAuth refresh token configuration returned in credential responses. + + - `String clientId` + + OAuth client ID. + + - `String tokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth tokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `Type type` + + - `NONE("none")` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional resource` + + OAuth resource indicator. + + - `Optional scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `STATIC_BEARER("static_bearer")` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `Metadata metadata` + + Arbitrary key-value metadata attached to the credential. + + - `Type type` + + - `VAULT_CREDENTIAL("vault_credential")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String vaultId` + + Identifier of the vault this credential belongs to. + + - `Optional displayName` + + Human-readable name for the credential. + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.vaults.credentials.BetaManagedAgentsCredential; +import com.anthropic.models.beta.vaults.credentials.CredentialArchiveParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + CredentialArchiveParams params = CredentialArchiveParams.builder() + .vaultId("vlt_011CZkZDLs7fYzm1hXNPeRjv") + .credentialId("vcrd_011CZkZEMt8gZan2iYOQfSkw") + .build(); + BetaManagedAgentsCredential betaManagedAgentsCredential = client.beta().vaults().credentials().archive(params); + } +} +``` diff --git a/content/en/api/java/beta/vaults/credentials/create.md b/content/en/api/java/beta/vaults/credentials/create.md new file mode 100644 index 000000000..09e2cd2bf --- /dev/null +++ b/content/en/api/java/beta/vaults/credentials/create.md @@ -0,0 +1,315 @@ +## Create + +`BetaManagedAgentsCredential beta().vaults().credentials().create(CredentialCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/vaults/{vault_id}/credentials` + +Create Credential + +### Parameters + +- `CredentialCreateParams params` + + - `Optional vaultId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + + - `Auth auth` + + Authentication details for creating a credential. + + - `class BetaManagedAgentsMcpOAuthCreateParams:` + + Parameters for creating an MCP OAuth credential. + + - `String accessToken` + + OAuth access token. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `MCP_OAUTH("mcp_oauth")` + + - `Optional expiresAt` + + A timestamp in RFC 3339 format + + - `Optional refresh` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `String clientId` + + OAuth client ID. + + - `String refreshToken` + + OAuth refresh token. + + - `String tokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth tokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam:` + + Token endpoint requires no client authentication. + + - `Type type` + + - `NONE("none")` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `String clientSecret` + + OAuth client secret. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam:` + + Token endpoint uses POST body authentication with client credentials. + + - `String clientSecret` + + OAuth client secret. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional resource` + + OAuth resource indicator. + + - `Optional scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerCreateParams:` + + Parameters for creating a static bearer token credential. + + - `String token` + + Static bearer token value. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `STATIC_BEARER("static_bearer")` + + - `Optional displayName` + + Human-readable name for the credential. Up to 255 characters. + + - `Optional metadata` + + Arbitrary key-value metadata to attach to the credential. + +### Returns + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `String id` + + Unique identifier for the credential. + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `Auth auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `MCP_OAUTH("mcp_oauth")` + + - `Optional expiresAt` + + A timestamp in RFC 3339 format + + - `Optional refresh` + + OAuth refresh token configuration returned in credential responses. + + - `String clientId` + + OAuth client ID. + + - `String tokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth tokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `Type type` + + - `NONE("none")` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional resource` + + OAuth resource indicator. + + - `Optional scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `STATIC_BEARER("static_bearer")` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `Metadata metadata` + + Arbitrary key-value metadata attached to the credential. + + - `Type type` + + - `VAULT_CREDENTIAL("vault_credential")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String vaultId` + + Identifier of the vault this credential belongs to. + + - `Optional displayName` + + Human-readable name for the credential. + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.vaults.credentials.BetaManagedAgentsCredential; +import com.anthropic.models.beta.vaults.credentials.BetaManagedAgentsStaticBearerCreateParams; +import com.anthropic.models.beta.vaults.credentials.CredentialCreateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + CredentialCreateParams params = CredentialCreateParams.builder() + .vaultId("vlt_011CZkZDLs7fYzm1hXNPeRjv") + .auth(BetaManagedAgentsStaticBearerCreateParams.builder() + .token("bearer_exampletoken") + .mcpServerUrl("https://example-server.modelcontextprotocol.io/sse") + .type(BetaManagedAgentsStaticBearerCreateParams.Type.STATIC_BEARER) + .build()) + .build(); + BetaManagedAgentsCredential betaManagedAgentsCredential = client.beta().vaults().credentials().create(params); + } +} +``` diff --git a/content/en/api/java/beta/vaults/credentials/delete.md b/content/en/api/java/beta/vaults/credentials/delete.md new file mode 100644 index 000000000..ecea986a3 --- /dev/null +++ b/content/en/api/java/beta/vaults/credentials/delete.md @@ -0,0 +1,100 @@ +## Delete + +`BetaManagedAgentsDeletedCredential beta().vaults().credentials().delete(CredentialDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**delete** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Delete Credential + +### Parameters + +- `CredentialDeleteParams params` + + - `String vaultId` + + - `Optional credentialId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsDeletedCredential:` + + Confirmation of a deleted credential. + + - `String id` + + Unique identifier of the deleted credential. + + - `Type type` + + - `VAULT_CREDENTIAL_DELETED("vault_credential_deleted")` + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.vaults.credentials.BetaManagedAgentsDeletedCredential; +import com.anthropic.models.beta.vaults.credentials.CredentialDeleteParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + CredentialDeleteParams params = CredentialDeleteParams.builder() + .vaultId("vlt_011CZkZDLs7fYzm1hXNPeRjv") + .credentialId("vcrd_011CZkZEMt8gZan2iYOQfSkw") + .build(); + BetaManagedAgentsDeletedCredential betaManagedAgentsDeletedCredential = client.beta().vaults().credentials().delete(params); + } +} +``` diff --git a/content/en/api/java/beta/vaults/credentials/list.md b/content/en/api/java/beta/vaults/credentials/list.md new file mode 100644 index 000000000..9f0909ccd --- /dev/null +++ b/content/en/api/java/beta/vaults/credentials/list.md @@ -0,0 +1,210 @@ +## List + +`CredentialListPage beta().vaults().credentials().list(CredentialListParamsparams = CredentialListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/vaults/{vault_id}/credentials` + +List Credentials + +### Parameters + +- `CredentialListParams params` + + - `Optional vaultId` + + - `Optional includeArchived` + + Whether to include archived credentials in the results. + + - `Optional limit` + + Maximum number of credentials to return per page. Defaults to 20, maximum 100. + + - `Optional page` + + Opaque pagination token from a previous `list_credentials` response. + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `String id` + + Unique identifier for the credential. + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `Auth auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `MCP_OAUTH("mcp_oauth")` + + - `Optional expiresAt` + + A timestamp in RFC 3339 format + + - `Optional refresh` + + OAuth refresh token configuration returned in credential responses. + + - `String clientId` + + OAuth client ID. + + - `String tokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth tokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `Type type` + + - `NONE("none")` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional resource` + + OAuth resource indicator. + + - `Optional scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `STATIC_BEARER("static_bearer")` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `Metadata metadata` + + Arbitrary key-value metadata attached to the credential. + + - `Type type` + + - `VAULT_CREDENTIAL("vault_credential")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String vaultId` + + Identifier of the vault this credential belongs to. + + - `Optional displayName` + + Human-readable name for the credential. + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.vaults.credentials.CredentialListPage; +import com.anthropic.models.beta.vaults.credentials.CredentialListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + CredentialListPage page = client.beta().vaults().credentials().list("vlt_011CZkZDLs7fYzm1hXNPeRjv"); + } +} +``` diff --git a/content/en/api/java/beta/vaults/credentials/retrieve.md b/content/en/api/java/beta/vaults/credentials/retrieve.md new file mode 100644 index 000000000..8616181eb --- /dev/null +++ b/content/en/api/java/beta/vaults/credentials/retrieve.md @@ -0,0 +1,204 @@ +## Retrieve + +`BetaManagedAgentsCredential beta().vaults().credentials().retrieve(CredentialRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Get Credential + +### Parameters + +- `CredentialRetrieveParams params` + + - `String vaultId` + + - `Optional credentialId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `String id` + + Unique identifier for the credential. + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `Auth auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `MCP_OAUTH("mcp_oauth")` + + - `Optional expiresAt` + + A timestamp in RFC 3339 format + + - `Optional refresh` + + OAuth refresh token configuration returned in credential responses. + + - `String clientId` + + OAuth client ID. + + - `String tokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth tokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `Type type` + + - `NONE("none")` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional resource` + + OAuth resource indicator. + + - `Optional scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `STATIC_BEARER("static_bearer")` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `Metadata metadata` + + Arbitrary key-value metadata attached to the credential. + + - `Type type` + + - `VAULT_CREDENTIAL("vault_credential")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String vaultId` + + Identifier of the vault this credential belongs to. + + - `Optional displayName` + + Human-readable name for the credential. + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.vaults.credentials.BetaManagedAgentsCredential; +import com.anthropic.models.beta.vaults.credentials.CredentialRetrieveParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + CredentialRetrieveParams params = CredentialRetrieveParams.builder() + .vaultId("vlt_011CZkZDLs7fYzm1hXNPeRjv") + .credentialId("vcrd_011CZkZEMt8gZan2iYOQfSkw") + .build(); + BetaManagedAgentsCredential betaManagedAgentsCredential = client.beta().vaults().credentials().retrieve(params); + } +} +``` diff --git a/content/en/api/java/beta/vaults/credentials/update.md b/content/en/api/java/beta/vaults/credentials/update.md new file mode 100644 index 000000000..997ef7b16 --- /dev/null +++ b/content/en/api/java/beta/vaults/credentials/update.md @@ -0,0 +1,284 @@ +## Update + +`BetaManagedAgentsCredential beta().vaults().credentials().update(CredentialUpdateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Update Credential + +### Parameters + +- `CredentialUpdateParams params` + + - `String vaultId` + + - `Optional credentialId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + + - `Optional auth` + + Updated authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthUpdateParams:` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `Type type` + + - `MCP_OAUTH("mcp_oauth")` + + - `Optional accessToken` + + Updated OAuth access token. + + - `Optional expiresAt` + + A timestamp in RFC 3339 format + + - `Optional refresh` + + Parameters for updating OAuth refresh token configuration. + + - `Optional refreshToken` + + Updated OAuth refresh token. + + - `Optional scope` + + Updated OAuth scope for the refresh request. + + - `Optional tokenEndpointAuth` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam:` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `Optional clientSecret` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam:` + + Updated POST body authentication parameters for the token endpoint. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional clientSecret` + + Updated OAuth client secret. + + - `class BetaManagedAgentsStaticBearerUpdateParams:` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `Type type` + + - `STATIC_BEARER("static_bearer")` + + - `Optional token` + + Updated static bearer token value. + + - `Optional displayName` + + Updated human-readable name for the credential. 1-255 characters. + + - `Optional metadata` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + +### Returns + +- `class BetaManagedAgentsCredential:` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `String id` + + Unique identifier for the credential. + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `Auth auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMcpOAuthAuthResponse:` + + OAuth credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `MCP_OAUTH("mcp_oauth")` + + - `Optional expiresAt` + + A timestamp in RFC 3339 format + + - `Optional refresh` + + OAuth refresh token configuration returned in credential responses. + + - `String clientId` + + OAuth client ID. + + - `String tokenEndpoint` + + Token endpoint URL used to refresh the access token. + + - `TokenEndpointAuth tokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:` + + Token endpoint requires no client authentication. + + - `Type type` + + - `NONE("none")` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_BASIC("client_secret_basic")` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse:` + + Token endpoint uses POST body authentication with client credentials. + + - `Type type` + + - `CLIENT_SECRET_POST("client_secret_post")` + + - `Optional resource` + + OAuth resource indicator. + + - `Optional scope` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse:` + + Static bearer token credential details for an MCP server. + + - `String mcpServerUrl` + + URL of the MCP server this credential authenticates against. + + - `Type type` + + - `STATIC_BEARER("static_bearer")` + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `Metadata metadata` + + Arbitrary key-value metadata attached to the credential. + + - `Type type` + + - `VAULT_CREDENTIAL("vault_credential")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + + - `String vaultId` + + Identifier of the vault this credential belongs to. + + - `Optional displayName` + + Human-readable name for the credential. + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.vaults.credentials.BetaManagedAgentsCredential; +import com.anthropic.models.beta.vaults.credentials.CredentialUpdateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + CredentialUpdateParams params = CredentialUpdateParams.builder() + .vaultId("vlt_011CZkZDLs7fYzm1hXNPeRjv") + .credentialId("vcrd_011CZkZEMt8gZan2iYOQfSkw") + .build(); + BetaManagedAgentsCredential betaManagedAgentsCredential = client.beta().vaults().credentials().update(params); + } +} +``` diff --git a/content/en/api/java/beta/vaults/delete.md b/content/en/api/java/beta/vaults/delete.md new file mode 100644 index 000000000..e5ff3bfad --- /dev/null +++ b/content/en/api/java/beta/vaults/delete.md @@ -0,0 +1,94 @@ +## Delete + +`BetaManagedAgentsDeletedVault beta().vaults().delete(VaultDeleteParamsparams = VaultDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**delete** `/v1/vaults/{vault_id}` + +Delete Vault + +### Parameters + +- `VaultDeleteParams params` + + - `Optional vaultId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsDeletedVault:` + + Confirmation of a deleted vault. + + - `String id` + + Unique identifier of the deleted vault. + + - `Type type` + + - `VAULT_DELETED("vault_deleted")` + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.vaults.BetaManagedAgentsDeletedVault; +import com.anthropic.models.beta.vaults.VaultDeleteParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BetaManagedAgentsDeletedVault betaManagedAgentsDeletedVault = client.beta().vaults().delete("vlt_011CZkZDLs7fYzm1hXNPeRjv"); + } +} +``` diff --git a/content/en/api/java/beta/vaults/list.md b/content/en/api/java/beta/vaults/list.md new file mode 100644 index 000000000..258392f56 --- /dev/null +++ b/content/en/api/java/beta/vaults/list.md @@ -0,0 +1,124 @@ +## List + +`VaultListPage beta().vaults().list(VaultListParamsparams = VaultListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/vaults` + +List Vaults + +### Parameters + +- `VaultListParams params` + + - `Optional includeArchived` + + Whether to include archived vaults in the results. + + - `Optional limit` + + Maximum number of vaults to return per page. Defaults to 20, maximum 100. + + - `Optional page` + + Opaque pagination token from a previous `list_vaults` response. + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsVault:` + + A vault that stores credentials for use by agents during sessions. + + - `String id` + + Unique identifier for the vault. + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String displayName` + + Human-readable name for the vault. + + - `Metadata metadata` + + Arbitrary key-value metadata attached to the vault. + + - `Type type` + + - `VAULT("vault")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.vaults.VaultListPage; +import com.anthropic.models.beta.vaults.VaultListParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + VaultListPage page = client.beta().vaults().list(); + } +} +``` diff --git a/content/en/api/java/beta/vaults/retrieve.md b/content/en/api/java/beta/vaults/retrieve.md new file mode 100644 index 000000000..2214541dc --- /dev/null +++ b/content/en/api/java/beta/vaults/retrieve.md @@ -0,0 +1,114 @@ +## Retrieve + +`BetaManagedAgentsVault beta().vaults().retrieve(VaultRetrieveParamsparams = VaultRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**get** `/v1/vaults/{vault_id}` + +Get Vault + +### Parameters + +- `VaultRetrieveParams params` + + - `Optional vaultId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + +### Returns + +- `class BetaManagedAgentsVault:` + + A vault that stores credentials for use by agents during sessions. + + - `String id` + + Unique identifier for the vault. + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String displayName` + + Human-readable name for the vault. + + - `Metadata metadata` + + Arbitrary key-value metadata attached to the vault. + + - `Type type` + + - `VAULT("vault")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.vaults.BetaManagedAgentsVault; +import com.anthropic.models.beta.vaults.VaultRetrieveParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BetaManagedAgentsVault betaManagedAgentsVault = client.beta().vaults().retrieve("vlt_011CZkZDLs7fYzm1hXNPeRjv"); + } +} +``` diff --git a/content/en/api/java/beta/vaults/update.md b/content/en/api/java/beta/vaults/update.md new file mode 100644 index 000000000..ccaea68bf --- /dev/null +++ b/content/en/api/java/beta/vaults/update.md @@ -0,0 +1,122 @@ +## Update + +`BetaManagedAgentsVault beta().vaults().update(VaultUpdateParamsparams = VaultUpdateParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + +**post** `/v1/vaults/{vault_id}` + +Update Vault + +### Parameters + +- `VaultUpdateParams params` + + - `Optional vaultId` + + - `Optional> betas` + + Optional header to specify the beta version(s) you want to use. + + - `MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")` + + - `PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")` + + - `COMPUTER_USE_2024_10_22("computer-use-2024-10-22")` + + - `COMPUTER_USE_2025_01_24("computer-use-2025-01-24")` + + - `PDFS_2024_09_25("pdfs-2024-09-25")` + + - `TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")` + + - `TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")` + + - `OUTPUT_128K_2025_02_19("output-128k-2025-02-19")` + + - `FILES_API_2025_04_14("files-api-2025-04-14")` + + - `MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")` + + - `MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")` + + - `DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")` + + - `INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")` + + - `CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")` + + - `EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")` + + - `CONTEXT_1M_2025_08_07("context-1m-2025-08-07")` + + - `CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")` + + - `MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")` + + - `SKILLS_2025_10_02("skills-2025-10-02")` + + - `FAST_MODE_2026_02_01("fast-mode-2026-02-01")` + + - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` + + - `Optional displayName` + + Updated human-readable name for the vault. 1-255 characters. + + - `Optional metadata` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + +### Returns + +- `class BetaManagedAgentsVault:` + + A vault that stores credentials for use by agents during sessions. + + - `String id` + + Unique identifier for the vault. + + - `Optional archivedAt` + + A timestamp in RFC 3339 format + + - `LocalDateTime createdAt` + + A timestamp in RFC 3339 format + + - `String displayName` + + Human-readable name for the vault. + + - `Metadata metadata` + + Arbitrary key-value metadata attached to the vault. + + - `Type type` + + - `VAULT("vault")` + + - `LocalDateTime updatedAt` + + A timestamp in RFC 3339 format + +### Example + +```java +package com.anthropic.example; + +import com.anthropic.client.AnthropicClient; +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.vaults.BetaManagedAgentsVault; +import com.anthropic.models.beta.vaults.VaultUpdateParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BetaManagedAgentsVault betaManagedAgentsVault = client.beta().vaults().update("vlt_011CZkZDLs7fYzm1hXNPeRjv"); + } +} +``` diff --git a/content/en/api/java/completions.md b/content/en/api/java/completions.md index 913221e75..1ae75e2d7 100644 --- a/content/en/api/java/completions.md +++ b/content/en/api/java/completions.md @@ -62,8 +62,6 @@ Future models and features will not be compatible with Text Completions. See our - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - - `long maxTokensToSample` The maximum number of tokens to generate before stopping. @@ -152,9 +150,13 @@ Future models and features will not be compatible with Text Completions. See our See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` @@ -248,7 +250,7 @@ public final class Main { CompletionCreateParams params = CompletionCreateParams.builder() .maxTokensToSample(256L) - .model(Model.CLAUDE_OPUS_4_6) + .model(Model.CLAUDE_MYTHOS_PREVIEW) .prompt("\n\nHuman: Hello, world!\n\nAssistant:") .build(); Completion completion = client.completions().create(params); @@ -278,9 +280,13 @@ public final class Main { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` diff --git a/content/en/api/java/completions/create.md b/content/en/api/java/completions/create.md index b49aebd23..7b1b109e7 100644 --- a/content/en/api/java/completions/create.md +++ b/content/en/api/java/completions/create.md @@ -60,8 +60,6 @@ Future models and features will not be compatible with Text Completions. See our - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - - `long maxTokensToSample` The maximum number of tokens to generate before stopping. @@ -150,9 +148,13 @@ Future models and features will not be compatible with Text Completions. See our See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` @@ -246,7 +248,7 @@ public final class Main { CompletionCreateParams params = CompletionCreateParams.builder() .maxTokensToSample(256L) - .model(Model.CLAUDE_OPUS_4_6) + .model(Model.CLAUDE_MYTHOS_PREVIEW) .prompt("\n\nHuman: Hello, world!\n\nAssistant:") .build(); Completion completion = client.completions().create(params); diff --git a/content/en/api/java/messages.md b/content/en/api/java/messages.md index 1408ca041..01076eb40 100644 --- a/content/en/api/java/messages.md +++ b/content/en/api/java/messages.md @@ -4315,9 +4315,13 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` @@ -13805,9 +13809,13 @@ public final class Main { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` @@ -19133,9 +19141,13 @@ public final class Main { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` @@ -20061,9 +20073,13 @@ public final class Main { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` @@ -29150,9 +29166,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` @@ -31985,9 +32005,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` @@ -33255,9 +33279,13 @@ public final class Main { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` @@ -34311,9 +34339,13 @@ public final class Main { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` @@ -35329,9 +35361,13 @@ public final class Main { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` diff --git a/content/en/api/java/messages/batches.md b/content/en/api/java/messages/batches.md index 7515cc09c..759a28deb 100644 --- a/content/en/api/java/messages/batches.md +++ b/content/en/api/java/messages/batches.md @@ -2323,9 +2323,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` @@ -5158,9 +5162,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` @@ -6428,9 +6436,13 @@ public final class Main { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` @@ -7484,9 +7496,13 @@ public final class Main { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` @@ -8502,9 +8518,13 @@ public final class Main { See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` diff --git a/content/en/api/java/messages/batches/create.md b/content/en/api/java/messages/batches/create.md index 0acabe70e..ba898e552 100644 --- a/content/en/api/java/messages/batches/create.md +++ b/content/en/api/java/messages/batches/create.md @@ -2321,9 +2321,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` diff --git a/content/en/api/java/messages/batches/results.md b/content/en/api/java/messages/batches/results.md index 2da46ca61..e74be47e1 100644 --- a/content/en/api/java/messages/batches/results.md +++ b/content/en/api/java/messages/batches/results.md @@ -749,9 +749,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` diff --git a/content/en/api/java/messages/create.md b/content/en/api/java/messages/create.md index a6516ff83..ded5e360e 100644 --- a/content/en/api/java/messages/create.md +++ b/content/en/api/java/messages/create.md @@ -4313,9 +4313,13 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")` + + New class of intelligence, strongest in coding and cybersecurity + - `CLAUDE_OPUS_4_6("claude-opus-4-6")` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `CLAUDE_SONNET_4_6("claude-sonnet-4-6")` diff --git a/content/en/api/java/models.md b/content/en/api/java/models.md index 6c5304e02..5ebc1ac0a 100644 --- a/content/en/api/java/models.md +++ b/content/en/api/java/models.md @@ -74,8 +74,6 @@ The Models API response can be used to determine which models are available for - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class ModelInfo:` @@ -345,8 +343,6 @@ The Models API response can be used to determine information about a specific mo - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class ModelInfo:` diff --git a/content/en/api/java/models/list.md b/content/en/api/java/models/list.md index 60c07fc8c..7d22c21ef 100644 --- a/content/en/api/java/models/list.md +++ b/content/en/api/java/models/list.md @@ -72,8 +72,6 @@ The Models API response can be used to determine which models are available for - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class ModelInfo:` diff --git a/content/en/api/java/models/retrieve.md b/content/en/api/java/models/retrieve.md index 19cfb7e03..4ffb5b7b5 100644 --- a/content/en/api/java/models/retrieve.md +++ b/content/en/api/java/models/retrieve.md @@ -62,8 +62,6 @@ The Models API response can be used to determine information about a specific mo - `OUTPUT_300K_2026_03_24("output-300k-2026-03-24")` - - `USER_PROFILES_2026_03_24("user-profiles-2026-03-24")` - ### Returns - `class ModelInfo:` diff --git a/content/en/api/messages.md b/content/en/api/messages.md index c26e42149..cefeab18e 100644 --- a/content/en/api/messages.md +++ b/content/en/api/messages.md @@ -2303,15 +2303,19 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -4530,15 +4534,19 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -7052,15 +7060,19 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -8522,7 +8534,7 @@ curl https://api.anthropic.com/v1/messages/count_tokens \ "role": "user" } ], - "model": "claude-opus-4-6" + "model": "claude-mythos-preview" }' ``` @@ -14216,15 +14228,19 @@ curl https://api.anthropic.com/v1/messages/count_tokens \ See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -17747,21 +17763,25 @@ curl https://api.anthropic.com/v1/messages/count_tokens \ ### Model -- `Model = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more or string` +- `Model = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more or string` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -19628,15 +19648,19 @@ curl https://api.anthropic.com/v1/messages/count_tokens \ See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -20564,15 +20588,19 @@ curl https://api.anthropic.com/v1/messages/count_tokens \ See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -29657,15 +29685,19 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -32436,15 +32468,19 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -33700,15 +33736,19 @@ curl https://api.anthropic.com/v1/messages/batches/$MESSAGE_BATCH_ID/results \ See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -34764,15 +34804,19 @@ curl https://api.anthropic.com/v1/messages/batches/$MESSAGE_BATCH_ID/results \ See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -35790,15 +35834,19 @@ curl https://api.anthropic.com/v1/messages/batches/$MESSAGE_BATCH_ID/results \ See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` diff --git a/content/en/api/messages/batches.md b/content/en/api/messages/batches.md index 80b31374b..74c3aabeb 100644 --- a/content/en/api/messages/batches.md +++ b/content/en/api/messages/batches.md @@ -2319,15 +2319,19 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -5098,15 +5102,19 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -6362,15 +6370,19 @@ curl https://api.anthropic.com/v1/messages/batches/$MESSAGE_BATCH_ID/results \ See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -7426,15 +7438,19 @@ curl https://api.anthropic.com/v1/messages/batches/$MESSAGE_BATCH_ID/results \ See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -8452,15 +8468,19 @@ curl https://api.anthropic.com/v1/messages/batches/$MESSAGE_BATCH_ID/results \ See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` diff --git a/content/en/api/messages/batches/create.md b/content/en/api/messages/batches/create.md index 922740e31..fa9394d8f 100644 --- a/content/en/api/messages/batches/create.md +++ b/content/en/api/messages/batches/create.md @@ -2317,15 +2317,19 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` diff --git a/content/en/api/messages/batches/results.md b/content/en/api/messages/batches/results.md index dfa847144..34625b23a 100644 --- a/content/en/api/messages/batches/results.md +++ b/content/en/api/messages/batches/results.md @@ -745,15 +745,19 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` diff --git a/content/en/api/messages/count_tokens.md b/content/en/api/messages/count_tokens.md index c0a233fd2..6af97ef62 100644 --- a/content/en/api/messages/count_tokens.md +++ b/content/en/api/messages/count_tokens.md @@ -2293,15 +2293,19 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -3763,6 +3767,6 @@ curl https://api.anthropic.com/v1/messages/count_tokens \ "role": "user" } ], - "model": "claude-opus-4-6" + "model": "claude-mythos-preview" }' ``` diff --git a/content/en/api/messages/create.md b/content/en/api/messages/create.md index 1dcad7039..42d4f2b41 100644 --- a/content/en/api/messages/create.md +++ b/content/en/api/messages/create.md @@ -2301,15 +2301,19 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -4528,15 +4532,19 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `UnionMember0 = "claude-opus-4-6" or "claude-sonnet-4-6" or "claude-haiku-4-5" or 12 more` + - `UnionMember0 = "claude-mythos-preview" or "claude-opus-4-6" or "claude-sonnet-4-6" or 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` diff --git a/content/en/api/models.md b/content/en/api/models.md index a5459f9fe..1c0cc11b2 100644 --- a/content/en/api/models.md +++ b/content/en/api/models.md @@ -32,7 +32,7 @@ The Models API response can be used to determine which models are available for - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -76,8 +76,6 @@ The Models API response can be used to determine which models are available for - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `data: array of ModelInfo` @@ -304,7 +302,7 @@ The Models API response can be used to determine information about a specific mo - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -348,8 +346,6 @@ The Models API response can be used to determine information about a specific mo - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `ModelInfo = object { id, capabilities, created_at, 4 more }` diff --git a/content/en/api/models/list.md b/content/en/api/models/list.md index def238a7b..413a21e75 100644 --- a/content/en/api/models/list.md +++ b/content/en/api/models/list.md @@ -30,7 +30,7 @@ The Models API response can be used to determine which models are available for - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -74,8 +74,6 @@ The Models API response can be used to determine which models are available for - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `data: array of ModelInfo` diff --git a/content/en/api/models/retrieve.md b/content/en/api/models/retrieve.md index f1f9ec547..de0c82227 100644 --- a/content/en/api/models/retrieve.md +++ b/content/en/api/models/retrieve.md @@ -20,7 +20,7 @@ The Models API response can be used to determine information about a specific mo - `UnionMember0 = string` - - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 19 more` + - `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 18 more` - `"message-batches-2024-09-24"` @@ -64,8 +64,6 @@ The Models API response can be used to determine information about a specific mo - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `ModelInfo = object { id, capabilities, created_at, 4 more }` diff --git a/content/en/api/overview.md b/content/en/api/overview.md index 9b3e66d98..b261e4bd9 100644 --- a/content/en/api/overview.md +++ b/content/en/api/overview.md @@ -2,17 +2,17 @@ --- -The Claude API is a RESTful API at `https://api.anthropic.com` that provides programmatic access to Claude models. The primary API is the Messages API (`POST /v1/messages`) for conversational interactions. +The Claude API is a RESTful API at `https://api.anthropic.com` that provides programmatic access to Claude models and Claude Managed Agents. -**New to Claude?** Start with [Get started](/docs/en/get-started) for prerequisites and your first API call, or see [Working with Messages](/docs/en/build-with-claude/working-with-messages) for request/response patterns and examples. +**New to Claude?** For direct model access, start with [Get started](/docs/en/get-started) and [Working with Messages](/docs/en/build-with-claude/working-with-messages). For managed agent infrastructure, see the [Claude Managed Agents quickstart](/docs/en/managed-agents/quickstart). ## Prerequisites To use the Claude API, you'll need: -- An [Anthropic Console account](https://platform.claude.com) +- A [Claude Console account](https://platform.claude.com) - An [API key](/settings/keys) For step-by-step setup instructions, see [Get started](/docs/en/get-started). @@ -22,7 +22,7 @@ For step-by-step setup instructions, see [Get started](/docs/en/get-started). The Claude API includes the following APIs: **General Availability:** -- **[Messages API](/docs/en/api/messages)**: Send messages to Claude for conversational interactions (`POST /v1/messages`) +- **[Messages API](/docs/en/api/messages/create)**: Send messages to Claude for conversational interactions (`POST /v1/messages`) - **[Message Batches API](/docs/en/api/creating-message-batches)**: Process large volumes of Messages requests asynchronously with 50% cost reduction (`POST /v1/messages/batches`) - **[Token Counting API](/docs/en/api/messages-count-tokens)**: Count tokens in a message before sending to manage costs and rate limits (`POST /v1/messages/count_tokens`) - **[Models API](/docs/en/api/models-list)**: List available Claude models and their details (`GET /v1/models`) @@ -30,11 +30,12 @@ The Claude API includes the following APIs: **Beta:** - **[Files API](/docs/en/api/files-create)**: Upload and manage files for use across multiple API calls (`POST /v1/files`, `GET /v1/files`) - **[Skills API](/docs/en/api/skills/create-skill)**: Create and manage custom agent skills (`POST /v1/skills`, `GET /v1/skills`) +- **[Agents API](/docs/en/api/beta/agents/create)**: Define reusable, versioned agent configurations for Claude Managed Agents (`POST /v1/agents`, `GET /v1/agents`) +- **[Sessions API](/docs/en/api/beta/sessions/create)**: Run stateful agent sessions in managed cloud containers (`POST /v1/sessions`, `GET /v1/sessions/{id}/stream`) +- **[Environments API](/docs/en/api/beta/environments/create)**: Configure container templates for agent sessions (`POST /v1/environments`, `GET /v1/environments`) For the complete API reference with all endpoints, parameters, and response schemas, explore the API reference pages listed in the navigation. To access beta features, see [Beta headers](/docs/en/api/beta-headers). -The Messages API supports an optional `inference_geo` parameter for [data residency controls](/docs/en/build-with-claude/data-residency), allowing you to specify where model inference runs. - ## Authentication All requests to the Claude API must include these headers: @@ -62,23 +63,11 @@ Anthropic provides official SDKs that simplify API integration by handling authe - Streaming support - Request timeouts and connection management -**Example** (Python): -```python -from anthropic import Anthropic - -client = Anthropic() # Reads ANTHROPIC_API_KEY from environment -message = client.messages.create( - model="claude-opus-4-6", - max_tokens=1024, - messages=[{"role": "user", "content": "Hello, Claude"}], -) -``` - For a list of client SDKs and their respective installation instructions, see [Client SDKs](/docs/en/api/client-sdks). -## Claude API vs Third-Party Platforms +## Availability on partner platforms -Claude is available through Anthropic's direct API and through partner platforms. Choose based on your infrastructure, compliance requirements, and pricing preferences. +Claude is available through the direct Claude API and through partner platforms. Choose based on your infrastructure, compliance requirements, and pricing preferences. ### Claude API @@ -100,20 +89,19 @@ Access Claude through AWS, Google Cloud, or Microsoft Azure: | Azure AI | Microsoft Azure | [Claude on Azure AI](/docs/en/build-with-claude/claude-in-microsoft-foundry) | -For feature availability across platforms, see the [Features overview](/docs/en/build-with-claude/overview). +Claude Managed Agents is available only through the direct Claude API. For feature availability across platforms, see the [Features overview](/docs/en/build-with-claude/overview). ## Request and Response Format -### Request Size Limits - -The API has different maximum request sizes depending on the endpoint: +### Request size limits -| Endpoint | Maximum Size | -|----------|--------------| -| Standard endpoints (Messages, Token Counting) | 32 MB | +| Endpoint | Maximum request size | +| --- | --- | +| Messages, Token Counting | 32 MB | | [Batch API](/docs/en/build-with-claude/batch-processing) | 256 MB | | [Files API](/docs/en/build-with-claude/files) | 500 MB | +| Sessions, Agents, Environments | 32 MB | If you exceed these limits, you'll receive a 413 `request_too_large` error. @@ -145,66 +133,19 @@ For detailed information about limits, tiers, and the token bucket algorithm use The Claude API is available in [many countries and regions](/docs/en/api/supported-regions) worldwide. Check the supported regions page to confirm availability in your location. -## Basic Example - -Here's a minimal request using the Messages API: - -```bash -curl https://api.anthropic.com/v1/messages \ - --header "x-api-key: $ANTHROPIC_API_KEY" \ - --header "anthropic-version: 2023-06-01" \ - --header "content-type: application/json" \ - --data '{ - "model": "claude-opus-4-6", - "max_tokens": 1024, - "messages": [ - {"role": "user", "content": "Hello, Claude"} - ] - }' -``` - -**Response:** -```json -{ - "id": "msg_01XFDUDYJgAACzvnptvVoYEL", - "type": "message", - "role": "assistant", - "content": [ - { - "type": "text", - "text": "Hello! How can I assist you today?" - } - ], - "model": "claude-opus-4-6", - "stop_reason": "end_turn", - "usage": { - "input_tokens": 12, - "output_tokens": 8 - } -} -``` - -For complete examples and tutorials, see [Get started](/docs/en/get-started) and [Working with Messages](/docs/en/build-with-claude/working-with-messages). - ## Next Steps - - - Prerequisites, step-by-step tutorial, and examples in multiple languages - - - Request/response patterns, multi-turn conversations, and best practices + + + Complete API specification for direct model interactions - - Complete API specification: parameters, responses, and error codes + + Agents, Sessions, and Environments endpoints - Installation guides for Python, TypeScript, Java, Go, C#, Ruby, and PHP - - - Explore capabilities: caching, vision, tool use, streaming, and more + Python, TypeScript, Java, Go, C#, Ruby, and PHP - Usage tiers, spend limits, and rate limiting with token bucket algorithm + Usage tiers, spend limits, and token bucket algorithm \ No newline at end of file diff --git a/content/en/api/php/beta.md b/content/en/api/php/beta.md index 0f1c2f42e..aff7c74a4 100644 --- a/content/en/api/php/beta.md +++ b/content/en/api/php/beta.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                      \ No newline at end of file +Not Found - Claude API Docs
                                                                                                        \ No newline at end of file diff --git a/content/en/api/php/beta/agents.md b/content/en/api/php/beta/agents.md new file mode 100644 index 000000000..1672a5717 --- /dev/null +++ b/content/en/api/php/beta/agents.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                          \ No newline at end of file diff --git a/content/en/api/php/beta/agents/archive.md b/content/en/api/php/beta/agents/archive.md new file mode 100644 index 000000000..936d4b83e --- /dev/null +++ b/content/en/api/php/beta/agents/archive.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                            \ No newline at end of file diff --git a/content/en/api/php/beta/agents/create.md b/content/en/api/php/beta/agents/create.md new file mode 100644 index 000000000..450cc1262 --- /dev/null +++ b/content/en/api/php/beta/agents/create.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                              \ No newline at end of file diff --git a/content/en/api/php/beta/agents/list.md b/content/en/api/php/beta/agents/list.md new file mode 100644 index 000000000..15a542090 --- /dev/null +++ b/content/en/api/php/beta/agents/list.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                \ No newline at end of file diff --git a/content/en/api/php/beta/agents/retrieve.md b/content/en/api/php/beta/agents/retrieve.md new file mode 100644 index 000000000..2203efbec --- /dev/null +++ b/content/en/api/php/beta/agents/retrieve.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                  \ No newline at end of file diff --git a/content/en/api/php/beta/agents/update.md b/content/en/api/php/beta/agents/update.md new file mode 100644 index 000000000..2c051ed52 --- /dev/null +++ b/content/en/api/php/beta/agents/update.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                    \ No newline at end of file diff --git a/content/en/api/php/beta/agents/versions.md b/content/en/api/php/beta/agents/versions.md new file mode 100644 index 000000000..dbb594584 --- /dev/null +++ b/content/en/api/php/beta/agents/versions.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                      \ No newline at end of file diff --git a/content/en/api/php/beta/agents/versions/list.md b/content/en/api/php/beta/agents/versions/list.md new file mode 100644 index 000000000..5bd5d8a58 --- /dev/null +++ b/content/en/api/php/beta/agents/versions/list.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                        \ No newline at end of file diff --git a/content/en/api/php/beta/environments.md b/content/en/api/php/beta/environments.md new file mode 100644 index 000000000..cd987dc3f --- /dev/null +++ b/content/en/api/php/beta/environments.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                          \ No newline at end of file diff --git a/content/en/api/php/beta/environments/archive.md b/content/en/api/php/beta/environments/archive.md new file mode 100644 index 000000000..de1c48d40 --- /dev/null +++ b/content/en/api/php/beta/environments/archive.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                            \ No newline at end of file diff --git a/content/en/api/php/beta/environments/create.md b/content/en/api/php/beta/environments/create.md new file mode 100644 index 000000000..889dda0b3 --- /dev/null +++ b/content/en/api/php/beta/environments/create.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                              \ No newline at end of file diff --git a/content/en/api/php/beta/environments/delete.md b/content/en/api/php/beta/environments/delete.md new file mode 100644 index 000000000..dc31733ea --- /dev/null +++ b/content/en/api/php/beta/environments/delete.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                \ No newline at end of file diff --git a/content/en/api/php/beta/environments/list.md b/content/en/api/php/beta/environments/list.md new file mode 100644 index 000000000..e2f2803b6 --- /dev/null +++ b/content/en/api/php/beta/environments/list.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                  \ No newline at end of file diff --git a/content/en/api/php/beta/environments/retrieve.md b/content/en/api/php/beta/environments/retrieve.md new file mode 100644 index 000000000..db9388bc8 --- /dev/null +++ b/content/en/api/php/beta/environments/retrieve.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                    \ No newline at end of file diff --git a/content/en/api/php/beta/environments/update.md b/content/en/api/php/beta/environments/update.md new file mode 100644 index 000000000..91aa752b0 --- /dev/null +++ b/content/en/api/php/beta/environments/update.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                      \ No newline at end of file diff --git a/content/en/api/php/beta/files.md b/content/en/api/php/beta/files.md index 2ae6834ce..1abaafe51 100644 --- a/content/en/api/php/beta/files.md +++ b/content/en/api/php/beta/files.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                        \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                          \ No newline at end of file diff --git a/content/en/api/php/beta/files/delete.md b/content/en/api/php/beta/files/delete.md index 34b1c0cb0..2d5440ad7 100644 --- a/content/en/api/php/beta/files/delete.md +++ b/content/en/api/php/beta/files/delete.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                            \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                              \ No newline at end of file diff --git a/content/en/api/php/beta/files/download.md b/content/en/api/php/beta/files/download.md index c13194408..abb3ffed3 100644 --- a/content/en/api/php/beta/files/download.md +++ b/content/en/api/php/beta/files/download.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                  \ No newline at end of file diff --git a/content/en/api/php/beta/files/list.md b/content/en/api/php/beta/files/list.md index c80b52d30..ad1a0a392 100644 --- a/content/en/api/php/beta/files/list.md +++ b/content/en/api/php/beta/files/list.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                    \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                      \ No newline at end of file diff --git a/content/en/api/php/beta/files/retrieve_metadata.md b/content/en/api/php/beta/files/retrieve_metadata.md index 9b54ada1e..928bff4ff 100644 --- a/content/en/api/php/beta/files/retrieve_metadata.md +++ b/content/en/api/php/beta/files/retrieve_metadata.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                        \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                          \ No newline at end of file diff --git a/content/en/api/php/beta/files/upload.md b/content/en/api/php/beta/files/upload.md index 2d457caa3..b4e65a28f 100644 --- a/content/en/api/php/beta/files/upload.md +++ b/content/en/api/php/beta/files/upload.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                            \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                              \ No newline at end of file diff --git a/content/en/api/php/beta/messages.md b/content/en/api/php/beta/messages.md index 56603ebb9..86f105a09 100644 --- a/content/en/api/php/beta/messages.md +++ b/content/en/api/php/beta/messages.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                  \ No newline at end of file diff --git a/content/en/api/php/beta/messages/batches.md b/content/en/api/php/beta/messages/batches.md index 1bf2266b1..2cdfd0ae2 100644 --- a/content/en/api/php/beta/messages/batches.md +++ b/content/en/api/php/beta/messages/batches.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                    \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                      \ No newline at end of file diff --git a/content/en/api/php/beta/messages/batches/cancel.md b/content/en/api/php/beta/messages/batches/cancel.md index c5cf4e971..490522bb7 100644 --- a/content/en/api/php/beta/messages/batches/cancel.md +++ b/content/en/api/php/beta/messages/batches/cancel.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                        \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                          \ No newline at end of file diff --git a/content/en/api/php/beta/messages/batches/create.md b/content/en/api/php/beta/messages/batches/create.md index f8d00abfa..54876a347 100644 --- a/content/en/api/php/beta/messages/batches/create.md +++ b/content/en/api/php/beta/messages/batches/create.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                            \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                              \ No newline at end of file diff --git a/content/en/api/php/beta/messages/batches/delete.md b/content/en/api/php/beta/messages/batches/delete.md index bee3be146..3170d13cb 100644 --- a/content/en/api/php/beta/messages/batches/delete.md +++ b/content/en/api/php/beta/messages/batches/delete.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                  \ No newline at end of file diff --git a/content/en/api/php/beta/messages/batches/list.md b/content/en/api/php/beta/messages/batches/list.md index b8be02177..634b1c549 100644 --- a/content/en/api/php/beta/messages/batches/list.md +++ b/content/en/api/php/beta/messages/batches/list.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                    \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                      \ No newline at end of file diff --git a/content/en/api/php/beta/messages/batches/results.md b/content/en/api/php/beta/messages/batches/results.md index 4548aa51b..74973e985 100644 --- a/content/en/api/php/beta/messages/batches/results.md +++ b/content/en/api/php/beta/messages/batches/results.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                        \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                          \ No newline at end of file diff --git a/content/en/api/php/beta/messages/batches/retrieve.md b/content/en/api/php/beta/messages/batches/retrieve.md index b83863753..2933db778 100644 --- a/content/en/api/php/beta/messages/batches/retrieve.md +++ b/content/en/api/php/beta/messages/batches/retrieve.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                            \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                              \ No newline at end of file diff --git a/content/en/api/php/beta/messages/count_tokens.md b/content/en/api/php/beta/messages/count_tokens.md index 014585ad7..be12a26c6 100644 --- a/content/en/api/php/beta/messages/count_tokens.md +++ b/content/en/api/php/beta/messages/count_tokens.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                  \ No newline at end of file diff --git a/content/en/api/php/beta/messages/create.md b/content/en/api/php/beta/messages/create.md index 05b238043..f2c8ee300 100644 --- a/content/en/api/php/beta/messages/create.md +++ b/content/en/api/php/beta/messages/create.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                    \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                      \ No newline at end of file diff --git a/content/en/api/php/beta/models.md b/content/en/api/php/beta/models.md index 143f5b078..f738b973e 100644 --- a/content/en/api/php/beta/models.md +++ b/content/en/api/php/beta/models.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                        \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                          \ No newline at end of file diff --git a/content/en/api/php/beta/models/list.md b/content/en/api/php/beta/models/list.md index b47bb613c..7f1d1ba94 100644 --- a/content/en/api/php/beta/models/list.md +++ b/content/en/api/php/beta/models/list.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                            \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                              \ No newline at end of file diff --git a/content/en/api/php/beta/models/retrieve.md b/content/en/api/php/beta/models/retrieve.md index e376e4ad0..ad7787f8f 100644 --- a/content/en/api/php/beta/models/retrieve.md +++ b/content/en/api/php/beta/models/retrieve.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                  \ No newline at end of file diff --git a/content/en/api/php/beta/sessions.md b/content/en/api/php/beta/sessions.md new file mode 100644 index 000000000..d7641f3f1 --- /dev/null +++ b/content/en/api/php/beta/sessions.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                    \ No newline at end of file diff --git a/content/en/api/php/beta/sessions/archive.md b/content/en/api/php/beta/sessions/archive.md new file mode 100644 index 000000000..d1a91afd1 --- /dev/null +++ b/content/en/api/php/beta/sessions/archive.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                      \ No newline at end of file diff --git a/content/en/api/php/beta/sessions/create.md b/content/en/api/php/beta/sessions/create.md new file mode 100644 index 000000000..8ed590e33 --- /dev/null +++ b/content/en/api/php/beta/sessions/create.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                        \ No newline at end of file diff --git a/content/en/api/php/beta/sessions/delete.md b/content/en/api/php/beta/sessions/delete.md new file mode 100644 index 000000000..0f7e09e01 --- /dev/null +++ b/content/en/api/php/beta/sessions/delete.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                          \ No newline at end of file diff --git a/content/en/api/php/beta/sessions/events.md b/content/en/api/php/beta/sessions/events.md new file mode 100644 index 000000000..054f72e33 --- /dev/null +++ b/content/en/api/php/beta/sessions/events.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                            \ No newline at end of file diff --git a/content/en/api/php/beta/sessions/events/list.md b/content/en/api/php/beta/sessions/events/list.md new file mode 100644 index 000000000..001f9566b --- /dev/null +++ b/content/en/api/php/beta/sessions/events/list.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                              \ No newline at end of file diff --git a/content/en/api/php/beta/sessions/events/send.md b/content/en/api/php/beta/sessions/events/send.md new file mode 100644 index 000000000..525a94a0d --- /dev/null +++ b/content/en/api/php/beta/sessions/events/send.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                \ No newline at end of file diff --git a/content/en/api/php/beta/sessions/events/stream.md b/content/en/api/php/beta/sessions/events/stream.md new file mode 100644 index 000000000..f96c1af08 --- /dev/null +++ b/content/en/api/php/beta/sessions/events/stream.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                  \ No newline at end of file diff --git a/content/en/api/php/beta/sessions/list.md b/content/en/api/php/beta/sessions/list.md new file mode 100644 index 000000000..f15412693 --- /dev/null +++ b/content/en/api/php/beta/sessions/list.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                    \ No newline at end of file diff --git a/content/en/api/php/beta/sessions/resources.md b/content/en/api/php/beta/sessions/resources.md new file mode 100644 index 000000000..33d251adf --- /dev/null +++ b/content/en/api/php/beta/sessions/resources.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                      \ No newline at end of file diff --git a/content/en/api/php/beta/sessions/resources/add.md b/content/en/api/php/beta/sessions/resources/add.md new file mode 100644 index 000000000..e07a12e41 --- /dev/null +++ b/content/en/api/php/beta/sessions/resources/add.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                        \ No newline at end of file diff --git a/content/en/api/php/beta/sessions/resources/delete.md b/content/en/api/php/beta/sessions/resources/delete.md new file mode 100644 index 000000000..26bf15d1c --- /dev/null +++ b/content/en/api/php/beta/sessions/resources/delete.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                          \ No newline at end of file diff --git a/content/en/api/php/beta/sessions/resources/list.md b/content/en/api/php/beta/sessions/resources/list.md new file mode 100644 index 000000000..1c506169c --- /dev/null +++ b/content/en/api/php/beta/sessions/resources/list.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                            \ No newline at end of file diff --git a/content/en/api/php/beta/sessions/resources/retrieve.md b/content/en/api/php/beta/sessions/resources/retrieve.md new file mode 100644 index 000000000..401e8bb63 --- /dev/null +++ b/content/en/api/php/beta/sessions/resources/retrieve.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                              \ No newline at end of file diff --git a/content/en/api/php/beta/sessions/resources/update.md b/content/en/api/php/beta/sessions/resources/update.md new file mode 100644 index 000000000..eefa770ae --- /dev/null +++ b/content/en/api/php/beta/sessions/resources/update.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                \ No newline at end of file diff --git a/content/en/api/php/beta/sessions/retrieve.md b/content/en/api/php/beta/sessions/retrieve.md new file mode 100644 index 000000000..03a23483f --- /dev/null +++ b/content/en/api/php/beta/sessions/retrieve.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                  \ No newline at end of file diff --git a/content/en/api/php/beta/sessions/update.md b/content/en/api/php/beta/sessions/update.md new file mode 100644 index 000000000..24b9a4a75 --- /dev/null +++ b/content/en/api/php/beta/sessions/update.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                    \ No newline at end of file diff --git a/content/en/api/php/beta/skills.md b/content/en/api/php/beta/skills.md index b0f9e9ffb..684abd9d9 100644 --- a/content/en/api/php/beta/skills.md +++ b/content/en/api/php/beta/skills.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                      \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                        \ No newline at end of file diff --git a/content/en/api/php/beta/skills/create.md b/content/en/api/php/beta/skills/create.md index 67dbff7c4..b6a859d85 100644 --- a/content/en/api/php/beta/skills/create.md +++ b/content/en/api/php/beta/skills/create.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                          \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                            \ No newline at end of file diff --git a/content/en/api/php/beta/skills/delete.md b/content/en/api/php/beta/skills/delete.md index 8ae059d8e..42bba426e 100644 --- a/content/en/api/php/beta/skills/delete.md +++ b/content/en/api/php/beta/skills/delete.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                              \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                \ No newline at end of file diff --git a/content/en/api/php/beta/skills/list.md b/content/en/api/php/beta/skills/list.md index d957d3235..4f4d84407 100644 --- a/content/en/api/php/beta/skills/list.md +++ b/content/en/api/php/beta/skills/list.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                  \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                    \ No newline at end of file diff --git a/content/en/api/php/beta/skills/retrieve.md b/content/en/api/php/beta/skills/retrieve.md index 425270b9f..fb74c4338 100644 --- a/content/en/api/php/beta/skills/retrieve.md +++ b/content/en/api/php/beta/skills/retrieve.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                      \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                        \ No newline at end of file diff --git a/content/en/api/php/beta/skills/versions.md b/content/en/api/php/beta/skills/versions.md index 6b630222d..3ecb15084 100644 --- a/content/en/api/php/beta/skills/versions.md +++ b/content/en/api/php/beta/skills/versions.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                          \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                            \ No newline at end of file diff --git a/content/en/api/php/beta/skills/versions/create.md b/content/en/api/php/beta/skills/versions/create.md index 00a376067..6f9f2fe51 100644 --- a/content/en/api/php/beta/skills/versions/create.md +++ b/content/en/api/php/beta/skills/versions/create.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                              \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                \ No newline at end of file diff --git a/content/en/api/php/beta/skills/versions/delete.md b/content/en/api/php/beta/skills/versions/delete.md index 6c7790c29..267c3243d 100644 --- a/content/en/api/php/beta/skills/versions/delete.md +++ b/content/en/api/php/beta/skills/versions/delete.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                  \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                    \ No newline at end of file diff --git a/content/en/api/php/beta/skills/versions/list.md b/content/en/api/php/beta/skills/versions/list.md index f6cc11f82..a7c370f6b 100644 --- a/content/en/api/php/beta/skills/versions/list.md +++ b/content/en/api/php/beta/skills/versions/list.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                      \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                        \ No newline at end of file diff --git a/content/en/api/php/beta/skills/versions/retrieve.md b/content/en/api/php/beta/skills/versions/retrieve.md index a3b467db8..e51eadfb3 100644 --- a/content/en/api/php/beta/skills/versions/retrieve.md +++ b/content/en/api/php/beta/skills/versions/retrieve.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                          \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                            \ No newline at end of file diff --git a/content/en/api/php/beta/vaults.md b/content/en/api/php/beta/vaults.md new file mode 100644 index 000000000..a3ccc862d --- /dev/null +++ b/content/en/api/php/beta/vaults.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                              \ No newline at end of file diff --git a/content/en/api/php/beta/vaults/archive.md b/content/en/api/php/beta/vaults/archive.md new file mode 100644 index 000000000..c601f955f --- /dev/null +++ b/content/en/api/php/beta/vaults/archive.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                \ No newline at end of file diff --git a/content/en/api/php/beta/vaults/create.md b/content/en/api/php/beta/vaults/create.md new file mode 100644 index 000000000..f2c06f686 --- /dev/null +++ b/content/en/api/php/beta/vaults/create.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                  \ No newline at end of file diff --git a/content/en/api/php/beta/vaults/credentials.md b/content/en/api/php/beta/vaults/credentials.md new file mode 100644 index 000000000..7992b6bd5 --- /dev/null +++ b/content/en/api/php/beta/vaults/credentials.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                    \ No newline at end of file diff --git a/content/en/api/php/beta/vaults/credentials/archive.md b/content/en/api/php/beta/vaults/credentials/archive.md new file mode 100644 index 000000000..905794cc4 --- /dev/null +++ b/content/en/api/php/beta/vaults/credentials/archive.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                      \ No newline at end of file diff --git a/content/en/api/php/beta/vaults/credentials/create.md b/content/en/api/php/beta/vaults/credentials/create.md new file mode 100644 index 000000000..4525cdb9d --- /dev/null +++ b/content/en/api/php/beta/vaults/credentials/create.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                        \ No newline at end of file diff --git a/content/en/api/php/beta/vaults/credentials/delete.md b/content/en/api/php/beta/vaults/credentials/delete.md new file mode 100644 index 000000000..b4c7e37eb --- /dev/null +++ b/content/en/api/php/beta/vaults/credentials/delete.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                          \ No newline at end of file diff --git a/content/en/api/php/beta/vaults/credentials/list.md b/content/en/api/php/beta/vaults/credentials/list.md new file mode 100644 index 000000000..231948e5e --- /dev/null +++ b/content/en/api/php/beta/vaults/credentials/list.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                            \ No newline at end of file diff --git a/content/en/api/php/beta/vaults/credentials/retrieve.md b/content/en/api/php/beta/vaults/credentials/retrieve.md new file mode 100644 index 000000000..02f5d2b6e --- /dev/null +++ b/content/en/api/php/beta/vaults/credentials/retrieve.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                              \ No newline at end of file diff --git a/content/en/api/php/beta/vaults/credentials/update.md b/content/en/api/php/beta/vaults/credentials/update.md new file mode 100644 index 000000000..b57ed7771 --- /dev/null +++ b/content/en/api/php/beta/vaults/credentials/update.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                \ No newline at end of file diff --git a/content/en/api/php/beta/vaults/delete.md b/content/en/api/php/beta/vaults/delete.md new file mode 100644 index 000000000..01871f2a2 --- /dev/null +++ b/content/en/api/php/beta/vaults/delete.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                  \ No newline at end of file diff --git a/content/en/api/php/beta/vaults/list.md b/content/en/api/php/beta/vaults/list.md new file mode 100644 index 000000000..8f76c8cd1 --- /dev/null +++ b/content/en/api/php/beta/vaults/list.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                    \ No newline at end of file diff --git a/content/en/api/php/beta/vaults/retrieve.md b/content/en/api/php/beta/vaults/retrieve.md new file mode 100644 index 000000000..a7b78d555 --- /dev/null +++ b/content/en/api/php/beta/vaults/retrieve.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                      \ No newline at end of file diff --git a/content/en/api/php/beta/vaults/update.md b/content/en/api/php/beta/vaults/update.md new file mode 100644 index 000000000..bf28f46f2 --- /dev/null +++ b/content/en/api/php/beta/vaults/update.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                        \ No newline at end of file diff --git a/content/en/api/php/completions.md b/content/en/api/php/completions.md index 78e408a9a..c1a3f548f 100644 --- a/content/en/api/php/completions.md +++ b/content/en/api/php/completions.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                          \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                            \ No newline at end of file diff --git a/content/en/api/php/completions/create.md b/content/en/api/php/completions/create.md index e951b16a7..3d0623fdd 100644 --- a/content/en/api/php/completions/create.md +++ b/content/en/api/php/completions/create.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                              \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                \ No newline at end of file diff --git a/content/en/api/php/messages.md b/content/en/api/php/messages.md index 2dcf24595..774bb1e52 100644 --- a/content/en/api/php/messages.md +++ b/content/en/api/php/messages.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                  \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                    \ No newline at end of file diff --git a/content/en/api/php/messages/batches.md b/content/en/api/php/messages/batches.md index d70f6114e..cfa8ff7d0 100644 --- a/content/en/api/php/messages/batches.md +++ b/content/en/api/php/messages/batches.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                      \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                        \ No newline at end of file diff --git a/content/en/api/php/messages/batches/cancel.md b/content/en/api/php/messages/batches/cancel.md index a175b77b6..1900767f6 100644 --- a/content/en/api/php/messages/batches/cancel.md +++ b/content/en/api/php/messages/batches/cancel.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                          \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                            \ No newline at end of file diff --git a/content/en/api/php/messages/batches/create.md b/content/en/api/php/messages/batches/create.md index c75589a3c..14fc89154 100644 --- a/content/en/api/php/messages/batches/create.md +++ b/content/en/api/php/messages/batches/create.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                              \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                \ No newline at end of file diff --git a/content/en/api/php/messages/batches/delete.md b/content/en/api/php/messages/batches/delete.md index 234950a9f..3e61ee071 100644 --- a/content/en/api/php/messages/batches/delete.md +++ b/content/en/api/php/messages/batches/delete.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                  \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                    \ No newline at end of file diff --git a/content/en/api/php/messages/batches/list.md b/content/en/api/php/messages/batches/list.md index 4e854a263..492aa4ce8 100644 --- a/content/en/api/php/messages/batches/list.md +++ b/content/en/api/php/messages/batches/list.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                      \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                        \ No newline at end of file diff --git a/content/en/api/php/messages/batches/results.md b/content/en/api/php/messages/batches/results.md index 7b4a26ebe..f9e2f9665 100644 --- a/content/en/api/php/messages/batches/results.md +++ b/content/en/api/php/messages/batches/results.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                          \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                            \ No newline at end of file diff --git a/content/en/api/php/messages/batches/retrieve.md b/content/en/api/php/messages/batches/retrieve.md index 730e51723..f92b2fcfe 100644 --- a/content/en/api/php/messages/batches/retrieve.md +++ b/content/en/api/php/messages/batches/retrieve.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                              \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                \ No newline at end of file diff --git a/content/en/api/php/messages/count_tokens.md b/content/en/api/php/messages/count_tokens.md index d51f7692a..af3f26c32 100644 --- a/content/en/api/php/messages/count_tokens.md +++ b/content/en/api/php/messages/count_tokens.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                  \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                    \ No newline at end of file diff --git a/content/en/api/php/messages/create.md b/content/en/api/php/messages/create.md index 408ebb984..ebf15b124 100644 --- a/content/en/api/php/messages/create.md +++ b/content/en/api/php/messages/create.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                      \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                        \ No newline at end of file diff --git a/content/en/api/php/models.md b/content/en/api/php/models.md index 83d0ce88f..d6a948438 100644 --- a/content/en/api/php/models.md +++ b/content/en/api/php/models.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                          \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                            \ No newline at end of file diff --git a/content/en/api/php/models/list.md b/content/en/api/php/models/list.md index 1ede4c256..2394c0f6a 100644 --- a/content/en/api/php/models/list.md +++ b/content/en/api/php/models/list.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                              \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                \ No newline at end of file diff --git a/content/en/api/php/models/retrieve.md b/content/en/api/php/models/retrieve.md index abf087584..df7ee95c4 100644 --- a/content/en/api/php/models/retrieve.md +++ b/content/en/api/php/models/retrieve.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                  \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                    \ No newline at end of file diff --git a/content/en/api/python/beta.md b/content/en/api/python/beta.md index 940a78c19..d1b7a6719 100644 --- a/content/en/api/python/beta.md +++ b/content/en/api/python/beta.md @@ -4,11 +4,11 @@ ### Anthropic Beta -- `Union[str, Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]]` +- `Union[str, Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]]` - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -52,8 +52,6 @@ - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Beta API Error - `class BetaAPIError: …` @@ -338,7 +336,7 @@ The Models API response can be used to determine which models are available for - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -382,8 +380,6 @@ The Models API response can be used to determine which models are available for - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaModelInfo: …` @@ -604,7 +600,7 @@ The Models API response can be used to determine information about a specific mo - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -648,8 +644,6 @@ The Models API response can be used to determine information about a specific mo - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaModelInfo: …` @@ -3928,13 +3922,14 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -3950,9 +3945,13 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -6023,17 +6022,13 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en Recommended for advanced use cases only. You usually only need to use `temperature`. -- `user_profile_id: Optional[str]` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `betas: Optional[List[AnthropicBetaParam]]` Optional header to specify the beta version(s) you want to use. - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -6077,8 +6072,6 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaMessage: …` @@ -7002,13 +6995,14 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -7024,9 +7018,13 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -9934,13 +9932,14 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -9956,9 +9955,13 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -11937,7 +11940,7 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -11981,8 +11984,6 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageTokensCount: …` @@ -12013,7 +12014,7 @@ beta_message_tokens_count = client.beta.messages.count_tokens( "content": "string", "role": "user", }], - model="claude-opus-4-6", + model="claude-mythos-preview", ) print(beta_message_tokens_count.context_management) ``` @@ -19203,13 +19204,14 @@ print(beta_message_tokens_count.context_management) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -19225,9 +19227,13 @@ print(beta_message_tokens_count.context_management) - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -24563,13 +24569,14 @@ print(beta_message_tokens_count.context_management) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -24585,9 +24592,13 @@ print(beta_message_tokens_count.context_management) - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -25823,13 +25834,14 @@ print(beta_message_tokens_count.context_management) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -25845,9 +25857,13 @@ print(beta_message_tokens_count.context_management) - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -36979,13 +36995,14 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -37001,9 +37018,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -39072,17 +39093,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Recommended for advanced use cases only. You usually only need to use `temperature`. - - `user_profile_id: Optional[str]` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `betas: Optional[List[AnthropicBetaParam]]` Optional header to specify the beta version(s) you want to use. - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -39126,8 +39143,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatch: …` @@ -39265,7 +39280,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -39309,8 +39324,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatch: …` @@ -39448,7 +39461,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -39492,8 +39505,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatch: …` @@ -39622,7 +39633,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -39666,8 +39677,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatch: …` @@ -39797,7 +39806,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -39841,8 +39850,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaDeletedMessageBatch: …` @@ -39898,7 +39905,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -39942,8 +39949,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatchIndividualResponse: …` @@ -40885,13 +40890,14 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -40907,9 +40913,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -42480,13 +42490,14 @@ for batch in client.beta.messages.batches.results( See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -42502,9 +42513,13 @@ for batch in client.beta.messages.batches.results( - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -43868,13 +43883,14 @@ for batch in client.beta.messages.batches.results( See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -43890,9 +43906,13 @@ for batch in client.beta.messages.batches.results( - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -45218,13 +45238,14 @@ for batch in client.beta.messages.batches.results( See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -45240,9 +45261,13 @@ for batch in client.beta.messages.batches.results( - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -45543,21 +45568,401 @@ for batch in client.beta.messages.batches.results( - `"succeeded"` -# Files +# Agents -## Upload +## Create -`beta.files.upload(FileUploadParams**kwargs) -> FileMetadata` +`beta.agents.create(AgentCreateParams**kwargs) -> BetaManagedAgentsAgent` -**post** `/v1/files` +**post** `/v1/agents` -Upload File +Create Agent ### Parameters -- `file: FileTypes` +- `model: Model` - The file to upload + Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control + + - `Union[Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more], str]` + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `class BetaManagedAgentsModelConfigParams: …` + + An object that defines additional configuration control over model use + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +- `name: str` + + Human-readable name for the agent. 1-256 characters. + +- `description: Optional[str]` + + Description of what the agent does. Up to 2048 characters. + +- `mcp_servers: Optional[Iterable[BetaManagedAgentsURLMCPServerParams]]` + + MCP servers this agent connects to. Maximum 20. Names must be unique within the array. + + - `name: str` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + Endpoint URL for the MCP server. + +- `metadata: Optional[Dict[str, str]]` + + Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars. + +- `skills: Optional[Iterable[BetaManagedAgentsSkillParams]]` + + Skills available to the agent. Maximum 20. + + - `class BetaManagedAgentsAnthropicSkillParams: …` + + An Anthropic-managed skill. + + - `skill_id: str` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: Optional[str]` + + Version to pin. Defaults to latest if omitted. + + - `class BetaManagedAgentsCustomSkillParams: …` + + A user-created custom skill. + + - `skill_id: str` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: Optional[str]` + + Version to pin. Defaults to latest if omitted. + +- `system: Optional[str]` + + System prompt for the agent. Up to 100,000 characters. + +- `tools: Optional[Iterable[Tool]]` + + Tool configurations available to the agent. Maximum of 128 tools across all toolsets allowed. + + - `class BetaManagedAgentsAgentToolset20260401Params: …` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `configs: Optional[List[BetaManagedAgentsAgentToolConfigParams]]` + + Per-tool configuration overrides. + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled: Optional[bool]` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: Optional[BetaManagedAgentsAgentToolsetDefaultConfigParams]` + + Default configuration for all tools in a toolset. + + - `enabled: Optional[bool]` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `class BetaManagedAgentsMCPToolsetParams: …` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `mcp_server_name: str` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `configs: Optional[List[BetaManagedAgentsMCPToolConfigParams]]` + + Per-tool configuration overrides. + + - `name: str` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled: Optional[bool]` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: Optional[BetaManagedAgentsMCPToolsetDefaultConfigParams]` + + Default configuration for all tools from an MCP server. + + - `enabled: Optional[bool]` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `class BetaManagedAgentsCustomToolParams: …` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: str` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: Literal["custom"]` + + - `"custom"` - `betas: Optional[List[AnthropicBetaParam]]` @@ -45565,7 +45970,7 @@ Upload File - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -45609,7 +46014,22752 @@ Upload File - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` +### Returns + +- `class BetaManagedAgentsAgent: …` + + A Managed Agents `agent`. + + - `id: str` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `metadata: Dict[str, str]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `version: int` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_agent = client.beta.agents.create( + model="claude-sonnet-4-6", + name="My First Agent", +) +print(beta_managed_agents_agent.id) +``` + +## List + +`beta.agents.list(AgentListParams**kwargs) -> SyncPageCursor[BetaManagedAgentsAgent]` + +**get** `/v1/agents` + +List Agents + +### Parameters + +- `created_at_gte: Optional[Union[str, datetime]]` + + Return agents created at or after this time (inclusive). + +- `created_at_lte: Optional[Union[str, datetime]]` + + Return agents created at or before this time (inclusive). + +- `include_archived: Optional[bool]` + + Include archived agents in results. Defaults to false. + +- `limit: Optional[int]` + + Maximum results per page. Default 20, maximum 100. + +- `page: Optional[str]` + + Opaque pagination cursor from a previous response. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent: …` + + A Managed Agents `agent`. + + - `id: str` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `metadata: Dict[str, str]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `version: int` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +page = client.beta.agents.list() +page = page.data[0] +print(page.id) +``` + +## Retrieve + +`beta.agents.retrieve(stragent_id, AgentRetrieveParams**kwargs) -> BetaManagedAgentsAgent` + +**get** `/v1/agents/{agent_id}` + +Get Agent + +### Parameters + +- `agent_id: str` + +- `version: Optional[int]` + + Agent version. Omit for the most recent version. Must be at least 1 if specified. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent: …` + + A Managed Agents `agent`. + + - `id: str` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `metadata: Dict[str, str]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `version: int` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_agent = client.beta.agents.retrieve( + agent_id="agent_011CZkYpogX7uDKUyvBTophP", +) +print(beta_managed_agents_agent.id) +``` + +## Update + +`beta.agents.update(stragent_id, AgentUpdateParams**kwargs) -> BetaManagedAgentsAgent` + +**post** `/v1/agents/{agent_id}` + +Update Agent + +### Parameters + +- `agent_id: str` + +- `version: int` + + The agent's current version, used to prevent concurrent overwrites. Obtain this value from a create or retrieve response. The request fails if this does not match the server's current version. + +- `description: Optional[str]` + + Description. Up to 2048 characters. Omit to preserve; send empty string or null to clear. + +- `mcp_servers: Optional[Iterable[BetaManagedAgentsURLMCPServerParams]]` + + MCP servers. Full replacement. Omit to preserve; send empty array or null to clear. Names must be unique. Maximum 20. + + - `name: str` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + Endpoint URL for the MCP server. + +- `metadata: Optional[Dict[str, Optional[str]]]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. The stored bag is limited to 16 keys (up to 64 chars each) with values up to 512 chars. + +- `model: Optional[Model]` + + Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control. Omit to preserve. Cannot be cleared. + + - `Union[Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more], str]` + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `class BetaManagedAgentsModelConfigParams: …` + + An object that defines additional configuration control over model use + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +- `name: Optional[str]` + + Human-readable name. 1-256 characters. Omit to preserve. Cannot be cleared. + +- `skills: Optional[Iterable[BetaManagedAgentsSkillParams]]` + + Skills. Full replacement. Omit to preserve; send empty array or null to clear. Maximum 20. + + - `class BetaManagedAgentsAnthropicSkillParams: …` + + An Anthropic-managed skill. + + - `skill_id: str` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: Optional[str]` + + Version to pin. Defaults to latest if omitted. + + - `class BetaManagedAgentsCustomSkillParams: …` + + A user-created custom skill. + + - `skill_id: str` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: Optional[str]` + + Version to pin. Defaults to latest if omitted. + +- `system: Optional[str]` + + System prompt. Up to 100,000 characters. Omit to preserve; send empty string or null to clear. + +- `tools: Optional[Iterable[Tool]]` + + Tool configurations available to the agent. Full replacement. Omit to preserve; send empty array or null to clear. Maximum of 128 tools across all toolsets allowed. + + - `class BetaManagedAgentsAgentToolset20260401Params: …` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `configs: Optional[List[BetaManagedAgentsAgentToolConfigParams]]` + + Per-tool configuration overrides. + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled: Optional[bool]` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: Optional[BetaManagedAgentsAgentToolsetDefaultConfigParams]` + + Default configuration for all tools in a toolset. + + - `enabled: Optional[bool]` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `class BetaManagedAgentsMCPToolsetParams: …` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `mcp_server_name: str` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `configs: Optional[List[BetaManagedAgentsMCPToolConfigParams]]` + + Per-tool configuration overrides. + + - `name: str` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled: Optional[bool]` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: Optional[BetaManagedAgentsMCPToolsetDefaultConfigParams]` + + Default configuration for all tools from an MCP server. + + - `enabled: Optional[bool]` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `class BetaManagedAgentsCustomToolParams: …` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: str` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: Literal["custom"]` + + - `"custom"` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent: …` + + A Managed Agents `agent`. + + - `id: str` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `metadata: Dict[str, str]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `version: int` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_agent = client.beta.agents.update( + agent_id="agent_011CZkYpogX7uDKUyvBTophP", + version=1, +) +print(beta_managed_agents_agent.id) +``` + +## Archive + +`beta.agents.archive(stragent_id, AgentArchiveParams**kwargs) -> BetaManagedAgentsAgent` + +**post** `/v1/agents/{agent_id}/archive` + +Archive Agent + +### Parameters + +- `agent_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent: …` + + A Managed Agents `agent`. + + - `id: str` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `metadata: Dict[str, str]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `version: int` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_agent = client.beta.agents.archive( + agent_id="agent_011CZkYpogX7uDKUyvBTophP", +) +print(beta_managed_agents_agent.id) +``` + +## Domain Types + +### Beta Managed Agents Agent + +- `class BetaManagedAgentsAgent: …` + + A Managed Agents `agent`. + + - `id: str` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `metadata: Dict[str, str]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `version: int` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Beta Managed Agents Agent Tool Config + +- `class BetaManagedAgentsAgentToolConfig: …` + + Configuration for a specific agent tool. + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + +### Beta Managed Agents Agent Tool Config Params + +- `class BetaManagedAgentsAgentToolConfigParams: …` + + Configuration override for a specific tool within a toolset. + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled: Optional[bool]` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + +### Beta Managed Agents Agent Toolset Default Config + +- `class BetaManagedAgentsAgentToolsetDefaultConfig: …` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + +### Beta Managed Agents Agent Toolset Default Config Params + +- `class BetaManagedAgentsAgentToolsetDefaultConfigParams: …` + + Default configuration for all tools in a toolset. + + - `enabled: Optional[bool]` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + +### Beta Managed Agents Agent Toolset20260401 + +- `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + +### Beta Managed Agents Agent Toolset20260401 Params + +- `class BetaManagedAgentsAgentToolset20260401Params: …` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `configs: Optional[List[BetaManagedAgentsAgentToolConfigParams]]` + + Per-tool configuration overrides. + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled: Optional[bool]` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: Optional[BetaManagedAgentsAgentToolsetDefaultConfigParams]` + + Default configuration for all tools in a toolset. + + - `enabled: Optional[bool]` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + +### Beta Managed Agents Always Allow Policy + +- `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + +### Beta Managed Agents Always Ask Policy + +- `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + +### Beta Managed Agents Anthropic Skill + +- `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + +### Beta Managed Agents Anthropic Skill Params + +- `class BetaManagedAgentsAnthropicSkillParams: …` + + An Anthropic-managed skill. + + - `skill_id: str` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: Optional[str]` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents Custom Skill + +- `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + +### Beta Managed Agents Custom Skill Params + +- `class BetaManagedAgentsCustomSkillParams: …` + + A user-created custom skill. + + - `skill_id: str` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: Optional[str]` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents Custom Tool + +- `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + +### Beta Managed Agents Custom Tool Input Schema + +- `class BetaManagedAgentsCustomToolInputSchema: …` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + +### Beta Managed Agents Custom Tool Params + +- `class BetaManagedAgentsCustomToolParams: …` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: str` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: Literal["custom"]` + + - `"custom"` + +### Beta Managed Agents MCP Server URL Definition + +- `class BetaManagedAgentsMCPServerURLDefinition: …` + + URL-based MCP server connection as returned in API responses. + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + +### Beta Managed Agents MCP Tool Config + +- `class BetaManagedAgentsMCPToolConfig: …` + + Resolved configuration for a specific MCP tool. + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + +### Beta Managed Agents MCP Tool Config Params + +- `class BetaManagedAgentsMCPToolConfigParams: …` + + Configuration override for a specific MCP tool. + + - `name: str` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled: Optional[bool]` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + +### Beta Managed Agents MCP Toolset + +- `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + +### Beta Managed Agents MCP Toolset Default Config + +- `class BetaManagedAgentsMCPToolsetDefaultConfig: …` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + +### Beta Managed Agents MCP Toolset Default Config Params + +- `class BetaManagedAgentsMCPToolsetDefaultConfigParams: …` + + Default configuration for all tools from an MCP server. + + - `enabled: Optional[bool]` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + +### Beta Managed Agents MCP Toolset Params + +- `class BetaManagedAgentsMCPToolsetParams: …` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `mcp_server_name: str` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `configs: Optional[List[BetaManagedAgentsMCPToolConfigParams]]` + + Per-tool configuration overrides. + + - `name: str` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled: Optional[bool]` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: Optional[BetaManagedAgentsMCPToolsetDefaultConfigParams]` + + Default configuration for all tools from an MCP server. + + - `enabled: Optional[bool]` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + +### Beta Managed Agents Model + +- `Union[Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more], str]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + +### Beta Managed Agents Model Config + +- `class BetaManagedAgentsModelConfig: …` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +### Beta Managed Agents Model Config Params + +- `class BetaManagedAgentsModelConfigParams: …` + + An object that defines additional configuration control over model use + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +### Beta Managed Agents Skill Params + +- `BetaManagedAgentsSkillParams` + + Skill to load in the session container. + + - `class BetaManagedAgentsAnthropicSkillParams: …` + + An Anthropic-managed skill. + + - `skill_id: str` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: Optional[str]` + + Version to pin. Defaults to latest if omitted. + + - `class BetaManagedAgentsCustomSkillParams: …` + + A user-created custom skill. + + - `skill_id: str` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: Optional[str]` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents URL MCP Server Params + +- `class BetaManagedAgentsURLMCPServerParams: …` + + URL-based MCP server connection. + + - `name: str` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + Endpoint URL for the MCP server. + +# Versions + +## List + +`beta.agents.versions.list(stragent_id, VersionListParams**kwargs) -> SyncPageCursor[BetaManagedAgentsAgent]` + +**get** `/v1/agents/{agent_id}/versions` + +List Agent Versions + +### Parameters + +- `agent_id: str` + +- `limit: Optional[int]` + + Maximum results per page. Default 20, maximum 100. + +- `page: Optional[str]` + + Opaque pagination cursor. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent: …` + + A Managed Agents `agent`. + + - `id: str` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `metadata: Dict[str, str]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `version: int` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +page = client.beta.agents.versions.list( + agent_id="agent_011CZkYpogX7uDKUyvBTophP", +) +page = page.data[0] +print(page.id) +``` + +# Environments + +## Create + +`beta.environments.create(EnvironmentCreateParams**kwargs) -> BetaEnvironment` + +**post** `/v1/environments` + +Create a new environment with the specified configuration. + +### Parameters + +- `name: str` + + Human-readable name for the environment + +- `config: Optional[BetaCloudConfigParams]` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: Literal["cloud"]` + + Environment type + + - `"cloud"` + + - `networking: Optional[Networking]` + + Network configuration policy. Omit on update to preserve the existing value. + + - `class BetaUnrestrictedNetwork: …` + + Unrestricted network access. + + - `type: Literal["unrestricted"]` + + Network policy type + + - `"unrestricted"` + + - `class BetaLimitedNetworkParams: …` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: Literal["limited"]` + + Network policy type + + - `"limited"` + + - `allow_mcp_servers: Optional[bool]` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: Optional[bool]` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: Optional[List[str]]` + + Specifies domains the container can reach. + + - `packages: Optional[BetaPackagesParams]` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: Optional[List[str]]` + + Ubuntu/Debian packages to install + + - `cargo: Optional[List[str]]` + + Rust packages to install + + - `gem: Optional[List[str]]` + + Ruby packages to install + + - `go: Optional[List[str]]` + + Go packages to install + + - `npm: Optional[List[str]]` + + Node.js packages to install + + - `pip: Optional[List[str]]` + + Python packages to install + + - `type: Optional[Literal["packages"]]` + + Package configuration type + + - `"packages"` + +- `description: Optional[str]` + + Optional description of the environment + +- `metadata: Optional[Dict[str, str]]` + + User-provided metadata key-value pairs + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironment: …` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: str` + + Environment identifier (e.g., 'env_...') + + - `archived_at: Optional[str]` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork: …` + + Unrestricted network access. + + - `type: Literal["unrestricted"]` + + Network policy type + + - `"unrestricted"` + + - `class BetaLimitedNetwork: …` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: List[str]` + + Specifies domains the container can reach. + + - `type: Literal["limited"]` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: List[str]` + + Ubuntu/Debian packages to install + + - `cargo: List[str]` + + Rust packages to install + + - `gem: List[str]` + + Ruby packages to install + + - `go: List[str]` + + Go packages to install + + - `npm: List[str]` + + Node.js packages to install + + - `pip: List[str]` + + Python packages to install + + - `type: Optional[Literal["packages"]]` + + Package configuration type + + - `"packages"` + + - `type: Literal["cloud"]` + + Environment type + + - `"cloud"` + + - `created_at: str` + + RFC 3339 timestamp when environment was created + + - `description: str` + + User-provided description for the environment + + - `metadata: Dict[str, str]` + + User-provided metadata key-value pairs + + - `name: str` + + Human-readable name for the environment + + - `type: Literal["environment"]` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: str` + + RFC 3339 timestamp when environment was last updated + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_environment = client.beta.environments.create( + name="python-data-analysis", +) +print(beta_environment.id) +``` + +## List + +`beta.environments.list(EnvironmentListParams**kwargs) -> SyncPageCursor[BetaEnvironment]` + +**get** `/v1/environments` + +List environments with pagination support. + +### Parameters + +- `include_archived: Optional[bool]` + + Include archived environments in the response + +- `limit: Optional[int]` + + Maximum number of environments to return + +- `page: Optional[str]` + + Opaque cursor from previous response for pagination. Pass the `next_page` value from the previous response. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironment: …` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: str` + + Environment identifier (e.g., 'env_...') + + - `archived_at: Optional[str]` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork: …` + + Unrestricted network access. + + - `type: Literal["unrestricted"]` + + Network policy type + + - `"unrestricted"` + + - `class BetaLimitedNetwork: …` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: List[str]` + + Specifies domains the container can reach. + + - `type: Literal["limited"]` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: List[str]` + + Ubuntu/Debian packages to install + + - `cargo: List[str]` + + Rust packages to install + + - `gem: List[str]` + + Ruby packages to install + + - `go: List[str]` + + Go packages to install + + - `npm: List[str]` + + Node.js packages to install + + - `pip: List[str]` + + Python packages to install + + - `type: Optional[Literal["packages"]]` + + Package configuration type + + - `"packages"` + + - `type: Literal["cloud"]` + + Environment type + + - `"cloud"` + + - `created_at: str` + + RFC 3339 timestamp when environment was created + + - `description: str` + + User-provided description for the environment + + - `metadata: Dict[str, str]` + + User-provided metadata key-value pairs + + - `name: str` + + Human-readable name for the environment + + - `type: Literal["environment"]` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: str` + + RFC 3339 timestamp when environment was last updated + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +page = client.beta.environments.list() +page = page.data[0] +print(page.id) +``` + +## Retrieve + +`beta.environments.retrieve(strenvironment_id, EnvironmentRetrieveParams**kwargs) -> BetaEnvironment` + +**get** `/v1/environments/{environment_id}` + +Retrieve a specific environment by ID. + +### Parameters + +- `environment_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironment: …` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: str` + + Environment identifier (e.g., 'env_...') + + - `archived_at: Optional[str]` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork: …` + + Unrestricted network access. + + - `type: Literal["unrestricted"]` + + Network policy type + + - `"unrestricted"` + + - `class BetaLimitedNetwork: …` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: List[str]` + + Specifies domains the container can reach. + + - `type: Literal["limited"]` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: List[str]` + + Ubuntu/Debian packages to install + + - `cargo: List[str]` + + Rust packages to install + + - `gem: List[str]` + + Ruby packages to install + + - `go: List[str]` + + Go packages to install + + - `npm: List[str]` + + Node.js packages to install + + - `pip: List[str]` + + Python packages to install + + - `type: Optional[Literal["packages"]]` + + Package configuration type + + - `"packages"` + + - `type: Literal["cloud"]` + + Environment type + + - `"cloud"` + + - `created_at: str` + + RFC 3339 timestamp when environment was created + + - `description: str` + + User-provided description for the environment + + - `metadata: Dict[str, str]` + + User-provided metadata key-value pairs + + - `name: str` + + Human-readable name for the environment + + - `type: Literal["environment"]` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: str` + + RFC 3339 timestamp when environment was last updated + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_environment = client.beta.environments.retrieve( + environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW", +) +print(beta_environment.id) +``` + +## Update + +`beta.environments.update(strenvironment_id, EnvironmentUpdateParams**kwargs) -> BetaEnvironment` + +**post** `/v1/environments/{environment_id}` + +Update an existing environment's configuration. + +### Parameters + +- `environment_id: str` + +- `config: Optional[BetaCloudConfigParams]` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: Literal["cloud"]` + + Environment type + + - `"cloud"` + + - `networking: Optional[Networking]` + + Network configuration policy. Omit on update to preserve the existing value. + + - `class BetaUnrestrictedNetwork: …` + + Unrestricted network access. + + - `type: Literal["unrestricted"]` + + Network policy type + + - `"unrestricted"` + + - `class BetaLimitedNetworkParams: …` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: Literal["limited"]` + + Network policy type + + - `"limited"` + + - `allow_mcp_servers: Optional[bool]` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: Optional[bool]` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: Optional[List[str]]` + + Specifies domains the container can reach. + + - `packages: Optional[BetaPackagesParams]` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: Optional[List[str]]` + + Ubuntu/Debian packages to install + + - `cargo: Optional[List[str]]` + + Rust packages to install + + - `gem: Optional[List[str]]` + + Ruby packages to install + + - `go: Optional[List[str]]` + + Go packages to install + + - `npm: Optional[List[str]]` + + Node.js packages to install + + - `pip: Optional[List[str]]` + + Python packages to install + + - `type: Optional[Literal["packages"]]` + + Package configuration type + + - `"packages"` + +- `description: Optional[str]` + + Updated description of the environment + +- `metadata: Optional[Dict[str, Optional[str]]]` + + User-provided metadata key-value pairs. Set a value to null or empty string to delete the key. + +- `name: Optional[str]` + + Updated name for the environment + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironment: …` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: str` + + Environment identifier (e.g., 'env_...') + + - `archived_at: Optional[str]` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork: …` + + Unrestricted network access. + + - `type: Literal["unrestricted"]` + + Network policy type + + - `"unrestricted"` + + - `class BetaLimitedNetwork: …` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: List[str]` + + Specifies domains the container can reach. + + - `type: Literal["limited"]` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: List[str]` + + Ubuntu/Debian packages to install + + - `cargo: List[str]` + + Rust packages to install + + - `gem: List[str]` + + Ruby packages to install + + - `go: List[str]` + + Go packages to install + + - `npm: List[str]` + + Node.js packages to install + + - `pip: List[str]` + + Python packages to install + + - `type: Optional[Literal["packages"]]` + + Package configuration type + + - `"packages"` + + - `type: Literal["cloud"]` + + Environment type + + - `"cloud"` + + - `created_at: str` + + RFC 3339 timestamp when environment was created + + - `description: str` + + User-provided description for the environment + + - `metadata: Dict[str, str]` + + User-provided metadata key-value pairs + + - `name: str` + + Human-readable name for the environment + + - `type: Literal["environment"]` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: str` + + RFC 3339 timestamp when environment was last updated + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_environment = client.beta.environments.update( + environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW", +) +print(beta_environment.id) +``` + +## Delete + +`beta.environments.delete(strenvironment_id, EnvironmentDeleteParams**kwargs) -> BetaEnvironmentDeleteResponse` + +**delete** `/v1/environments/{environment_id}` + +Delete an environment by ID. Returns a confirmation of the deletion. + +### Parameters + +- `environment_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironmentDeleteResponse: …` + + Response after deleting an environment. + + - `id: str` + + Environment identifier + + - `type: Literal["environment_deleted"]` + + The type of response + + - `"environment_deleted"` + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_environment_delete_response = client.beta.environments.delete( + environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW", +) +print(beta_environment_delete_response.id) +``` + +## Archive + +`beta.environments.archive(strenvironment_id, EnvironmentArchiveParams**kwargs) -> BetaEnvironment` + +**post** `/v1/environments/{environment_id}/archive` + +Archive an environment by ID. Archived environments cannot be used to create new sessions. + +### Parameters + +- `environment_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironment: …` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: str` + + Environment identifier (e.g., 'env_...') + + - `archived_at: Optional[str]` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork: …` + + Unrestricted network access. + + - `type: Literal["unrestricted"]` + + Network policy type + + - `"unrestricted"` + + - `class BetaLimitedNetwork: …` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: List[str]` + + Specifies domains the container can reach. + + - `type: Literal["limited"]` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: List[str]` + + Ubuntu/Debian packages to install + + - `cargo: List[str]` + + Rust packages to install + + - `gem: List[str]` + + Ruby packages to install + + - `go: List[str]` + + Go packages to install + + - `npm: List[str]` + + Node.js packages to install + + - `pip: List[str]` + + Python packages to install + + - `type: Optional[Literal["packages"]]` + + Package configuration type + + - `"packages"` + + - `type: Literal["cloud"]` + + Environment type + + - `"cloud"` + + - `created_at: str` + + RFC 3339 timestamp when environment was created + + - `description: str` + + User-provided description for the environment + + - `metadata: Dict[str, str]` + + User-provided metadata key-value pairs + + - `name: str` + + Human-readable name for the environment + + - `type: Literal["environment"]` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: str` + + RFC 3339 timestamp when environment was last updated + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_environment = client.beta.environments.archive( + environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW", +) +print(beta_environment.id) +``` + +## Domain Types + +### Beta Cloud Config + +- `class BetaCloudConfig: …` + + `cloud` environment configuration. + + - `networking: Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork: …` + + Unrestricted network access. + + - `type: Literal["unrestricted"]` + + Network policy type + + - `"unrestricted"` + + - `class BetaLimitedNetwork: …` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: List[str]` + + Specifies domains the container can reach. + + - `type: Literal["limited"]` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: List[str]` + + Ubuntu/Debian packages to install + + - `cargo: List[str]` + + Rust packages to install + + - `gem: List[str]` + + Ruby packages to install + + - `go: List[str]` + + Go packages to install + + - `npm: List[str]` + + Node.js packages to install + + - `pip: List[str]` + + Python packages to install + + - `type: Optional[Literal["packages"]]` + + Package configuration type + + - `"packages"` + + - `type: Literal["cloud"]` + + Environment type + + - `"cloud"` + +### Beta Cloud Config Params + +- `class BetaCloudConfigParams: …` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: Literal["cloud"]` + + Environment type + + - `"cloud"` + + - `networking: Optional[Networking]` + + Network configuration policy. Omit on update to preserve the existing value. + + - `class BetaUnrestrictedNetwork: …` + + Unrestricted network access. + + - `type: Literal["unrestricted"]` + + Network policy type + + - `"unrestricted"` + + - `class BetaLimitedNetworkParams: …` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: Literal["limited"]` + + Network policy type + + - `"limited"` + + - `allow_mcp_servers: Optional[bool]` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: Optional[bool]` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: Optional[List[str]]` + + Specifies domains the container can reach. + + - `packages: Optional[BetaPackagesParams]` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: Optional[List[str]]` + + Ubuntu/Debian packages to install + + - `cargo: Optional[List[str]]` + + Rust packages to install + + - `gem: Optional[List[str]]` + + Ruby packages to install + + - `go: Optional[List[str]]` + + Go packages to install + + - `npm: Optional[List[str]]` + + Node.js packages to install + + - `pip: Optional[List[str]]` + + Python packages to install + + - `type: Optional[Literal["packages"]]` + + Package configuration type + + - `"packages"` + +### Beta Environment + +- `class BetaEnvironment: …` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: str` + + Environment identifier (e.g., 'env_...') + + - `archived_at: Optional[str]` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork: …` + + Unrestricted network access. + + - `type: Literal["unrestricted"]` + + Network policy type + + - `"unrestricted"` + + - `class BetaLimitedNetwork: …` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: List[str]` + + Specifies domains the container can reach. + + - `type: Literal["limited"]` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: List[str]` + + Ubuntu/Debian packages to install + + - `cargo: List[str]` + + Rust packages to install + + - `gem: List[str]` + + Ruby packages to install + + - `go: List[str]` + + Go packages to install + + - `npm: List[str]` + + Node.js packages to install + + - `pip: List[str]` + + Python packages to install + + - `type: Optional[Literal["packages"]]` + + Package configuration type + + - `"packages"` + + - `type: Literal["cloud"]` + + Environment type + + - `"cloud"` + + - `created_at: str` + + RFC 3339 timestamp when environment was created + + - `description: str` + + User-provided description for the environment + + - `metadata: Dict[str, str]` + + User-provided metadata key-value pairs + + - `name: str` + + Human-readable name for the environment + + - `type: Literal["environment"]` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: str` + + RFC 3339 timestamp when environment was last updated + +### Beta Environment Delete Response + +- `class BetaEnvironmentDeleteResponse: …` + + Response after deleting an environment. + + - `id: str` + + Environment identifier + + - `type: Literal["environment_deleted"]` + + The type of response + + - `"environment_deleted"` + +### Beta Limited Network + +- `class BetaLimitedNetwork: …` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: List[str]` + + Specifies domains the container can reach. + + - `type: Literal["limited"]` + + Network policy type + + - `"limited"` + +### Beta Limited Network Params + +- `class BetaLimitedNetworkParams: …` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: Literal["limited"]` + + Network policy type + + - `"limited"` + + - `allow_mcp_servers: Optional[bool]` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: Optional[bool]` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: Optional[List[str]]` + + Specifies domains the container can reach. + +### Beta Packages + +- `class BetaPackages: …` + + Packages (and their versions) available in this environment. + + - `apt: List[str]` + + Ubuntu/Debian packages to install + + - `cargo: List[str]` + + Rust packages to install + + - `gem: List[str]` + + Ruby packages to install + + - `go: List[str]` + + Go packages to install + + - `npm: List[str]` + + Node.js packages to install + + - `pip: List[str]` + + Python packages to install + + - `type: Optional[Literal["packages"]]` + + Package configuration type + + - `"packages"` + +### Beta Packages Params + +- `class BetaPackagesParams: …` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: Optional[List[str]]` + + Ubuntu/Debian packages to install + + - `cargo: Optional[List[str]]` + + Rust packages to install + + - `gem: Optional[List[str]]` + + Ruby packages to install + + - `go: Optional[List[str]]` + + Go packages to install + + - `npm: Optional[List[str]]` + + Node.js packages to install + + - `pip: Optional[List[str]]` + + Python packages to install + + - `type: Optional[Literal["packages"]]` + + Package configuration type + + - `"packages"` + +### Beta Unrestricted Network + +- `class BetaUnrestrictedNetwork: …` + + Unrestricted network access. + + - `type: Literal["unrestricted"]` + + Network policy type + + - `"unrestricted"` + +# Sessions + +## Create + +`beta.sessions.create(SessionCreateParams**kwargs) -> BetaManagedAgentsSession` + +**post** `/v1/sessions` + +Create Session + +### Parameters + +- `agent: Agent` + + Agent identifier. Accepts the `agent` ID string, which pins the latest version for the session, or an `agent` object with both id and version specified. + + - `str` + + - `class BetaManagedAgentsAgentParams: …` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `id: str` + + The `agent` ID. + + - `type: Literal["agent"]` + + - `"agent"` + + - `version: Optional[int]` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + +- `environment_id: str` + + ID of the `environment` defining the container configuration for this session. + +- `metadata: Optional[Dict[str, str]]` + + Arbitrary key-value metadata attached to the session. + +- `resources: Optional[Iterable[Resource]]` + + Resources (e.g. repositories, files) to mount into the session's container. + + - `class BetaManagedAgentsGitHubRepositoryResourceParams: …` + + Mount a GitHub repository into the session's container. + + - `authorization_token: str` + + GitHub authorization token used to clone the repository. + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `url: str` + + Github URL of the repository + + - `checkout: Optional[Checkout]` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `mount_path: Optional[str]` + + Mount path in the container. Defaults to `/workspace/`. + + - `class BetaManagedAgentsFileResourceParams: …` + + Mount a file uploaded via the Files API into the session. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `mount_path: Optional[str]` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +- `title: Optional[str]` + + Human-readable session title. + +- `vault_ids: Optional[Sequence[str]]` + + Vault IDs for stored credentials the agent can use during the session. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSession: …` + + A Managed Agents `session`. + + - `id: str` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: str` + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `version: int` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `environment_id: str` + + - `metadata: Dict[str, str]` + + - `resources: List[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Optional[float]` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Optional[float]` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: Literal["rescheduling", "running", "idle", "terminated"]` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: Optional[str]` + + - `type: Literal["session"]` + + - `"session"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: Optional[BetaManagedAgentsCacheCreationUsage]` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Optional[int]` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Optional[int]` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Optional[int]` + + Total tokens read from prompt cache. + + - `input_tokens: Optional[int]` + + Total input tokens consumed across all turns. + + - `output_tokens: Optional[int]` + + Total output tokens generated across all turns. + + - `vault_ids: List[str]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_session = client.beta.sessions.create( + agent="agent_011CZkYpogX7uDKUyvBTophP", + environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW", +) +print(beta_managed_agents_session.id) +``` + +## List + +`beta.sessions.list(SessionListParams**kwargs) -> SyncPageCursor[BetaManagedAgentsSession]` + +**get** `/v1/sessions` + +List Sessions + +### Parameters + +- `agent_id: Optional[str]` + + Filter sessions created with this agent ID. + +- `agent_version: Optional[int]` + + Filter by agent version. Only applies when agent_id is also set. + +- `created_at_gt: Optional[Union[str, datetime]]` + + Return sessions created after this time (exclusive). + +- `created_at_gte: Optional[Union[str, datetime]]` + + Return sessions created at or after this time (inclusive). + +- `created_at_lt: Optional[Union[str, datetime]]` + + Return sessions created before this time (exclusive). + +- `created_at_lte: Optional[Union[str, datetime]]` + + Return sessions created at or before this time (inclusive). + +- `include_archived: Optional[bool]` + + When true, includes archived sessions. Default: false (exclude archived). + +- `limit: Optional[int]` + + Maximum number of results to return. + +- `order: Optional[Literal["asc", "desc"]]` + + Sort direction for results, ordered by created_at. Defaults to desc (newest first). + + - `"asc"` + + - `"desc"` + +- `page: Optional[str]` + + Opaque pagination cursor from a previous response's next_page. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSession: …` + + A Managed Agents `session`. + + - `id: str` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: str` + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `version: int` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `environment_id: str` + + - `metadata: Dict[str, str]` + + - `resources: List[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Optional[float]` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Optional[float]` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: Literal["rescheduling", "running", "idle", "terminated"]` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: Optional[str]` + + - `type: Literal["session"]` + + - `"session"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: Optional[BetaManagedAgentsCacheCreationUsage]` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Optional[int]` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Optional[int]` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Optional[int]` + + Total tokens read from prompt cache. + + - `input_tokens: Optional[int]` + + Total input tokens consumed across all turns. + + - `output_tokens: Optional[int]` + + Total output tokens generated across all turns. + + - `vault_ids: List[str]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +page = client.beta.sessions.list() +page = page.data[0] +print(page.id) +``` + +## Retrieve + +`beta.sessions.retrieve(strsession_id, SessionRetrieveParams**kwargs) -> BetaManagedAgentsSession` + +**get** `/v1/sessions/{session_id}` + +Get Session + +### Parameters + +- `session_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSession: …` + + A Managed Agents `session`. + + - `id: str` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: str` + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `version: int` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `environment_id: str` + + - `metadata: Dict[str, str]` + + - `resources: List[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Optional[float]` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Optional[float]` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: Literal["rescheduling", "running", "idle", "terminated"]` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: Optional[str]` + + - `type: Literal["session"]` + + - `"session"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: Optional[BetaManagedAgentsCacheCreationUsage]` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Optional[int]` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Optional[int]` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Optional[int]` + + Total tokens read from prompt cache. + + - `input_tokens: Optional[int]` + + Total input tokens consumed across all turns. + + - `output_tokens: Optional[int]` + + Total output tokens generated across all turns. + + - `vault_ids: List[str]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_session = client.beta.sessions.retrieve( + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", +) +print(beta_managed_agents_session.id) +``` + +## Update + +`beta.sessions.update(strsession_id, SessionUpdateParams**kwargs) -> BetaManagedAgentsSession` + +**post** `/v1/sessions/{session_id}` + +Update Session + +### Parameters + +- `session_id: str` + +- `metadata: Optional[Dict[str, Optional[str]]]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. + +- `title: Optional[str]` + + Human-readable session title. + +- `vault_ids: Optional[Sequence[str]]` + + Vault IDs (`vlt_*`) to attach to the session. Not yet supported; requests setting this field are rejected. Reserved for future use. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSession: …` + + A Managed Agents `session`. + + - `id: str` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: str` + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `version: int` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `environment_id: str` + + - `metadata: Dict[str, str]` + + - `resources: List[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Optional[float]` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Optional[float]` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: Literal["rescheduling", "running", "idle", "terminated"]` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: Optional[str]` + + - `type: Literal["session"]` + + - `"session"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: Optional[BetaManagedAgentsCacheCreationUsage]` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Optional[int]` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Optional[int]` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Optional[int]` + + Total tokens read from prompt cache. + + - `input_tokens: Optional[int]` + + Total input tokens consumed across all turns. + + - `output_tokens: Optional[int]` + + Total output tokens generated across all turns. + + - `vault_ids: List[str]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_session = client.beta.sessions.update( + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", +) +print(beta_managed_agents_session.id) +``` + +## Delete + +`beta.sessions.delete(strsession_id, SessionDeleteParams**kwargs) -> BetaManagedAgentsDeletedSession` + +**delete** `/v1/sessions/{session_id}` + +Delete Session + +### Parameters + +- `session_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsDeletedSession: …` + + Confirmation that a `session` has been permanently deleted. + + - `id: str` + + - `type: Literal["session_deleted"]` + + - `"session_deleted"` + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_deleted_session = client.beta.sessions.delete( + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", +) +print(beta_managed_agents_deleted_session.id) +``` + +## Archive + +`beta.sessions.archive(strsession_id, SessionArchiveParams**kwargs) -> BetaManagedAgentsSession` + +**post** `/v1/sessions/{session_id}/archive` + +Archive Session + +### Parameters + +- `session_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSession: …` + + A Managed Agents `session`. + + - `id: str` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: str` + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `version: int` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `environment_id: str` + + - `metadata: Dict[str, str]` + + - `resources: List[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Optional[float]` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Optional[float]` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: Literal["rescheduling", "running", "idle", "terminated"]` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: Optional[str]` + + - `type: Literal["session"]` + + - `"session"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: Optional[BetaManagedAgentsCacheCreationUsage]` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Optional[int]` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Optional[int]` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Optional[int]` + + Total tokens read from prompt cache. + + - `input_tokens: Optional[int]` + + Total input tokens consumed across all turns. + + - `output_tokens: Optional[int]` + + Total output tokens generated across all turns. + + - `vault_ids: List[str]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_session = client.beta.sessions.archive( + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", +) +print(beta_managed_agents_session.id) +``` + +## Domain Types + +### Beta Managed Agents Agent Params + +- `class BetaManagedAgentsAgentParams: …` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `id: str` + + The `agent` ID. + + - `type: Literal["agent"]` + + - `"agent"` + + - `version: Optional[int]` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + +### Beta Managed Agents Branch Checkout + +- `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + +### Beta Managed Agents Cache Creation Usage + +- `class BetaManagedAgentsCacheCreationUsage: …` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Optional[int]` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Optional[int]` + + Tokens used to create 5-minute ephemeral cache entries. + +### Beta Managed Agents Commit Checkout + +- `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + +### Beta Managed Agents Deleted Session + +- `class BetaManagedAgentsDeletedSession: …` + + Confirmation that a `session` has been permanently deleted. + + - `id: str` + + - `type: Literal["session_deleted"]` + + - `"session_deleted"` + +### Beta Managed Agents File Resource Params + +- `class BetaManagedAgentsFileResourceParams: …` + + Mount a file uploaded via the Files API into the session. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `mount_path: Optional[str]` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +### Beta Managed Agents GitHub Repository Resource Params + +- `class BetaManagedAgentsGitHubRepositoryResourceParams: …` + + Mount a GitHub repository into the session's container. + + - `authorization_token: str` + + GitHub authorization token used to clone the repository. + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `url: str` + + Github URL of the repository + + - `checkout: Optional[Checkout]` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `mount_path: Optional[str]` + + Mount path in the container. Defaults to `/workspace/`. + +### Beta Managed Agents Session + +- `class BetaManagedAgentsSession: …` + + A Managed Agents `session`. + + - `id: str` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: str` + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `version: int` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `environment_id: str` + + - `metadata: Dict[str, str]` + + - `resources: List[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Optional[float]` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Optional[float]` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: Literal["rescheduling", "running", "idle", "terminated"]` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: Optional[str]` + + - `type: Literal["session"]` + + - `"session"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: Optional[BetaManagedAgentsCacheCreationUsage]` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Optional[int]` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Optional[int]` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Optional[int]` + + Total tokens read from prompt cache. + + - `input_tokens: Optional[int]` + + Total input tokens consumed across all turns. + + - `output_tokens: Optional[int]` + + Total output tokens generated across all turns. + + - `vault_ids: List[str]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Beta Managed Agents Session Agent + +- `class BetaManagedAgentsSessionAgent: …` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: str` + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `version: int` + +### Beta Managed Agents Session Stats + +- `class BetaManagedAgentsSessionStats: …` + + Timing statistics for a session. + + - `active_seconds: Optional[float]` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Optional[float]` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + +### Beta Managed Agents Session Usage + +- `class BetaManagedAgentsSessionUsage: …` + + Cumulative token usage for a session across all turns. + + - `cache_creation: Optional[BetaManagedAgentsCacheCreationUsage]` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Optional[int]` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Optional[int]` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Optional[int]` + + Total tokens read from prompt cache. + + - `input_tokens: Optional[int]` + + Total input tokens consumed across all turns. + + - `output_tokens: Optional[int]` + + Total output tokens generated across all turns. + +# Events + +## List + +`beta.sessions.events.list(strsession_id, EventListParams**kwargs) -> SyncPageCursor[BetaManagedAgentsSessionEvent]` + +**get** `/v1/sessions/{session_id}/events` + +List Events + +### Parameters + +- `session_id: str` + +- `limit: Optional[int]` + + Query parameter for limit + +- `order: Optional[Literal["asc", "desc"]]` + + Sort direction for results, ordered by created_at. Defaults to asc (chronological). + + - `"asc"` + + - `"desc"` + +- `page: Optional[str]` + + Opaque pagination cursor from a previous response's next_page. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSessionEvent` + + Union type for all event types in a session. + + - `class BetaManagedAgentsUserMessageEvent: …` + + A user message event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[Content]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent: …` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: str` + + Unique identifier for this event. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent: …` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: str` + + Unique identifier for this event. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent: …` + + Event sent by the client providing the result of a custom tool execution. + + - `id: str` + + Unique identifier for this event. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent: …` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the custom tool being called. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.custom_tool_use"]` + + - `"agent.custom_tool_use"` + + - `class BetaManagedAgentsAgentMessageEvent: …` + + An agent response event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.message"]` + + - `"agent.message"` + + - `class BetaManagedAgentsAgentThinkingEvent: …` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thinking"]` + + - `"agent.thinking"` + + - `class BetaManagedAgentsAgentMCPToolUseEvent: …` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `mcp_server_name: str` + + Name of the MCP server providing the tool. + + - `name: str` + + Name of the MCP tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_use"]` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `class BetaManagedAgentsAgentMCPToolResultEvent: …` + + Event representing the result of an MCP tool execution. + + - `id: str` + + Unique identifier for this event. + + - `mcp_tool_use_id: str` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_result"]` + + - `"agent.mcp_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent: …` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the agent tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.tool_use"]` + + - `"agent.tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `class BetaManagedAgentsAgentToolResultEvent: …` + + Event representing the result of an agent tool execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `tool_use_id: str` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: Literal["agent.tool_result"]` + + - `"agent.tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent: …` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thread_context_compacted"]` + + - `"agent.thread_context_compacted"` + + - `class BetaManagedAgentsSessionErrorEvent: …` + + An error event indicating a problem occurred during session execution. + + - `id: str` + + Unique identifier for this event. + + - `error: Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError: …` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["unknown_error"]` + + - `"unknown_error"` + + - `class BetaManagedAgentsModelOverloadedError: …` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_overloaded_error"]` + + - `"model_overloaded_error"` + + - `class BetaManagedAgentsModelRateLimitedError: …` + + The model request was rate-limited. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_rate_limited_error"]` + + - `"model_rate_limited_error"` + + - `class BetaManagedAgentsModelRequestFailedError: …` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_request_failed_error"]` + + - `"model_request_failed_error"` + + - `class BetaManagedAgentsMCPConnectionFailedError: …` + + Failed to connect to an MCP server. + + - `mcp_server_name: str` + + Name of the MCP server that failed to connect. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_connection_failed_error"]` + + - `"mcp_connection_failed_error"` + + - `class BetaManagedAgentsMCPAuthenticationFailedError: …` + + Authentication to an MCP server failed. + + - `mcp_server_name: str` + + Name of the MCP server that failed authentication. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_authentication_failed_error"]` + + - `"mcp_authentication_failed_error"` + + - `class BetaManagedAgentsBillingError: …` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["billing_error"]` + + - `"billing_error"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.error"]` + + - `"session.error"` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent: …` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_rescheduled"]` + + - `"session.status_rescheduled"` + + - `class BetaManagedAgentsSessionStatusRunningEvent: …` + + Indicates the session is actively running and the agent is working. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_running"]` + + - `"session.status_running"` + + - `class BetaManagedAgentsSessionStatusIdleEvent: …` + + Indicates the agent has paused and is awaiting user input. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `stop_reason: StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn: …` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: Literal["end_turn"]` + + - `"end_turn"` + + - `class BetaManagedAgentsSessionRequiresAction: …` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: List[str]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: Literal["requires_action"]` + + - `"requires_action"` + + - `class BetaManagedAgentsSessionRetriesExhausted: …` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: Literal["retries_exhausted"]` + + - `"retries_exhausted"` + + - `type: Literal["session.status_idle"]` + + - `"session.status_idle"` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent: …` + + Indicates the session has terminated, either due to an error or completion. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_terminated"]` + + - `"session.status_terminated"` + + - `class BetaManagedAgentsSpanModelRequestStartEvent: …` + + Emitted when a model request is initiated by the agent. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_start"]` + + - `"span.model_request_start"` + + - `class BetaManagedAgentsSpanModelRequestEndEvent: …` + + Emitted when a model request completes. + + - `id: str` + + Unique identifier for this event. + + - `is_error: Optional[bool]` + + Whether the model request resulted in an error. + + - `model_request_start_id: str` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: int` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: int` + + Tokens read from prompt cache in this request. + + - `input_tokens: int` + + Input tokens consumed by this request. + + - `output_tokens: int` + + Output tokens generated by this request. + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_end"]` + + - `"span.model_request_end"` + + - `class BetaManagedAgentsSessionDeletedEvent: …` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.deleted"]` + + - `"session.deleted"` + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +page = client.beta.sessions.events.list( + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", +) +page = page.data[0] +print(page) +``` + +## Send + +`beta.sessions.events.send(strsession_id, EventSendParams**kwargs) -> BetaManagedAgentsSendSessionEvents` + +**post** `/v1/sessions/{session_id}/events` + +Send Events + +### Parameters + +- `session_id: str` + +- `events: Iterable[BetaManagedAgentsEventParams]` + + Events to send to the `session`. + + - `class BetaManagedAgentsUserMessageEventParams: …` + + Parameters for sending a user message to the session. + + - `content: List[Content]` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + + - `class BetaManagedAgentsUserInterruptEventParams: …` + + Parameters for sending an interrupt to pause the agent. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + + - `class BetaManagedAgentsUserToolConfirmationEventParams: …` + + Parameters for confirming or denying a tool execution request. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `class BetaManagedAgentsUserCustomToolResultEventParams: …` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSendSessionEvents: …` + + Events that were successfully sent to the session. + + - `data: Optional[List[Data]]` + + Sent events + + - `class BetaManagedAgentsUserMessageEvent: …` + + A user message event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[Content]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent: …` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: str` + + Unique identifier for this event. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent: …` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: str` + + Unique identifier for this event. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent: …` + + Event sent by the client providing the result of a custom tool execution. + + - `id: str` + + Unique identifier for this event. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_send_session_events = client.beta.sessions.events.send( + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", + events=[{ + "content": [{ + "text": "Where is my order #1234?", + "type": "text", + }], + "type": "user.message", + }], +) +print(beta_managed_agents_send_session_events.data) +``` + +## Stream + +`beta.sessions.events.stream(strsession_id, EventStreamParams**kwargs) -> BetaManagedAgentsStreamSessionEvents` + +**get** `/v1/sessions/{session_id}/events/stream` + +Stream Events + +### Parameters + +- `session_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsStreamSessionEvents` + + Server-sent event in the session stream. + + - `class BetaManagedAgentsUserMessageEvent: …` + + A user message event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[Content]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent: …` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: str` + + Unique identifier for this event. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent: …` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: str` + + Unique identifier for this event. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent: …` + + Event sent by the client providing the result of a custom tool execution. + + - `id: str` + + Unique identifier for this event. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent: …` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the custom tool being called. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.custom_tool_use"]` + + - `"agent.custom_tool_use"` + + - `class BetaManagedAgentsAgentMessageEvent: …` + + An agent response event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.message"]` + + - `"agent.message"` + + - `class BetaManagedAgentsAgentThinkingEvent: …` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thinking"]` + + - `"agent.thinking"` + + - `class BetaManagedAgentsAgentMCPToolUseEvent: …` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `mcp_server_name: str` + + Name of the MCP server providing the tool. + + - `name: str` + + Name of the MCP tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_use"]` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `class BetaManagedAgentsAgentMCPToolResultEvent: …` + + Event representing the result of an MCP tool execution. + + - `id: str` + + Unique identifier for this event. + + - `mcp_tool_use_id: str` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_result"]` + + - `"agent.mcp_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent: …` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the agent tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.tool_use"]` + + - `"agent.tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `class BetaManagedAgentsAgentToolResultEvent: …` + + Event representing the result of an agent tool execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `tool_use_id: str` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: Literal["agent.tool_result"]` + + - `"agent.tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent: …` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thread_context_compacted"]` + + - `"agent.thread_context_compacted"` + + - `class BetaManagedAgentsSessionErrorEvent: …` + + An error event indicating a problem occurred during session execution. + + - `id: str` + + Unique identifier for this event. + + - `error: Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError: …` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["unknown_error"]` + + - `"unknown_error"` + + - `class BetaManagedAgentsModelOverloadedError: …` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_overloaded_error"]` + + - `"model_overloaded_error"` + + - `class BetaManagedAgentsModelRateLimitedError: …` + + The model request was rate-limited. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_rate_limited_error"]` + + - `"model_rate_limited_error"` + + - `class BetaManagedAgentsModelRequestFailedError: …` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_request_failed_error"]` + + - `"model_request_failed_error"` + + - `class BetaManagedAgentsMCPConnectionFailedError: …` + + Failed to connect to an MCP server. + + - `mcp_server_name: str` + + Name of the MCP server that failed to connect. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_connection_failed_error"]` + + - `"mcp_connection_failed_error"` + + - `class BetaManagedAgentsMCPAuthenticationFailedError: …` + + Authentication to an MCP server failed. + + - `mcp_server_name: str` + + Name of the MCP server that failed authentication. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_authentication_failed_error"]` + + - `"mcp_authentication_failed_error"` + + - `class BetaManagedAgentsBillingError: …` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["billing_error"]` + + - `"billing_error"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.error"]` + + - `"session.error"` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent: …` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_rescheduled"]` + + - `"session.status_rescheduled"` + + - `class BetaManagedAgentsSessionStatusRunningEvent: …` + + Indicates the session is actively running and the agent is working. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_running"]` + + - `"session.status_running"` + + - `class BetaManagedAgentsSessionStatusIdleEvent: …` + + Indicates the agent has paused and is awaiting user input. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `stop_reason: StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn: …` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: Literal["end_turn"]` + + - `"end_turn"` + + - `class BetaManagedAgentsSessionRequiresAction: …` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: List[str]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: Literal["requires_action"]` + + - `"requires_action"` + + - `class BetaManagedAgentsSessionRetriesExhausted: …` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: Literal["retries_exhausted"]` + + - `"retries_exhausted"` + + - `type: Literal["session.status_idle"]` + + - `"session.status_idle"` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent: …` + + Indicates the session has terminated, either due to an error or completion. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_terminated"]` + + - `"session.status_terminated"` + + - `class BetaManagedAgentsSpanModelRequestStartEvent: …` + + Emitted when a model request is initiated by the agent. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_start"]` + + - `"span.model_request_start"` + + - `class BetaManagedAgentsSpanModelRequestEndEvent: …` + + Emitted when a model request completes. + + - `id: str` + + Unique identifier for this event. + + - `is_error: Optional[bool]` + + Whether the model request resulted in an error. + + - `model_request_start_id: str` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: int` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: int` + + Tokens read from prompt cache in this request. + + - `input_tokens: int` + + Input tokens consumed by this request. + + - `output_tokens: int` + + Output tokens generated by this request. + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_end"]` + + - `"span.model_request_end"` + + - `class BetaManagedAgentsSessionDeletedEvent: …` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.deleted"]` + + - `"session.deleted"` + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +for event in client.beta.sessions.events.stream( + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", +): + print(event) +``` + +## Domain Types + +### Beta Managed Agents Agent Custom Tool Use Event + +- `class BetaManagedAgentsAgentCustomToolUseEvent: …` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the custom tool being called. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.custom_tool_use"]` + + - `"agent.custom_tool_use"` + +### Beta Managed Agents Agent MCP Tool Result Event + +- `class BetaManagedAgentsAgentMCPToolResultEvent: …` + + Event representing the result of an MCP tool execution. + + - `id: str` + + Unique identifier for this event. + + - `mcp_tool_use_id: str` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_result"]` + + - `"agent.mcp_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent MCP Tool Use Event + +- `class BetaManagedAgentsAgentMCPToolUseEvent: …` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `mcp_server_name: str` + + Name of the MCP server providing the tool. + + - `name: str` + + Name of the MCP tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_use"]` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + +### Beta Managed Agents Agent Message Event + +- `class BetaManagedAgentsAgentMessageEvent: …` + + An agent response event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.message"]` + + - `"agent.message"` + +### Beta Managed Agents Agent Thinking Event + +- `class BetaManagedAgentsAgentThinkingEvent: …` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thinking"]` + + - `"agent.thinking"` + +### Beta Managed Agents Agent Thread Context Compacted Event + +- `class BetaManagedAgentsAgentThreadContextCompactedEvent: …` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thread_context_compacted"]` + + - `"agent.thread_context_compacted"` + +### Beta Managed Agents Agent Tool Result Event + +- `class BetaManagedAgentsAgentToolResultEvent: …` + + Event representing the result of an agent tool execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `tool_use_id: str` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: Literal["agent.tool_result"]` + + - `"agent.tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent Tool Use Event + +- `class BetaManagedAgentsAgentToolUseEvent: …` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the agent tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.tool_use"]` + + - `"agent.tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + +### Beta Managed Agents Base64 Document Source + +- `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + +### Beta Managed Agents Base64 Image Source + +- `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + +### Beta Managed Agents Billing Error + +- `class BetaManagedAgentsBillingError: …` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["billing_error"]` + + - `"billing_error"` + +### Beta Managed Agents Document Block + +- `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + +### Beta Managed Agents Event Params + +- `BetaManagedAgentsEventParams` + + Union type for event parameters that can be sent to a session. + + - `class BetaManagedAgentsUserMessageEventParams: …` + + Parameters for sending a user message to the session. + + - `content: List[Content]` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + + - `class BetaManagedAgentsUserInterruptEventParams: …` + + Parameters for sending an interrupt to pause the agent. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + + - `class BetaManagedAgentsUserToolConfirmationEventParams: …` + + Parameters for confirming or denying a tool execution request. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `class BetaManagedAgentsUserCustomToolResultEventParams: …` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents File Document Source + +- `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + +### Beta Managed Agents File Image Source + +- `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + +### Beta Managed Agents Image Block + +- `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + +### Beta Managed Agents MCP Authentication Failed Error + +- `class BetaManagedAgentsMCPAuthenticationFailedError: …` + + Authentication to an MCP server failed. + + - `mcp_server_name: str` + + Name of the MCP server that failed authentication. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_authentication_failed_error"]` + + - `"mcp_authentication_failed_error"` + +### Beta Managed Agents MCP Connection Failed Error + +- `class BetaManagedAgentsMCPConnectionFailedError: …` + + Failed to connect to an MCP server. + + - `mcp_server_name: str` + + Name of the MCP server that failed to connect. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_connection_failed_error"]` + + - `"mcp_connection_failed_error"` + +### Beta Managed Agents Model Overloaded Error + +- `class BetaManagedAgentsModelOverloadedError: …` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_overloaded_error"]` + + - `"model_overloaded_error"` + +### Beta Managed Agents Model Rate Limited Error + +- `class BetaManagedAgentsModelRateLimitedError: …` + + The model request was rate-limited. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_rate_limited_error"]` + + - `"model_rate_limited_error"` + +### Beta Managed Agents Model Request Failed Error + +- `class BetaManagedAgentsModelRequestFailedError: …` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_request_failed_error"]` + + - `"model_request_failed_error"` + +### Beta Managed Agents Plain Text Document Source + +- `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + +### Beta Managed Agents Retry Status Exhausted + +- `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + +### Beta Managed Agents Retry Status Retrying + +- `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + +### Beta Managed Agents Retry Status Terminal + +- `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + +### Beta Managed Agents Send Session Events + +- `class BetaManagedAgentsSendSessionEvents: …` + + Events that were successfully sent to the session. + + - `data: Optional[List[Data]]` + + Sent events + + - `class BetaManagedAgentsUserMessageEvent: …` + + A user message event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[Content]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent: …` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: str` + + Unique identifier for this event. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent: …` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: str` + + Unique identifier for this event. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent: …` + + Event sent by the client providing the result of a custom tool execution. + + - `id: str` + + Unique identifier for this event. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + +### Beta Managed Agents Session Deleted Event + +- `class BetaManagedAgentsSessionDeletedEvent: …` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.deleted"]` + + - `"session.deleted"` + +### Beta Managed Agents Session End Turn + +- `class BetaManagedAgentsSessionEndTurn: …` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: Literal["end_turn"]` + + - `"end_turn"` + +### Beta Managed Agents Session Error Event + +- `class BetaManagedAgentsSessionErrorEvent: …` + + An error event indicating a problem occurred during session execution. + + - `id: str` + + Unique identifier for this event. + + - `error: Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError: …` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["unknown_error"]` + + - `"unknown_error"` + + - `class BetaManagedAgentsModelOverloadedError: …` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_overloaded_error"]` + + - `"model_overloaded_error"` + + - `class BetaManagedAgentsModelRateLimitedError: …` + + The model request was rate-limited. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_rate_limited_error"]` + + - `"model_rate_limited_error"` + + - `class BetaManagedAgentsModelRequestFailedError: …` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_request_failed_error"]` + + - `"model_request_failed_error"` + + - `class BetaManagedAgentsMCPConnectionFailedError: …` + + Failed to connect to an MCP server. + + - `mcp_server_name: str` + + Name of the MCP server that failed to connect. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_connection_failed_error"]` + + - `"mcp_connection_failed_error"` + + - `class BetaManagedAgentsMCPAuthenticationFailedError: …` + + Authentication to an MCP server failed. + + - `mcp_server_name: str` + + Name of the MCP server that failed authentication. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_authentication_failed_error"]` + + - `"mcp_authentication_failed_error"` + + - `class BetaManagedAgentsBillingError: …` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["billing_error"]` + + - `"billing_error"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.error"]` + + - `"session.error"` + +### Beta Managed Agents Session Event + +- `BetaManagedAgentsSessionEvent` + + Union type for all event types in a session. + + - `class BetaManagedAgentsUserMessageEvent: …` + + A user message event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[Content]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent: …` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: str` + + Unique identifier for this event. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent: …` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: str` + + Unique identifier for this event. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent: …` + + Event sent by the client providing the result of a custom tool execution. + + - `id: str` + + Unique identifier for this event. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent: …` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the custom tool being called. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.custom_tool_use"]` + + - `"agent.custom_tool_use"` + + - `class BetaManagedAgentsAgentMessageEvent: …` + + An agent response event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.message"]` + + - `"agent.message"` + + - `class BetaManagedAgentsAgentThinkingEvent: …` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thinking"]` + + - `"agent.thinking"` + + - `class BetaManagedAgentsAgentMCPToolUseEvent: …` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `mcp_server_name: str` + + Name of the MCP server providing the tool. + + - `name: str` + + Name of the MCP tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_use"]` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `class BetaManagedAgentsAgentMCPToolResultEvent: …` + + Event representing the result of an MCP tool execution. + + - `id: str` + + Unique identifier for this event. + + - `mcp_tool_use_id: str` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_result"]` + + - `"agent.mcp_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent: …` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the agent tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.tool_use"]` + + - `"agent.tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `class BetaManagedAgentsAgentToolResultEvent: …` + + Event representing the result of an agent tool execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `tool_use_id: str` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: Literal["agent.tool_result"]` + + - `"agent.tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent: …` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thread_context_compacted"]` + + - `"agent.thread_context_compacted"` + + - `class BetaManagedAgentsSessionErrorEvent: …` + + An error event indicating a problem occurred during session execution. + + - `id: str` + + Unique identifier for this event. + + - `error: Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError: …` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["unknown_error"]` + + - `"unknown_error"` + + - `class BetaManagedAgentsModelOverloadedError: …` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_overloaded_error"]` + + - `"model_overloaded_error"` + + - `class BetaManagedAgentsModelRateLimitedError: …` + + The model request was rate-limited. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_rate_limited_error"]` + + - `"model_rate_limited_error"` + + - `class BetaManagedAgentsModelRequestFailedError: …` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_request_failed_error"]` + + - `"model_request_failed_error"` + + - `class BetaManagedAgentsMCPConnectionFailedError: …` + + Failed to connect to an MCP server. + + - `mcp_server_name: str` + + Name of the MCP server that failed to connect. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_connection_failed_error"]` + + - `"mcp_connection_failed_error"` + + - `class BetaManagedAgentsMCPAuthenticationFailedError: …` + + Authentication to an MCP server failed. + + - `mcp_server_name: str` + + Name of the MCP server that failed authentication. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_authentication_failed_error"]` + + - `"mcp_authentication_failed_error"` + + - `class BetaManagedAgentsBillingError: …` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["billing_error"]` + + - `"billing_error"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.error"]` + + - `"session.error"` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent: …` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_rescheduled"]` + + - `"session.status_rescheduled"` + + - `class BetaManagedAgentsSessionStatusRunningEvent: …` + + Indicates the session is actively running and the agent is working. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_running"]` + + - `"session.status_running"` + + - `class BetaManagedAgentsSessionStatusIdleEvent: …` + + Indicates the agent has paused and is awaiting user input. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `stop_reason: StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn: …` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: Literal["end_turn"]` + + - `"end_turn"` + + - `class BetaManagedAgentsSessionRequiresAction: …` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: List[str]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: Literal["requires_action"]` + + - `"requires_action"` + + - `class BetaManagedAgentsSessionRetriesExhausted: …` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: Literal["retries_exhausted"]` + + - `"retries_exhausted"` + + - `type: Literal["session.status_idle"]` + + - `"session.status_idle"` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent: …` + + Indicates the session has terminated, either due to an error or completion. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_terminated"]` + + - `"session.status_terminated"` + + - `class BetaManagedAgentsSpanModelRequestStartEvent: …` + + Emitted when a model request is initiated by the agent. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_start"]` + + - `"span.model_request_start"` + + - `class BetaManagedAgentsSpanModelRequestEndEvent: …` + + Emitted when a model request completes. + + - `id: str` + + Unique identifier for this event. + + - `is_error: Optional[bool]` + + Whether the model request resulted in an error. + + - `model_request_start_id: str` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: int` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: int` + + Tokens read from prompt cache in this request. + + - `input_tokens: int` + + Input tokens consumed by this request. + + - `output_tokens: int` + + Output tokens generated by this request. + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_end"]` + + - `"span.model_request_end"` + + - `class BetaManagedAgentsSessionDeletedEvent: …` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.deleted"]` + + - `"session.deleted"` + +### Beta Managed Agents Session Requires Action + +- `class BetaManagedAgentsSessionRequiresAction: …` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: List[str]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: Literal["requires_action"]` + + - `"requires_action"` + +### Beta Managed Agents Session Retries Exhausted + +- `class BetaManagedAgentsSessionRetriesExhausted: …` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: Literal["retries_exhausted"]` + + - `"retries_exhausted"` + +### Beta Managed Agents Session Status Idle Event + +- `class BetaManagedAgentsSessionStatusIdleEvent: …` + + Indicates the agent has paused and is awaiting user input. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `stop_reason: StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn: …` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: Literal["end_turn"]` + + - `"end_turn"` + + - `class BetaManagedAgentsSessionRequiresAction: …` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: List[str]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: Literal["requires_action"]` + + - `"requires_action"` + + - `class BetaManagedAgentsSessionRetriesExhausted: …` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: Literal["retries_exhausted"]` + + - `"retries_exhausted"` + + - `type: Literal["session.status_idle"]` + + - `"session.status_idle"` + +### Beta Managed Agents Session Status Rescheduled Event + +- `class BetaManagedAgentsSessionStatusRescheduledEvent: …` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_rescheduled"]` + + - `"session.status_rescheduled"` + +### Beta Managed Agents Session Status Running Event + +- `class BetaManagedAgentsSessionStatusRunningEvent: …` + + Indicates the session is actively running and the agent is working. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_running"]` + + - `"session.status_running"` + +### Beta Managed Agents Session Status Terminated Event + +- `class BetaManagedAgentsSessionStatusTerminatedEvent: …` + + Indicates the session has terminated, either due to an error or completion. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_terminated"]` + + - `"session.status_terminated"` + +### Beta Managed Agents Span Model Request End Event + +- `class BetaManagedAgentsSpanModelRequestEndEvent: …` + + Emitted when a model request completes. + + - `id: str` + + Unique identifier for this event. + + - `is_error: Optional[bool]` + + Whether the model request resulted in an error. + + - `model_request_start_id: str` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: int` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: int` + + Tokens read from prompt cache in this request. + + - `input_tokens: int` + + Input tokens consumed by this request. + + - `output_tokens: int` + + Output tokens generated by this request. + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_end"]` + + - `"span.model_request_end"` + +### Beta Managed Agents Span Model Request Start Event + +- `class BetaManagedAgentsSpanModelRequestStartEvent: …` + + Emitted when a model request is initiated by the agent. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_start"]` + + - `"span.model_request_start"` + +### Beta Managed Agents Span Model Usage + +- `class BetaManagedAgentsSpanModelUsage: …` + + Token usage for a single model request. + + - `cache_creation_input_tokens: int` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: int` + + Tokens read from prompt cache in this request. + + - `input_tokens: int` + + Input tokens consumed by this request. + + - `output_tokens: int` + + Output tokens generated by this request. + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +### Beta Managed Agents Stream Session Events + +- `BetaManagedAgentsStreamSessionEvents` + + Server-sent event in the session stream. + + - `class BetaManagedAgentsUserMessageEvent: …` + + A user message event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[Content]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent: …` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: str` + + Unique identifier for this event. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent: …` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: str` + + Unique identifier for this event. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent: …` + + Event sent by the client providing the result of a custom tool execution. + + - `id: str` + + Unique identifier for this event. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent: …` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the custom tool being called. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.custom_tool_use"]` + + - `"agent.custom_tool_use"` + + - `class BetaManagedAgentsAgentMessageEvent: …` + + An agent response event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.message"]` + + - `"agent.message"` + + - `class BetaManagedAgentsAgentThinkingEvent: …` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thinking"]` + + - `"agent.thinking"` + + - `class BetaManagedAgentsAgentMCPToolUseEvent: …` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `mcp_server_name: str` + + Name of the MCP server providing the tool. + + - `name: str` + + Name of the MCP tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_use"]` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `class BetaManagedAgentsAgentMCPToolResultEvent: …` + + Event representing the result of an MCP tool execution. + + - `id: str` + + Unique identifier for this event. + + - `mcp_tool_use_id: str` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_result"]` + + - `"agent.mcp_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent: …` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the agent tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.tool_use"]` + + - `"agent.tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `class BetaManagedAgentsAgentToolResultEvent: …` + + Event representing the result of an agent tool execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `tool_use_id: str` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: Literal["agent.tool_result"]` + + - `"agent.tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent: …` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thread_context_compacted"]` + + - `"agent.thread_context_compacted"` + + - `class BetaManagedAgentsSessionErrorEvent: …` + + An error event indicating a problem occurred during session execution. + + - `id: str` + + Unique identifier for this event. + + - `error: Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError: …` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["unknown_error"]` + + - `"unknown_error"` + + - `class BetaManagedAgentsModelOverloadedError: …` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_overloaded_error"]` + + - `"model_overloaded_error"` + + - `class BetaManagedAgentsModelRateLimitedError: …` + + The model request was rate-limited. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_rate_limited_error"]` + + - `"model_rate_limited_error"` + + - `class BetaManagedAgentsModelRequestFailedError: …` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_request_failed_error"]` + + - `"model_request_failed_error"` + + - `class BetaManagedAgentsMCPConnectionFailedError: …` + + Failed to connect to an MCP server. + + - `mcp_server_name: str` + + Name of the MCP server that failed to connect. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_connection_failed_error"]` + + - `"mcp_connection_failed_error"` + + - `class BetaManagedAgentsMCPAuthenticationFailedError: …` + + Authentication to an MCP server failed. + + - `mcp_server_name: str` + + Name of the MCP server that failed authentication. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_authentication_failed_error"]` + + - `"mcp_authentication_failed_error"` + + - `class BetaManagedAgentsBillingError: …` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["billing_error"]` + + - `"billing_error"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.error"]` + + - `"session.error"` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent: …` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_rescheduled"]` + + - `"session.status_rescheduled"` + + - `class BetaManagedAgentsSessionStatusRunningEvent: …` + + Indicates the session is actively running and the agent is working. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_running"]` + + - `"session.status_running"` + + - `class BetaManagedAgentsSessionStatusIdleEvent: …` + + Indicates the agent has paused and is awaiting user input. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `stop_reason: StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn: …` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: Literal["end_turn"]` + + - `"end_turn"` + + - `class BetaManagedAgentsSessionRequiresAction: …` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: List[str]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: Literal["requires_action"]` + + - `"requires_action"` + + - `class BetaManagedAgentsSessionRetriesExhausted: …` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: Literal["retries_exhausted"]` + + - `"retries_exhausted"` + + - `type: Literal["session.status_idle"]` + + - `"session.status_idle"` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent: …` + + Indicates the session has terminated, either due to an error or completion. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_terminated"]` + + - `"session.status_terminated"` + + - `class BetaManagedAgentsSpanModelRequestStartEvent: …` + + Emitted when a model request is initiated by the agent. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_start"]` + + - `"span.model_request_start"` + + - `class BetaManagedAgentsSpanModelRequestEndEvent: …` + + Emitted when a model request completes. + + - `id: str` + + Unique identifier for this event. + + - `is_error: Optional[bool]` + + Whether the model request resulted in an error. + + - `model_request_start_id: str` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: int` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: int` + + Tokens read from prompt cache in this request. + + - `input_tokens: int` + + Input tokens consumed by this request. + + - `output_tokens: int` + + Output tokens generated by this request. + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_end"]` + + - `"span.model_request_end"` + + - `class BetaManagedAgentsSessionDeletedEvent: …` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.deleted"]` + + - `"session.deleted"` + +### Beta Managed Agents Text Block + +- `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + +### Beta Managed Agents Unknown Error + +- `class BetaManagedAgentsUnknownError: …` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["unknown_error"]` + + - `"unknown_error"` + +### Beta Managed Agents URL Document Source + +- `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + +### Beta Managed Agents URL Image Source + +- `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + +### Beta Managed Agents User Custom Tool Result Event + +- `class BetaManagedAgentsUserCustomToolResultEvent: …` + + Event sent by the client providing the result of a custom tool execution. + + - `id: str` + + Unique identifier for this event. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Custom Tool Result Event Params + +- `class BetaManagedAgentsUserCustomToolResultEventParams: …` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents User Interrupt Event + +- `class BetaManagedAgentsUserInterruptEvent: …` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: str` + + Unique identifier for this event. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Interrupt Event Params + +- `class BetaManagedAgentsUserInterruptEventParams: …` + + Parameters for sending an interrupt to pause the agent. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + +### Beta Managed Agents User Message Event + +- `class BetaManagedAgentsUserMessageEvent: …` + + A user message event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[Content]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Message Event Params + +- `class BetaManagedAgentsUserMessageEventParams: …` + + Parameters for sending a user message to the session. + + - `content: List[Content]` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + +### Beta Managed Agents User Tool Confirmation Event + +- `class BetaManagedAgentsUserToolConfirmationEvent: …` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: str` + + Unique identifier for this event. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Tool Confirmation Event Params + +- `class BetaManagedAgentsUserToolConfirmationEventParams: …` + + Parameters for confirming or denying a tool execution request. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + +# Resources + +## Add + +`beta.sessions.resources.add(strsession_id, ResourceAddParams**kwargs) -> BetaManagedAgentsFileResource` + +**post** `/v1/sessions/{session_id}/resources` + +Add Session Resource + +### Parameters + +- `session_id: str` + +- `file_id: str` + + ID of a previously uploaded file. + +- `type: Literal["file"]` + + - `"file"` + +- `mount_path: Optional[str]` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_file_resource = client.beta.sessions.resources.add( + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", + file_id="file_011CNha8iCJcU1wXNR6q4V8w", + type="file", +) +print(beta_managed_agents_file_resource.id) +``` + +## List + +`beta.sessions.resources.list(strsession_id, ResourceListParams**kwargs) -> SyncPageCursor[BetaManagedAgentsSessionResource]` + +**get** `/v1/sessions/{session_id}/resources` + +List Session Resources + +### Parameters + +- `session_id: str` + +- `limit: Optional[int]` + + Maximum number of resources to return per page (max 1000). If omitted, returns all resources. + +- `page: Optional[str]` + + Opaque cursor from a previous response's next_page field. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSessionResource` + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +page = client.beta.sessions.resources.list( + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", +) +page = page.data[0] +print(page) +``` + +## Retrieve + +`beta.sessions.resources.retrieve(strresource_id, ResourceRetrieveParams**kwargs) -> ResourceRetrieveResponse` + +**get** `/v1/sessions/{session_id}/resources/{resource_id}` + +Get Session Resource + +### Parameters + +- `session_id: str` + +- `resource_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `ResourceRetrieveResponse` + + The requested session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +resource = client.beta.sessions.resources.retrieve( + resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht", + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", +) +print(resource) +``` + +## Update + +`beta.sessions.resources.update(strresource_id, ResourceUpdateParams**kwargs) -> ResourceUpdateResponse` + +**post** `/v1/sessions/{session_id}/resources/{resource_id}` + +Update Session Resource + +### Parameters + +- `session_id: str` + +- `resource_id: str` + +- `authorization_token: str` + + New authorization token for the resource. Currently only `github_repository` resources support token rotation. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `ResourceUpdateResponse` + + The updated session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +resource = client.beta.sessions.resources.update( + resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht", + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", + authorization_token="ghp_exampletoken", +) +print(resource) +``` + +## Delete + +`beta.sessions.resources.delete(strresource_id, ResourceDeleteParams**kwargs) -> BetaManagedAgentsDeleteSessionResource` + +**delete** `/v1/sessions/{session_id}/resources/{resource_id}` + +Delete Session Resource + +### Parameters + +- `session_id: str` + +- `resource_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsDeleteSessionResource: …` + + Confirmation of resource deletion. + + - `id: str` + + - `type: Literal["session_resource_deleted"]` + + - `"session_resource_deleted"` + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_delete_session_resource = client.beta.sessions.resources.delete( + resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht", + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", +) +print(beta_managed_agents_delete_session_resource.id) +``` + +## Domain Types + +### Beta Managed Agents Delete Session Resource + +- `class BetaManagedAgentsDeleteSessionResource: …` + + Confirmation of resource deletion. + + - `id: str` + + - `type: Literal["session_resource_deleted"]` + + - `"session_resource_deleted"` + +### Beta Managed Agents File Resource + +- `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Beta Managed Agents GitHub Repository Resource + +- `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + +### Beta Managed Agents Session Resource + +- `BetaManagedAgentsSessionResource` + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Resource Retrieve Response + +- `ResourceRetrieveResponse` + + The requested session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Resource Update Response + +- `ResourceUpdateResponse` + + The updated session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +# Vaults + +## Create + +`beta.vaults.create(VaultCreateParams**kwargs) -> BetaManagedAgentsVault` + +**post** `/v1/vaults` + +Create Vault + +### Parameters + +- `display_name: str` + + Human-readable name for the vault. 1-255 characters. + +- `metadata: Optional[Dict[str, str]]` + + Arbitrary key-value metadata to attach to the vault. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsVault: …` + + A vault that stores credentials for use by agents during sessions. + + - `id: str` + + Unique identifier for the vault. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `display_name: str` + + Human-readable name for the vault. + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the vault. + + - `type: Literal["vault"]` + + - `"vault"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_vault = client.beta.vaults.create( + display_name="Example vault", +) +print(beta_managed_agents_vault.id) +``` + +## List + +`beta.vaults.list(VaultListParams**kwargs) -> SyncPageCursor[BetaManagedAgentsVault]` + +**get** `/v1/vaults` + +List Vaults + +### Parameters + +- `include_archived: Optional[bool]` + + Whether to include archived vaults in the results. + +- `limit: Optional[int]` + + Maximum number of vaults to return per page. Defaults to 20, maximum 100. + +- `page: Optional[str]` + + Opaque pagination token from a previous `list_vaults` response. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsVault: …` + + A vault that stores credentials for use by agents during sessions. + + - `id: str` + + Unique identifier for the vault. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `display_name: str` + + Human-readable name for the vault. + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the vault. + + - `type: Literal["vault"]` + + - `"vault"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +page = client.beta.vaults.list() +page = page.data[0] +print(page.id) +``` + +## Retrieve + +`beta.vaults.retrieve(strvault_id, VaultRetrieveParams**kwargs) -> BetaManagedAgentsVault` + +**get** `/v1/vaults/{vault_id}` + +Get Vault + +### Parameters + +- `vault_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsVault: …` + + A vault that stores credentials for use by agents during sessions. + + - `id: str` + + Unique identifier for the vault. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `display_name: str` + + Human-readable name for the vault. + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the vault. + + - `type: Literal["vault"]` + + - `"vault"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_vault = client.beta.vaults.retrieve( + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", +) +print(beta_managed_agents_vault.id) +``` + +## Update + +`beta.vaults.update(strvault_id, VaultUpdateParams**kwargs) -> BetaManagedAgentsVault` + +**post** `/v1/vaults/{vault_id}` + +Update Vault + +### Parameters + +- `vault_id: str` + +- `display_name: Optional[str]` + + Updated human-readable name for the vault. 1-255 characters. + +- `metadata: Optional[Dict[str, Optional[str]]]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsVault: …` + + A vault that stores credentials for use by agents during sessions. + + - `id: str` + + Unique identifier for the vault. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `display_name: str` + + Human-readable name for the vault. + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the vault. + + - `type: Literal["vault"]` + + - `"vault"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_vault = client.beta.vaults.update( + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", +) +print(beta_managed_agents_vault.id) +``` + +## Delete + +`beta.vaults.delete(strvault_id, VaultDeleteParams**kwargs) -> BetaManagedAgentsDeletedVault` + +**delete** `/v1/vaults/{vault_id}` + +Delete Vault + +### Parameters + +- `vault_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsDeletedVault: …` + + Confirmation of a deleted vault. + + - `id: str` + + Unique identifier of the deleted vault. + + - `type: Literal["vault_deleted"]` + + - `"vault_deleted"` + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_deleted_vault = client.beta.vaults.delete( + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", +) +print(beta_managed_agents_deleted_vault.id) +``` + +## Archive + +`beta.vaults.archive(strvault_id, VaultArchiveParams**kwargs) -> BetaManagedAgentsVault` + +**post** `/v1/vaults/{vault_id}/archive` + +Archive Vault + +### Parameters + +- `vault_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsVault: …` + + A vault that stores credentials for use by agents during sessions. + + - `id: str` + + Unique identifier for the vault. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `display_name: str` + + Human-readable name for the vault. + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the vault. + + - `type: Literal["vault"]` + + - `"vault"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_vault = client.beta.vaults.archive( + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", +) +print(beta_managed_agents_vault.id) +``` + +## Domain Types + +### Beta Managed Agents Deleted Vault + +- `class BetaManagedAgentsDeletedVault: …` + + Confirmation of a deleted vault. + + - `id: str` + + Unique identifier of the deleted vault. + + - `type: Literal["vault_deleted"]` + + - `"vault_deleted"` + +### Beta Managed Agents Vault + +- `class BetaManagedAgentsVault: …` + + A vault that stores credentials for use by agents during sessions. + + - `id: str` + + Unique identifier for the vault. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `display_name: str` + + Human-readable name for the vault. + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the vault. + + - `type: Literal["vault"]` + + - `"vault"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +# Credentials + +## Create + +`beta.vaults.credentials.create(strvault_id, CredentialCreateParams**kwargs) -> BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials` + +Create Credential + +### Parameters + +- `vault_id: str` + +- `auth: Auth` + + Authentication details for creating a credential. + + - `class BetaManagedAgentsMCPOAuthCreateParams: …` + + Parameters for creating an MCP OAuth credential. + + - `access_token: str` + + OAuth access token. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshParams]` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: str` + + OAuth client ID. + + - `refresh_token: str` + + OAuth refresh token. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: str` + + OAuth client secret. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam: …` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: str` + + OAuth client secret. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerCreateParams: …` + + Parameters for creating a static bearer token credential. + + - `token: str` + + Static bearer token value. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + +- `display_name: Optional[str]` + + Human-readable name for the credential. Up to 255 characters. + +- `metadata: Optional[Dict[str, str]]` + + Arbitrary key-value metadata to attach to the credential. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential: …` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: str` + + Unique identifier for the credential. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `auth: Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse: …` + + OAuth credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshResponse]` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: str` + + OAuth client ID. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse: …` + + Token endpoint uses POST body authentication with client credentials. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse: …` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the credential. + + - `type: Literal["vault_credential"]` + + - `"vault_credential"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `vault_id: str` + + Identifier of the vault this credential belongs to. + + - `display_name: Optional[str]` + + Human-readable name for the credential. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_credential = client.beta.vaults.credentials.create( + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", + auth={ + "token": "bearer_exampletoken", + "mcp_server_url": "https://example-server.modelcontextprotocol.io/sse", + "type": "static_bearer", + }, +) +print(beta_managed_agents_credential.id) +``` + +## List + +`beta.vaults.credentials.list(strvault_id, CredentialListParams**kwargs) -> SyncPageCursor[BetaManagedAgentsCredential]` + +**get** `/v1/vaults/{vault_id}/credentials` + +List Credentials + +### Parameters + +- `vault_id: str` + +- `include_archived: Optional[bool]` + + Whether to include archived credentials in the results. + +- `limit: Optional[int]` + + Maximum number of credentials to return per page. Defaults to 20, maximum 100. + +- `page: Optional[str]` + + Opaque pagination token from a previous `list_credentials` response. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential: …` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: str` + + Unique identifier for the credential. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `auth: Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse: …` + + OAuth credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshResponse]` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: str` + + OAuth client ID. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse: …` + + Token endpoint uses POST body authentication with client credentials. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse: …` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the credential. + + - `type: Literal["vault_credential"]` + + - `"vault_credential"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `vault_id: str` + + Identifier of the vault this credential belongs to. + + - `display_name: Optional[str]` + + Human-readable name for the credential. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +page = client.beta.vaults.credentials.list( + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", +) +page = page.data[0] +print(page.id) +``` + +## Retrieve + +`beta.vaults.credentials.retrieve(strcredential_id, CredentialRetrieveParams**kwargs) -> BetaManagedAgentsCredential` + +**get** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Get Credential + +### Parameters + +- `vault_id: str` + +- `credential_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential: …` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: str` + + Unique identifier for the credential. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `auth: Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse: …` + + OAuth credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshResponse]` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: str` + + OAuth client ID. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse: …` + + Token endpoint uses POST body authentication with client credentials. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse: …` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the credential. + + - `type: Literal["vault_credential"]` + + - `"vault_credential"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `vault_id: str` + + Identifier of the vault this credential belongs to. + + - `display_name: Optional[str]` + + Human-readable name for the credential. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_credential = client.beta.vaults.credentials.retrieve( + credential_id="vcrd_011CZkZEMt8gZan2iYOQfSkw", + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", +) +print(beta_managed_agents_credential.id) +``` + +## Update + +`beta.vaults.credentials.update(strcredential_id, CredentialUpdateParams**kwargs) -> BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Update Credential + +### Parameters + +- `vault_id: str` + +- `credential_id: str` + +- `auth: Optional[Auth]` + + Updated authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthUpdateParams: …` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `access_token: Optional[str]` + + Updated OAuth access token. + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshUpdateParams]` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: Optional[str]` + + Updated OAuth refresh token. + + - `scope: Optional[str]` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: Optional[TokenEndpointAuth]` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam: …` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `client_secret: Optional[str]` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam: …` + + Updated POST body authentication parameters for the token endpoint. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `client_secret: Optional[str]` + + Updated OAuth client secret. + + - `class BetaManagedAgentsStaticBearerUpdateParams: …` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + + - `token: Optional[str]` + + Updated static bearer token value. + +- `display_name: Optional[str]` + + Updated human-readable name for the credential. 1-255 characters. + +- `metadata: Optional[Dict[str, Optional[str]]]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential: …` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: str` + + Unique identifier for the credential. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `auth: Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse: …` + + OAuth credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshResponse]` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: str` + + OAuth client ID. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse: …` + + Token endpoint uses POST body authentication with client credentials. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse: …` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the credential. + + - `type: Literal["vault_credential"]` + + - `"vault_credential"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `vault_id: str` + + Identifier of the vault this credential belongs to. + + - `display_name: Optional[str]` + + Human-readable name for the credential. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_credential = client.beta.vaults.credentials.update( + credential_id="vcrd_011CZkZEMt8gZan2iYOQfSkw", + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", +) +print(beta_managed_agents_credential.id) +``` + +## Delete + +`beta.vaults.credentials.delete(strcredential_id, CredentialDeleteParams**kwargs) -> BetaManagedAgentsDeletedCredential` + +**delete** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Delete Credential + +### Parameters + +- `vault_id: str` + +- `credential_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsDeletedCredential: …` + + Confirmation of a deleted credential. + + - `id: str` + + Unique identifier of the deleted credential. + + - `type: Literal["vault_credential_deleted"]` + + - `"vault_credential_deleted"` + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_deleted_credential = client.beta.vaults.credentials.delete( + credential_id="vcrd_011CZkZEMt8gZan2iYOQfSkw", + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", +) +print(beta_managed_agents_deleted_credential.id) +``` + +## Archive + +`beta.vaults.credentials.archive(strcredential_id, CredentialArchiveParams**kwargs) -> BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}/archive` + +Archive Credential + +### Parameters + +- `vault_id: str` + +- `credential_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential: …` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: str` + + Unique identifier for the credential. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `auth: Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse: …` + + OAuth credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshResponse]` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: str` + + OAuth client ID. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse: …` + + Token endpoint uses POST body authentication with client credentials. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse: …` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the credential. + + - `type: Literal["vault_credential"]` + + - `"vault_credential"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `vault_id: str` + + Identifier of the vault this credential belongs to. + + - `display_name: Optional[str]` + + Human-readable name for the credential. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_credential = client.beta.vaults.credentials.archive( + credential_id="vcrd_011CZkZEMt8gZan2iYOQfSkw", + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", +) +print(beta_managed_agents_credential.id) +``` + +## Domain Types + +### Beta Managed Agents Credential + +- `class BetaManagedAgentsCredential: …` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: str` + + Unique identifier for the credential. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `auth: Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse: …` + + OAuth credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshResponse]` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: str` + + OAuth client ID. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse: …` + + Token endpoint uses POST body authentication with client credentials. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse: …` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the credential. + + - `type: Literal["vault_credential"]` + + - `"vault_credential"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `vault_id: str` + + Identifier of the vault this credential belongs to. + + - `display_name: Optional[str]` + + Human-readable name for the credential. + +### Beta Managed Agents Deleted Credential + +- `class BetaManagedAgentsDeletedCredential: …` + + Confirmation of a deleted credential. + + - `id: str` + + Unique identifier of the deleted credential. + + - `type: Literal["vault_credential_deleted"]` + + - `"vault_credential_deleted"` + +### Beta Managed Agents MCP OAuth Auth Response + +- `class BetaManagedAgentsMCPOAuthAuthResponse: …` + + OAuth credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshResponse]` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: str` + + OAuth client ID. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse: …` + + Token endpoint uses POST body authentication with client credentials. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Create Params + +- `class BetaManagedAgentsMCPOAuthCreateParams: …` + + Parameters for creating an MCP OAuth credential. + + - `access_token: str` + + OAuth access token. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshParams]` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: str` + + OAuth client ID. + + - `refresh_token: str` + + OAuth refresh token. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: str` + + OAuth client secret. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam: …` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: str` + + OAuth client secret. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Params + +- `class BetaManagedAgentsMCPOAuthRefreshParams: …` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: str` + + OAuth client ID. + + - `refresh_token: str` + + OAuth refresh token. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: str` + + OAuth client secret. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam: …` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: str` + + OAuth client secret. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Response + +- `class BetaManagedAgentsMCPOAuthRefreshResponse: …` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: str` + + OAuth client ID. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse: …` + + Token endpoint uses POST body authentication with client credentials. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Update Params + +- `class BetaManagedAgentsMCPOAuthRefreshUpdateParams: …` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: Optional[str]` + + Updated OAuth refresh token. + + - `scope: Optional[str]` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: Optional[TokenEndpointAuth]` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam: …` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `client_secret: Optional[str]` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam: …` + + Updated POST body authentication parameters for the token endpoint. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `client_secret: Optional[str]` + + Updated OAuth client secret. + +### Beta Managed Agents MCP OAuth Update Params + +- `class BetaManagedAgentsMCPOAuthUpdateParams: …` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `access_token: Optional[str]` + + Updated OAuth access token. + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshUpdateParams]` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: Optional[str]` + + Updated OAuth refresh token. + + - `scope: Optional[str]` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: Optional[TokenEndpointAuth]` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam: …` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `client_secret: Optional[str]` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam: …` + + Updated POST body authentication parameters for the token endpoint. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `client_secret: Optional[str]` + + Updated OAuth client secret. + +### Beta Managed Agents Static Bearer Auth Response + +- `class BetaManagedAgentsStaticBearerAuthResponse: …` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + +### Beta Managed Agents Static Bearer Create Params + +- `class BetaManagedAgentsStaticBearerCreateParams: …` + + Parameters for creating a static bearer token credential. + + - `token: str` + + Static bearer token value. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + +### Beta Managed Agents Static Bearer Update Params + +- `class BetaManagedAgentsStaticBearerUpdateParams: …` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + + - `token: Optional[str]` + + Updated static bearer token value. + +### Beta Managed Agents Token Endpoint Auth Basic Param + +- `class BetaManagedAgentsTokenEndpointAuthBasicParam: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: str` + + OAuth client secret. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + +### Beta Managed Agents Token Endpoint Auth Basic Response + +- `class BetaManagedAgentsTokenEndpointAuthBasicResponse: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + +### Beta Managed Agents Token Endpoint Auth Basic Update Param + +- `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam: …` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `client_secret: Optional[str]` + + Updated OAuth client secret. + +### Beta Managed Agents Token Endpoint Auth None Param + +- `class BetaManagedAgentsTokenEndpointAuthNoneParam: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + +### Beta Managed Agents Token Endpoint Auth None Response + +- `class BetaManagedAgentsTokenEndpointAuthNoneResponse: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + +### Beta Managed Agents Token Endpoint Auth Post Param + +- `class BetaManagedAgentsTokenEndpointAuthPostParam: …` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: str` + + OAuth client secret. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + +### Beta Managed Agents Token Endpoint Auth Post Response + +- `class BetaManagedAgentsTokenEndpointAuthPostResponse: …` + + Token endpoint uses POST body authentication with client credentials. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + +### Beta Managed Agents Token Endpoint Auth Post Update Param + +- `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam: …` + + Updated POST body authentication parameters for the token endpoint. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `client_secret: Optional[str]` + + Updated OAuth client secret. + +# Files + +## Upload + +`beta.files.upload(FileUploadParams**kwargs) -> FileMetadata` + +**post** `/v1/files` + +Upload File + +### Parameters + +- `file: FileTypes` + + The file to upload + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` ### Returns @@ -45649,6 +68799,20 @@ Upload File Whether the file can be downloaded. + - `scope: Optional[BetaFileScope]` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: str` + + The ID of the scoping resource (e.g., the session ID). + + - `type: Literal["session"]` + + The type of scope (e.g., `"session"`). + + - `"session"` + ### Example ```python @@ -45688,13 +68852,17 @@ List Files Defaults to `20`. Ranges from `1` to `1000`. +- `scope_id: Optional[str]` + + Filter by scope ID. Only returns files associated with the specified scope (e.g., a session ID). + - `betas: Optional[List[AnthropicBetaParam]]` Optional header to specify the beta version(s) you want to use. - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -45738,8 +68906,6 @@ List Files - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class FileMetadata: …` @@ -45778,6 +68944,20 @@ List Files Whether the file can be downloaded. + - `scope: Optional[BetaFileScope]` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: str` + + The ID of the scoping resource (e.g., the session ID). + + - `type: Literal["session"]` + + The type of scope (e.g., `"session"`). + + - `"session"` + ### Example ```python @@ -45812,7 +68992,7 @@ Download File - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -45856,8 +69036,6 @@ Download File - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BinaryResponseContent` @@ -45899,7 +69077,7 @@ Get File Metadata - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -45943,8 +69121,6 @@ Get File Metadata - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class FileMetadata: …` @@ -45983,6 +69159,20 @@ Get File Metadata Whether the file can be downloaded. + - `scope: Optional[BetaFileScope]` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: str` + + The ID of the scoping resource (e.g., the session ID). + + - `type: Literal["session"]` + + The type of scope (e.g., `"session"`). + + - `"session"` + ### Example ```python @@ -46018,7 +69208,7 @@ Delete File - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -46062,8 +69252,6 @@ Delete File - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class DeletedFile: …` @@ -46097,6 +69285,20 @@ print(deleted_file.id) ## Domain Types +### Beta File Scope + +- `class BetaFileScope: …` + + - `id: str` + + The ID of the scoping resource (e.g., the session ID). + + - `type: Literal["session"]` + + The type of scope (e.g., `"session"`). + + - `"session"` + ### Deleted File - `class DeletedFile: …` @@ -46151,6 +69353,20 @@ print(deleted_file.id) Whether the file can be downloaded. + - `scope: Optional[BetaFileScope]` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: str` + + The ID of the scoping resource (e.g., the session ID). + + - `type: Literal["session"]` + + The type of scope (e.g., `"session"`). + + - `"session"` + # Skills ## Create @@ -46181,7 +69397,7 @@ Create Skill - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -46225,8 +69441,6 @@ Create Skill - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class SkillCreateResponse: …` @@ -46322,7 +69536,7 @@ List Skills - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -46366,8 +69580,6 @@ List Skills - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class SkillListResponse: …` @@ -46449,7 +69661,7 @@ Get Skill - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -46493,8 +69705,6 @@ Get Skill - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class SkillRetrieveResponse: …` @@ -46577,7 +69787,7 @@ Delete Skill - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -46621,8 +69831,6 @@ Delete Skill - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class SkillDeleteResponse: …` @@ -46837,7 +70045,7 @@ Create Skill Version - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -46881,8 +70089,6 @@ Create Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class VersionCreateResponse: …` @@ -46978,7 +70184,7 @@ List Skill Versions - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -47022,8 +70228,6 @@ List Skill Versions - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class VersionListResponse: …` @@ -47116,7 +70320,7 @@ Get Skill Version - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -47160,8 +70364,6 @@ Get Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class VersionRetrieveResponse: …` @@ -47254,7 +70456,7 @@ Delete Skill Version - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -47298,8 +70500,6 @@ Delete Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class VersionDeleteResponse: …` @@ -47493,573 +70693,3 @@ print(version.id) Deleted object type. For Skill Versions, this is always `"skill_version_deleted"`. - -# User Profiles - -## Create - -`beta.user_profiles.create(UserProfileCreateParams**kwargs) -> BetaUserProfile` - -**post** `/v1/user_profiles` - -Create User Profile - -### Parameters - -- `external_id: Optional[str]` - -- `metadata: Optional[Dict[str, str]]` - - Free-form key-value data to attach to this user profile. Maximum 16 keys, with keys up to 64 characters and values up to 512 characters. Values must be non-empty strings. - -- `betas: Optional[List[AnthropicBetaParam]]` - - Optional header to specify the beta version(s) you want to use. - - - `str` - - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` - - - `"message-batches-2024-09-24"` - - - `"prompt-caching-2024-07-31"` - - - `"computer-use-2024-10-22"` - - - `"computer-use-2025-01-24"` - - - `"pdfs-2024-09-25"` - - - `"token-counting-2024-11-01"` - - - `"token-efficient-tools-2025-02-19"` - - - `"output-128k-2025-02-19"` - - - `"files-api-2025-04-14"` - - - `"mcp-client-2025-04-04"` - - - `"mcp-client-2025-11-20"` - - - `"dev-full-thinking-2025-05-14"` - - - `"interleaved-thinking-2025-05-14"` - - - `"code-execution-2025-05-22"` - - - `"extended-cache-ttl-2025-04-11"` - - - `"context-1m-2025-08-07"` - - - `"context-management-2025-06-27"` - - - `"model-context-window-exceeded-2025-08-26"` - - - `"skills-2025-10-02"` - - - `"fast-mode-2026-02-01"` - - - `"output-300k-2026-03-24"` - - - `"user-profiles-2026-03-24"` - -### Returns - -- `class BetaUserProfile: …` - - - `id: str` - - - `created_at: datetime` - - A timestamp in RFC 3339 format - - - `metadata: Dict[str, str]` - - - `trust_grants: Dict[str, BetaUserProfileTrustGrant]` - - - `status: str` - - - `type: str` - - - `updated_at: datetime` - - A timestamp in RFC 3339 format - - - `external_id: Optional[str]` - -### Example - -```python -import os -from anthropic import Anthropic - -client = Anthropic( - api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted -) -beta_user_profile = client.beta.user_profiles.create() -print(beta_user_profile.id) -``` - -## List - -`beta.user_profiles.list(UserProfileListParams**kwargs) -> SyncPageCursorV2[BetaUserProfile]` - -**get** `/v1/user_profiles` - -List User Profiles - -### Parameters - -- `limit: Optional[int]` - - Query parameter for limit - -- `order: Optional[Literal["asc", "desc"]]` - - Query parameter for order - - - `"asc"` - - - `"desc"` - -- `page: Optional[str]` - - Query parameter for page - -- `betas: Optional[List[AnthropicBetaParam]]` - - Optional header to specify the beta version(s) you want to use. - - - `str` - - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` - - - `"message-batches-2024-09-24"` - - - `"prompt-caching-2024-07-31"` - - - `"computer-use-2024-10-22"` - - - `"computer-use-2025-01-24"` - - - `"pdfs-2024-09-25"` - - - `"token-counting-2024-11-01"` - - - `"token-efficient-tools-2025-02-19"` - - - `"output-128k-2025-02-19"` - - - `"files-api-2025-04-14"` - - - `"mcp-client-2025-04-04"` - - - `"mcp-client-2025-11-20"` - - - `"dev-full-thinking-2025-05-14"` - - - `"interleaved-thinking-2025-05-14"` - - - `"code-execution-2025-05-22"` - - - `"extended-cache-ttl-2025-04-11"` - - - `"context-1m-2025-08-07"` - - - `"context-management-2025-06-27"` - - - `"model-context-window-exceeded-2025-08-26"` - - - `"skills-2025-10-02"` - - - `"fast-mode-2026-02-01"` - - - `"output-300k-2026-03-24"` - - - `"user-profiles-2026-03-24"` - -### Returns - -- `class BetaUserProfile: …` - - - `id: str` - - - `created_at: datetime` - - A timestamp in RFC 3339 format - - - `metadata: Dict[str, str]` - - - `trust_grants: Dict[str, BetaUserProfileTrustGrant]` - - - `status: str` - - - `type: str` - - - `updated_at: datetime` - - A timestamp in RFC 3339 format - - - `external_id: Optional[str]` - -### Example - -```python -import os -from anthropic import Anthropic - -client = Anthropic( - api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted -) -page = client.beta.user_profiles.list() -page = page.data[0] -print(page.id) -``` - -## Retrieve - -`beta.user_profiles.retrieve(strid, UserProfileRetrieveParams**kwargs) -> BetaUserProfile` - -**get** `/v1/user_profiles/{id}` - -Get User Profile - -### Parameters - -- `id: str` - -- `betas: Optional[List[AnthropicBetaParam]]` - - Optional header to specify the beta version(s) you want to use. - - - `str` - - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` - - - `"message-batches-2024-09-24"` - - - `"prompt-caching-2024-07-31"` - - - `"computer-use-2024-10-22"` - - - `"computer-use-2025-01-24"` - - - `"pdfs-2024-09-25"` - - - `"token-counting-2024-11-01"` - - - `"token-efficient-tools-2025-02-19"` - - - `"output-128k-2025-02-19"` - - - `"files-api-2025-04-14"` - - - `"mcp-client-2025-04-04"` - - - `"mcp-client-2025-11-20"` - - - `"dev-full-thinking-2025-05-14"` - - - `"interleaved-thinking-2025-05-14"` - - - `"code-execution-2025-05-22"` - - - `"extended-cache-ttl-2025-04-11"` - - - `"context-1m-2025-08-07"` - - - `"context-management-2025-06-27"` - - - `"model-context-window-exceeded-2025-08-26"` - - - `"skills-2025-10-02"` - - - `"fast-mode-2026-02-01"` - - - `"output-300k-2026-03-24"` - - - `"user-profiles-2026-03-24"` - -### Returns - -- `class BetaUserProfile: …` - - - `id: str` - - - `created_at: datetime` - - A timestamp in RFC 3339 format - - - `metadata: Dict[str, str]` - - - `trust_grants: Dict[str, BetaUserProfileTrustGrant]` - - - `status: str` - - - `type: str` - - - `updated_at: datetime` - - A timestamp in RFC 3339 format - - - `external_id: Optional[str]` - -### Example - -```python -import os -from anthropic import Anthropic - -client = Anthropic( - api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted -) -beta_user_profile = client.beta.user_profiles.retrieve( - id="id", -) -print(beta_user_profile.id) -``` - -## Update - -`beta.user_profiles.update(strid, UserProfileUpdateParams**kwargs) -> BetaUserProfile` - -**post** `/v1/user_profiles/{id}` - -Update User Profile - -### Parameters - -- `id: str` - -- `external_id: Optional[str]` - -- `metadata: Optional[Dict[str, str]]` - - Key-value pairs to merge into the stored metadata. Keys provided overwrite existing values. To remove a key, set its value to an empty string. Keys not provided are left unchanged. Maximum 16 keys, with keys up to 64 characters and values up to 512 characters. - -- `betas: Optional[List[AnthropicBetaParam]]` - - Optional header to specify the beta version(s) you want to use. - - - `str` - - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` - - - `"message-batches-2024-09-24"` - - - `"prompt-caching-2024-07-31"` - - - `"computer-use-2024-10-22"` - - - `"computer-use-2025-01-24"` - - - `"pdfs-2024-09-25"` - - - `"token-counting-2024-11-01"` - - - `"token-efficient-tools-2025-02-19"` - - - `"output-128k-2025-02-19"` - - - `"files-api-2025-04-14"` - - - `"mcp-client-2025-04-04"` - - - `"mcp-client-2025-11-20"` - - - `"dev-full-thinking-2025-05-14"` - - - `"interleaved-thinking-2025-05-14"` - - - `"code-execution-2025-05-22"` - - - `"extended-cache-ttl-2025-04-11"` - - - `"context-1m-2025-08-07"` - - - `"context-management-2025-06-27"` - - - `"model-context-window-exceeded-2025-08-26"` - - - `"skills-2025-10-02"` - - - `"fast-mode-2026-02-01"` - - - `"output-300k-2026-03-24"` - - - `"user-profiles-2026-03-24"` - -### Returns - -- `class BetaUserProfile: …` - - - `id: str` - - - `created_at: datetime` - - A timestamp in RFC 3339 format - - - `metadata: Dict[str, str]` - - - `trust_grants: Dict[str, BetaUserProfileTrustGrant]` - - - `status: str` - - - `type: str` - - - `updated_at: datetime` - - A timestamp in RFC 3339 format - - - `external_id: Optional[str]` - -### Example - -```python -import os -from anthropic import Anthropic - -client = Anthropic( - api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted -) -beta_user_profile = client.beta.user_profiles.update( - id="id", -) -print(beta_user_profile.id) -``` - -## Create Enrollment URL - -`beta.user_profiles.create_enrollment_url(strid, UserProfileCreateEnrollmentURLParams**kwargs) -> BetaUserProfileEnrollmentURL` - -**post** `/v1/user_profiles/{id}/enrollment_url` - -Create Enrollment URL - -### Parameters - -- `id: str` - -- `betas: Optional[List[AnthropicBetaParam]]` - - Optional header to specify the beta version(s) you want to use. - - - `str` - - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` - - - `"message-batches-2024-09-24"` - - - `"prompt-caching-2024-07-31"` - - - `"computer-use-2024-10-22"` - - - `"computer-use-2025-01-24"` - - - `"pdfs-2024-09-25"` - - - `"token-counting-2024-11-01"` - - - `"token-efficient-tools-2025-02-19"` - - - `"output-128k-2025-02-19"` - - - `"files-api-2025-04-14"` - - - `"mcp-client-2025-04-04"` - - - `"mcp-client-2025-11-20"` - - - `"dev-full-thinking-2025-05-14"` - - - `"interleaved-thinking-2025-05-14"` - - - `"code-execution-2025-05-22"` - - - `"extended-cache-ttl-2025-04-11"` - - - `"context-1m-2025-08-07"` - - - `"context-management-2025-06-27"` - - - `"model-context-window-exceeded-2025-08-26"` - - - `"skills-2025-10-02"` - - - `"fast-mode-2026-02-01"` - - - `"output-300k-2026-03-24"` - - - `"user-profiles-2026-03-24"` - -### Returns - -- `class BetaUserProfileEnrollmentURL: …` - - - `expires_at: datetime` - - A timestamp in RFC 3339 format - - - `type: str` - - - `url: str` - -### Example - -```python -import os -from anthropic import Anthropic - -client = Anthropic( - api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted -) -beta_user_profile_enrollment_url = client.beta.user_profiles.create_enrollment_url( - id="id", -) -print(beta_user_profile_enrollment_url.expires_at) -``` - -## Domain Types - -### Beta User Profile - -- `class BetaUserProfile: …` - - - `id: str` - - - `created_at: datetime` - - A timestamp in RFC 3339 format - - - `metadata: Dict[str, str]` - - - `trust_grants: Dict[str, BetaUserProfileTrustGrant]` - - - `status: str` - - - `type: str` - - - `updated_at: datetime` - - A timestamp in RFC 3339 format - - - `external_id: Optional[str]` - -### Beta User Profile Enrollment URL - -- `class BetaUserProfileEnrollmentURL: …` - - - `expires_at: datetime` - - A timestamp in RFC 3339 format - - - `type: str` - - - `url: str` - -### Beta User Profile Trust Grant - -- `class BetaUserProfileTrustGrant: …` - - - `status: str` diff --git a/content/en/api/python/beta/agents.md b/content/en/api/python/beta/agents.md new file mode 100644 index 000000000..8efc76839 --- /dev/null +++ b/content/en/api/python/beta/agents.md @@ -0,0 +1,4433 @@ +# Agents + +## Create + +`beta.agents.create(AgentCreateParams**kwargs) -> BetaManagedAgentsAgent` + +**post** `/v1/agents` + +Create Agent + +### Parameters + +- `model: Model` + + Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control + + - `Union[Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more], str]` + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `class BetaManagedAgentsModelConfigParams: …` + + An object that defines additional configuration control over model use + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +- `name: str` + + Human-readable name for the agent. 1-256 characters. + +- `description: Optional[str]` + + Description of what the agent does. Up to 2048 characters. + +- `mcp_servers: Optional[Iterable[BetaManagedAgentsURLMCPServerParams]]` + + MCP servers this agent connects to. Maximum 20. Names must be unique within the array. + + - `name: str` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + Endpoint URL for the MCP server. + +- `metadata: Optional[Dict[str, str]]` + + Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars. + +- `skills: Optional[Iterable[BetaManagedAgentsSkillParams]]` + + Skills available to the agent. Maximum 20. + + - `class BetaManagedAgentsAnthropicSkillParams: …` + + An Anthropic-managed skill. + + - `skill_id: str` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: Optional[str]` + + Version to pin. Defaults to latest if omitted. + + - `class BetaManagedAgentsCustomSkillParams: …` + + A user-created custom skill. + + - `skill_id: str` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: Optional[str]` + + Version to pin. Defaults to latest if omitted. + +- `system: Optional[str]` + + System prompt for the agent. Up to 100,000 characters. + +- `tools: Optional[Iterable[Tool]]` + + Tool configurations available to the agent. Maximum of 128 tools across all toolsets allowed. + + - `class BetaManagedAgentsAgentToolset20260401Params: …` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `configs: Optional[List[BetaManagedAgentsAgentToolConfigParams]]` + + Per-tool configuration overrides. + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled: Optional[bool]` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: Optional[BetaManagedAgentsAgentToolsetDefaultConfigParams]` + + Default configuration for all tools in a toolset. + + - `enabled: Optional[bool]` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `class BetaManagedAgentsMCPToolsetParams: …` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `mcp_server_name: str` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `configs: Optional[List[BetaManagedAgentsMCPToolConfigParams]]` + + Per-tool configuration overrides. + + - `name: str` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled: Optional[bool]` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: Optional[BetaManagedAgentsMCPToolsetDefaultConfigParams]` + + Default configuration for all tools from an MCP server. + + - `enabled: Optional[bool]` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `class BetaManagedAgentsCustomToolParams: …` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: str` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: Literal["custom"]` + + - `"custom"` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent: …` + + A Managed Agents `agent`. + + - `id: str` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `metadata: Dict[str, str]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `version: int` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_agent = client.beta.agents.create( + model="claude-sonnet-4-6", + name="My First Agent", +) +print(beta_managed_agents_agent.id) +``` + +## List + +`beta.agents.list(AgentListParams**kwargs) -> SyncPageCursor[BetaManagedAgentsAgent]` + +**get** `/v1/agents` + +List Agents + +### Parameters + +- `created_at_gte: Optional[Union[str, datetime]]` + + Return agents created at or after this time (inclusive). + +- `created_at_lte: Optional[Union[str, datetime]]` + + Return agents created at or before this time (inclusive). + +- `include_archived: Optional[bool]` + + Include archived agents in results. Defaults to false. + +- `limit: Optional[int]` + + Maximum results per page. Default 20, maximum 100. + +- `page: Optional[str]` + + Opaque pagination cursor from a previous response. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent: …` + + A Managed Agents `agent`. + + - `id: str` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `metadata: Dict[str, str]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `version: int` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +page = client.beta.agents.list() +page = page.data[0] +print(page.id) +``` + +## Retrieve + +`beta.agents.retrieve(stragent_id, AgentRetrieveParams**kwargs) -> BetaManagedAgentsAgent` + +**get** `/v1/agents/{agent_id}` + +Get Agent + +### Parameters + +- `agent_id: str` + +- `version: Optional[int]` + + Agent version. Omit for the most recent version. Must be at least 1 if specified. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent: …` + + A Managed Agents `agent`. + + - `id: str` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `metadata: Dict[str, str]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `version: int` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_agent = client.beta.agents.retrieve( + agent_id="agent_011CZkYpogX7uDKUyvBTophP", +) +print(beta_managed_agents_agent.id) +``` + +## Update + +`beta.agents.update(stragent_id, AgentUpdateParams**kwargs) -> BetaManagedAgentsAgent` + +**post** `/v1/agents/{agent_id}` + +Update Agent + +### Parameters + +- `agent_id: str` + +- `version: int` + + The agent's current version, used to prevent concurrent overwrites. Obtain this value from a create or retrieve response. The request fails if this does not match the server's current version. + +- `description: Optional[str]` + + Description. Up to 2048 characters. Omit to preserve; send empty string or null to clear. + +- `mcp_servers: Optional[Iterable[BetaManagedAgentsURLMCPServerParams]]` + + MCP servers. Full replacement. Omit to preserve; send empty array or null to clear. Names must be unique. Maximum 20. + + - `name: str` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + Endpoint URL for the MCP server. + +- `metadata: Optional[Dict[str, Optional[str]]]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. The stored bag is limited to 16 keys (up to 64 chars each) with values up to 512 chars. + +- `model: Optional[Model]` + + Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control. Omit to preserve. Cannot be cleared. + + - `Union[Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more], str]` + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `class BetaManagedAgentsModelConfigParams: …` + + An object that defines additional configuration control over model use + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +- `name: Optional[str]` + + Human-readable name. 1-256 characters. Omit to preserve. Cannot be cleared. + +- `skills: Optional[Iterable[BetaManagedAgentsSkillParams]]` + + Skills. Full replacement. Omit to preserve; send empty array or null to clear. Maximum 20. + + - `class BetaManagedAgentsAnthropicSkillParams: …` + + An Anthropic-managed skill. + + - `skill_id: str` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: Optional[str]` + + Version to pin. Defaults to latest if omitted. + + - `class BetaManagedAgentsCustomSkillParams: …` + + A user-created custom skill. + + - `skill_id: str` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: Optional[str]` + + Version to pin. Defaults to latest if omitted. + +- `system: Optional[str]` + + System prompt. Up to 100,000 characters. Omit to preserve; send empty string or null to clear. + +- `tools: Optional[Iterable[Tool]]` + + Tool configurations available to the agent. Full replacement. Omit to preserve; send empty array or null to clear. Maximum of 128 tools across all toolsets allowed. + + - `class BetaManagedAgentsAgentToolset20260401Params: …` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `configs: Optional[List[BetaManagedAgentsAgentToolConfigParams]]` + + Per-tool configuration overrides. + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled: Optional[bool]` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: Optional[BetaManagedAgentsAgentToolsetDefaultConfigParams]` + + Default configuration for all tools in a toolset. + + - `enabled: Optional[bool]` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `class BetaManagedAgentsMCPToolsetParams: …` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `mcp_server_name: str` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `configs: Optional[List[BetaManagedAgentsMCPToolConfigParams]]` + + Per-tool configuration overrides. + + - `name: str` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled: Optional[bool]` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: Optional[BetaManagedAgentsMCPToolsetDefaultConfigParams]` + + Default configuration for all tools from an MCP server. + + - `enabled: Optional[bool]` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `class BetaManagedAgentsCustomToolParams: …` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: str` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: Literal["custom"]` + + - `"custom"` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent: …` + + A Managed Agents `agent`. + + - `id: str` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `metadata: Dict[str, str]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `version: int` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_agent = client.beta.agents.update( + agent_id="agent_011CZkYpogX7uDKUyvBTophP", + version=1, +) +print(beta_managed_agents_agent.id) +``` + +## Archive + +`beta.agents.archive(stragent_id, AgentArchiveParams**kwargs) -> BetaManagedAgentsAgent` + +**post** `/v1/agents/{agent_id}/archive` + +Archive Agent + +### Parameters + +- `agent_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent: …` + + A Managed Agents `agent`. + + - `id: str` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `metadata: Dict[str, str]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `version: int` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_agent = client.beta.agents.archive( + agent_id="agent_011CZkYpogX7uDKUyvBTophP", +) +print(beta_managed_agents_agent.id) +``` + +## Domain Types + +### Beta Managed Agents Agent + +- `class BetaManagedAgentsAgent: …` + + A Managed Agents `agent`. + + - `id: str` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `metadata: Dict[str, str]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `version: int` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Beta Managed Agents Agent Tool Config + +- `class BetaManagedAgentsAgentToolConfig: …` + + Configuration for a specific agent tool. + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + +### Beta Managed Agents Agent Tool Config Params + +- `class BetaManagedAgentsAgentToolConfigParams: …` + + Configuration override for a specific tool within a toolset. + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled: Optional[bool]` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + +### Beta Managed Agents Agent Toolset Default Config + +- `class BetaManagedAgentsAgentToolsetDefaultConfig: …` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + +### Beta Managed Agents Agent Toolset Default Config Params + +- `class BetaManagedAgentsAgentToolsetDefaultConfigParams: …` + + Default configuration for all tools in a toolset. + + - `enabled: Optional[bool]` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + +### Beta Managed Agents Agent Toolset20260401 + +- `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + +### Beta Managed Agents Agent Toolset20260401 Params + +- `class BetaManagedAgentsAgentToolset20260401Params: …` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `configs: Optional[List[BetaManagedAgentsAgentToolConfigParams]]` + + Per-tool configuration overrides. + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled: Optional[bool]` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: Optional[BetaManagedAgentsAgentToolsetDefaultConfigParams]` + + Default configuration for all tools in a toolset. + + - `enabled: Optional[bool]` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + +### Beta Managed Agents Always Allow Policy + +- `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + +### Beta Managed Agents Always Ask Policy + +- `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + +### Beta Managed Agents Anthropic Skill + +- `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + +### Beta Managed Agents Anthropic Skill Params + +- `class BetaManagedAgentsAnthropicSkillParams: …` + + An Anthropic-managed skill. + + - `skill_id: str` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: Optional[str]` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents Custom Skill + +- `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + +### Beta Managed Agents Custom Skill Params + +- `class BetaManagedAgentsCustomSkillParams: …` + + A user-created custom skill. + + - `skill_id: str` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: Optional[str]` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents Custom Tool + +- `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + +### Beta Managed Agents Custom Tool Input Schema + +- `class BetaManagedAgentsCustomToolInputSchema: …` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + +### Beta Managed Agents Custom Tool Params + +- `class BetaManagedAgentsCustomToolParams: …` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: str` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: Literal["custom"]` + + - `"custom"` + +### Beta Managed Agents MCP Server URL Definition + +- `class BetaManagedAgentsMCPServerURLDefinition: …` + + URL-based MCP server connection as returned in API responses. + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + +### Beta Managed Agents MCP Tool Config + +- `class BetaManagedAgentsMCPToolConfig: …` + + Resolved configuration for a specific MCP tool. + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + +### Beta Managed Agents MCP Tool Config Params + +- `class BetaManagedAgentsMCPToolConfigParams: …` + + Configuration override for a specific MCP tool. + + - `name: str` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled: Optional[bool]` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + +### Beta Managed Agents MCP Toolset + +- `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + +### Beta Managed Agents MCP Toolset Default Config + +- `class BetaManagedAgentsMCPToolsetDefaultConfig: …` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + +### Beta Managed Agents MCP Toolset Default Config Params + +- `class BetaManagedAgentsMCPToolsetDefaultConfigParams: …` + + Default configuration for all tools from an MCP server. + + - `enabled: Optional[bool]` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + +### Beta Managed Agents MCP Toolset Params + +- `class BetaManagedAgentsMCPToolsetParams: …` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `mcp_server_name: str` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `configs: Optional[List[BetaManagedAgentsMCPToolConfigParams]]` + + Per-tool configuration overrides. + + - `name: str` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled: Optional[bool]` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: Optional[BetaManagedAgentsMCPToolsetDefaultConfigParams]` + + Default configuration for all tools from an MCP server. + + - `enabled: Optional[bool]` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + +### Beta Managed Agents Model + +- `Union[Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more], str]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + +### Beta Managed Agents Model Config + +- `class BetaManagedAgentsModelConfig: …` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +### Beta Managed Agents Model Config Params + +- `class BetaManagedAgentsModelConfigParams: …` + + An object that defines additional configuration control over model use + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +### Beta Managed Agents Skill Params + +- `BetaManagedAgentsSkillParams` + + Skill to load in the session container. + + - `class BetaManagedAgentsAnthropicSkillParams: …` + + An Anthropic-managed skill. + + - `skill_id: str` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: Optional[str]` + + Version to pin. Defaults to latest if omitted. + + - `class BetaManagedAgentsCustomSkillParams: …` + + A user-created custom skill. + + - `skill_id: str` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: Optional[str]` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents URL MCP Server Params + +- `class BetaManagedAgentsURLMCPServerParams: …` + + URL-based MCP server connection. + + - `name: str` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + Endpoint URL for the MCP server. + +# Versions + +## List + +`beta.agents.versions.list(stragent_id, VersionListParams**kwargs) -> SyncPageCursor[BetaManagedAgentsAgent]` + +**get** `/v1/agents/{agent_id}/versions` + +List Agent Versions + +### Parameters + +- `agent_id: str` + +- `limit: Optional[int]` + + Maximum results per page. Default 20, maximum 100. + +- `page: Optional[str]` + + Opaque pagination cursor. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent: …` + + A Managed Agents `agent`. + + - `id: str` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `metadata: Dict[str, str]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `version: int` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +page = client.beta.agents.versions.list( + agent_id="agent_011CZkYpogX7uDKUyvBTophP", +) +page = page.data[0] +print(page.id) +``` diff --git a/content/en/api/python/beta/agents/archive.md b/content/en/api/python/beta/agents/archive.md new file mode 100644 index 000000000..b3df1e996 --- /dev/null +++ b/content/en/api/python/beta/agents/archive.md @@ -0,0 +1,383 @@ +## Archive + +`beta.agents.archive(stragent_id, AgentArchiveParams**kwargs) -> BetaManagedAgentsAgent` + +**post** `/v1/agents/{agent_id}/archive` + +Archive Agent + +### Parameters + +- `agent_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent: …` + + A Managed Agents `agent`. + + - `id: str` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `metadata: Dict[str, str]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `version: int` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_agent = client.beta.agents.archive( + agent_id="agent_011CZkYpogX7uDKUyvBTophP", +) +print(beta_managed_agents_agent.id) +``` diff --git a/content/en/api/python/beta/agents/create.md b/content/en/api/python/beta/agents/create.md new file mode 100644 index 000000000..16dceded3 --- /dev/null +++ b/content/en/api/python/beta/agents/create.md @@ -0,0 +1,766 @@ +## Create + +`beta.agents.create(AgentCreateParams**kwargs) -> BetaManagedAgentsAgent` + +**post** `/v1/agents` + +Create Agent + +### Parameters + +- `model: Model` + + Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control + + - `Union[Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more], str]` + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `class BetaManagedAgentsModelConfigParams: …` + + An object that defines additional configuration control over model use + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +- `name: str` + + Human-readable name for the agent. 1-256 characters. + +- `description: Optional[str]` + + Description of what the agent does. Up to 2048 characters. + +- `mcp_servers: Optional[Iterable[BetaManagedAgentsURLMCPServerParams]]` + + MCP servers this agent connects to. Maximum 20. Names must be unique within the array. + + - `name: str` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + Endpoint URL for the MCP server. + +- `metadata: Optional[Dict[str, str]]` + + Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars. + +- `skills: Optional[Iterable[BetaManagedAgentsSkillParams]]` + + Skills available to the agent. Maximum 20. + + - `class BetaManagedAgentsAnthropicSkillParams: …` + + An Anthropic-managed skill. + + - `skill_id: str` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: Optional[str]` + + Version to pin. Defaults to latest if omitted. + + - `class BetaManagedAgentsCustomSkillParams: …` + + A user-created custom skill. + + - `skill_id: str` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: Optional[str]` + + Version to pin. Defaults to latest if omitted. + +- `system: Optional[str]` + + System prompt for the agent. Up to 100,000 characters. + +- `tools: Optional[Iterable[Tool]]` + + Tool configurations available to the agent. Maximum of 128 tools across all toolsets allowed. + + - `class BetaManagedAgentsAgentToolset20260401Params: …` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `configs: Optional[List[BetaManagedAgentsAgentToolConfigParams]]` + + Per-tool configuration overrides. + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled: Optional[bool]` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: Optional[BetaManagedAgentsAgentToolsetDefaultConfigParams]` + + Default configuration for all tools in a toolset. + + - `enabled: Optional[bool]` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `class BetaManagedAgentsMCPToolsetParams: …` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `mcp_server_name: str` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `configs: Optional[List[BetaManagedAgentsMCPToolConfigParams]]` + + Per-tool configuration overrides. + + - `name: str` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled: Optional[bool]` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: Optional[BetaManagedAgentsMCPToolsetDefaultConfigParams]` + + Default configuration for all tools from an MCP server. + + - `enabled: Optional[bool]` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `class BetaManagedAgentsCustomToolParams: …` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: str` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: Literal["custom"]` + + - `"custom"` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent: …` + + A Managed Agents `agent`. + + - `id: str` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `metadata: Dict[str, str]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `version: int` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_agent = client.beta.agents.create( + model="claude-sonnet-4-6", + name="My First Agent", +) +print(beta_managed_agents_agent.id) +``` diff --git a/content/en/api/python/beta/agents/list.md b/content/en/api/python/beta/agents/list.md new file mode 100644 index 000000000..cb81e777f --- /dev/null +++ b/content/en/api/python/beta/agents/list.md @@ -0,0 +1,400 @@ +## List + +`beta.agents.list(AgentListParams**kwargs) -> SyncPageCursor[BetaManagedAgentsAgent]` + +**get** `/v1/agents` + +List Agents + +### Parameters + +- `created_at_gte: Optional[Union[str, datetime]]` + + Return agents created at or after this time (inclusive). + +- `created_at_lte: Optional[Union[str, datetime]]` + + Return agents created at or before this time (inclusive). + +- `include_archived: Optional[bool]` + + Include archived agents in results. Defaults to false. + +- `limit: Optional[int]` + + Maximum results per page. Default 20, maximum 100. + +- `page: Optional[str]` + + Opaque pagination cursor from a previous response. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent: …` + + A Managed Agents `agent`. + + - `id: str` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `metadata: Dict[str, str]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `version: int` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +page = client.beta.agents.list() +page = page.data[0] +print(page.id) +``` diff --git a/content/en/api/python/beta/agents/retrieve.md b/content/en/api/python/beta/agents/retrieve.md new file mode 100644 index 000000000..6be095d1e --- /dev/null +++ b/content/en/api/python/beta/agents/retrieve.md @@ -0,0 +1,387 @@ +## Retrieve + +`beta.agents.retrieve(stragent_id, AgentRetrieveParams**kwargs) -> BetaManagedAgentsAgent` + +**get** `/v1/agents/{agent_id}` + +Get Agent + +### Parameters + +- `agent_id: str` + +- `version: Optional[int]` + + Agent version. Omit for the most recent version. Must be at least 1 if specified. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent: …` + + A Managed Agents `agent`. + + - `id: str` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `metadata: Dict[str, str]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `version: int` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_agent = client.beta.agents.retrieve( + agent_id="agent_011CZkYpogX7uDKUyvBTophP", +) +print(beta_managed_agents_agent.id) +``` diff --git a/content/en/api/python/beta/agents/update.md b/content/en/api/python/beta/agents/update.md new file mode 100644 index 000000000..5617f6771 --- /dev/null +++ b/content/en/api/python/beta/agents/update.md @@ -0,0 +1,772 @@ +## Update + +`beta.agents.update(stragent_id, AgentUpdateParams**kwargs) -> BetaManagedAgentsAgent` + +**post** `/v1/agents/{agent_id}` + +Update Agent + +### Parameters + +- `agent_id: str` + +- `version: int` + + The agent's current version, used to prevent concurrent overwrites. Obtain this value from a create or retrieve response. The request fails if this does not match the server's current version. + +- `description: Optional[str]` + + Description. Up to 2048 characters. Omit to preserve; send empty string or null to clear. + +- `mcp_servers: Optional[Iterable[BetaManagedAgentsURLMCPServerParams]]` + + MCP servers. Full replacement. Omit to preserve; send empty array or null to clear. Names must be unique. Maximum 20. + + - `name: str` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + Endpoint URL for the MCP server. + +- `metadata: Optional[Dict[str, Optional[str]]]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. The stored bag is limited to 16 keys (up to 64 chars each) with values up to 512 chars. + +- `model: Optional[Model]` + + Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control. Omit to preserve. Cannot be cleared. + + - `Union[Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more], str]` + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `class BetaManagedAgentsModelConfigParams: …` + + An object that defines additional configuration control over model use + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +- `name: Optional[str]` + + Human-readable name. 1-256 characters. Omit to preserve. Cannot be cleared. + +- `skills: Optional[Iterable[BetaManagedAgentsSkillParams]]` + + Skills. Full replacement. Omit to preserve; send empty array or null to clear. Maximum 20. + + - `class BetaManagedAgentsAnthropicSkillParams: …` + + An Anthropic-managed skill. + + - `skill_id: str` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: Optional[str]` + + Version to pin. Defaults to latest if omitted. + + - `class BetaManagedAgentsCustomSkillParams: …` + + A user-created custom skill. + + - `skill_id: str` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: Optional[str]` + + Version to pin. Defaults to latest if omitted. + +- `system: Optional[str]` + + System prompt. Up to 100,000 characters. Omit to preserve; send empty string or null to clear. + +- `tools: Optional[Iterable[Tool]]` + + Tool configurations available to the agent. Full replacement. Omit to preserve; send empty array or null to clear. Maximum of 128 tools across all toolsets allowed. + + - `class BetaManagedAgentsAgentToolset20260401Params: …` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `configs: Optional[List[BetaManagedAgentsAgentToolConfigParams]]` + + Per-tool configuration overrides. + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled: Optional[bool]` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: Optional[BetaManagedAgentsAgentToolsetDefaultConfigParams]` + + Default configuration for all tools in a toolset. + + - `enabled: Optional[bool]` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `class BetaManagedAgentsMCPToolsetParams: …` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `mcp_server_name: str` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `configs: Optional[List[BetaManagedAgentsMCPToolConfigParams]]` + + Per-tool configuration overrides. + + - `name: str` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled: Optional[bool]` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: Optional[BetaManagedAgentsMCPToolsetDefaultConfigParams]` + + Default configuration for all tools from an MCP server. + + - `enabled: Optional[bool]` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy: Optional[PermissionPolicy]` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `class BetaManagedAgentsCustomToolParams: …` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: str` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: Literal["custom"]` + + - `"custom"` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent: …` + + A Managed Agents `agent`. + + - `id: str` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `metadata: Dict[str, str]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `version: int` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_agent = client.beta.agents.update( + agent_id="agent_011CZkYpogX7uDKUyvBTophP", + version=1, +) +print(beta_managed_agents_agent.id) +``` diff --git a/content/en/api/python/beta/agents/versions.md b/content/en/api/python/beta/agents/versions.md new file mode 100644 index 000000000..b9907b029 --- /dev/null +++ b/content/en/api/python/beta/agents/versions.md @@ -0,0 +1,394 @@ +# Versions + +## List + +`beta.agents.versions.list(stragent_id, VersionListParams**kwargs) -> SyncPageCursor[BetaManagedAgentsAgent]` + +**get** `/v1/agents/{agent_id}/versions` + +List Agent Versions + +### Parameters + +- `agent_id: str` + +- `limit: Optional[int]` + + Maximum results per page. Default 20, maximum 100. + +- `page: Optional[str]` + + Opaque pagination cursor. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent: …` + + A Managed Agents `agent`. + + - `id: str` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `metadata: Dict[str, str]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `version: int` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +page = client.beta.agents.versions.list( + agent_id="agent_011CZkYpogX7uDKUyvBTophP", +) +page = page.data[0] +print(page.id) +``` diff --git a/content/en/api/python/beta/agents/versions/list.md b/content/en/api/python/beta/agents/versions/list.md new file mode 100644 index 000000000..5233863c9 --- /dev/null +++ b/content/en/api/python/beta/agents/versions/list.md @@ -0,0 +1,392 @@ +## List + +`beta.agents.versions.list(stragent_id, VersionListParams**kwargs) -> SyncPageCursor[BetaManagedAgentsAgent]` + +**get** `/v1/agents/{agent_id}/versions` + +List Agent Versions + +### Parameters + +- `agent_id: str` + +- `limit: Optional[int]` + + Maximum results per page. Default 20, maximum 100. + +- `page: Optional[str]` + + Opaque pagination cursor. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent: …` + + A Managed Agents `agent`. + + - `id: str` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `metadata: Dict[str, str]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `version: int` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +page = client.beta.agents.versions.list( + agent_id="agent_011CZkYpogX7uDKUyvBTophP", +) +page = page.data[0] +print(page.id) +``` diff --git a/content/en/api/python/beta/environments.md b/content/en/api/python/beta/environments.md new file mode 100644 index 000000000..c300e8a40 --- /dev/null +++ b/content/en/api/python/beta/environments.md @@ -0,0 +1,1733 @@ +# Environments + +## Create + +`beta.environments.create(EnvironmentCreateParams**kwargs) -> BetaEnvironment` + +**post** `/v1/environments` + +Create a new environment with the specified configuration. + +### Parameters + +- `name: str` + + Human-readable name for the environment + +- `config: Optional[BetaCloudConfigParams]` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: Literal["cloud"]` + + Environment type + + - `"cloud"` + + - `networking: Optional[Networking]` + + Network configuration policy. Omit on update to preserve the existing value. + + - `class BetaUnrestrictedNetwork: …` + + Unrestricted network access. + + - `type: Literal["unrestricted"]` + + Network policy type + + - `"unrestricted"` + + - `class BetaLimitedNetworkParams: …` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: Literal["limited"]` + + Network policy type + + - `"limited"` + + - `allow_mcp_servers: Optional[bool]` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: Optional[bool]` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: Optional[List[str]]` + + Specifies domains the container can reach. + + - `packages: Optional[BetaPackagesParams]` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: Optional[List[str]]` + + Ubuntu/Debian packages to install + + - `cargo: Optional[List[str]]` + + Rust packages to install + + - `gem: Optional[List[str]]` + + Ruby packages to install + + - `go: Optional[List[str]]` + + Go packages to install + + - `npm: Optional[List[str]]` + + Node.js packages to install + + - `pip: Optional[List[str]]` + + Python packages to install + + - `type: Optional[Literal["packages"]]` + + Package configuration type + + - `"packages"` + +- `description: Optional[str]` + + Optional description of the environment + +- `metadata: Optional[Dict[str, str]]` + + User-provided metadata key-value pairs + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironment: …` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: str` + + Environment identifier (e.g., 'env_...') + + - `archived_at: Optional[str]` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork: …` + + Unrestricted network access. + + - `type: Literal["unrestricted"]` + + Network policy type + + - `"unrestricted"` + + - `class BetaLimitedNetwork: …` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: List[str]` + + Specifies domains the container can reach. + + - `type: Literal["limited"]` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: List[str]` + + Ubuntu/Debian packages to install + + - `cargo: List[str]` + + Rust packages to install + + - `gem: List[str]` + + Ruby packages to install + + - `go: List[str]` + + Go packages to install + + - `npm: List[str]` + + Node.js packages to install + + - `pip: List[str]` + + Python packages to install + + - `type: Optional[Literal["packages"]]` + + Package configuration type + + - `"packages"` + + - `type: Literal["cloud"]` + + Environment type + + - `"cloud"` + + - `created_at: str` + + RFC 3339 timestamp when environment was created + + - `description: str` + + User-provided description for the environment + + - `metadata: Dict[str, str]` + + User-provided metadata key-value pairs + + - `name: str` + + Human-readable name for the environment + + - `type: Literal["environment"]` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: str` + + RFC 3339 timestamp when environment was last updated + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_environment = client.beta.environments.create( + name="python-data-analysis", +) +print(beta_environment.id) +``` + +## List + +`beta.environments.list(EnvironmentListParams**kwargs) -> SyncPageCursor[BetaEnvironment]` + +**get** `/v1/environments` + +List environments with pagination support. + +### Parameters + +- `include_archived: Optional[bool]` + + Include archived environments in the response + +- `limit: Optional[int]` + + Maximum number of environments to return + +- `page: Optional[str]` + + Opaque cursor from previous response for pagination. Pass the `next_page` value from the previous response. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironment: …` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: str` + + Environment identifier (e.g., 'env_...') + + - `archived_at: Optional[str]` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork: …` + + Unrestricted network access. + + - `type: Literal["unrestricted"]` + + Network policy type + + - `"unrestricted"` + + - `class BetaLimitedNetwork: …` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: List[str]` + + Specifies domains the container can reach. + + - `type: Literal["limited"]` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: List[str]` + + Ubuntu/Debian packages to install + + - `cargo: List[str]` + + Rust packages to install + + - `gem: List[str]` + + Ruby packages to install + + - `go: List[str]` + + Go packages to install + + - `npm: List[str]` + + Node.js packages to install + + - `pip: List[str]` + + Python packages to install + + - `type: Optional[Literal["packages"]]` + + Package configuration type + + - `"packages"` + + - `type: Literal["cloud"]` + + Environment type + + - `"cloud"` + + - `created_at: str` + + RFC 3339 timestamp when environment was created + + - `description: str` + + User-provided description for the environment + + - `metadata: Dict[str, str]` + + User-provided metadata key-value pairs + + - `name: str` + + Human-readable name for the environment + + - `type: Literal["environment"]` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: str` + + RFC 3339 timestamp when environment was last updated + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +page = client.beta.environments.list() +page = page.data[0] +print(page.id) +``` + +## Retrieve + +`beta.environments.retrieve(strenvironment_id, EnvironmentRetrieveParams**kwargs) -> BetaEnvironment` + +**get** `/v1/environments/{environment_id}` + +Retrieve a specific environment by ID. + +### Parameters + +- `environment_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironment: …` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: str` + + Environment identifier (e.g., 'env_...') + + - `archived_at: Optional[str]` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork: …` + + Unrestricted network access. + + - `type: Literal["unrestricted"]` + + Network policy type + + - `"unrestricted"` + + - `class BetaLimitedNetwork: …` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: List[str]` + + Specifies domains the container can reach. + + - `type: Literal["limited"]` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: List[str]` + + Ubuntu/Debian packages to install + + - `cargo: List[str]` + + Rust packages to install + + - `gem: List[str]` + + Ruby packages to install + + - `go: List[str]` + + Go packages to install + + - `npm: List[str]` + + Node.js packages to install + + - `pip: List[str]` + + Python packages to install + + - `type: Optional[Literal["packages"]]` + + Package configuration type + + - `"packages"` + + - `type: Literal["cloud"]` + + Environment type + + - `"cloud"` + + - `created_at: str` + + RFC 3339 timestamp when environment was created + + - `description: str` + + User-provided description for the environment + + - `metadata: Dict[str, str]` + + User-provided metadata key-value pairs + + - `name: str` + + Human-readable name for the environment + + - `type: Literal["environment"]` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: str` + + RFC 3339 timestamp when environment was last updated + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_environment = client.beta.environments.retrieve( + environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW", +) +print(beta_environment.id) +``` + +## Update + +`beta.environments.update(strenvironment_id, EnvironmentUpdateParams**kwargs) -> BetaEnvironment` + +**post** `/v1/environments/{environment_id}` + +Update an existing environment's configuration. + +### Parameters + +- `environment_id: str` + +- `config: Optional[BetaCloudConfigParams]` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: Literal["cloud"]` + + Environment type + + - `"cloud"` + + - `networking: Optional[Networking]` + + Network configuration policy. Omit on update to preserve the existing value. + + - `class BetaUnrestrictedNetwork: …` + + Unrestricted network access. + + - `type: Literal["unrestricted"]` + + Network policy type + + - `"unrestricted"` + + - `class BetaLimitedNetworkParams: …` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: Literal["limited"]` + + Network policy type + + - `"limited"` + + - `allow_mcp_servers: Optional[bool]` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: Optional[bool]` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: Optional[List[str]]` + + Specifies domains the container can reach. + + - `packages: Optional[BetaPackagesParams]` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: Optional[List[str]]` + + Ubuntu/Debian packages to install + + - `cargo: Optional[List[str]]` + + Rust packages to install + + - `gem: Optional[List[str]]` + + Ruby packages to install + + - `go: Optional[List[str]]` + + Go packages to install + + - `npm: Optional[List[str]]` + + Node.js packages to install + + - `pip: Optional[List[str]]` + + Python packages to install + + - `type: Optional[Literal["packages"]]` + + Package configuration type + + - `"packages"` + +- `description: Optional[str]` + + Updated description of the environment + +- `metadata: Optional[Dict[str, Optional[str]]]` + + User-provided metadata key-value pairs. Set a value to null or empty string to delete the key. + +- `name: Optional[str]` + + Updated name for the environment + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironment: …` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: str` + + Environment identifier (e.g., 'env_...') + + - `archived_at: Optional[str]` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork: …` + + Unrestricted network access. + + - `type: Literal["unrestricted"]` + + Network policy type + + - `"unrestricted"` + + - `class BetaLimitedNetwork: …` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: List[str]` + + Specifies domains the container can reach. + + - `type: Literal["limited"]` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: List[str]` + + Ubuntu/Debian packages to install + + - `cargo: List[str]` + + Rust packages to install + + - `gem: List[str]` + + Ruby packages to install + + - `go: List[str]` + + Go packages to install + + - `npm: List[str]` + + Node.js packages to install + + - `pip: List[str]` + + Python packages to install + + - `type: Optional[Literal["packages"]]` + + Package configuration type + + - `"packages"` + + - `type: Literal["cloud"]` + + Environment type + + - `"cloud"` + + - `created_at: str` + + RFC 3339 timestamp when environment was created + + - `description: str` + + User-provided description for the environment + + - `metadata: Dict[str, str]` + + User-provided metadata key-value pairs + + - `name: str` + + Human-readable name for the environment + + - `type: Literal["environment"]` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: str` + + RFC 3339 timestamp when environment was last updated + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_environment = client.beta.environments.update( + environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW", +) +print(beta_environment.id) +``` + +## Delete + +`beta.environments.delete(strenvironment_id, EnvironmentDeleteParams**kwargs) -> BetaEnvironmentDeleteResponse` + +**delete** `/v1/environments/{environment_id}` + +Delete an environment by ID. Returns a confirmation of the deletion. + +### Parameters + +- `environment_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironmentDeleteResponse: …` + + Response after deleting an environment. + + - `id: str` + + Environment identifier + + - `type: Literal["environment_deleted"]` + + The type of response + + - `"environment_deleted"` + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_environment_delete_response = client.beta.environments.delete( + environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW", +) +print(beta_environment_delete_response.id) +``` + +## Archive + +`beta.environments.archive(strenvironment_id, EnvironmentArchiveParams**kwargs) -> BetaEnvironment` + +**post** `/v1/environments/{environment_id}/archive` + +Archive an environment by ID. Archived environments cannot be used to create new sessions. + +### Parameters + +- `environment_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironment: …` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: str` + + Environment identifier (e.g., 'env_...') + + - `archived_at: Optional[str]` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork: …` + + Unrestricted network access. + + - `type: Literal["unrestricted"]` + + Network policy type + + - `"unrestricted"` + + - `class BetaLimitedNetwork: …` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: List[str]` + + Specifies domains the container can reach. + + - `type: Literal["limited"]` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: List[str]` + + Ubuntu/Debian packages to install + + - `cargo: List[str]` + + Rust packages to install + + - `gem: List[str]` + + Ruby packages to install + + - `go: List[str]` + + Go packages to install + + - `npm: List[str]` + + Node.js packages to install + + - `pip: List[str]` + + Python packages to install + + - `type: Optional[Literal["packages"]]` + + Package configuration type + + - `"packages"` + + - `type: Literal["cloud"]` + + Environment type + + - `"cloud"` + + - `created_at: str` + + RFC 3339 timestamp when environment was created + + - `description: str` + + User-provided description for the environment + + - `metadata: Dict[str, str]` + + User-provided metadata key-value pairs + + - `name: str` + + Human-readable name for the environment + + - `type: Literal["environment"]` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: str` + + RFC 3339 timestamp when environment was last updated + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_environment = client.beta.environments.archive( + environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW", +) +print(beta_environment.id) +``` + +## Domain Types + +### Beta Cloud Config + +- `class BetaCloudConfig: …` + + `cloud` environment configuration. + + - `networking: Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork: …` + + Unrestricted network access. + + - `type: Literal["unrestricted"]` + + Network policy type + + - `"unrestricted"` + + - `class BetaLimitedNetwork: …` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: List[str]` + + Specifies domains the container can reach. + + - `type: Literal["limited"]` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: List[str]` + + Ubuntu/Debian packages to install + + - `cargo: List[str]` + + Rust packages to install + + - `gem: List[str]` + + Ruby packages to install + + - `go: List[str]` + + Go packages to install + + - `npm: List[str]` + + Node.js packages to install + + - `pip: List[str]` + + Python packages to install + + - `type: Optional[Literal["packages"]]` + + Package configuration type + + - `"packages"` + + - `type: Literal["cloud"]` + + Environment type + + - `"cloud"` + +### Beta Cloud Config Params + +- `class BetaCloudConfigParams: …` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: Literal["cloud"]` + + Environment type + + - `"cloud"` + + - `networking: Optional[Networking]` + + Network configuration policy. Omit on update to preserve the existing value. + + - `class BetaUnrestrictedNetwork: …` + + Unrestricted network access. + + - `type: Literal["unrestricted"]` + + Network policy type + + - `"unrestricted"` + + - `class BetaLimitedNetworkParams: …` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: Literal["limited"]` + + Network policy type + + - `"limited"` + + - `allow_mcp_servers: Optional[bool]` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: Optional[bool]` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: Optional[List[str]]` + + Specifies domains the container can reach. + + - `packages: Optional[BetaPackagesParams]` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: Optional[List[str]]` + + Ubuntu/Debian packages to install + + - `cargo: Optional[List[str]]` + + Rust packages to install + + - `gem: Optional[List[str]]` + + Ruby packages to install + + - `go: Optional[List[str]]` + + Go packages to install + + - `npm: Optional[List[str]]` + + Node.js packages to install + + - `pip: Optional[List[str]]` + + Python packages to install + + - `type: Optional[Literal["packages"]]` + + Package configuration type + + - `"packages"` + +### Beta Environment + +- `class BetaEnvironment: …` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: str` + + Environment identifier (e.g., 'env_...') + + - `archived_at: Optional[str]` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork: …` + + Unrestricted network access. + + - `type: Literal["unrestricted"]` + + Network policy type + + - `"unrestricted"` + + - `class BetaLimitedNetwork: …` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: List[str]` + + Specifies domains the container can reach. + + - `type: Literal["limited"]` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: List[str]` + + Ubuntu/Debian packages to install + + - `cargo: List[str]` + + Rust packages to install + + - `gem: List[str]` + + Ruby packages to install + + - `go: List[str]` + + Go packages to install + + - `npm: List[str]` + + Node.js packages to install + + - `pip: List[str]` + + Python packages to install + + - `type: Optional[Literal["packages"]]` + + Package configuration type + + - `"packages"` + + - `type: Literal["cloud"]` + + Environment type + + - `"cloud"` + + - `created_at: str` + + RFC 3339 timestamp when environment was created + + - `description: str` + + User-provided description for the environment + + - `metadata: Dict[str, str]` + + User-provided metadata key-value pairs + + - `name: str` + + Human-readable name for the environment + + - `type: Literal["environment"]` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: str` + + RFC 3339 timestamp when environment was last updated + +### Beta Environment Delete Response + +- `class BetaEnvironmentDeleteResponse: …` + + Response after deleting an environment. + + - `id: str` + + Environment identifier + + - `type: Literal["environment_deleted"]` + + The type of response + + - `"environment_deleted"` + +### Beta Limited Network + +- `class BetaLimitedNetwork: …` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: List[str]` + + Specifies domains the container can reach. + + - `type: Literal["limited"]` + + Network policy type + + - `"limited"` + +### Beta Limited Network Params + +- `class BetaLimitedNetworkParams: …` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: Literal["limited"]` + + Network policy type + + - `"limited"` + + - `allow_mcp_servers: Optional[bool]` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: Optional[bool]` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: Optional[List[str]]` + + Specifies domains the container can reach. + +### Beta Packages + +- `class BetaPackages: …` + + Packages (and their versions) available in this environment. + + - `apt: List[str]` + + Ubuntu/Debian packages to install + + - `cargo: List[str]` + + Rust packages to install + + - `gem: List[str]` + + Ruby packages to install + + - `go: List[str]` + + Go packages to install + + - `npm: List[str]` + + Node.js packages to install + + - `pip: List[str]` + + Python packages to install + + - `type: Optional[Literal["packages"]]` + + Package configuration type + + - `"packages"` + +### Beta Packages Params + +- `class BetaPackagesParams: …` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: Optional[List[str]]` + + Ubuntu/Debian packages to install + + - `cargo: Optional[List[str]]` + + Rust packages to install + + - `gem: Optional[List[str]]` + + Ruby packages to install + + - `go: Optional[List[str]]` + + Go packages to install + + - `npm: Optional[List[str]]` + + Node.js packages to install + + - `pip: Optional[List[str]]` + + Python packages to install + + - `type: Optional[Literal["packages"]]` + + Package configuration type + + - `"packages"` + +### Beta Unrestricted Network + +- `class BetaUnrestrictedNetwork: …` + + Unrestricted network access. + + - `type: Literal["unrestricted"]` + + Network policy type + + - `"unrestricted"` diff --git a/content/en/api/python/beta/environments/archive.md b/content/en/api/python/beta/environments/archive.md new file mode 100644 index 000000000..ee5469728 --- /dev/null +++ b/content/en/api/python/beta/environments/archive.md @@ -0,0 +1,196 @@ +## Archive + +`beta.environments.archive(strenvironment_id, EnvironmentArchiveParams**kwargs) -> BetaEnvironment` + +**post** `/v1/environments/{environment_id}/archive` + +Archive an environment by ID. Archived environments cannot be used to create new sessions. + +### Parameters + +- `environment_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironment: …` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: str` + + Environment identifier (e.g., 'env_...') + + - `archived_at: Optional[str]` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork: …` + + Unrestricted network access. + + - `type: Literal["unrestricted"]` + + Network policy type + + - `"unrestricted"` + + - `class BetaLimitedNetwork: …` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: List[str]` + + Specifies domains the container can reach. + + - `type: Literal["limited"]` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: List[str]` + + Ubuntu/Debian packages to install + + - `cargo: List[str]` + + Rust packages to install + + - `gem: List[str]` + + Ruby packages to install + + - `go: List[str]` + + Go packages to install + + - `npm: List[str]` + + Node.js packages to install + + - `pip: List[str]` + + Python packages to install + + - `type: Optional[Literal["packages"]]` + + Package configuration type + + - `"packages"` + + - `type: Literal["cloud"]` + + Environment type + + - `"cloud"` + + - `created_at: str` + + RFC 3339 timestamp when environment was created + + - `description: str` + + User-provided description for the environment + + - `metadata: Dict[str, str]` + + User-provided metadata key-value pairs + + - `name: str` + + Human-readable name for the environment + + - `type: Literal["environment"]` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: str` + + RFC 3339 timestamp when environment was last updated + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_environment = client.beta.environments.archive( + environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW", +) +print(beta_environment.id) +``` diff --git a/content/en/api/python/beta/environments/create.md b/content/en/api/python/beta/environments/create.md new file mode 100644 index 000000000..42aa11a0f --- /dev/null +++ b/content/en/api/python/beta/environments/create.md @@ -0,0 +1,294 @@ +## Create + +`beta.environments.create(EnvironmentCreateParams**kwargs) -> BetaEnvironment` + +**post** `/v1/environments` + +Create a new environment with the specified configuration. + +### Parameters + +- `name: str` + + Human-readable name for the environment + +- `config: Optional[BetaCloudConfigParams]` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: Literal["cloud"]` + + Environment type + + - `"cloud"` + + - `networking: Optional[Networking]` + + Network configuration policy. Omit on update to preserve the existing value. + + - `class BetaUnrestrictedNetwork: …` + + Unrestricted network access. + + - `type: Literal["unrestricted"]` + + Network policy type + + - `"unrestricted"` + + - `class BetaLimitedNetworkParams: …` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: Literal["limited"]` + + Network policy type + + - `"limited"` + + - `allow_mcp_servers: Optional[bool]` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: Optional[bool]` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: Optional[List[str]]` + + Specifies domains the container can reach. + + - `packages: Optional[BetaPackagesParams]` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: Optional[List[str]]` + + Ubuntu/Debian packages to install + + - `cargo: Optional[List[str]]` + + Rust packages to install + + - `gem: Optional[List[str]]` + + Ruby packages to install + + - `go: Optional[List[str]]` + + Go packages to install + + - `npm: Optional[List[str]]` + + Node.js packages to install + + - `pip: Optional[List[str]]` + + Python packages to install + + - `type: Optional[Literal["packages"]]` + + Package configuration type + + - `"packages"` + +- `description: Optional[str]` + + Optional description of the environment + +- `metadata: Optional[Dict[str, str]]` + + User-provided metadata key-value pairs + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironment: …` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: str` + + Environment identifier (e.g., 'env_...') + + - `archived_at: Optional[str]` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork: …` + + Unrestricted network access. + + - `type: Literal["unrestricted"]` + + Network policy type + + - `"unrestricted"` + + - `class BetaLimitedNetwork: …` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: List[str]` + + Specifies domains the container can reach. + + - `type: Literal["limited"]` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: List[str]` + + Ubuntu/Debian packages to install + + - `cargo: List[str]` + + Rust packages to install + + - `gem: List[str]` + + Ruby packages to install + + - `go: List[str]` + + Go packages to install + + - `npm: List[str]` + + Node.js packages to install + + - `pip: List[str]` + + Python packages to install + + - `type: Optional[Literal["packages"]]` + + Package configuration type + + - `"packages"` + + - `type: Literal["cloud"]` + + Environment type + + - `"cloud"` + + - `created_at: str` + + RFC 3339 timestamp when environment was created + + - `description: str` + + User-provided description for the environment + + - `metadata: Dict[str, str]` + + User-provided metadata key-value pairs + + - `name: str` + + Human-readable name for the environment + + - `type: Literal["environment"]` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: str` + + RFC 3339 timestamp when environment was last updated + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_environment = client.beta.environments.create( + name="python-data-analysis", +) +print(beta_environment.id) +``` diff --git a/content/en/api/python/beta/environments/delete.md b/content/en/api/python/beta/environments/delete.md new file mode 100644 index 000000000..c891550ca --- /dev/null +++ b/content/en/api/python/beta/environments/delete.md @@ -0,0 +1,92 @@ +## Delete + +`beta.environments.delete(strenvironment_id, EnvironmentDeleteParams**kwargs) -> BetaEnvironmentDeleteResponse` + +**delete** `/v1/environments/{environment_id}` + +Delete an environment by ID. Returns a confirmation of the deletion. + +### Parameters + +- `environment_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironmentDeleteResponse: …` + + Response after deleting an environment. + + - `id: str` + + Environment identifier + + - `type: Literal["environment_deleted"]` + + The type of response + + - `"environment_deleted"` + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_environment_delete_response = client.beta.environments.delete( + environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW", +) +print(beta_environment_delete_response.id) +``` diff --git a/content/en/api/python/beta/environments/list.md b/content/en/api/python/beta/environments/list.md new file mode 100644 index 000000000..ff23b51c6 --- /dev/null +++ b/content/en/api/python/beta/environments/list.md @@ -0,0 +1,205 @@ +## List + +`beta.environments.list(EnvironmentListParams**kwargs) -> SyncPageCursor[BetaEnvironment]` + +**get** `/v1/environments` + +List environments with pagination support. + +### Parameters + +- `include_archived: Optional[bool]` + + Include archived environments in the response + +- `limit: Optional[int]` + + Maximum number of environments to return + +- `page: Optional[str]` + + Opaque cursor from previous response for pagination. Pass the `next_page` value from the previous response. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironment: …` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: str` + + Environment identifier (e.g., 'env_...') + + - `archived_at: Optional[str]` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork: …` + + Unrestricted network access. + + - `type: Literal["unrestricted"]` + + Network policy type + + - `"unrestricted"` + + - `class BetaLimitedNetwork: …` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: List[str]` + + Specifies domains the container can reach. + + - `type: Literal["limited"]` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: List[str]` + + Ubuntu/Debian packages to install + + - `cargo: List[str]` + + Rust packages to install + + - `gem: List[str]` + + Ruby packages to install + + - `go: List[str]` + + Go packages to install + + - `npm: List[str]` + + Node.js packages to install + + - `pip: List[str]` + + Python packages to install + + - `type: Optional[Literal["packages"]]` + + Package configuration type + + - `"packages"` + + - `type: Literal["cloud"]` + + Environment type + + - `"cloud"` + + - `created_at: str` + + RFC 3339 timestamp when environment was created + + - `description: str` + + User-provided description for the environment + + - `metadata: Dict[str, str]` + + User-provided metadata key-value pairs + + - `name: str` + + Human-readable name for the environment + + - `type: Literal["environment"]` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: str` + + RFC 3339 timestamp when environment was last updated + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +page = client.beta.environments.list() +page = page.data[0] +print(page.id) +``` diff --git a/content/en/api/python/beta/environments/retrieve.md b/content/en/api/python/beta/environments/retrieve.md new file mode 100644 index 000000000..249938dad --- /dev/null +++ b/content/en/api/python/beta/environments/retrieve.md @@ -0,0 +1,196 @@ +## Retrieve + +`beta.environments.retrieve(strenvironment_id, EnvironmentRetrieveParams**kwargs) -> BetaEnvironment` + +**get** `/v1/environments/{environment_id}` + +Retrieve a specific environment by ID. + +### Parameters + +- `environment_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironment: …` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: str` + + Environment identifier (e.g., 'env_...') + + - `archived_at: Optional[str]` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork: …` + + Unrestricted network access. + + - `type: Literal["unrestricted"]` + + Network policy type + + - `"unrestricted"` + + - `class BetaLimitedNetwork: …` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: List[str]` + + Specifies domains the container can reach. + + - `type: Literal["limited"]` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: List[str]` + + Ubuntu/Debian packages to install + + - `cargo: List[str]` + + Rust packages to install + + - `gem: List[str]` + + Ruby packages to install + + - `go: List[str]` + + Go packages to install + + - `npm: List[str]` + + Node.js packages to install + + - `pip: List[str]` + + Python packages to install + + - `type: Optional[Literal["packages"]]` + + Package configuration type + + - `"packages"` + + - `type: Literal["cloud"]` + + Environment type + + - `"cloud"` + + - `created_at: str` + + RFC 3339 timestamp when environment was created + + - `description: str` + + User-provided description for the environment + + - `metadata: Dict[str, str]` + + User-provided metadata key-value pairs + + - `name: str` + + Human-readable name for the environment + + - `type: Literal["environment"]` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: str` + + RFC 3339 timestamp when environment was last updated + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_environment = client.beta.environments.retrieve( + environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW", +) +print(beta_environment.id) +``` diff --git a/content/en/api/python/beta/environments/update.md b/content/en/api/python/beta/environments/update.md new file mode 100644 index 000000000..4a076bf52 --- /dev/null +++ b/content/en/api/python/beta/environments/update.md @@ -0,0 +1,296 @@ +## Update + +`beta.environments.update(strenvironment_id, EnvironmentUpdateParams**kwargs) -> BetaEnvironment` + +**post** `/v1/environments/{environment_id}` + +Update an existing environment's configuration. + +### Parameters + +- `environment_id: str` + +- `config: Optional[BetaCloudConfigParams]` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: Literal["cloud"]` + + Environment type + + - `"cloud"` + + - `networking: Optional[Networking]` + + Network configuration policy. Omit on update to preserve the existing value. + + - `class BetaUnrestrictedNetwork: …` + + Unrestricted network access. + + - `type: Literal["unrestricted"]` + + Network policy type + + - `"unrestricted"` + + - `class BetaLimitedNetworkParams: …` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: Literal["limited"]` + + Network policy type + + - `"limited"` + + - `allow_mcp_servers: Optional[bool]` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: Optional[bool]` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: Optional[List[str]]` + + Specifies domains the container can reach. + + - `packages: Optional[BetaPackagesParams]` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: Optional[List[str]]` + + Ubuntu/Debian packages to install + + - `cargo: Optional[List[str]]` + + Rust packages to install + + - `gem: Optional[List[str]]` + + Ruby packages to install + + - `go: Optional[List[str]]` + + Go packages to install + + - `npm: Optional[List[str]]` + + Node.js packages to install + + - `pip: Optional[List[str]]` + + Python packages to install + + - `type: Optional[Literal["packages"]]` + + Package configuration type + + - `"packages"` + +- `description: Optional[str]` + + Updated description of the environment + +- `metadata: Optional[Dict[str, Optional[str]]]` + + User-provided metadata key-value pairs. Set a value to null or empty string to delete the key. + +- `name: Optional[str]` + + Updated name for the environment + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironment: …` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: str` + + Environment identifier (e.g., 'env_...') + + - `archived_at: Optional[str]` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: Networking` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork: …` + + Unrestricted network access. + + - `type: Literal["unrestricted"]` + + Network policy type + + - `"unrestricted"` + + - `class BetaLimitedNetwork: …` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: List[str]` + + Specifies domains the container can reach. + + - `type: Literal["limited"]` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: List[str]` + + Ubuntu/Debian packages to install + + - `cargo: List[str]` + + Rust packages to install + + - `gem: List[str]` + + Ruby packages to install + + - `go: List[str]` + + Go packages to install + + - `npm: List[str]` + + Node.js packages to install + + - `pip: List[str]` + + Python packages to install + + - `type: Optional[Literal["packages"]]` + + Package configuration type + + - `"packages"` + + - `type: Literal["cloud"]` + + Environment type + + - `"cloud"` + + - `created_at: str` + + RFC 3339 timestamp when environment was created + + - `description: str` + + User-provided description for the environment + + - `metadata: Dict[str, str]` + + User-provided metadata key-value pairs + + - `name: str` + + Human-readable name for the environment + + - `type: Literal["environment"]` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: str` + + RFC 3339 timestamp when environment was last updated + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_environment = client.beta.environments.update( + environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW", +) +print(beta_environment.id) +``` diff --git a/content/en/api/python/beta/files.md b/content/en/api/python/beta/files.md index 7a53c8bea..ebbd10e22 100644 --- a/content/en/api/python/beta/files.md +++ b/content/en/api/python/beta/files.md @@ -20,7 +20,7 @@ Upload File - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -64,8 +64,6 @@ Upload File - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class FileMetadata: …` @@ -104,6 +102,20 @@ Upload File Whether the file can be downloaded. + - `scope: Optional[BetaFileScope]` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: str` + + The ID of the scoping resource (e.g., the session ID). + + - `type: Literal["session"]` + + The type of scope (e.g., `"session"`). + + - `"session"` + ### Example ```python @@ -143,13 +155,17 @@ List Files Defaults to `20`. Ranges from `1` to `1000`. +- `scope_id: Optional[str]` + + Filter by scope ID. Only returns files associated with the specified scope (e.g., a session ID). + - `betas: Optional[List[AnthropicBetaParam]]` Optional header to specify the beta version(s) you want to use. - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -193,8 +209,6 @@ List Files - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class FileMetadata: …` @@ -233,6 +247,20 @@ List Files Whether the file can be downloaded. + - `scope: Optional[BetaFileScope]` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: str` + + The ID of the scoping resource (e.g., the session ID). + + - `type: Literal["session"]` + + The type of scope (e.g., `"session"`). + + - `"session"` + ### Example ```python @@ -267,7 +295,7 @@ Download File - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -311,8 +339,6 @@ Download File - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BinaryResponseContent` @@ -354,7 +380,7 @@ Get File Metadata - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -398,8 +424,6 @@ Get File Metadata - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class FileMetadata: …` @@ -438,6 +462,20 @@ Get File Metadata Whether the file can be downloaded. + - `scope: Optional[BetaFileScope]` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: str` + + The ID of the scoping resource (e.g., the session ID). + + - `type: Literal["session"]` + + The type of scope (e.g., `"session"`). + + - `"session"` + ### Example ```python @@ -473,7 +511,7 @@ Delete File - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -517,8 +555,6 @@ Delete File - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class DeletedFile: …` @@ -552,6 +588,20 @@ print(deleted_file.id) ## Domain Types +### Beta File Scope + +- `class BetaFileScope: …` + + - `id: str` + + The ID of the scoping resource (e.g., the session ID). + + - `type: Literal["session"]` + + The type of scope (e.g., `"session"`). + + - `"session"` + ### Deleted File - `class DeletedFile: …` @@ -605,3 +655,17 @@ print(deleted_file.id) - `downloadable: Optional[bool]` Whether the file can be downloaded. + + - `scope: Optional[BetaFileScope]` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: str` + + The ID of the scoping resource (e.g., the session ID). + + - `type: Literal["session"]` + + The type of scope (e.g., `"session"`). + + - `"session"` diff --git a/content/en/api/python/beta/files/delete.md b/content/en/api/python/beta/files/delete.md index e0f38f11b..210800842 100644 --- a/content/en/api/python/beta/files/delete.md +++ b/content/en/api/python/beta/files/delete.md @@ -18,7 +18,7 @@ Delete File - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -62,8 +62,6 @@ Delete File - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class DeletedFile: …` diff --git a/content/en/api/python/beta/files/download.md b/content/en/api/python/beta/files/download.md index 6b9a71149..68744f8a7 100644 --- a/content/en/api/python/beta/files/download.md +++ b/content/en/api/python/beta/files/download.md @@ -18,7 +18,7 @@ Download File - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -62,8 +62,6 @@ Download File - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BinaryResponseContent` diff --git a/content/en/api/python/beta/files/list.md b/content/en/api/python/beta/files/list.md index 386ede2d4..ebb796a0f 100644 --- a/content/en/api/python/beta/files/list.md +++ b/content/en/api/python/beta/files/list.md @@ -22,13 +22,17 @@ List Files Defaults to `20`. Ranges from `1` to `1000`. +- `scope_id: Optional[str]` + + Filter by scope ID. Only returns files associated with the specified scope (e.g., a session ID). + - `betas: Optional[List[AnthropicBetaParam]]` Optional header to specify the beta version(s) you want to use. - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -72,8 +76,6 @@ List Files - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class FileMetadata: …` @@ -112,6 +114,20 @@ List Files Whether the file can be downloaded. + - `scope: Optional[BetaFileScope]` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: str` + + The ID of the scoping resource (e.g., the session ID). + + - `type: Literal["session"]` + + The type of scope (e.g., `"session"`). + + - `"session"` + ### Example ```python diff --git a/content/en/api/python/beta/files/retrieve_metadata.md b/content/en/api/python/beta/files/retrieve_metadata.md index 2efa97ff7..10377ed16 100644 --- a/content/en/api/python/beta/files/retrieve_metadata.md +++ b/content/en/api/python/beta/files/retrieve_metadata.md @@ -18,7 +18,7 @@ Get File Metadata - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -62,8 +62,6 @@ Get File Metadata - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class FileMetadata: …` @@ -102,6 +100,20 @@ Get File Metadata Whether the file can be downloaded. + - `scope: Optional[BetaFileScope]` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: str` + + The ID of the scoping resource (e.g., the session ID). + + - `type: Literal["session"]` + + The type of scope (e.g., `"session"`). + + - `"session"` + ### Example ```python diff --git a/content/en/api/python/beta/files/upload.md b/content/en/api/python/beta/files/upload.md index 82e21b347..e289478f9 100644 --- a/content/en/api/python/beta/files/upload.md +++ b/content/en/api/python/beta/files/upload.md @@ -18,7 +18,7 @@ Upload File - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -62,8 +62,6 @@ Upload File - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class FileMetadata: …` @@ -102,6 +100,20 @@ Upload File Whether the file can be downloaded. + - `scope: Optional[BetaFileScope]` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: str` + + The ID of the scoping resource (e.g., the session ID). + + - `type: Literal["session"]` + + The type of scope (e.g., `"session"`). + + - `"session"` + ### Example ```python diff --git a/content/en/api/python/beta/messages.md b/content/en/api/python/beta/messages.md index 393952bcb..25cd61c37 100644 --- a/content/en/api/python/beta/messages.md +++ b/content/en/api/python/beta/messages.md @@ -2599,13 +2599,14 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -2621,9 +2622,13 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -4694,17 +4699,13 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en Recommended for advanced use cases only. You usually only need to use `temperature`. -- `user_profile_id: Optional[str]` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `betas: Optional[List[AnthropicBetaParam]]` Optional header to specify the beta version(s) you want to use. - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -4748,8 +4749,6 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaMessage: …` @@ -5673,13 +5672,14 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -5695,9 +5695,13 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -8605,13 +8609,14 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -8627,9 +8632,13 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -10608,7 +10617,7 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -10652,8 +10661,6 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageTokensCount: …` @@ -10684,7 +10691,7 @@ beta_message_tokens_count = client.beta.messages.count_tokens( "content": "string", "role": "user", }], - model="claude-opus-4-6", + model="claude-mythos-preview", ) print(beta_message_tokens_count.context_management) ``` @@ -17874,13 +17881,14 @@ print(beta_message_tokens_count.context_management) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -17896,9 +17904,13 @@ print(beta_message_tokens_count.context_management) - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -23234,13 +23246,14 @@ print(beta_message_tokens_count.context_management) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -23256,9 +23269,13 @@ print(beta_message_tokens_count.context_management) - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -24494,13 +24511,14 @@ print(beta_message_tokens_count.context_management) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -24516,9 +24534,13 @@ print(beta_message_tokens_count.context_management) - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -35650,13 +35672,14 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -35672,9 +35695,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -37743,17 +37770,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Recommended for advanced use cases only. You usually only need to use `temperature`. - - `user_profile_id: Optional[str]` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `betas: Optional[List[AnthropicBetaParam]]` Optional header to specify the beta version(s) you want to use. - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -37797,8 +37820,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatch: …` @@ -37936,7 +37957,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -37980,8 +38001,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatch: …` @@ -38119,7 +38138,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -38163,8 +38182,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatch: …` @@ -38293,7 +38310,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -38337,8 +38354,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatch: …` @@ -38468,7 +38483,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -38512,8 +38527,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaDeletedMessageBatch: …` @@ -38569,7 +38582,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -38613,8 +38626,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatchIndividualResponse: …` @@ -39556,13 +39567,14 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -39578,9 +39590,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -41151,13 +41167,14 @@ for batch in client.beta.messages.batches.results( See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -41173,9 +41190,13 @@ for batch in client.beta.messages.batches.results( - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -42539,13 +42560,14 @@ for batch in client.beta.messages.batches.results( See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -42561,9 +42583,13 @@ for batch in client.beta.messages.batches.results( - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -43889,13 +43915,14 @@ for batch in client.beta.messages.batches.results( See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -43911,9 +43938,13 @@ for batch in client.beta.messages.batches.results( - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` diff --git a/content/en/api/python/beta/messages/batches.md b/content/en/api/python/beta/messages/batches.md index 61f3405ce..c08c50315 100644 --- a/content/en/api/python/beta/messages/batches.md +++ b/content/en/api/python/beta/messages/batches.md @@ -2615,13 +2615,14 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -2637,9 +2638,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -4708,17 +4713,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Recommended for advanced use cases only. You usually only need to use `temperature`. - - `user_profile_id: Optional[str]` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `betas: Optional[List[AnthropicBetaParam]]` Optional header to specify the beta version(s) you want to use. - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -4762,8 +4763,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatch: …` @@ -4901,7 +4900,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -4945,8 +4944,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatch: …` @@ -5084,7 +5081,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -5128,8 +5125,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatch: …` @@ -5258,7 +5253,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -5302,8 +5297,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatch: …` @@ -5433,7 +5426,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -5477,8 +5470,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaDeletedMessageBatch: …` @@ -5534,7 +5525,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -5578,8 +5569,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatchIndividualResponse: …` @@ -6521,13 +6510,14 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -6543,9 +6533,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -8116,13 +8110,14 @@ for batch in client.beta.messages.batches.results( See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -8138,9 +8133,13 @@ for batch in client.beta.messages.batches.results( - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -9504,13 +9503,14 @@ for batch in client.beta.messages.batches.results( See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -9526,9 +9526,13 @@ for batch in client.beta.messages.batches.results( - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -10854,13 +10858,14 @@ for batch in client.beta.messages.batches.results( See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -10876,9 +10881,13 @@ for batch in client.beta.messages.batches.results( - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` diff --git a/content/en/api/python/beta/messages/batches/cancel.md b/content/en/api/python/beta/messages/batches/cancel.md index c762c9d52..1ee41a3bc 100644 --- a/content/en/api/python/beta/messages/batches/cancel.md +++ b/content/en/api/python/beta/messages/batches/cancel.md @@ -22,7 +22,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -66,8 +66,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatch: …` diff --git a/content/en/api/python/beta/messages/batches/create.md b/content/en/api/python/beta/messages/batches/create.md index a308fbf9c..8b90cacc0 100644 --- a/content/en/api/python/beta/messages/batches/create.md +++ b/content/en/api/python/beta/messages/batches/create.md @@ -2613,13 +2613,14 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -2635,9 +2636,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -4706,17 +4711,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Recommended for advanced use cases only. You usually only need to use `temperature`. - - `user_profile_id: Optional[str]` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `betas: Optional[List[AnthropicBetaParam]]` Optional header to specify the beta version(s) you want to use. - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -4760,8 +4761,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatch: …` diff --git a/content/en/api/python/beta/messages/batches/delete.md b/content/en/api/python/beta/messages/batches/delete.md index c08d15b77..a61b1c7c0 100644 --- a/content/en/api/python/beta/messages/batches/delete.md +++ b/content/en/api/python/beta/messages/batches/delete.md @@ -22,7 +22,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -66,8 +66,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaDeletedMessageBatch: …` diff --git a/content/en/api/python/beta/messages/batches/list.md b/content/en/api/python/beta/messages/batches/list.md index bacee2ce7..a1433cddd 100644 --- a/content/en/api/python/beta/messages/batches/list.md +++ b/content/en/api/python/beta/messages/batches/list.md @@ -30,7 +30,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -74,8 +74,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatch: …` diff --git a/content/en/api/python/beta/messages/batches/results.md b/content/en/api/python/beta/messages/batches/results.md index 04a2ca1c2..11b2688cf 100644 --- a/content/en/api/python/beta/messages/batches/results.md +++ b/content/en/api/python/beta/messages/batches/results.md @@ -22,7 +22,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -66,8 +66,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatchIndividualResponse: …` @@ -1009,13 +1007,14 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -1031,9 +1030,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` diff --git a/content/en/api/python/beta/messages/batches/retrieve.md b/content/en/api/python/beta/messages/batches/retrieve.md index f6183cf35..6333ff91f 100644 --- a/content/en/api/python/beta/messages/batches/retrieve.md +++ b/content/en/api/python/beta/messages/batches/retrieve.md @@ -20,7 +20,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -64,8 +64,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatch: …` diff --git a/content/en/api/python/beta/messages/count_tokens.md b/content/en/api/python/beta/messages/count_tokens.md index 8d99c229b..77926eb81 100644 --- a/content/en/api/python/beta/messages/count_tokens.md +++ b/content/en/api/python/beta/messages/count_tokens.md @@ -2589,13 +2589,14 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -2611,9 +2612,13 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -4592,7 +4597,7 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -4636,8 +4641,6 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageTokensCount: …` @@ -4668,7 +4671,7 @@ beta_message_tokens_count = client.beta.messages.count_tokens( "content": "string", "role": "user", }], - model="claude-opus-4-6", + model="claude-mythos-preview", ) print(beta_message_tokens_count.context_management) ``` diff --git a/content/en/api/python/beta/messages/create.md b/content/en/api/python/beta/messages/create.md index 24804ac63..53a50065b 100644 --- a/content/en/api/python/beta/messages/create.md +++ b/content/en/api/python/beta/messages/create.md @@ -2597,13 +2597,14 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -2619,9 +2620,13 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -4692,17 +4697,13 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en Recommended for advanced use cases only. You usually only need to use `temperature`. -- `user_profile_id: Optional[str]` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `betas: Optional[List[AnthropicBetaParam]]` Optional header to specify the beta version(s) you want to use. - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -4746,8 +4747,6 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaMessage: …` @@ -5671,13 +5670,14 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -5693,9 +5693,13 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` diff --git a/content/en/api/python/beta/models.md b/content/en/api/python/beta/models.md index 075f95f84..54de58a6b 100644 --- a/content/en/api/python/beta/models.md +++ b/content/en/api/python/beta/models.md @@ -32,7 +32,7 @@ The Models API response can be used to determine which models are available for - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -76,8 +76,6 @@ The Models API response can be used to determine which models are available for - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaModelInfo: …` @@ -298,7 +296,7 @@ The Models API response can be used to determine information about a specific mo - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -342,8 +340,6 @@ The Models API response can be used to determine information about a specific mo - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaModelInfo: …` diff --git a/content/en/api/python/beta/models/list.md b/content/en/api/python/beta/models/list.md index ebd2bf725..bf8d84fdb 100644 --- a/content/en/api/python/beta/models/list.md +++ b/content/en/api/python/beta/models/list.md @@ -30,7 +30,7 @@ The Models API response can be used to determine which models are available for - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -74,8 +74,6 @@ The Models API response can be used to determine which models are available for - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaModelInfo: …` diff --git a/content/en/api/python/beta/models/retrieve.md b/content/en/api/python/beta/models/retrieve.md index 0cde128e5..da2c05f1e 100644 --- a/content/en/api/python/beta/models/retrieve.md +++ b/content/en/api/python/beta/models/retrieve.md @@ -20,7 +20,7 @@ The Models API response can be used to determine information about a specific mo - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -64,8 +64,6 @@ The Models API response can be used to determine information about a specific mo - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class BetaModelInfo: …` diff --git a/content/en/api/python/beta/sessions.md b/content/en/api/python/beta/sessions.md new file mode 100644 index 000000000..28663c8bc --- /dev/null +++ b/content/en/api/python/beta/sessions.md @@ -0,0 +1,14315 @@ +# Sessions + +## Create + +`beta.sessions.create(SessionCreateParams**kwargs) -> BetaManagedAgentsSession` + +**post** `/v1/sessions` + +Create Session + +### Parameters + +- `agent: Agent` + + Agent identifier. Accepts the `agent` ID string, which pins the latest version for the session, or an `agent` object with both id and version specified. + + - `str` + + - `class BetaManagedAgentsAgentParams: …` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `id: str` + + The `agent` ID. + + - `type: Literal["agent"]` + + - `"agent"` + + - `version: Optional[int]` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + +- `environment_id: str` + + ID of the `environment` defining the container configuration for this session. + +- `metadata: Optional[Dict[str, str]]` + + Arbitrary key-value metadata attached to the session. + +- `resources: Optional[Iterable[Resource]]` + + Resources (e.g. repositories, files) to mount into the session's container. + + - `class BetaManagedAgentsGitHubRepositoryResourceParams: …` + + Mount a GitHub repository into the session's container. + + - `authorization_token: str` + + GitHub authorization token used to clone the repository. + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `url: str` + + Github URL of the repository + + - `checkout: Optional[Checkout]` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `mount_path: Optional[str]` + + Mount path in the container. Defaults to `/workspace/`. + + - `class BetaManagedAgentsFileResourceParams: …` + + Mount a file uploaded via the Files API into the session. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `mount_path: Optional[str]` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +- `title: Optional[str]` + + Human-readable session title. + +- `vault_ids: Optional[Sequence[str]]` + + Vault IDs for stored credentials the agent can use during the session. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSession: …` + + A Managed Agents `session`. + + - `id: str` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: str` + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `version: int` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `environment_id: str` + + - `metadata: Dict[str, str]` + + - `resources: List[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Optional[float]` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Optional[float]` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: Literal["rescheduling", "running", "idle", "terminated"]` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: Optional[str]` + + - `type: Literal["session"]` + + - `"session"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: Optional[BetaManagedAgentsCacheCreationUsage]` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Optional[int]` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Optional[int]` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Optional[int]` + + Total tokens read from prompt cache. + + - `input_tokens: Optional[int]` + + Total input tokens consumed across all turns. + + - `output_tokens: Optional[int]` + + Total output tokens generated across all turns. + + - `vault_ids: List[str]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_session = client.beta.sessions.create( + agent="agent_011CZkYpogX7uDKUyvBTophP", + environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW", +) +print(beta_managed_agents_session.id) +``` + +## List + +`beta.sessions.list(SessionListParams**kwargs) -> SyncPageCursor[BetaManagedAgentsSession]` + +**get** `/v1/sessions` + +List Sessions + +### Parameters + +- `agent_id: Optional[str]` + + Filter sessions created with this agent ID. + +- `agent_version: Optional[int]` + + Filter by agent version. Only applies when agent_id is also set. + +- `created_at_gt: Optional[Union[str, datetime]]` + + Return sessions created after this time (exclusive). + +- `created_at_gte: Optional[Union[str, datetime]]` + + Return sessions created at or after this time (inclusive). + +- `created_at_lt: Optional[Union[str, datetime]]` + + Return sessions created before this time (exclusive). + +- `created_at_lte: Optional[Union[str, datetime]]` + + Return sessions created at or before this time (inclusive). + +- `include_archived: Optional[bool]` + + When true, includes archived sessions. Default: false (exclude archived). + +- `limit: Optional[int]` + + Maximum number of results to return. + +- `order: Optional[Literal["asc", "desc"]]` + + Sort direction for results, ordered by created_at. Defaults to desc (newest first). + + - `"asc"` + + - `"desc"` + +- `page: Optional[str]` + + Opaque pagination cursor from a previous response's next_page. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSession: …` + + A Managed Agents `session`. + + - `id: str` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: str` + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `version: int` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `environment_id: str` + + - `metadata: Dict[str, str]` + + - `resources: List[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Optional[float]` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Optional[float]` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: Literal["rescheduling", "running", "idle", "terminated"]` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: Optional[str]` + + - `type: Literal["session"]` + + - `"session"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: Optional[BetaManagedAgentsCacheCreationUsage]` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Optional[int]` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Optional[int]` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Optional[int]` + + Total tokens read from prompt cache. + + - `input_tokens: Optional[int]` + + Total input tokens consumed across all turns. + + - `output_tokens: Optional[int]` + + Total output tokens generated across all turns. + + - `vault_ids: List[str]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +page = client.beta.sessions.list() +page = page.data[0] +print(page.id) +``` + +## Retrieve + +`beta.sessions.retrieve(strsession_id, SessionRetrieveParams**kwargs) -> BetaManagedAgentsSession` + +**get** `/v1/sessions/{session_id}` + +Get Session + +### Parameters + +- `session_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSession: …` + + A Managed Agents `session`. + + - `id: str` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: str` + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `version: int` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `environment_id: str` + + - `metadata: Dict[str, str]` + + - `resources: List[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Optional[float]` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Optional[float]` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: Literal["rescheduling", "running", "idle", "terminated"]` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: Optional[str]` + + - `type: Literal["session"]` + + - `"session"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: Optional[BetaManagedAgentsCacheCreationUsage]` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Optional[int]` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Optional[int]` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Optional[int]` + + Total tokens read from prompt cache. + + - `input_tokens: Optional[int]` + + Total input tokens consumed across all turns. + + - `output_tokens: Optional[int]` + + Total output tokens generated across all turns. + + - `vault_ids: List[str]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_session = client.beta.sessions.retrieve( + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", +) +print(beta_managed_agents_session.id) +``` + +## Update + +`beta.sessions.update(strsession_id, SessionUpdateParams**kwargs) -> BetaManagedAgentsSession` + +**post** `/v1/sessions/{session_id}` + +Update Session + +### Parameters + +- `session_id: str` + +- `metadata: Optional[Dict[str, Optional[str]]]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. + +- `title: Optional[str]` + + Human-readable session title. + +- `vault_ids: Optional[Sequence[str]]` + + Vault IDs (`vlt_*`) to attach to the session. Not yet supported; requests setting this field are rejected. Reserved for future use. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSession: …` + + A Managed Agents `session`. + + - `id: str` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: str` + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `version: int` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `environment_id: str` + + - `metadata: Dict[str, str]` + + - `resources: List[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Optional[float]` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Optional[float]` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: Literal["rescheduling", "running", "idle", "terminated"]` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: Optional[str]` + + - `type: Literal["session"]` + + - `"session"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: Optional[BetaManagedAgentsCacheCreationUsage]` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Optional[int]` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Optional[int]` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Optional[int]` + + Total tokens read from prompt cache. + + - `input_tokens: Optional[int]` + + Total input tokens consumed across all turns. + + - `output_tokens: Optional[int]` + + Total output tokens generated across all turns. + + - `vault_ids: List[str]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_session = client.beta.sessions.update( + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", +) +print(beta_managed_agents_session.id) +``` + +## Delete + +`beta.sessions.delete(strsession_id, SessionDeleteParams**kwargs) -> BetaManagedAgentsDeletedSession` + +**delete** `/v1/sessions/{session_id}` + +Delete Session + +### Parameters + +- `session_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsDeletedSession: …` + + Confirmation that a `session` has been permanently deleted. + + - `id: str` + + - `type: Literal["session_deleted"]` + + - `"session_deleted"` + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_deleted_session = client.beta.sessions.delete( + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", +) +print(beta_managed_agents_deleted_session.id) +``` + +## Archive + +`beta.sessions.archive(strsession_id, SessionArchiveParams**kwargs) -> BetaManagedAgentsSession` + +**post** `/v1/sessions/{session_id}/archive` + +Archive Session + +### Parameters + +- `session_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSession: …` + + A Managed Agents `session`. + + - `id: str` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: str` + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `version: int` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `environment_id: str` + + - `metadata: Dict[str, str]` + + - `resources: List[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Optional[float]` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Optional[float]` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: Literal["rescheduling", "running", "idle", "terminated"]` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: Optional[str]` + + - `type: Literal["session"]` + + - `"session"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: Optional[BetaManagedAgentsCacheCreationUsage]` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Optional[int]` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Optional[int]` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Optional[int]` + + Total tokens read from prompt cache. + + - `input_tokens: Optional[int]` + + Total input tokens consumed across all turns. + + - `output_tokens: Optional[int]` + + Total output tokens generated across all turns. + + - `vault_ids: List[str]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_session = client.beta.sessions.archive( + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", +) +print(beta_managed_agents_session.id) +``` + +## Domain Types + +### Beta Managed Agents Agent Params + +- `class BetaManagedAgentsAgentParams: …` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `id: str` + + The `agent` ID. + + - `type: Literal["agent"]` + + - `"agent"` + + - `version: Optional[int]` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + +### Beta Managed Agents Branch Checkout + +- `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + +### Beta Managed Agents Cache Creation Usage + +- `class BetaManagedAgentsCacheCreationUsage: …` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Optional[int]` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Optional[int]` + + Tokens used to create 5-minute ephemeral cache entries. + +### Beta Managed Agents Commit Checkout + +- `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + +### Beta Managed Agents Deleted Session + +- `class BetaManagedAgentsDeletedSession: …` + + Confirmation that a `session` has been permanently deleted. + + - `id: str` + + - `type: Literal["session_deleted"]` + + - `"session_deleted"` + +### Beta Managed Agents File Resource Params + +- `class BetaManagedAgentsFileResourceParams: …` + + Mount a file uploaded via the Files API into the session. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `mount_path: Optional[str]` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +### Beta Managed Agents GitHub Repository Resource Params + +- `class BetaManagedAgentsGitHubRepositoryResourceParams: …` + + Mount a GitHub repository into the session's container. + + - `authorization_token: str` + + GitHub authorization token used to clone the repository. + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `url: str` + + Github URL of the repository + + - `checkout: Optional[Checkout]` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `mount_path: Optional[str]` + + Mount path in the container. Defaults to `/workspace/`. + +### Beta Managed Agents Session + +- `class BetaManagedAgentsSession: …` + + A Managed Agents `session`. + + - `id: str` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: str` + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `version: int` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `environment_id: str` + + - `metadata: Dict[str, str]` + + - `resources: List[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Optional[float]` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Optional[float]` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: Literal["rescheduling", "running", "idle", "terminated"]` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: Optional[str]` + + - `type: Literal["session"]` + + - `"session"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: Optional[BetaManagedAgentsCacheCreationUsage]` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Optional[int]` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Optional[int]` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Optional[int]` + + Total tokens read from prompt cache. + + - `input_tokens: Optional[int]` + + Total input tokens consumed across all turns. + + - `output_tokens: Optional[int]` + + Total output tokens generated across all turns. + + - `vault_ids: List[str]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Beta Managed Agents Session Agent + +- `class BetaManagedAgentsSessionAgent: …` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: str` + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `version: int` + +### Beta Managed Agents Session Stats + +- `class BetaManagedAgentsSessionStats: …` + + Timing statistics for a session. + + - `active_seconds: Optional[float]` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Optional[float]` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + +### Beta Managed Agents Session Usage + +- `class BetaManagedAgentsSessionUsage: …` + + Cumulative token usage for a session across all turns. + + - `cache_creation: Optional[BetaManagedAgentsCacheCreationUsage]` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Optional[int]` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Optional[int]` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Optional[int]` + + Total tokens read from prompt cache. + + - `input_tokens: Optional[int]` + + Total input tokens consumed across all turns. + + - `output_tokens: Optional[int]` + + Total output tokens generated across all turns. + +# Events + +## List + +`beta.sessions.events.list(strsession_id, EventListParams**kwargs) -> SyncPageCursor[BetaManagedAgentsSessionEvent]` + +**get** `/v1/sessions/{session_id}/events` + +List Events + +### Parameters + +- `session_id: str` + +- `limit: Optional[int]` + + Query parameter for limit + +- `order: Optional[Literal["asc", "desc"]]` + + Sort direction for results, ordered by created_at. Defaults to asc (chronological). + + - `"asc"` + + - `"desc"` + +- `page: Optional[str]` + + Opaque pagination cursor from a previous response's next_page. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSessionEvent` + + Union type for all event types in a session. + + - `class BetaManagedAgentsUserMessageEvent: …` + + A user message event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[Content]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent: …` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: str` + + Unique identifier for this event. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent: …` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: str` + + Unique identifier for this event. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent: …` + + Event sent by the client providing the result of a custom tool execution. + + - `id: str` + + Unique identifier for this event. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent: …` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the custom tool being called. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.custom_tool_use"]` + + - `"agent.custom_tool_use"` + + - `class BetaManagedAgentsAgentMessageEvent: …` + + An agent response event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.message"]` + + - `"agent.message"` + + - `class BetaManagedAgentsAgentThinkingEvent: …` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thinking"]` + + - `"agent.thinking"` + + - `class BetaManagedAgentsAgentMCPToolUseEvent: …` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `mcp_server_name: str` + + Name of the MCP server providing the tool. + + - `name: str` + + Name of the MCP tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_use"]` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `class BetaManagedAgentsAgentMCPToolResultEvent: …` + + Event representing the result of an MCP tool execution. + + - `id: str` + + Unique identifier for this event. + + - `mcp_tool_use_id: str` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_result"]` + + - `"agent.mcp_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent: …` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the agent tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.tool_use"]` + + - `"agent.tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `class BetaManagedAgentsAgentToolResultEvent: …` + + Event representing the result of an agent tool execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `tool_use_id: str` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: Literal["agent.tool_result"]` + + - `"agent.tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent: …` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thread_context_compacted"]` + + - `"agent.thread_context_compacted"` + + - `class BetaManagedAgentsSessionErrorEvent: …` + + An error event indicating a problem occurred during session execution. + + - `id: str` + + Unique identifier for this event. + + - `error: Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError: …` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["unknown_error"]` + + - `"unknown_error"` + + - `class BetaManagedAgentsModelOverloadedError: …` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_overloaded_error"]` + + - `"model_overloaded_error"` + + - `class BetaManagedAgentsModelRateLimitedError: …` + + The model request was rate-limited. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_rate_limited_error"]` + + - `"model_rate_limited_error"` + + - `class BetaManagedAgentsModelRequestFailedError: …` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_request_failed_error"]` + + - `"model_request_failed_error"` + + - `class BetaManagedAgentsMCPConnectionFailedError: …` + + Failed to connect to an MCP server. + + - `mcp_server_name: str` + + Name of the MCP server that failed to connect. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_connection_failed_error"]` + + - `"mcp_connection_failed_error"` + + - `class BetaManagedAgentsMCPAuthenticationFailedError: …` + + Authentication to an MCP server failed. + + - `mcp_server_name: str` + + Name of the MCP server that failed authentication. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_authentication_failed_error"]` + + - `"mcp_authentication_failed_error"` + + - `class BetaManagedAgentsBillingError: …` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["billing_error"]` + + - `"billing_error"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.error"]` + + - `"session.error"` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent: …` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_rescheduled"]` + + - `"session.status_rescheduled"` + + - `class BetaManagedAgentsSessionStatusRunningEvent: …` + + Indicates the session is actively running and the agent is working. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_running"]` + + - `"session.status_running"` + + - `class BetaManagedAgentsSessionStatusIdleEvent: …` + + Indicates the agent has paused and is awaiting user input. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `stop_reason: StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn: …` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: Literal["end_turn"]` + + - `"end_turn"` + + - `class BetaManagedAgentsSessionRequiresAction: …` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: List[str]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: Literal["requires_action"]` + + - `"requires_action"` + + - `class BetaManagedAgentsSessionRetriesExhausted: …` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: Literal["retries_exhausted"]` + + - `"retries_exhausted"` + + - `type: Literal["session.status_idle"]` + + - `"session.status_idle"` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent: …` + + Indicates the session has terminated, either due to an error or completion. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_terminated"]` + + - `"session.status_terminated"` + + - `class BetaManagedAgentsSpanModelRequestStartEvent: …` + + Emitted when a model request is initiated by the agent. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_start"]` + + - `"span.model_request_start"` + + - `class BetaManagedAgentsSpanModelRequestEndEvent: …` + + Emitted when a model request completes. + + - `id: str` + + Unique identifier for this event. + + - `is_error: Optional[bool]` + + Whether the model request resulted in an error. + + - `model_request_start_id: str` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: int` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: int` + + Tokens read from prompt cache in this request. + + - `input_tokens: int` + + Input tokens consumed by this request. + + - `output_tokens: int` + + Output tokens generated by this request. + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_end"]` + + - `"span.model_request_end"` + + - `class BetaManagedAgentsSessionDeletedEvent: …` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.deleted"]` + + - `"session.deleted"` + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +page = client.beta.sessions.events.list( + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", +) +page = page.data[0] +print(page) +``` + +## Send + +`beta.sessions.events.send(strsession_id, EventSendParams**kwargs) -> BetaManagedAgentsSendSessionEvents` + +**post** `/v1/sessions/{session_id}/events` + +Send Events + +### Parameters + +- `session_id: str` + +- `events: Iterable[BetaManagedAgentsEventParams]` + + Events to send to the `session`. + + - `class BetaManagedAgentsUserMessageEventParams: …` + + Parameters for sending a user message to the session. + + - `content: List[Content]` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + + - `class BetaManagedAgentsUserInterruptEventParams: …` + + Parameters for sending an interrupt to pause the agent. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + + - `class BetaManagedAgentsUserToolConfirmationEventParams: …` + + Parameters for confirming or denying a tool execution request. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `class BetaManagedAgentsUserCustomToolResultEventParams: …` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSendSessionEvents: …` + + Events that were successfully sent to the session. + + - `data: Optional[List[Data]]` + + Sent events + + - `class BetaManagedAgentsUserMessageEvent: …` + + A user message event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[Content]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent: …` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: str` + + Unique identifier for this event. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent: …` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: str` + + Unique identifier for this event. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent: …` + + Event sent by the client providing the result of a custom tool execution. + + - `id: str` + + Unique identifier for this event. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_send_session_events = client.beta.sessions.events.send( + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", + events=[{ + "content": [{ + "text": "Where is my order #1234?", + "type": "text", + }], + "type": "user.message", + }], +) +print(beta_managed_agents_send_session_events.data) +``` + +## Stream + +`beta.sessions.events.stream(strsession_id, EventStreamParams**kwargs) -> BetaManagedAgentsStreamSessionEvents` + +**get** `/v1/sessions/{session_id}/events/stream` + +Stream Events + +### Parameters + +- `session_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsStreamSessionEvents` + + Server-sent event in the session stream. + + - `class BetaManagedAgentsUserMessageEvent: …` + + A user message event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[Content]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent: …` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: str` + + Unique identifier for this event. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent: …` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: str` + + Unique identifier for this event. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent: …` + + Event sent by the client providing the result of a custom tool execution. + + - `id: str` + + Unique identifier for this event. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent: …` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the custom tool being called. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.custom_tool_use"]` + + - `"agent.custom_tool_use"` + + - `class BetaManagedAgentsAgentMessageEvent: …` + + An agent response event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.message"]` + + - `"agent.message"` + + - `class BetaManagedAgentsAgentThinkingEvent: …` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thinking"]` + + - `"agent.thinking"` + + - `class BetaManagedAgentsAgentMCPToolUseEvent: …` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `mcp_server_name: str` + + Name of the MCP server providing the tool. + + - `name: str` + + Name of the MCP tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_use"]` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `class BetaManagedAgentsAgentMCPToolResultEvent: …` + + Event representing the result of an MCP tool execution. + + - `id: str` + + Unique identifier for this event. + + - `mcp_tool_use_id: str` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_result"]` + + - `"agent.mcp_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent: …` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the agent tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.tool_use"]` + + - `"agent.tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `class BetaManagedAgentsAgentToolResultEvent: …` + + Event representing the result of an agent tool execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `tool_use_id: str` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: Literal["agent.tool_result"]` + + - `"agent.tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent: …` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thread_context_compacted"]` + + - `"agent.thread_context_compacted"` + + - `class BetaManagedAgentsSessionErrorEvent: …` + + An error event indicating a problem occurred during session execution. + + - `id: str` + + Unique identifier for this event. + + - `error: Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError: …` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["unknown_error"]` + + - `"unknown_error"` + + - `class BetaManagedAgentsModelOverloadedError: …` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_overloaded_error"]` + + - `"model_overloaded_error"` + + - `class BetaManagedAgentsModelRateLimitedError: …` + + The model request was rate-limited. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_rate_limited_error"]` + + - `"model_rate_limited_error"` + + - `class BetaManagedAgentsModelRequestFailedError: …` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_request_failed_error"]` + + - `"model_request_failed_error"` + + - `class BetaManagedAgentsMCPConnectionFailedError: …` + + Failed to connect to an MCP server. + + - `mcp_server_name: str` + + Name of the MCP server that failed to connect. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_connection_failed_error"]` + + - `"mcp_connection_failed_error"` + + - `class BetaManagedAgentsMCPAuthenticationFailedError: …` + + Authentication to an MCP server failed. + + - `mcp_server_name: str` + + Name of the MCP server that failed authentication. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_authentication_failed_error"]` + + - `"mcp_authentication_failed_error"` + + - `class BetaManagedAgentsBillingError: …` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["billing_error"]` + + - `"billing_error"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.error"]` + + - `"session.error"` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent: …` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_rescheduled"]` + + - `"session.status_rescheduled"` + + - `class BetaManagedAgentsSessionStatusRunningEvent: …` + + Indicates the session is actively running and the agent is working. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_running"]` + + - `"session.status_running"` + + - `class BetaManagedAgentsSessionStatusIdleEvent: …` + + Indicates the agent has paused and is awaiting user input. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `stop_reason: StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn: …` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: Literal["end_turn"]` + + - `"end_turn"` + + - `class BetaManagedAgentsSessionRequiresAction: …` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: List[str]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: Literal["requires_action"]` + + - `"requires_action"` + + - `class BetaManagedAgentsSessionRetriesExhausted: …` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: Literal["retries_exhausted"]` + + - `"retries_exhausted"` + + - `type: Literal["session.status_idle"]` + + - `"session.status_idle"` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent: …` + + Indicates the session has terminated, either due to an error or completion. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_terminated"]` + + - `"session.status_terminated"` + + - `class BetaManagedAgentsSpanModelRequestStartEvent: …` + + Emitted when a model request is initiated by the agent. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_start"]` + + - `"span.model_request_start"` + + - `class BetaManagedAgentsSpanModelRequestEndEvent: …` + + Emitted when a model request completes. + + - `id: str` + + Unique identifier for this event. + + - `is_error: Optional[bool]` + + Whether the model request resulted in an error. + + - `model_request_start_id: str` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: int` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: int` + + Tokens read from prompt cache in this request. + + - `input_tokens: int` + + Input tokens consumed by this request. + + - `output_tokens: int` + + Output tokens generated by this request. + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_end"]` + + - `"span.model_request_end"` + + - `class BetaManagedAgentsSessionDeletedEvent: …` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.deleted"]` + + - `"session.deleted"` + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +for event in client.beta.sessions.events.stream( + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", +): + print(event) +``` + +## Domain Types + +### Beta Managed Agents Agent Custom Tool Use Event + +- `class BetaManagedAgentsAgentCustomToolUseEvent: …` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the custom tool being called. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.custom_tool_use"]` + + - `"agent.custom_tool_use"` + +### Beta Managed Agents Agent MCP Tool Result Event + +- `class BetaManagedAgentsAgentMCPToolResultEvent: …` + + Event representing the result of an MCP tool execution. + + - `id: str` + + Unique identifier for this event. + + - `mcp_tool_use_id: str` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_result"]` + + - `"agent.mcp_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent MCP Tool Use Event + +- `class BetaManagedAgentsAgentMCPToolUseEvent: …` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `mcp_server_name: str` + + Name of the MCP server providing the tool. + + - `name: str` + + Name of the MCP tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_use"]` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + +### Beta Managed Agents Agent Message Event + +- `class BetaManagedAgentsAgentMessageEvent: …` + + An agent response event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.message"]` + + - `"agent.message"` + +### Beta Managed Agents Agent Thinking Event + +- `class BetaManagedAgentsAgentThinkingEvent: …` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thinking"]` + + - `"agent.thinking"` + +### Beta Managed Agents Agent Thread Context Compacted Event + +- `class BetaManagedAgentsAgentThreadContextCompactedEvent: …` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thread_context_compacted"]` + + - `"agent.thread_context_compacted"` + +### Beta Managed Agents Agent Tool Result Event + +- `class BetaManagedAgentsAgentToolResultEvent: …` + + Event representing the result of an agent tool execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `tool_use_id: str` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: Literal["agent.tool_result"]` + + - `"agent.tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent Tool Use Event + +- `class BetaManagedAgentsAgentToolUseEvent: …` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the agent tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.tool_use"]` + + - `"agent.tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + +### Beta Managed Agents Base64 Document Source + +- `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + +### Beta Managed Agents Base64 Image Source + +- `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + +### Beta Managed Agents Billing Error + +- `class BetaManagedAgentsBillingError: …` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["billing_error"]` + + - `"billing_error"` + +### Beta Managed Agents Document Block + +- `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + +### Beta Managed Agents Event Params + +- `BetaManagedAgentsEventParams` + + Union type for event parameters that can be sent to a session. + + - `class BetaManagedAgentsUserMessageEventParams: …` + + Parameters for sending a user message to the session. + + - `content: List[Content]` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + + - `class BetaManagedAgentsUserInterruptEventParams: …` + + Parameters for sending an interrupt to pause the agent. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + + - `class BetaManagedAgentsUserToolConfirmationEventParams: …` + + Parameters for confirming or denying a tool execution request. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `class BetaManagedAgentsUserCustomToolResultEventParams: …` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents File Document Source + +- `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + +### Beta Managed Agents File Image Source + +- `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + +### Beta Managed Agents Image Block + +- `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + +### Beta Managed Agents MCP Authentication Failed Error + +- `class BetaManagedAgentsMCPAuthenticationFailedError: …` + + Authentication to an MCP server failed. + + - `mcp_server_name: str` + + Name of the MCP server that failed authentication. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_authentication_failed_error"]` + + - `"mcp_authentication_failed_error"` + +### Beta Managed Agents MCP Connection Failed Error + +- `class BetaManagedAgentsMCPConnectionFailedError: …` + + Failed to connect to an MCP server. + + - `mcp_server_name: str` + + Name of the MCP server that failed to connect. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_connection_failed_error"]` + + - `"mcp_connection_failed_error"` + +### Beta Managed Agents Model Overloaded Error + +- `class BetaManagedAgentsModelOverloadedError: …` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_overloaded_error"]` + + - `"model_overloaded_error"` + +### Beta Managed Agents Model Rate Limited Error + +- `class BetaManagedAgentsModelRateLimitedError: …` + + The model request was rate-limited. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_rate_limited_error"]` + + - `"model_rate_limited_error"` + +### Beta Managed Agents Model Request Failed Error + +- `class BetaManagedAgentsModelRequestFailedError: …` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_request_failed_error"]` + + - `"model_request_failed_error"` + +### Beta Managed Agents Plain Text Document Source + +- `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + +### Beta Managed Agents Retry Status Exhausted + +- `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + +### Beta Managed Agents Retry Status Retrying + +- `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + +### Beta Managed Agents Retry Status Terminal + +- `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + +### Beta Managed Agents Send Session Events + +- `class BetaManagedAgentsSendSessionEvents: …` + + Events that were successfully sent to the session. + + - `data: Optional[List[Data]]` + + Sent events + + - `class BetaManagedAgentsUserMessageEvent: …` + + A user message event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[Content]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent: …` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: str` + + Unique identifier for this event. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent: …` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: str` + + Unique identifier for this event. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent: …` + + Event sent by the client providing the result of a custom tool execution. + + - `id: str` + + Unique identifier for this event. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + +### Beta Managed Agents Session Deleted Event + +- `class BetaManagedAgentsSessionDeletedEvent: …` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.deleted"]` + + - `"session.deleted"` + +### Beta Managed Agents Session End Turn + +- `class BetaManagedAgentsSessionEndTurn: …` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: Literal["end_turn"]` + + - `"end_turn"` + +### Beta Managed Agents Session Error Event + +- `class BetaManagedAgentsSessionErrorEvent: …` + + An error event indicating a problem occurred during session execution. + + - `id: str` + + Unique identifier for this event. + + - `error: Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError: …` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["unknown_error"]` + + - `"unknown_error"` + + - `class BetaManagedAgentsModelOverloadedError: …` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_overloaded_error"]` + + - `"model_overloaded_error"` + + - `class BetaManagedAgentsModelRateLimitedError: …` + + The model request was rate-limited. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_rate_limited_error"]` + + - `"model_rate_limited_error"` + + - `class BetaManagedAgentsModelRequestFailedError: …` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_request_failed_error"]` + + - `"model_request_failed_error"` + + - `class BetaManagedAgentsMCPConnectionFailedError: …` + + Failed to connect to an MCP server. + + - `mcp_server_name: str` + + Name of the MCP server that failed to connect. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_connection_failed_error"]` + + - `"mcp_connection_failed_error"` + + - `class BetaManagedAgentsMCPAuthenticationFailedError: …` + + Authentication to an MCP server failed. + + - `mcp_server_name: str` + + Name of the MCP server that failed authentication. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_authentication_failed_error"]` + + - `"mcp_authentication_failed_error"` + + - `class BetaManagedAgentsBillingError: …` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["billing_error"]` + + - `"billing_error"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.error"]` + + - `"session.error"` + +### Beta Managed Agents Session Event + +- `BetaManagedAgentsSessionEvent` + + Union type for all event types in a session. + + - `class BetaManagedAgentsUserMessageEvent: …` + + A user message event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[Content]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent: …` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: str` + + Unique identifier for this event. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent: …` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: str` + + Unique identifier for this event. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent: …` + + Event sent by the client providing the result of a custom tool execution. + + - `id: str` + + Unique identifier for this event. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent: …` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the custom tool being called. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.custom_tool_use"]` + + - `"agent.custom_tool_use"` + + - `class BetaManagedAgentsAgentMessageEvent: …` + + An agent response event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.message"]` + + - `"agent.message"` + + - `class BetaManagedAgentsAgentThinkingEvent: …` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thinking"]` + + - `"agent.thinking"` + + - `class BetaManagedAgentsAgentMCPToolUseEvent: …` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `mcp_server_name: str` + + Name of the MCP server providing the tool. + + - `name: str` + + Name of the MCP tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_use"]` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `class BetaManagedAgentsAgentMCPToolResultEvent: …` + + Event representing the result of an MCP tool execution. + + - `id: str` + + Unique identifier for this event. + + - `mcp_tool_use_id: str` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_result"]` + + - `"agent.mcp_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent: …` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the agent tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.tool_use"]` + + - `"agent.tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `class BetaManagedAgentsAgentToolResultEvent: …` + + Event representing the result of an agent tool execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `tool_use_id: str` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: Literal["agent.tool_result"]` + + - `"agent.tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent: …` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thread_context_compacted"]` + + - `"agent.thread_context_compacted"` + + - `class BetaManagedAgentsSessionErrorEvent: …` + + An error event indicating a problem occurred during session execution. + + - `id: str` + + Unique identifier for this event. + + - `error: Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError: …` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["unknown_error"]` + + - `"unknown_error"` + + - `class BetaManagedAgentsModelOverloadedError: …` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_overloaded_error"]` + + - `"model_overloaded_error"` + + - `class BetaManagedAgentsModelRateLimitedError: …` + + The model request was rate-limited. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_rate_limited_error"]` + + - `"model_rate_limited_error"` + + - `class BetaManagedAgentsModelRequestFailedError: …` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_request_failed_error"]` + + - `"model_request_failed_error"` + + - `class BetaManagedAgentsMCPConnectionFailedError: …` + + Failed to connect to an MCP server. + + - `mcp_server_name: str` + + Name of the MCP server that failed to connect. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_connection_failed_error"]` + + - `"mcp_connection_failed_error"` + + - `class BetaManagedAgentsMCPAuthenticationFailedError: …` + + Authentication to an MCP server failed. + + - `mcp_server_name: str` + + Name of the MCP server that failed authentication. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_authentication_failed_error"]` + + - `"mcp_authentication_failed_error"` + + - `class BetaManagedAgentsBillingError: …` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["billing_error"]` + + - `"billing_error"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.error"]` + + - `"session.error"` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent: …` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_rescheduled"]` + + - `"session.status_rescheduled"` + + - `class BetaManagedAgentsSessionStatusRunningEvent: …` + + Indicates the session is actively running and the agent is working. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_running"]` + + - `"session.status_running"` + + - `class BetaManagedAgentsSessionStatusIdleEvent: …` + + Indicates the agent has paused and is awaiting user input. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `stop_reason: StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn: …` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: Literal["end_turn"]` + + - `"end_turn"` + + - `class BetaManagedAgentsSessionRequiresAction: …` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: List[str]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: Literal["requires_action"]` + + - `"requires_action"` + + - `class BetaManagedAgentsSessionRetriesExhausted: …` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: Literal["retries_exhausted"]` + + - `"retries_exhausted"` + + - `type: Literal["session.status_idle"]` + + - `"session.status_idle"` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent: …` + + Indicates the session has terminated, either due to an error or completion. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_terminated"]` + + - `"session.status_terminated"` + + - `class BetaManagedAgentsSpanModelRequestStartEvent: …` + + Emitted when a model request is initiated by the agent. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_start"]` + + - `"span.model_request_start"` + + - `class BetaManagedAgentsSpanModelRequestEndEvent: …` + + Emitted when a model request completes. + + - `id: str` + + Unique identifier for this event. + + - `is_error: Optional[bool]` + + Whether the model request resulted in an error. + + - `model_request_start_id: str` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: int` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: int` + + Tokens read from prompt cache in this request. + + - `input_tokens: int` + + Input tokens consumed by this request. + + - `output_tokens: int` + + Output tokens generated by this request. + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_end"]` + + - `"span.model_request_end"` + + - `class BetaManagedAgentsSessionDeletedEvent: …` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.deleted"]` + + - `"session.deleted"` + +### Beta Managed Agents Session Requires Action + +- `class BetaManagedAgentsSessionRequiresAction: …` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: List[str]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: Literal["requires_action"]` + + - `"requires_action"` + +### Beta Managed Agents Session Retries Exhausted + +- `class BetaManagedAgentsSessionRetriesExhausted: …` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: Literal["retries_exhausted"]` + + - `"retries_exhausted"` + +### Beta Managed Agents Session Status Idle Event + +- `class BetaManagedAgentsSessionStatusIdleEvent: …` + + Indicates the agent has paused and is awaiting user input. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `stop_reason: StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn: …` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: Literal["end_turn"]` + + - `"end_turn"` + + - `class BetaManagedAgentsSessionRequiresAction: …` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: List[str]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: Literal["requires_action"]` + + - `"requires_action"` + + - `class BetaManagedAgentsSessionRetriesExhausted: …` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: Literal["retries_exhausted"]` + + - `"retries_exhausted"` + + - `type: Literal["session.status_idle"]` + + - `"session.status_idle"` + +### Beta Managed Agents Session Status Rescheduled Event + +- `class BetaManagedAgentsSessionStatusRescheduledEvent: …` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_rescheduled"]` + + - `"session.status_rescheduled"` + +### Beta Managed Agents Session Status Running Event + +- `class BetaManagedAgentsSessionStatusRunningEvent: …` + + Indicates the session is actively running and the agent is working. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_running"]` + + - `"session.status_running"` + +### Beta Managed Agents Session Status Terminated Event + +- `class BetaManagedAgentsSessionStatusTerminatedEvent: …` + + Indicates the session has terminated, either due to an error or completion. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_terminated"]` + + - `"session.status_terminated"` + +### Beta Managed Agents Span Model Request End Event + +- `class BetaManagedAgentsSpanModelRequestEndEvent: …` + + Emitted when a model request completes. + + - `id: str` + + Unique identifier for this event. + + - `is_error: Optional[bool]` + + Whether the model request resulted in an error. + + - `model_request_start_id: str` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: int` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: int` + + Tokens read from prompt cache in this request. + + - `input_tokens: int` + + Input tokens consumed by this request. + + - `output_tokens: int` + + Output tokens generated by this request. + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_end"]` + + - `"span.model_request_end"` + +### Beta Managed Agents Span Model Request Start Event + +- `class BetaManagedAgentsSpanModelRequestStartEvent: …` + + Emitted when a model request is initiated by the agent. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_start"]` + + - `"span.model_request_start"` + +### Beta Managed Agents Span Model Usage + +- `class BetaManagedAgentsSpanModelUsage: …` + + Token usage for a single model request. + + - `cache_creation_input_tokens: int` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: int` + + Tokens read from prompt cache in this request. + + - `input_tokens: int` + + Input tokens consumed by this request. + + - `output_tokens: int` + + Output tokens generated by this request. + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +### Beta Managed Agents Stream Session Events + +- `BetaManagedAgentsStreamSessionEvents` + + Server-sent event in the session stream. + + - `class BetaManagedAgentsUserMessageEvent: …` + + A user message event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[Content]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent: …` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: str` + + Unique identifier for this event. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent: …` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: str` + + Unique identifier for this event. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent: …` + + Event sent by the client providing the result of a custom tool execution. + + - `id: str` + + Unique identifier for this event. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent: …` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the custom tool being called. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.custom_tool_use"]` + + - `"agent.custom_tool_use"` + + - `class BetaManagedAgentsAgentMessageEvent: …` + + An agent response event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.message"]` + + - `"agent.message"` + + - `class BetaManagedAgentsAgentThinkingEvent: …` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thinking"]` + + - `"agent.thinking"` + + - `class BetaManagedAgentsAgentMCPToolUseEvent: …` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `mcp_server_name: str` + + Name of the MCP server providing the tool. + + - `name: str` + + Name of the MCP tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_use"]` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `class BetaManagedAgentsAgentMCPToolResultEvent: …` + + Event representing the result of an MCP tool execution. + + - `id: str` + + Unique identifier for this event. + + - `mcp_tool_use_id: str` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_result"]` + + - `"agent.mcp_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent: …` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the agent tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.tool_use"]` + + - `"agent.tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `class BetaManagedAgentsAgentToolResultEvent: …` + + Event representing the result of an agent tool execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `tool_use_id: str` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: Literal["agent.tool_result"]` + + - `"agent.tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent: …` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thread_context_compacted"]` + + - `"agent.thread_context_compacted"` + + - `class BetaManagedAgentsSessionErrorEvent: …` + + An error event indicating a problem occurred during session execution. + + - `id: str` + + Unique identifier for this event. + + - `error: Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError: …` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["unknown_error"]` + + - `"unknown_error"` + + - `class BetaManagedAgentsModelOverloadedError: …` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_overloaded_error"]` + + - `"model_overloaded_error"` + + - `class BetaManagedAgentsModelRateLimitedError: …` + + The model request was rate-limited. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_rate_limited_error"]` + + - `"model_rate_limited_error"` + + - `class BetaManagedAgentsModelRequestFailedError: …` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_request_failed_error"]` + + - `"model_request_failed_error"` + + - `class BetaManagedAgentsMCPConnectionFailedError: …` + + Failed to connect to an MCP server. + + - `mcp_server_name: str` + + Name of the MCP server that failed to connect. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_connection_failed_error"]` + + - `"mcp_connection_failed_error"` + + - `class BetaManagedAgentsMCPAuthenticationFailedError: …` + + Authentication to an MCP server failed. + + - `mcp_server_name: str` + + Name of the MCP server that failed authentication. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_authentication_failed_error"]` + + - `"mcp_authentication_failed_error"` + + - `class BetaManagedAgentsBillingError: …` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["billing_error"]` + + - `"billing_error"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.error"]` + + - `"session.error"` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent: …` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_rescheduled"]` + + - `"session.status_rescheduled"` + + - `class BetaManagedAgentsSessionStatusRunningEvent: …` + + Indicates the session is actively running and the agent is working. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_running"]` + + - `"session.status_running"` + + - `class BetaManagedAgentsSessionStatusIdleEvent: …` + + Indicates the agent has paused and is awaiting user input. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `stop_reason: StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn: …` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: Literal["end_turn"]` + + - `"end_turn"` + + - `class BetaManagedAgentsSessionRequiresAction: …` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: List[str]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: Literal["requires_action"]` + + - `"requires_action"` + + - `class BetaManagedAgentsSessionRetriesExhausted: …` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: Literal["retries_exhausted"]` + + - `"retries_exhausted"` + + - `type: Literal["session.status_idle"]` + + - `"session.status_idle"` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent: …` + + Indicates the session has terminated, either due to an error or completion. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_terminated"]` + + - `"session.status_terminated"` + + - `class BetaManagedAgentsSpanModelRequestStartEvent: …` + + Emitted when a model request is initiated by the agent. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_start"]` + + - `"span.model_request_start"` + + - `class BetaManagedAgentsSpanModelRequestEndEvent: …` + + Emitted when a model request completes. + + - `id: str` + + Unique identifier for this event. + + - `is_error: Optional[bool]` + + Whether the model request resulted in an error. + + - `model_request_start_id: str` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: int` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: int` + + Tokens read from prompt cache in this request. + + - `input_tokens: int` + + Input tokens consumed by this request. + + - `output_tokens: int` + + Output tokens generated by this request. + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_end"]` + + - `"span.model_request_end"` + + - `class BetaManagedAgentsSessionDeletedEvent: …` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.deleted"]` + + - `"session.deleted"` + +### Beta Managed Agents Text Block + +- `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + +### Beta Managed Agents Unknown Error + +- `class BetaManagedAgentsUnknownError: …` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["unknown_error"]` + + - `"unknown_error"` + +### Beta Managed Agents URL Document Source + +- `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + +### Beta Managed Agents URL Image Source + +- `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + +### Beta Managed Agents User Custom Tool Result Event + +- `class BetaManagedAgentsUserCustomToolResultEvent: …` + + Event sent by the client providing the result of a custom tool execution. + + - `id: str` + + Unique identifier for this event. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Custom Tool Result Event Params + +- `class BetaManagedAgentsUserCustomToolResultEventParams: …` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents User Interrupt Event + +- `class BetaManagedAgentsUserInterruptEvent: …` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: str` + + Unique identifier for this event. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Interrupt Event Params + +- `class BetaManagedAgentsUserInterruptEventParams: …` + + Parameters for sending an interrupt to pause the agent. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + +### Beta Managed Agents User Message Event + +- `class BetaManagedAgentsUserMessageEvent: …` + + A user message event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[Content]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Message Event Params + +- `class BetaManagedAgentsUserMessageEventParams: …` + + Parameters for sending a user message to the session. + + - `content: List[Content]` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + +### Beta Managed Agents User Tool Confirmation Event + +- `class BetaManagedAgentsUserToolConfirmationEvent: …` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: str` + + Unique identifier for this event. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Tool Confirmation Event Params + +- `class BetaManagedAgentsUserToolConfirmationEventParams: …` + + Parameters for confirming or denying a tool execution request. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + +# Resources + +## Add + +`beta.sessions.resources.add(strsession_id, ResourceAddParams**kwargs) -> BetaManagedAgentsFileResource` + +**post** `/v1/sessions/{session_id}/resources` + +Add Session Resource + +### Parameters + +- `session_id: str` + +- `file_id: str` + + ID of a previously uploaded file. + +- `type: Literal["file"]` + + - `"file"` + +- `mount_path: Optional[str]` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_file_resource = client.beta.sessions.resources.add( + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", + file_id="file_011CNha8iCJcU1wXNR6q4V8w", + type="file", +) +print(beta_managed_agents_file_resource.id) +``` + +## List + +`beta.sessions.resources.list(strsession_id, ResourceListParams**kwargs) -> SyncPageCursor[BetaManagedAgentsSessionResource]` + +**get** `/v1/sessions/{session_id}/resources` + +List Session Resources + +### Parameters + +- `session_id: str` + +- `limit: Optional[int]` + + Maximum number of resources to return per page (max 1000). If omitted, returns all resources. + +- `page: Optional[str]` + + Opaque cursor from a previous response's next_page field. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSessionResource` + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +page = client.beta.sessions.resources.list( + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", +) +page = page.data[0] +print(page) +``` + +## Retrieve + +`beta.sessions.resources.retrieve(strresource_id, ResourceRetrieveParams**kwargs) -> ResourceRetrieveResponse` + +**get** `/v1/sessions/{session_id}/resources/{resource_id}` + +Get Session Resource + +### Parameters + +- `session_id: str` + +- `resource_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `ResourceRetrieveResponse` + + The requested session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +resource = client.beta.sessions.resources.retrieve( + resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht", + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", +) +print(resource) +``` + +## Update + +`beta.sessions.resources.update(strresource_id, ResourceUpdateParams**kwargs) -> ResourceUpdateResponse` + +**post** `/v1/sessions/{session_id}/resources/{resource_id}` + +Update Session Resource + +### Parameters + +- `session_id: str` + +- `resource_id: str` + +- `authorization_token: str` + + New authorization token for the resource. Currently only `github_repository` resources support token rotation. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `ResourceUpdateResponse` + + The updated session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +resource = client.beta.sessions.resources.update( + resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht", + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", + authorization_token="ghp_exampletoken", +) +print(resource) +``` + +## Delete + +`beta.sessions.resources.delete(strresource_id, ResourceDeleteParams**kwargs) -> BetaManagedAgentsDeleteSessionResource` + +**delete** `/v1/sessions/{session_id}/resources/{resource_id}` + +Delete Session Resource + +### Parameters + +- `session_id: str` + +- `resource_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsDeleteSessionResource: …` + + Confirmation of resource deletion. + + - `id: str` + + - `type: Literal["session_resource_deleted"]` + + - `"session_resource_deleted"` + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_delete_session_resource = client.beta.sessions.resources.delete( + resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht", + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", +) +print(beta_managed_agents_delete_session_resource.id) +``` + +## Domain Types + +### Beta Managed Agents Delete Session Resource + +- `class BetaManagedAgentsDeleteSessionResource: …` + + Confirmation of resource deletion. + + - `id: str` + + - `type: Literal["session_resource_deleted"]` + + - `"session_resource_deleted"` + +### Beta Managed Agents File Resource + +- `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Beta Managed Agents GitHub Repository Resource + +- `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + +### Beta Managed Agents Session Resource + +- `BetaManagedAgentsSessionResource` + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Resource Retrieve Response + +- `ResourceRetrieveResponse` + + The requested session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Resource Update Response + +- `ResourceUpdateResponse` + + The updated session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format diff --git a/content/en/api/python/beta/sessions/archive.md b/content/en/api/python/beta/sessions/archive.md new file mode 100644 index 000000000..41990e26e --- /dev/null +++ b/content/en/api/python/beta/sessions/archive.md @@ -0,0 +1,515 @@ +## Archive + +`beta.sessions.archive(strsession_id, SessionArchiveParams**kwargs) -> BetaManagedAgentsSession` + +**post** `/v1/sessions/{session_id}/archive` + +Archive Session + +### Parameters + +- `session_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSession: …` + + A Managed Agents `session`. + + - `id: str` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: str` + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `version: int` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `environment_id: str` + + - `metadata: Dict[str, str]` + + - `resources: List[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Optional[float]` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Optional[float]` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: Literal["rescheduling", "running", "idle", "terminated"]` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: Optional[str]` + + - `type: Literal["session"]` + + - `"session"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: Optional[BetaManagedAgentsCacheCreationUsage]` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Optional[int]` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Optional[int]` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Optional[int]` + + Total tokens read from prompt cache. + + - `input_tokens: Optional[int]` + + Total input tokens consumed across all turns. + + - `output_tokens: Optional[int]` + + Total output tokens generated across all turns. + + - `vault_ids: List[str]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_session = client.beta.sessions.archive( + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", +) +print(beta_managed_agents_session.id) +``` diff --git a/content/en/api/python/beta/sessions/create.md b/content/en/api/python/beta/sessions/create.md new file mode 100644 index 000000000..5fcbc3468 --- /dev/null +++ b/content/en/api/python/beta/sessions/create.md @@ -0,0 +1,616 @@ +## Create + +`beta.sessions.create(SessionCreateParams**kwargs) -> BetaManagedAgentsSession` + +**post** `/v1/sessions` + +Create Session + +### Parameters + +- `agent: Agent` + + Agent identifier. Accepts the `agent` ID string, which pins the latest version for the session, or an `agent` object with both id and version specified. + + - `str` + + - `class BetaManagedAgentsAgentParams: …` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `id: str` + + The `agent` ID. + + - `type: Literal["agent"]` + + - `"agent"` + + - `version: Optional[int]` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + +- `environment_id: str` + + ID of the `environment` defining the container configuration for this session. + +- `metadata: Optional[Dict[str, str]]` + + Arbitrary key-value metadata attached to the session. + +- `resources: Optional[Iterable[Resource]]` + + Resources (e.g. repositories, files) to mount into the session's container. + + - `class BetaManagedAgentsGitHubRepositoryResourceParams: …` + + Mount a GitHub repository into the session's container. + + - `authorization_token: str` + + GitHub authorization token used to clone the repository. + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `url: str` + + Github URL of the repository + + - `checkout: Optional[Checkout]` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `mount_path: Optional[str]` + + Mount path in the container. Defaults to `/workspace/`. + + - `class BetaManagedAgentsFileResourceParams: …` + + Mount a file uploaded via the Files API into the session. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `mount_path: Optional[str]` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +- `title: Optional[str]` + + Human-readable session title. + +- `vault_ids: Optional[Sequence[str]]` + + Vault IDs for stored credentials the agent can use during the session. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSession: …` + + A Managed Agents `session`. + + - `id: str` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: str` + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `version: int` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `environment_id: str` + + - `metadata: Dict[str, str]` + + - `resources: List[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Optional[float]` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Optional[float]` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: Literal["rescheduling", "running", "idle", "terminated"]` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: Optional[str]` + + - `type: Literal["session"]` + + - `"session"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: Optional[BetaManagedAgentsCacheCreationUsage]` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Optional[int]` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Optional[int]` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Optional[int]` + + Total tokens read from prompt cache. + + - `input_tokens: Optional[int]` + + Total input tokens consumed across all turns. + + - `output_tokens: Optional[int]` + + Total output tokens generated across all turns. + + - `vault_ids: List[str]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_session = client.beta.sessions.create( + agent="agent_011CZkYpogX7uDKUyvBTophP", + environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW", +) +print(beta_managed_agents_session.id) +``` diff --git a/content/en/api/python/beta/sessions/delete.md b/content/en/api/python/beta/sessions/delete.md new file mode 100644 index 000000000..567cb3f09 --- /dev/null +++ b/content/en/api/python/beta/sessions/delete.md @@ -0,0 +1,88 @@ +## Delete + +`beta.sessions.delete(strsession_id, SessionDeleteParams**kwargs) -> BetaManagedAgentsDeletedSession` + +**delete** `/v1/sessions/{session_id}` + +Delete Session + +### Parameters + +- `session_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsDeletedSession: …` + + Confirmation that a `session` has been permanently deleted. + + - `id: str` + + - `type: Literal["session_deleted"]` + + - `"session_deleted"` + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_deleted_session = client.beta.sessions.delete( + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", +) +print(beta_managed_agents_deleted_session.id) +``` diff --git a/content/en/api/python/beta/sessions/events.md b/content/en/api/python/beta/sessions/events.md new file mode 100644 index 000000000..72a1959cd --- /dev/null +++ b/content/en/api/python/beta/sessions/events.md @@ -0,0 +1,9640 @@ +# Events + +## List + +`beta.sessions.events.list(strsession_id, EventListParams**kwargs) -> SyncPageCursor[BetaManagedAgentsSessionEvent]` + +**get** `/v1/sessions/{session_id}/events` + +List Events + +### Parameters + +- `session_id: str` + +- `limit: Optional[int]` + + Query parameter for limit + +- `order: Optional[Literal["asc", "desc"]]` + + Sort direction for results, ordered by created_at. Defaults to asc (chronological). + + - `"asc"` + + - `"desc"` + +- `page: Optional[str]` + + Opaque pagination cursor from a previous response's next_page. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSessionEvent` + + Union type for all event types in a session. + + - `class BetaManagedAgentsUserMessageEvent: …` + + A user message event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[Content]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent: …` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: str` + + Unique identifier for this event. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent: …` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: str` + + Unique identifier for this event. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent: …` + + Event sent by the client providing the result of a custom tool execution. + + - `id: str` + + Unique identifier for this event. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent: …` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the custom tool being called. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.custom_tool_use"]` + + - `"agent.custom_tool_use"` + + - `class BetaManagedAgentsAgentMessageEvent: …` + + An agent response event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.message"]` + + - `"agent.message"` + + - `class BetaManagedAgentsAgentThinkingEvent: …` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thinking"]` + + - `"agent.thinking"` + + - `class BetaManagedAgentsAgentMCPToolUseEvent: …` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `mcp_server_name: str` + + Name of the MCP server providing the tool. + + - `name: str` + + Name of the MCP tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_use"]` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `class BetaManagedAgentsAgentMCPToolResultEvent: …` + + Event representing the result of an MCP tool execution. + + - `id: str` + + Unique identifier for this event. + + - `mcp_tool_use_id: str` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_result"]` + + - `"agent.mcp_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent: …` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the agent tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.tool_use"]` + + - `"agent.tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `class BetaManagedAgentsAgentToolResultEvent: …` + + Event representing the result of an agent tool execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `tool_use_id: str` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: Literal["agent.tool_result"]` + + - `"agent.tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent: …` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thread_context_compacted"]` + + - `"agent.thread_context_compacted"` + + - `class BetaManagedAgentsSessionErrorEvent: …` + + An error event indicating a problem occurred during session execution. + + - `id: str` + + Unique identifier for this event. + + - `error: Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError: …` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["unknown_error"]` + + - `"unknown_error"` + + - `class BetaManagedAgentsModelOverloadedError: …` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_overloaded_error"]` + + - `"model_overloaded_error"` + + - `class BetaManagedAgentsModelRateLimitedError: …` + + The model request was rate-limited. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_rate_limited_error"]` + + - `"model_rate_limited_error"` + + - `class BetaManagedAgentsModelRequestFailedError: …` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_request_failed_error"]` + + - `"model_request_failed_error"` + + - `class BetaManagedAgentsMCPConnectionFailedError: …` + + Failed to connect to an MCP server. + + - `mcp_server_name: str` + + Name of the MCP server that failed to connect. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_connection_failed_error"]` + + - `"mcp_connection_failed_error"` + + - `class BetaManagedAgentsMCPAuthenticationFailedError: …` + + Authentication to an MCP server failed. + + - `mcp_server_name: str` + + Name of the MCP server that failed authentication. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_authentication_failed_error"]` + + - `"mcp_authentication_failed_error"` + + - `class BetaManagedAgentsBillingError: …` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["billing_error"]` + + - `"billing_error"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.error"]` + + - `"session.error"` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent: …` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_rescheduled"]` + + - `"session.status_rescheduled"` + + - `class BetaManagedAgentsSessionStatusRunningEvent: …` + + Indicates the session is actively running and the agent is working. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_running"]` + + - `"session.status_running"` + + - `class BetaManagedAgentsSessionStatusIdleEvent: …` + + Indicates the agent has paused and is awaiting user input. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `stop_reason: StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn: …` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: Literal["end_turn"]` + + - `"end_turn"` + + - `class BetaManagedAgentsSessionRequiresAction: …` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: List[str]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: Literal["requires_action"]` + + - `"requires_action"` + + - `class BetaManagedAgentsSessionRetriesExhausted: …` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: Literal["retries_exhausted"]` + + - `"retries_exhausted"` + + - `type: Literal["session.status_idle"]` + + - `"session.status_idle"` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent: …` + + Indicates the session has terminated, either due to an error or completion. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_terminated"]` + + - `"session.status_terminated"` + + - `class BetaManagedAgentsSpanModelRequestStartEvent: …` + + Emitted when a model request is initiated by the agent. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_start"]` + + - `"span.model_request_start"` + + - `class BetaManagedAgentsSpanModelRequestEndEvent: …` + + Emitted when a model request completes. + + - `id: str` + + Unique identifier for this event. + + - `is_error: Optional[bool]` + + Whether the model request resulted in an error. + + - `model_request_start_id: str` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: int` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: int` + + Tokens read from prompt cache in this request. + + - `input_tokens: int` + + Input tokens consumed by this request. + + - `output_tokens: int` + + Output tokens generated by this request. + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_end"]` + + - `"span.model_request_end"` + + - `class BetaManagedAgentsSessionDeletedEvent: …` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.deleted"]` + + - `"session.deleted"` + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +page = client.beta.sessions.events.list( + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", +) +page = page.data[0] +print(page) +``` + +## Send + +`beta.sessions.events.send(strsession_id, EventSendParams**kwargs) -> BetaManagedAgentsSendSessionEvents` + +**post** `/v1/sessions/{session_id}/events` + +Send Events + +### Parameters + +- `session_id: str` + +- `events: Iterable[BetaManagedAgentsEventParams]` + + Events to send to the `session`. + + - `class BetaManagedAgentsUserMessageEventParams: …` + + Parameters for sending a user message to the session. + + - `content: List[Content]` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + + - `class BetaManagedAgentsUserInterruptEventParams: …` + + Parameters for sending an interrupt to pause the agent. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + + - `class BetaManagedAgentsUserToolConfirmationEventParams: …` + + Parameters for confirming or denying a tool execution request. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `class BetaManagedAgentsUserCustomToolResultEventParams: …` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSendSessionEvents: …` + + Events that were successfully sent to the session. + + - `data: Optional[List[Data]]` + + Sent events + + - `class BetaManagedAgentsUserMessageEvent: …` + + A user message event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[Content]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent: …` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: str` + + Unique identifier for this event. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent: …` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: str` + + Unique identifier for this event. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent: …` + + Event sent by the client providing the result of a custom tool execution. + + - `id: str` + + Unique identifier for this event. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_send_session_events = client.beta.sessions.events.send( + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", + events=[{ + "content": [{ + "text": "Where is my order #1234?", + "type": "text", + }], + "type": "user.message", + }], +) +print(beta_managed_agents_send_session_events.data) +``` + +## Stream + +`beta.sessions.events.stream(strsession_id, EventStreamParams**kwargs) -> BetaManagedAgentsStreamSessionEvents` + +**get** `/v1/sessions/{session_id}/events/stream` + +Stream Events + +### Parameters + +- `session_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsStreamSessionEvents` + + Server-sent event in the session stream. + + - `class BetaManagedAgentsUserMessageEvent: …` + + A user message event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[Content]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent: …` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: str` + + Unique identifier for this event. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent: …` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: str` + + Unique identifier for this event. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent: …` + + Event sent by the client providing the result of a custom tool execution. + + - `id: str` + + Unique identifier for this event. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent: …` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the custom tool being called. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.custom_tool_use"]` + + - `"agent.custom_tool_use"` + + - `class BetaManagedAgentsAgentMessageEvent: …` + + An agent response event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.message"]` + + - `"agent.message"` + + - `class BetaManagedAgentsAgentThinkingEvent: …` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thinking"]` + + - `"agent.thinking"` + + - `class BetaManagedAgentsAgentMCPToolUseEvent: …` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `mcp_server_name: str` + + Name of the MCP server providing the tool. + + - `name: str` + + Name of the MCP tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_use"]` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `class BetaManagedAgentsAgentMCPToolResultEvent: …` + + Event representing the result of an MCP tool execution. + + - `id: str` + + Unique identifier for this event. + + - `mcp_tool_use_id: str` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_result"]` + + - `"agent.mcp_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent: …` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the agent tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.tool_use"]` + + - `"agent.tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `class BetaManagedAgentsAgentToolResultEvent: …` + + Event representing the result of an agent tool execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `tool_use_id: str` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: Literal["agent.tool_result"]` + + - `"agent.tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent: …` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thread_context_compacted"]` + + - `"agent.thread_context_compacted"` + + - `class BetaManagedAgentsSessionErrorEvent: …` + + An error event indicating a problem occurred during session execution. + + - `id: str` + + Unique identifier for this event. + + - `error: Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError: …` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["unknown_error"]` + + - `"unknown_error"` + + - `class BetaManagedAgentsModelOverloadedError: …` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_overloaded_error"]` + + - `"model_overloaded_error"` + + - `class BetaManagedAgentsModelRateLimitedError: …` + + The model request was rate-limited. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_rate_limited_error"]` + + - `"model_rate_limited_error"` + + - `class BetaManagedAgentsModelRequestFailedError: …` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_request_failed_error"]` + + - `"model_request_failed_error"` + + - `class BetaManagedAgentsMCPConnectionFailedError: …` + + Failed to connect to an MCP server. + + - `mcp_server_name: str` + + Name of the MCP server that failed to connect. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_connection_failed_error"]` + + - `"mcp_connection_failed_error"` + + - `class BetaManagedAgentsMCPAuthenticationFailedError: …` + + Authentication to an MCP server failed. + + - `mcp_server_name: str` + + Name of the MCP server that failed authentication. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_authentication_failed_error"]` + + - `"mcp_authentication_failed_error"` + + - `class BetaManagedAgentsBillingError: …` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["billing_error"]` + + - `"billing_error"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.error"]` + + - `"session.error"` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent: …` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_rescheduled"]` + + - `"session.status_rescheduled"` + + - `class BetaManagedAgentsSessionStatusRunningEvent: …` + + Indicates the session is actively running and the agent is working. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_running"]` + + - `"session.status_running"` + + - `class BetaManagedAgentsSessionStatusIdleEvent: …` + + Indicates the agent has paused and is awaiting user input. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `stop_reason: StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn: …` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: Literal["end_turn"]` + + - `"end_turn"` + + - `class BetaManagedAgentsSessionRequiresAction: …` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: List[str]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: Literal["requires_action"]` + + - `"requires_action"` + + - `class BetaManagedAgentsSessionRetriesExhausted: …` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: Literal["retries_exhausted"]` + + - `"retries_exhausted"` + + - `type: Literal["session.status_idle"]` + + - `"session.status_idle"` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent: …` + + Indicates the session has terminated, either due to an error or completion. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_terminated"]` + + - `"session.status_terminated"` + + - `class BetaManagedAgentsSpanModelRequestStartEvent: …` + + Emitted when a model request is initiated by the agent. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_start"]` + + - `"span.model_request_start"` + + - `class BetaManagedAgentsSpanModelRequestEndEvent: …` + + Emitted when a model request completes. + + - `id: str` + + Unique identifier for this event. + + - `is_error: Optional[bool]` + + Whether the model request resulted in an error. + + - `model_request_start_id: str` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: int` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: int` + + Tokens read from prompt cache in this request. + + - `input_tokens: int` + + Input tokens consumed by this request. + + - `output_tokens: int` + + Output tokens generated by this request. + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_end"]` + + - `"span.model_request_end"` + + - `class BetaManagedAgentsSessionDeletedEvent: …` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.deleted"]` + + - `"session.deleted"` + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +for event in client.beta.sessions.events.stream( + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", +): + print(event) +``` + +## Domain Types + +### Beta Managed Agents Agent Custom Tool Use Event + +- `class BetaManagedAgentsAgentCustomToolUseEvent: …` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the custom tool being called. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.custom_tool_use"]` + + - `"agent.custom_tool_use"` + +### Beta Managed Agents Agent MCP Tool Result Event + +- `class BetaManagedAgentsAgentMCPToolResultEvent: …` + + Event representing the result of an MCP tool execution. + + - `id: str` + + Unique identifier for this event. + + - `mcp_tool_use_id: str` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_result"]` + + - `"agent.mcp_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent MCP Tool Use Event + +- `class BetaManagedAgentsAgentMCPToolUseEvent: …` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `mcp_server_name: str` + + Name of the MCP server providing the tool. + + - `name: str` + + Name of the MCP tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_use"]` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + +### Beta Managed Agents Agent Message Event + +- `class BetaManagedAgentsAgentMessageEvent: …` + + An agent response event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.message"]` + + - `"agent.message"` + +### Beta Managed Agents Agent Thinking Event + +- `class BetaManagedAgentsAgentThinkingEvent: …` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thinking"]` + + - `"agent.thinking"` + +### Beta Managed Agents Agent Thread Context Compacted Event + +- `class BetaManagedAgentsAgentThreadContextCompactedEvent: …` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thread_context_compacted"]` + + - `"agent.thread_context_compacted"` + +### Beta Managed Agents Agent Tool Result Event + +- `class BetaManagedAgentsAgentToolResultEvent: …` + + Event representing the result of an agent tool execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `tool_use_id: str` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: Literal["agent.tool_result"]` + + - `"agent.tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent Tool Use Event + +- `class BetaManagedAgentsAgentToolUseEvent: …` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the agent tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.tool_use"]` + + - `"agent.tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + +### Beta Managed Agents Base64 Document Source + +- `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + +### Beta Managed Agents Base64 Image Source + +- `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + +### Beta Managed Agents Billing Error + +- `class BetaManagedAgentsBillingError: …` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["billing_error"]` + + - `"billing_error"` + +### Beta Managed Agents Document Block + +- `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + +### Beta Managed Agents Event Params + +- `BetaManagedAgentsEventParams` + + Union type for event parameters that can be sent to a session. + + - `class BetaManagedAgentsUserMessageEventParams: …` + + Parameters for sending a user message to the session. + + - `content: List[Content]` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + + - `class BetaManagedAgentsUserInterruptEventParams: …` + + Parameters for sending an interrupt to pause the agent. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + + - `class BetaManagedAgentsUserToolConfirmationEventParams: …` + + Parameters for confirming or denying a tool execution request. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `class BetaManagedAgentsUserCustomToolResultEventParams: …` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents File Document Source + +- `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + +### Beta Managed Agents File Image Source + +- `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + +### Beta Managed Agents Image Block + +- `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + +### Beta Managed Agents MCP Authentication Failed Error + +- `class BetaManagedAgentsMCPAuthenticationFailedError: …` + + Authentication to an MCP server failed. + + - `mcp_server_name: str` + + Name of the MCP server that failed authentication. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_authentication_failed_error"]` + + - `"mcp_authentication_failed_error"` + +### Beta Managed Agents MCP Connection Failed Error + +- `class BetaManagedAgentsMCPConnectionFailedError: …` + + Failed to connect to an MCP server. + + - `mcp_server_name: str` + + Name of the MCP server that failed to connect. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_connection_failed_error"]` + + - `"mcp_connection_failed_error"` + +### Beta Managed Agents Model Overloaded Error + +- `class BetaManagedAgentsModelOverloadedError: …` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_overloaded_error"]` + + - `"model_overloaded_error"` + +### Beta Managed Agents Model Rate Limited Error + +- `class BetaManagedAgentsModelRateLimitedError: …` + + The model request was rate-limited. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_rate_limited_error"]` + + - `"model_rate_limited_error"` + +### Beta Managed Agents Model Request Failed Error + +- `class BetaManagedAgentsModelRequestFailedError: …` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_request_failed_error"]` + + - `"model_request_failed_error"` + +### Beta Managed Agents Plain Text Document Source + +- `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + +### Beta Managed Agents Retry Status Exhausted + +- `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + +### Beta Managed Agents Retry Status Retrying + +- `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + +### Beta Managed Agents Retry Status Terminal + +- `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + +### Beta Managed Agents Send Session Events + +- `class BetaManagedAgentsSendSessionEvents: …` + + Events that were successfully sent to the session. + + - `data: Optional[List[Data]]` + + Sent events + + - `class BetaManagedAgentsUserMessageEvent: …` + + A user message event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[Content]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent: …` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: str` + + Unique identifier for this event. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent: …` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: str` + + Unique identifier for this event. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent: …` + + Event sent by the client providing the result of a custom tool execution. + + - `id: str` + + Unique identifier for this event. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + +### Beta Managed Agents Session Deleted Event + +- `class BetaManagedAgentsSessionDeletedEvent: …` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.deleted"]` + + - `"session.deleted"` + +### Beta Managed Agents Session End Turn + +- `class BetaManagedAgentsSessionEndTurn: …` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: Literal["end_turn"]` + + - `"end_turn"` + +### Beta Managed Agents Session Error Event + +- `class BetaManagedAgentsSessionErrorEvent: …` + + An error event indicating a problem occurred during session execution. + + - `id: str` + + Unique identifier for this event. + + - `error: Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError: …` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["unknown_error"]` + + - `"unknown_error"` + + - `class BetaManagedAgentsModelOverloadedError: …` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_overloaded_error"]` + + - `"model_overloaded_error"` + + - `class BetaManagedAgentsModelRateLimitedError: …` + + The model request was rate-limited. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_rate_limited_error"]` + + - `"model_rate_limited_error"` + + - `class BetaManagedAgentsModelRequestFailedError: …` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_request_failed_error"]` + + - `"model_request_failed_error"` + + - `class BetaManagedAgentsMCPConnectionFailedError: …` + + Failed to connect to an MCP server. + + - `mcp_server_name: str` + + Name of the MCP server that failed to connect. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_connection_failed_error"]` + + - `"mcp_connection_failed_error"` + + - `class BetaManagedAgentsMCPAuthenticationFailedError: …` + + Authentication to an MCP server failed. + + - `mcp_server_name: str` + + Name of the MCP server that failed authentication. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_authentication_failed_error"]` + + - `"mcp_authentication_failed_error"` + + - `class BetaManagedAgentsBillingError: …` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["billing_error"]` + + - `"billing_error"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.error"]` + + - `"session.error"` + +### Beta Managed Agents Session Event + +- `BetaManagedAgentsSessionEvent` + + Union type for all event types in a session. + + - `class BetaManagedAgentsUserMessageEvent: …` + + A user message event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[Content]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent: …` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: str` + + Unique identifier for this event. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent: …` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: str` + + Unique identifier for this event. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent: …` + + Event sent by the client providing the result of a custom tool execution. + + - `id: str` + + Unique identifier for this event. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent: …` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the custom tool being called. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.custom_tool_use"]` + + - `"agent.custom_tool_use"` + + - `class BetaManagedAgentsAgentMessageEvent: …` + + An agent response event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.message"]` + + - `"agent.message"` + + - `class BetaManagedAgentsAgentThinkingEvent: …` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thinking"]` + + - `"agent.thinking"` + + - `class BetaManagedAgentsAgentMCPToolUseEvent: …` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `mcp_server_name: str` + + Name of the MCP server providing the tool. + + - `name: str` + + Name of the MCP tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_use"]` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `class BetaManagedAgentsAgentMCPToolResultEvent: …` + + Event representing the result of an MCP tool execution. + + - `id: str` + + Unique identifier for this event. + + - `mcp_tool_use_id: str` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_result"]` + + - `"agent.mcp_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent: …` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the agent tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.tool_use"]` + + - `"agent.tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `class BetaManagedAgentsAgentToolResultEvent: …` + + Event representing the result of an agent tool execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `tool_use_id: str` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: Literal["agent.tool_result"]` + + - `"agent.tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent: …` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thread_context_compacted"]` + + - `"agent.thread_context_compacted"` + + - `class BetaManagedAgentsSessionErrorEvent: …` + + An error event indicating a problem occurred during session execution. + + - `id: str` + + Unique identifier for this event. + + - `error: Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError: …` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["unknown_error"]` + + - `"unknown_error"` + + - `class BetaManagedAgentsModelOverloadedError: …` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_overloaded_error"]` + + - `"model_overloaded_error"` + + - `class BetaManagedAgentsModelRateLimitedError: …` + + The model request was rate-limited. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_rate_limited_error"]` + + - `"model_rate_limited_error"` + + - `class BetaManagedAgentsModelRequestFailedError: …` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_request_failed_error"]` + + - `"model_request_failed_error"` + + - `class BetaManagedAgentsMCPConnectionFailedError: …` + + Failed to connect to an MCP server. + + - `mcp_server_name: str` + + Name of the MCP server that failed to connect. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_connection_failed_error"]` + + - `"mcp_connection_failed_error"` + + - `class BetaManagedAgentsMCPAuthenticationFailedError: …` + + Authentication to an MCP server failed. + + - `mcp_server_name: str` + + Name of the MCP server that failed authentication. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_authentication_failed_error"]` + + - `"mcp_authentication_failed_error"` + + - `class BetaManagedAgentsBillingError: …` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["billing_error"]` + + - `"billing_error"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.error"]` + + - `"session.error"` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent: …` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_rescheduled"]` + + - `"session.status_rescheduled"` + + - `class BetaManagedAgentsSessionStatusRunningEvent: …` + + Indicates the session is actively running and the agent is working. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_running"]` + + - `"session.status_running"` + + - `class BetaManagedAgentsSessionStatusIdleEvent: …` + + Indicates the agent has paused and is awaiting user input. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `stop_reason: StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn: …` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: Literal["end_turn"]` + + - `"end_turn"` + + - `class BetaManagedAgentsSessionRequiresAction: …` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: List[str]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: Literal["requires_action"]` + + - `"requires_action"` + + - `class BetaManagedAgentsSessionRetriesExhausted: …` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: Literal["retries_exhausted"]` + + - `"retries_exhausted"` + + - `type: Literal["session.status_idle"]` + + - `"session.status_idle"` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent: …` + + Indicates the session has terminated, either due to an error or completion. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_terminated"]` + + - `"session.status_terminated"` + + - `class BetaManagedAgentsSpanModelRequestStartEvent: …` + + Emitted when a model request is initiated by the agent. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_start"]` + + - `"span.model_request_start"` + + - `class BetaManagedAgentsSpanModelRequestEndEvent: …` + + Emitted when a model request completes. + + - `id: str` + + Unique identifier for this event. + + - `is_error: Optional[bool]` + + Whether the model request resulted in an error. + + - `model_request_start_id: str` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: int` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: int` + + Tokens read from prompt cache in this request. + + - `input_tokens: int` + + Input tokens consumed by this request. + + - `output_tokens: int` + + Output tokens generated by this request. + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_end"]` + + - `"span.model_request_end"` + + - `class BetaManagedAgentsSessionDeletedEvent: …` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.deleted"]` + + - `"session.deleted"` + +### Beta Managed Agents Session Requires Action + +- `class BetaManagedAgentsSessionRequiresAction: …` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: List[str]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: Literal["requires_action"]` + + - `"requires_action"` + +### Beta Managed Agents Session Retries Exhausted + +- `class BetaManagedAgentsSessionRetriesExhausted: …` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: Literal["retries_exhausted"]` + + - `"retries_exhausted"` + +### Beta Managed Agents Session Status Idle Event + +- `class BetaManagedAgentsSessionStatusIdleEvent: …` + + Indicates the agent has paused and is awaiting user input. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `stop_reason: StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn: …` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: Literal["end_turn"]` + + - `"end_turn"` + + - `class BetaManagedAgentsSessionRequiresAction: …` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: List[str]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: Literal["requires_action"]` + + - `"requires_action"` + + - `class BetaManagedAgentsSessionRetriesExhausted: …` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: Literal["retries_exhausted"]` + + - `"retries_exhausted"` + + - `type: Literal["session.status_idle"]` + + - `"session.status_idle"` + +### Beta Managed Agents Session Status Rescheduled Event + +- `class BetaManagedAgentsSessionStatusRescheduledEvent: …` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_rescheduled"]` + + - `"session.status_rescheduled"` + +### Beta Managed Agents Session Status Running Event + +- `class BetaManagedAgentsSessionStatusRunningEvent: …` + + Indicates the session is actively running and the agent is working. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_running"]` + + - `"session.status_running"` + +### Beta Managed Agents Session Status Terminated Event + +- `class BetaManagedAgentsSessionStatusTerminatedEvent: …` + + Indicates the session has terminated, either due to an error or completion. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_terminated"]` + + - `"session.status_terminated"` + +### Beta Managed Agents Span Model Request End Event + +- `class BetaManagedAgentsSpanModelRequestEndEvent: …` + + Emitted when a model request completes. + + - `id: str` + + Unique identifier for this event. + + - `is_error: Optional[bool]` + + Whether the model request resulted in an error. + + - `model_request_start_id: str` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: int` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: int` + + Tokens read from prompt cache in this request. + + - `input_tokens: int` + + Input tokens consumed by this request. + + - `output_tokens: int` + + Output tokens generated by this request. + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_end"]` + + - `"span.model_request_end"` + +### Beta Managed Agents Span Model Request Start Event + +- `class BetaManagedAgentsSpanModelRequestStartEvent: …` + + Emitted when a model request is initiated by the agent. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_start"]` + + - `"span.model_request_start"` + +### Beta Managed Agents Span Model Usage + +- `class BetaManagedAgentsSpanModelUsage: …` + + Token usage for a single model request. + + - `cache_creation_input_tokens: int` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: int` + + Tokens read from prompt cache in this request. + + - `input_tokens: int` + + Input tokens consumed by this request. + + - `output_tokens: int` + + Output tokens generated by this request. + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +### Beta Managed Agents Stream Session Events + +- `BetaManagedAgentsStreamSessionEvents` + + Server-sent event in the session stream. + + - `class BetaManagedAgentsUserMessageEvent: …` + + A user message event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[Content]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent: …` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: str` + + Unique identifier for this event. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent: …` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: str` + + Unique identifier for this event. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent: …` + + Event sent by the client providing the result of a custom tool execution. + + - `id: str` + + Unique identifier for this event. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent: …` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the custom tool being called. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.custom_tool_use"]` + + - `"agent.custom_tool_use"` + + - `class BetaManagedAgentsAgentMessageEvent: …` + + An agent response event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.message"]` + + - `"agent.message"` + + - `class BetaManagedAgentsAgentThinkingEvent: …` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thinking"]` + + - `"agent.thinking"` + + - `class BetaManagedAgentsAgentMCPToolUseEvent: …` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `mcp_server_name: str` + + Name of the MCP server providing the tool. + + - `name: str` + + Name of the MCP tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_use"]` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `class BetaManagedAgentsAgentMCPToolResultEvent: …` + + Event representing the result of an MCP tool execution. + + - `id: str` + + Unique identifier for this event. + + - `mcp_tool_use_id: str` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_result"]` + + - `"agent.mcp_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent: …` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the agent tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.tool_use"]` + + - `"agent.tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `class BetaManagedAgentsAgentToolResultEvent: …` + + Event representing the result of an agent tool execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `tool_use_id: str` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: Literal["agent.tool_result"]` + + - `"agent.tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent: …` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thread_context_compacted"]` + + - `"agent.thread_context_compacted"` + + - `class BetaManagedAgentsSessionErrorEvent: …` + + An error event indicating a problem occurred during session execution. + + - `id: str` + + Unique identifier for this event. + + - `error: Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError: …` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["unknown_error"]` + + - `"unknown_error"` + + - `class BetaManagedAgentsModelOverloadedError: …` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_overloaded_error"]` + + - `"model_overloaded_error"` + + - `class BetaManagedAgentsModelRateLimitedError: …` + + The model request was rate-limited. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_rate_limited_error"]` + + - `"model_rate_limited_error"` + + - `class BetaManagedAgentsModelRequestFailedError: …` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_request_failed_error"]` + + - `"model_request_failed_error"` + + - `class BetaManagedAgentsMCPConnectionFailedError: …` + + Failed to connect to an MCP server. + + - `mcp_server_name: str` + + Name of the MCP server that failed to connect. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_connection_failed_error"]` + + - `"mcp_connection_failed_error"` + + - `class BetaManagedAgentsMCPAuthenticationFailedError: …` + + Authentication to an MCP server failed. + + - `mcp_server_name: str` + + Name of the MCP server that failed authentication. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_authentication_failed_error"]` + + - `"mcp_authentication_failed_error"` + + - `class BetaManagedAgentsBillingError: …` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["billing_error"]` + + - `"billing_error"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.error"]` + + - `"session.error"` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent: …` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_rescheduled"]` + + - `"session.status_rescheduled"` + + - `class BetaManagedAgentsSessionStatusRunningEvent: …` + + Indicates the session is actively running and the agent is working. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_running"]` + + - `"session.status_running"` + + - `class BetaManagedAgentsSessionStatusIdleEvent: …` + + Indicates the agent has paused and is awaiting user input. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `stop_reason: StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn: …` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: Literal["end_turn"]` + + - `"end_turn"` + + - `class BetaManagedAgentsSessionRequiresAction: …` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: List[str]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: Literal["requires_action"]` + + - `"requires_action"` + + - `class BetaManagedAgentsSessionRetriesExhausted: …` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: Literal["retries_exhausted"]` + + - `"retries_exhausted"` + + - `type: Literal["session.status_idle"]` + + - `"session.status_idle"` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent: …` + + Indicates the session has terminated, either due to an error or completion. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_terminated"]` + + - `"session.status_terminated"` + + - `class BetaManagedAgentsSpanModelRequestStartEvent: …` + + Emitted when a model request is initiated by the agent. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_start"]` + + - `"span.model_request_start"` + + - `class BetaManagedAgentsSpanModelRequestEndEvent: …` + + Emitted when a model request completes. + + - `id: str` + + Unique identifier for this event. + + - `is_error: Optional[bool]` + + Whether the model request resulted in an error. + + - `model_request_start_id: str` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: int` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: int` + + Tokens read from prompt cache in this request. + + - `input_tokens: int` + + Input tokens consumed by this request. + + - `output_tokens: int` + + Output tokens generated by this request. + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_end"]` + + - `"span.model_request_end"` + + - `class BetaManagedAgentsSessionDeletedEvent: …` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.deleted"]` + + - `"session.deleted"` + +### Beta Managed Agents Text Block + +- `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + +### Beta Managed Agents Unknown Error + +- `class BetaManagedAgentsUnknownError: …` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["unknown_error"]` + + - `"unknown_error"` + +### Beta Managed Agents URL Document Source + +- `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + +### Beta Managed Agents URL Image Source + +- `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + +### Beta Managed Agents User Custom Tool Result Event + +- `class BetaManagedAgentsUserCustomToolResultEvent: …` + + Event sent by the client providing the result of a custom tool execution. + + - `id: str` + + Unique identifier for this event. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Custom Tool Result Event Params + +- `class BetaManagedAgentsUserCustomToolResultEventParams: …` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents User Interrupt Event + +- `class BetaManagedAgentsUserInterruptEvent: …` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: str` + + Unique identifier for this event. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Interrupt Event Params + +- `class BetaManagedAgentsUserInterruptEventParams: …` + + Parameters for sending an interrupt to pause the agent. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + +### Beta Managed Agents User Message Event + +- `class BetaManagedAgentsUserMessageEvent: …` + + A user message event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[Content]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Message Event Params + +- `class BetaManagedAgentsUserMessageEventParams: …` + + Parameters for sending a user message to the session. + + - `content: List[Content]` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + +### Beta Managed Agents User Tool Confirmation Event + +- `class BetaManagedAgentsUserToolConfirmationEvent: …` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: str` + + Unique identifier for this event. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Tool Confirmation Event Params + +- `class BetaManagedAgentsUserToolConfirmationEventParams: …` + + Parameters for confirming or denying a tool execution request. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. diff --git a/content/en/api/python/beta/sessions/events/list.md b/content/en/api/python/beta/sessions/events/list.md new file mode 100644 index 000000000..05fe09c75 --- /dev/null +++ b/content/en/api/python/beta/sessions/events/list.md @@ -0,0 +1,1463 @@ +## List + +`beta.sessions.events.list(strsession_id, EventListParams**kwargs) -> SyncPageCursor[BetaManagedAgentsSessionEvent]` + +**get** `/v1/sessions/{session_id}/events` + +List Events + +### Parameters + +- `session_id: str` + +- `limit: Optional[int]` + + Query parameter for limit + +- `order: Optional[Literal["asc", "desc"]]` + + Sort direction for results, ordered by created_at. Defaults to asc (chronological). + + - `"asc"` + + - `"desc"` + +- `page: Optional[str]` + + Opaque pagination cursor from a previous response's next_page. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSessionEvent` + + Union type for all event types in a session. + + - `class BetaManagedAgentsUserMessageEvent: …` + + A user message event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[Content]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent: …` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: str` + + Unique identifier for this event. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent: …` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: str` + + Unique identifier for this event. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent: …` + + Event sent by the client providing the result of a custom tool execution. + + - `id: str` + + Unique identifier for this event. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent: …` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the custom tool being called. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.custom_tool_use"]` + + - `"agent.custom_tool_use"` + + - `class BetaManagedAgentsAgentMessageEvent: …` + + An agent response event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.message"]` + + - `"agent.message"` + + - `class BetaManagedAgentsAgentThinkingEvent: …` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thinking"]` + + - `"agent.thinking"` + + - `class BetaManagedAgentsAgentMCPToolUseEvent: …` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `mcp_server_name: str` + + Name of the MCP server providing the tool. + + - `name: str` + + Name of the MCP tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_use"]` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `class BetaManagedAgentsAgentMCPToolResultEvent: …` + + Event representing the result of an MCP tool execution. + + - `id: str` + + Unique identifier for this event. + + - `mcp_tool_use_id: str` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_result"]` + + - `"agent.mcp_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent: …` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the agent tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.tool_use"]` + + - `"agent.tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `class BetaManagedAgentsAgentToolResultEvent: …` + + Event representing the result of an agent tool execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `tool_use_id: str` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: Literal["agent.tool_result"]` + + - `"agent.tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent: …` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thread_context_compacted"]` + + - `"agent.thread_context_compacted"` + + - `class BetaManagedAgentsSessionErrorEvent: …` + + An error event indicating a problem occurred during session execution. + + - `id: str` + + Unique identifier for this event. + + - `error: Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError: …` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["unknown_error"]` + + - `"unknown_error"` + + - `class BetaManagedAgentsModelOverloadedError: …` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_overloaded_error"]` + + - `"model_overloaded_error"` + + - `class BetaManagedAgentsModelRateLimitedError: …` + + The model request was rate-limited. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_rate_limited_error"]` + + - `"model_rate_limited_error"` + + - `class BetaManagedAgentsModelRequestFailedError: …` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_request_failed_error"]` + + - `"model_request_failed_error"` + + - `class BetaManagedAgentsMCPConnectionFailedError: …` + + Failed to connect to an MCP server. + + - `mcp_server_name: str` + + Name of the MCP server that failed to connect. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_connection_failed_error"]` + + - `"mcp_connection_failed_error"` + + - `class BetaManagedAgentsMCPAuthenticationFailedError: …` + + Authentication to an MCP server failed. + + - `mcp_server_name: str` + + Name of the MCP server that failed authentication. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_authentication_failed_error"]` + + - `"mcp_authentication_failed_error"` + + - `class BetaManagedAgentsBillingError: …` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["billing_error"]` + + - `"billing_error"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.error"]` + + - `"session.error"` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent: …` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_rescheduled"]` + + - `"session.status_rescheduled"` + + - `class BetaManagedAgentsSessionStatusRunningEvent: …` + + Indicates the session is actively running and the agent is working. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_running"]` + + - `"session.status_running"` + + - `class BetaManagedAgentsSessionStatusIdleEvent: …` + + Indicates the agent has paused and is awaiting user input. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `stop_reason: StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn: …` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: Literal["end_turn"]` + + - `"end_turn"` + + - `class BetaManagedAgentsSessionRequiresAction: …` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: List[str]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: Literal["requires_action"]` + + - `"requires_action"` + + - `class BetaManagedAgentsSessionRetriesExhausted: …` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: Literal["retries_exhausted"]` + + - `"retries_exhausted"` + + - `type: Literal["session.status_idle"]` + + - `"session.status_idle"` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent: …` + + Indicates the session has terminated, either due to an error or completion. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_terminated"]` + + - `"session.status_terminated"` + + - `class BetaManagedAgentsSpanModelRequestStartEvent: …` + + Emitted when a model request is initiated by the agent. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_start"]` + + - `"span.model_request_start"` + + - `class BetaManagedAgentsSpanModelRequestEndEvent: …` + + Emitted when a model request completes. + + - `id: str` + + Unique identifier for this event. + + - `is_error: Optional[bool]` + + Whether the model request resulted in an error. + + - `model_request_start_id: str` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: int` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: int` + + Tokens read from prompt cache in this request. + + - `input_tokens: int` + + Input tokens consumed by this request. + + - `output_tokens: int` + + Output tokens generated by this request. + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_end"]` + + - `"span.model_request_end"` + + - `class BetaManagedAgentsSessionDeletedEvent: …` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.deleted"]` + + - `"session.deleted"` + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +page = client.beta.sessions.events.list( + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", +) +page = page.data[0] +print(page) +``` diff --git a/content/en/api/python/beta/sessions/events/send.md b/content/en/api/python/beta/sessions/events/send.md new file mode 100644 index 000000000..4a13a8551 --- /dev/null +++ b/content/en/api/python/beta/sessions/events/send.md @@ -0,0 +1,825 @@ +## Send + +`beta.sessions.events.send(strsession_id, EventSendParams**kwargs) -> BetaManagedAgentsSendSessionEvents` + +**post** `/v1/sessions/{session_id}/events` + +Send Events + +### Parameters + +- `session_id: str` + +- `events: Iterable[BetaManagedAgentsEventParams]` + + Events to send to the `session`. + + - `class BetaManagedAgentsUserMessageEventParams: …` + + Parameters for sending a user message to the session. + + - `content: List[Content]` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + + - `class BetaManagedAgentsUserInterruptEventParams: …` + + Parameters for sending an interrupt to pause the agent. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + + - `class BetaManagedAgentsUserToolConfirmationEventParams: …` + + Parameters for confirming or denying a tool execution request. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `class BetaManagedAgentsUserCustomToolResultEventParams: …` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSendSessionEvents: …` + + Events that were successfully sent to the session. + + - `data: Optional[List[Data]]` + + Sent events + + - `class BetaManagedAgentsUserMessageEvent: …` + + A user message event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[Content]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent: …` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: str` + + Unique identifier for this event. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent: …` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: str` + + Unique identifier for this event. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent: …` + + Event sent by the client providing the result of a custom tool execution. + + - `id: str` + + Unique identifier for this event. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_send_session_events = client.beta.sessions.events.send( + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", + events=[{ + "content": [{ + "text": "Where is my order #1234?", + "type": "text", + }], + "type": "user.message", + }], +) +print(beta_managed_agents_send_session_events.data) +``` diff --git a/content/en/api/python/beta/sessions/events/stream.md b/content/en/api/python/beta/sessions/events/stream.md new file mode 100644 index 000000000..faca8ffe0 --- /dev/null +++ b/content/en/api/python/beta/sessions/events/stream.md @@ -0,0 +1,1446 @@ +## Stream + +`beta.sessions.events.stream(strsession_id, EventStreamParams**kwargs) -> BetaManagedAgentsStreamSessionEvents` + +**get** `/v1/sessions/{session_id}/events/stream` + +Stream Events + +### Parameters + +- `session_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsStreamSessionEvents` + + Server-sent event in the session stream. + + - `class BetaManagedAgentsUserMessageEvent: …` + + A user message event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[Content]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `type: Literal["user.message"]` + + - `"user.message"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent: …` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: str` + + Unique identifier for this event. + + - `type: Literal["user.interrupt"]` + + - `"user.interrupt"` + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent: …` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: str` + + Unique identifier for this event. + + - `result: Literal["allow", "deny"]` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: str` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.tool_confirmation"]` + + - `"user.tool_confirmation"` + + - `deny_message: Optional[str]` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent: …` + + Event sent by the client providing the result of a custom tool execution. + + - `id: str` + + Unique identifier for this event. + + - `custom_tool_use_id: str` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: Literal["user.custom_tool_result"]` + + - `"user.custom_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `processed_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent: …` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the custom tool being called. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.custom_tool_use"]` + + - `"agent.custom_tool_use"` + + - `class BetaManagedAgentsAgentMessageEvent: …` + + An agent response event in the session conversation. + + - `id: str` + + Unique identifier for this event. + + - `content: List[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.message"]` + + - `"agent.message"` + + - `class BetaManagedAgentsAgentThinkingEvent: …` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thinking"]` + + - `"agent.thinking"` + + - `class BetaManagedAgentsAgentMCPToolUseEvent: …` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `mcp_server_name: str` + + Name of the MCP server providing the tool. + + - `name: str` + + Name of the MCP tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_use"]` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `class BetaManagedAgentsAgentMCPToolResultEvent: …` + + Event representing the result of an MCP tool execution. + + - `id: str` + + Unique identifier for this event. + + - `mcp_tool_use_id: str` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.mcp_tool_result"]` + + - `"agent.mcp_tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent: …` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: str` + + Unique identifier for this event. + + - `input: Dict[str, object]` + + Input parameters for the tool call. + + - `name: str` + + Name of the agent tool being used. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.tool_use"]` + + - `"agent.tool_use"` + + - `evaluated_permission: Optional[Literal["allow", "ask", "deny"]]` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `class BetaManagedAgentsAgentToolResultEvent: …` + + Event representing the result of an agent tool execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `tool_use_id: str` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: Literal["agent.tool_result"]` + + - `"agent.tool_result"` + + - `content: Optional[List[Content]]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock: …` + + Regular text content. + + - `text: str` + + The text content. + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsImageBlock: …` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: Source` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource: …` + + Base64-encoded image data. + + - `data: str` + + Base64-encoded image data. + + - `media_type: str` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsURLImageSource: …` + + Image referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource: …` + + Image referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["image"]` + + - `"image"` + + - `class BetaManagedAgentsDocumentBlock: …` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: Source` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource: …` + + Base64-encoded document data. + + - `data: str` + + Base64-encoded document data. + + - `media_type: str` + + MIME type of the document (e.g., "application/pdf"). + + - `type: Literal["base64"]` + + - `"base64"` + + - `class BetaManagedAgentsPlainTextDocumentSource: …` + + Plain text document content. + + - `data: str` + + The plain text content. + + - `media_type: Literal["text/plain"]` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: Literal["text"]` + + - `"text"` + + - `class BetaManagedAgentsURLDocumentSource: …` + + Document referenced by URL. + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource: …` + + Document referenced by file ID. + + - `file_id: str` + + ID of a previously uploaded file. + + - `type: Literal["file"]` + + - `"file"` + + - `type: Literal["document"]` + + - `"document"` + + - `context: Optional[str]` + + Additional context about the document for the model. + + - `title: Optional[str]` + + The title of the document. + + - `is_error: Optional[bool]` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent: …` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["agent.thread_context_compacted"]` + + - `"agent.thread_context_compacted"` + + - `class BetaManagedAgentsSessionErrorEvent: …` + + An error event indicating a problem occurred during session execution. + + - `id: str` + + Unique identifier for this event. + + - `error: Error` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError: …` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["unknown_error"]` + + - `"unknown_error"` + + - `class BetaManagedAgentsModelOverloadedError: …` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_overloaded_error"]` + + - `"model_overloaded_error"` + + - `class BetaManagedAgentsModelRateLimitedError: …` + + The model request was rate-limited. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_rate_limited_error"]` + + - `"model_rate_limited_error"` + + - `class BetaManagedAgentsModelRequestFailedError: …` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["model_request_failed_error"]` + + - `"model_request_failed_error"` + + - `class BetaManagedAgentsMCPConnectionFailedError: …` + + Failed to connect to an MCP server. + + - `mcp_server_name: str` + + Name of the MCP server that failed to connect. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_connection_failed_error"]` + + - `"mcp_connection_failed_error"` + + - `class BetaManagedAgentsMCPAuthenticationFailedError: …` + + Authentication to an MCP server failed. + + - `mcp_server_name: str` + + Name of the MCP server that failed authentication. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["mcp_authentication_failed_error"]` + + - `"mcp_authentication_failed_error"` + + - `class BetaManagedAgentsBillingError: …` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: str` + + Human-readable error description. + + - `retry_status: RetryStatus` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying: …` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: Literal["retrying"]` + + - `"retrying"` + + - `class BetaManagedAgentsRetryStatusExhausted: …` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: Literal["exhausted"]` + + - `"exhausted"` + + - `class BetaManagedAgentsRetryStatusTerminal: …` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: Literal["terminal"]` + + - `"terminal"` + + - `type: Literal["billing_error"]` + + - `"billing_error"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.error"]` + + - `"session.error"` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent: …` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_rescheduled"]` + + - `"session.status_rescheduled"` + + - `class BetaManagedAgentsSessionStatusRunningEvent: …` + + Indicates the session is actively running and the agent is working. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_running"]` + + - `"session.status_running"` + + - `class BetaManagedAgentsSessionStatusIdleEvent: …` + + Indicates the agent has paused and is awaiting user input. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `stop_reason: StopReason` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn: …` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: Literal["end_turn"]` + + - `"end_turn"` + + - `class BetaManagedAgentsSessionRequiresAction: …` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: List[str]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: Literal["requires_action"]` + + - `"requires_action"` + + - `class BetaManagedAgentsSessionRetriesExhausted: …` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: Literal["retries_exhausted"]` + + - `"retries_exhausted"` + + - `type: Literal["session.status_idle"]` + + - `"session.status_idle"` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent: …` + + Indicates the session has terminated, either due to an error or completion. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.status_terminated"]` + + - `"session.status_terminated"` + + - `class BetaManagedAgentsSpanModelRequestStartEvent: …` + + Emitted when a model request is initiated by the agent. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_start"]` + + - `"span.model_request_start"` + + - `class BetaManagedAgentsSpanModelRequestEndEvent: …` + + Emitted when a model request completes. + + - `id: str` + + Unique identifier for this event. + + - `is_error: Optional[bool]` + + Whether the model request resulted in an error. + + - `model_request_start_id: str` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: int` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: int` + + Tokens read from prompt cache in this request. + + - `input_tokens: int` + + Input tokens consumed by this request. + + - `output_tokens: int` + + Output tokens generated by this request. + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["span.model_request_end"]` + + - `"span.model_request_end"` + + - `class BetaManagedAgentsSessionDeletedEvent: …` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: str` + + Unique identifier for this event. + + - `processed_at: datetime` + + A timestamp in RFC 3339 format + + - `type: Literal["session.deleted"]` + + - `"session.deleted"` + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +for event in client.beta.sessions.events.stream( + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", +): + print(event) +``` diff --git a/content/en/api/python/beta/sessions/list.md b/content/en/api/python/beta/sessions/list.md new file mode 100644 index 000000000..f2a2a22d5 --- /dev/null +++ b/content/en/api/python/beta/sessions/list.md @@ -0,0 +1,556 @@ +## List + +`beta.sessions.list(SessionListParams**kwargs) -> SyncPageCursor[BetaManagedAgentsSession]` + +**get** `/v1/sessions` + +List Sessions + +### Parameters + +- `agent_id: Optional[str]` + + Filter sessions created with this agent ID. + +- `agent_version: Optional[int]` + + Filter by agent version. Only applies when agent_id is also set. + +- `created_at_gt: Optional[Union[str, datetime]]` + + Return sessions created after this time (exclusive). + +- `created_at_gte: Optional[Union[str, datetime]]` + + Return sessions created at or after this time (inclusive). + +- `created_at_lt: Optional[Union[str, datetime]]` + + Return sessions created before this time (exclusive). + +- `created_at_lte: Optional[Union[str, datetime]]` + + Return sessions created at or before this time (inclusive). + +- `include_archived: Optional[bool]` + + When true, includes archived sessions. Default: false (exclude archived). + +- `limit: Optional[int]` + + Maximum number of results to return. + +- `order: Optional[Literal["asc", "desc"]]` + + Sort direction for results, ordered by created_at. Defaults to desc (newest first). + + - `"asc"` + + - `"desc"` + +- `page: Optional[str]` + + Opaque pagination cursor from a previous response's next_page. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSession: …` + + A Managed Agents `session`. + + - `id: str` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: str` + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `version: int` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `environment_id: str` + + - `metadata: Dict[str, str]` + + - `resources: List[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Optional[float]` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Optional[float]` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: Literal["rescheduling", "running", "idle", "terminated"]` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: Optional[str]` + + - `type: Literal["session"]` + + - `"session"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: Optional[BetaManagedAgentsCacheCreationUsage]` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Optional[int]` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Optional[int]` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Optional[int]` + + Total tokens read from prompt cache. + + - `input_tokens: Optional[int]` + + Total input tokens consumed across all turns. + + - `output_tokens: Optional[int]` + + Total output tokens generated across all turns. + + - `vault_ids: List[str]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +page = client.beta.sessions.list() +page = page.data[0] +print(page.id) +``` diff --git a/content/en/api/python/beta/sessions/resources.md b/content/en/api/python/beta/sessions/resources.md new file mode 100644 index 000000000..a25653486 --- /dev/null +++ b/content/en/api/python/beta/sessions/resources.md @@ -0,0 +1,941 @@ +# Resources + +## Add + +`beta.sessions.resources.add(strsession_id, ResourceAddParams**kwargs) -> BetaManagedAgentsFileResource` + +**post** `/v1/sessions/{session_id}/resources` + +Add Session Resource + +### Parameters + +- `session_id: str` + +- `file_id: str` + + ID of a previously uploaded file. + +- `type: Literal["file"]` + + - `"file"` + +- `mount_path: Optional[str]` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_file_resource = client.beta.sessions.resources.add( + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", + file_id="file_011CNha8iCJcU1wXNR6q4V8w", + type="file", +) +print(beta_managed_agents_file_resource.id) +``` + +## List + +`beta.sessions.resources.list(strsession_id, ResourceListParams**kwargs) -> SyncPageCursor[BetaManagedAgentsSessionResource]` + +**get** `/v1/sessions/{session_id}/resources` + +List Session Resources + +### Parameters + +- `session_id: str` + +- `limit: Optional[int]` + + Maximum number of resources to return per page (max 1000). If omitted, returns all resources. + +- `page: Optional[str]` + + Opaque cursor from a previous response's next_page field. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSessionResource` + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +page = client.beta.sessions.resources.list( + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", +) +page = page.data[0] +print(page) +``` + +## Retrieve + +`beta.sessions.resources.retrieve(strresource_id, ResourceRetrieveParams**kwargs) -> ResourceRetrieveResponse` + +**get** `/v1/sessions/{session_id}/resources/{resource_id}` + +Get Session Resource + +### Parameters + +- `session_id: str` + +- `resource_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `ResourceRetrieveResponse` + + The requested session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +resource = client.beta.sessions.resources.retrieve( + resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht", + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", +) +print(resource) +``` + +## Update + +`beta.sessions.resources.update(strresource_id, ResourceUpdateParams**kwargs) -> ResourceUpdateResponse` + +**post** `/v1/sessions/{session_id}/resources/{resource_id}` + +Update Session Resource + +### Parameters + +- `session_id: str` + +- `resource_id: str` + +- `authorization_token: str` + + New authorization token for the resource. Currently only `github_repository` resources support token rotation. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `ResourceUpdateResponse` + + The updated session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +resource = client.beta.sessions.resources.update( + resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht", + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", + authorization_token="ghp_exampletoken", +) +print(resource) +``` + +## Delete + +`beta.sessions.resources.delete(strresource_id, ResourceDeleteParams**kwargs) -> BetaManagedAgentsDeleteSessionResource` + +**delete** `/v1/sessions/{session_id}/resources/{resource_id}` + +Delete Session Resource + +### Parameters + +- `session_id: str` + +- `resource_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsDeleteSessionResource: …` + + Confirmation of resource deletion. + + - `id: str` + + - `type: Literal["session_resource_deleted"]` + + - `"session_resource_deleted"` + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_delete_session_resource = client.beta.sessions.resources.delete( + resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht", + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", +) +print(beta_managed_agents_delete_session_resource.id) +``` + +## Domain Types + +### Beta Managed Agents Delete Session Resource + +- `class BetaManagedAgentsDeleteSessionResource: …` + + Confirmation of resource deletion. + + - `id: str` + + - `type: Literal["session_resource_deleted"]` + + - `"session_resource_deleted"` + +### Beta Managed Agents File Resource + +- `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Beta Managed Agents GitHub Repository Resource + +- `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + +### Beta Managed Agents Session Resource + +- `BetaManagedAgentsSessionResource` + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Resource Retrieve Response + +- `ResourceRetrieveResponse` + + The requested session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Resource Update Response + +- `ResourceUpdateResponse` + + The updated session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format diff --git a/content/en/api/python/beta/sessions/resources/add.md b/content/en/api/python/beta/sessions/resources/add.md new file mode 100644 index 000000000..34ea44791 --- /dev/null +++ b/content/en/api/python/beta/sessions/resources/add.md @@ -0,0 +1,112 @@ +## Add + +`beta.sessions.resources.add(strsession_id, ResourceAddParams**kwargs) -> BetaManagedAgentsFileResource` + +**post** `/v1/sessions/{session_id}/resources` + +Add Session Resource + +### Parameters + +- `session_id: str` + +- `file_id: str` + + ID of a previously uploaded file. + +- `type: Literal["file"]` + + - `"file"` + +- `mount_path: Optional[str]` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_file_resource = client.beta.sessions.resources.add( + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", + file_id="file_011CNha8iCJcU1wXNR6q4V8w", + type="file", +) +print(beta_managed_agents_file_resource.id) +``` diff --git a/content/en/api/python/beta/sessions/resources/delete.md b/content/en/api/python/beta/sessions/resources/delete.md new file mode 100644 index 000000000..1434d1fbb --- /dev/null +++ b/content/en/api/python/beta/sessions/resources/delete.md @@ -0,0 +1,91 @@ +## Delete + +`beta.sessions.resources.delete(strresource_id, ResourceDeleteParams**kwargs) -> BetaManagedAgentsDeleteSessionResource` + +**delete** `/v1/sessions/{session_id}/resources/{resource_id}` + +Delete Session Resource + +### Parameters + +- `session_id: str` + +- `resource_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsDeleteSessionResource: …` + + Confirmation of resource deletion. + + - `id: str` + + - `type: Literal["session_resource_deleted"]` + + - `"session_resource_deleted"` + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_delete_session_resource = client.beta.sessions.resources.delete( + resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht", + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", +) +print(beta_managed_agents_delete_session_resource.id) +``` diff --git a/content/en/api/python/beta/sessions/resources/list.md b/content/en/api/python/beta/sessions/resources/list.md new file mode 100644 index 000000000..17d608b64 --- /dev/null +++ b/content/en/api/python/beta/sessions/resources/list.md @@ -0,0 +1,151 @@ +## List + +`beta.sessions.resources.list(strsession_id, ResourceListParams**kwargs) -> SyncPageCursor[BetaManagedAgentsSessionResource]` + +**get** `/v1/sessions/{session_id}/resources` + +List Session Resources + +### Parameters + +- `session_id: str` + +- `limit: Optional[int]` + + Maximum number of resources to return per page (max 1000). If omitted, returns all resources. + +- `page: Optional[str]` + + Opaque cursor from a previous response's next_page field. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSessionResource` + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +page = client.beta.sessions.resources.list( + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", +) +page = page.data[0] +print(page) +``` diff --git a/content/en/api/python/beta/sessions/resources/retrieve.md b/content/en/api/python/beta/sessions/resources/retrieve.md new file mode 100644 index 000000000..2b5c07224 --- /dev/null +++ b/content/en/api/python/beta/sessions/resources/retrieve.md @@ -0,0 +1,147 @@ +## Retrieve + +`beta.sessions.resources.retrieve(strresource_id, ResourceRetrieveParams**kwargs) -> ResourceRetrieveResponse` + +**get** `/v1/sessions/{session_id}/resources/{resource_id}` + +Get Session Resource + +### Parameters + +- `session_id: str` + +- `resource_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `ResourceRetrieveResponse` + + The requested session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +resource = client.beta.sessions.resources.retrieve( + resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht", + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", +) +print(resource) +``` diff --git a/content/en/api/python/beta/sessions/resources/update.md b/content/en/api/python/beta/sessions/resources/update.md new file mode 100644 index 000000000..d129f58f0 --- /dev/null +++ b/content/en/api/python/beta/sessions/resources/update.md @@ -0,0 +1,152 @@ +## Update + +`beta.sessions.resources.update(strresource_id, ResourceUpdateParams**kwargs) -> ResourceUpdateResponse` + +**post** `/v1/sessions/{session_id}/resources/{resource_id}` + +Update Session Resource + +### Parameters + +- `session_id: str` + +- `resource_id: str` + +- `authorization_token: str` + + New authorization token for the resource. Currently only `github_repository` resources support token rotation. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `ResourceUpdateResponse` + + The updated session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +resource = client.beta.sessions.resources.update( + resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht", + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", + authorization_token="ghp_exampletoken", +) +print(resource) +``` diff --git a/content/en/api/python/beta/sessions/retrieve.md b/content/en/api/python/beta/sessions/retrieve.md new file mode 100644 index 000000000..b97f0d352 --- /dev/null +++ b/content/en/api/python/beta/sessions/retrieve.md @@ -0,0 +1,515 @@ +## Retrieve + +`beta.sessions.retrieve(strsession_id, SessionRetrieveParams**kwargs) -> BetaManagedAgentsSession` + +**get** `/v1/sessions/{session_id}` + +Get Session + +### Parameters + +- `session_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSession: …` + + A Managed Agents `session`. + + - `id: str` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: str` + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `version: int` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `environment_id: str` + + - `metadata: Dict[str, str]` + + - `resources: List[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Optional[float]` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Optional[float]` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: Literal["rescheduling", "running", "idle", "terminated"]` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: Optional[str]` + + - `type: Literal["session"]` + + - `"session"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: Optional[BetaManagedAgentsCacheCreationUsage]` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Optional[int]` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Optional[int]` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Optional[int]` + + Total tokens read from prompt cache. + + - `input_tokens: Optional[int]` + + Total input tokens consumed across all turns. + + - `output_tokens: Optional[int]` + + Total output tokens generated across all turns. + + - `vault_ids: List[str]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_session = client.beta.sessions.retrieve( + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", +) +print(beta_managed_agents_session.id) +``` diff --git a/content/en/api/python/beta/sessions/update.md b/content/en/api/python/beta/sessions/update.md new file mode 100644 index 000000000..2b2d5b5cf --- /dev/null +++ b/content/en/api/python/beta/sessions/update.md @@ -0,0 +1,527 @@ +## Update + +`beta.sessions.update(strsession_id, SessionUpdateParams**kwargs) -> BetaManagedAgentsSession` + +**post** `/v1/sessions/{session_id}` + +Update Session + +### Parameters + +- `session_id: str` + +- `metadata: Optional[Dict[str, Optional[str]]]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. + +- `title: Optional[str]` + + Human-readable session title. + +- `vault_ids: Optional[Sequence[str]]` + + Vault IDs (`vlt_*`) to attach to the session. Not yet supported; requests setting this field are rejected. Reserved for future use. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSession: …` + + A Managed Agents `session`. + + - `id: str` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: str` + + - `description: Optional[str]` + + - `mcp_servers: List[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: str` + + - `type: Literal["url"]` + + - `"url"` + + - `url: str` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 5 more]` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-sonnet-4-6` - Best combination of speed and intelligence + - `claude-haiku-4-5` - Fastest model with near-frontier intelligence + - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence + - `claude-opus-4-5` - Premium model combining maximum intelligence with practical performance + - `claude-opus-4-5-20251101` - Premium model combining maximum intelligence with practical performance + - `claude-sonnet-4-5` - High-performance model for agents and coding + - `claude-sonnet-4-5-20250929` - High-performance model for agents and coding + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `str` + + - `speed: Optional[Literal["standard", "fast"]]` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: str` + + - `skills: List[Skill]` + + - `class BetaManagedAgentsAnthropicSkill: …` + + A resolved Anthropic-managed skill. + + - `skill_id: str` + + - `type: Literal["anthropic"]` + + - `"anthropic"` + + - `version: str` + + - `class BetaManagedAgentsCustomSkill: …` + + A resolved user-created custom skill. + + - `skill_id: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `version: str` + + - `system: Optional[str]` + + - `tools: List[Tool]` + + - `class BetaManagedAgentsAgentToolset20260401: …` + + - `configs: List[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: Literal["bash", "edit", "read", 5 more]` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `type: Literal["agent_toolset_20260401"]` + + - `"agent_toolset_20260401"` + + - `class BetaManagedAgentsMCPToolset: …` + + - `configs: List[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: str` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: PermissionPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy: …` + + Tool calls are automatically approved without user confirmation. + + - `type: Literal["always_allow"]` + + - `"always_allow"` + + - `class BetaManagedAgentsAlwaysAskPolicy: …` + + Tool calls require user confirmation before execution. + + - `type: Literal["always_ask"]` + + - `"always_ask"` + + - `mcp_server_name: str` + + - `type: Literal["mcp_toolset"]` + + - `"mcp_toolset"` + + - `class BetaManagedAgentsCustomTool: …` + + A custom tool as returned in API responses. + + - `description: str` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Optional[Dict[str, object]]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Optional[List[str]]` + + List of required property names. + + - `type: Optional[Literal["object"]]` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: str` + + - `type: Literal["custom"]` + + - `"custom"` + + - `type: Literal["agent"]` + + - `"agent"` + + - `version: int` + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `environment_id: str` + + - `metadata: Dict[str, str]` + + - `resources: List[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `mount_path: str` + + - `type: Literal["github_repository"]` + + - `"github_repository"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `url: str` + + - `checkout: Optional[Checkout]` + + - `class BetaManagedAgentsBranchCheckout: …` + + - `name: str` + + Branch name to check out. + + - `type: Literal["branch"]` + + - `"branch"` + + - `class BetaManagedAgentsCommitCheckout: …` + + - `sha: str` + + Full commit SHA to check out. + + - `type: Literal["commit"]` + + - `"commit"` + + - `class BetaManagedAgentsFileResource: …` + + - `id: str` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `file_id: str` + + - `mount_path: str` + + - `type: Literal["file"]` + + - `"file"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Optional[float]` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Optional[float]` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: Literal["rescheduling", "running", "idle", "terminated"]` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: Optional[str]` + + - `type: Literal["session"]` + + - `"session"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: Optional[BetaManagedAgentsCacheCreationUsage]` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Optional[int]` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Optional[int]` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Optional[int]` + + Total tokens read from prompt cache. + + - `input_tokens: Optional[int]` + + Total input tokens consumed across all turns. + + - `output_tokens: Optional[int]` + + Total output tokens generated across all turns. + + - `vault_ids: List[str]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_session = client.beta.sessions.update( + session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", +) +print(beta_managed_agents_session.id) +``` diff --git a/content/en/api/python/beta/skills.md b/content/en/api/python/beta/skills.md index b5a1f3d58..d2118840d 100644 --- a/content/en/api/python/beta/skills.md +++ b/content/en/api/python/beta/skills.md @@ -28,7 +28,7 @@ Create Skill - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -72,8 +72,6 @@ Create Skill - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class SkillCreateResponse: …` @@ -169,7 +167,7 @@ List Skills - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -213,8 +211,6 @@ List Skills - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class SkillListResponse: …` @@ -296,7 +292,7 @@ Get Skill - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -340,8 +336,6 @@ Get Skill - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class SkillRetrieveResponse: …` @@ -424,7 +418,7 @@ Delete Skill - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -468,8 +462,6 @@ Delete Skill - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class SkillDeleteResponse: …` @@ -684,7 +676,7 @@ Create Skill Version - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -728,8 +720,6 @@ Create Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class VersionCreateResponse: …` @@ -825,7 +815,7 @@ List Skill Versions - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -869,8 +859,6 @@ List Skill Versions - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class VersionListResponse: …` @@ -963,7 +951,7 @@ Get Skill Version - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -1007,8 +995,6 @@ Get Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class VersionRetrieveResponse: …` @@ -1101,7 +1087,7 @@ Delete Skill Version - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -1145,8 +1131,6 @@ Delete Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class VersionDeleteResponse: …` diff --git a/content/en/api/python/beta/skills/create.md b/content/en/api/python/beta/skills/create.md index f3506b9b7..d05f99330 100644 --- a/content/en/api/python/beta/skills/create.md +++ b/content/en/api/python/beta/skills/create.md @@ -26,7 +26,7 @@ Create Skill - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -70,8 +70,6 @@ Create Skill - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class SkillCreateResponse: …` diff --git a/content/en/api/python/beta/skills/delete.md b/content/en/api/python/beta/skills/delete.md index 5c42bc768..a5c12be07 100644 --- a/content/en/api/python/beta/skills/delete.md +++ b/content/en/api/python/beta/skills/delete.md @@ -20,7 +20,7 @@ Delete Skill - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -64,8 +64,6 @@ Delete Skill - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class SkillDeleteResponse: …` diff --git a/content/en/api/python/beta/skills/list.md b/content/en/api/python/beta/skills/list.md index 531531388..1d02bf843 100644 --- a/content/en/api/python/beta/skills/list.md +++ b/content/en/api/python/beta/skills/list.md @@ -35,7 +35,7 @@ List Skills - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -79,8 +79,6 @@ List Skills - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class SkillListResponse: …` diff --git a/content/en/api/python/beta/skills/retrieve.md b/content/en/api/python/beta/skills/retrieve.md index b2d9373ab..b57abef1d 100644 --- a/content/en/api/python/beta/skills/retrieve.md +++ b/content/en/api/python/beta/skills/retrieve.md @@ -20,7 +20,7 @@ Get Skill - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -64,8 +64,6 @@ Get Skill - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class SkillRetrieveResponse: …` diff --git a/content/en/api/python/beta/skills/versions.md b/content/en/api/python/beta/skills/versions.md index adcbdf70f..95da06a81 100644 --- a/content/en/api/python/beta/skills/versions.md +++ b/content/en/api/python/beta/skills/versions.md @@ -28,7 +28,7 @@ Create Skill Version - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -72,8 +72,6 @@ Create Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class VersionCreateResponse: …` @@ -169,7 +167,7 @@ List Skill Versions - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -213,8 +211,6 @@ List Skill Versions - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class VersionListResponse: …` @@ -307,7 +303,7 @@ Get Skill Version - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -351,8 +347,6 @@ Get Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class VersionRetrieveResponse: …` @@ -445,7 +439,7 @@ Delete Skill Version - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -489,8 +483,6 @@ Delete Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class VersionDeleteResponse: …` diff --git a/content/en/api/python/beta/skills/versions/create.md b/content/en/api/python/beta/skills/versions/create.md index a12d81eb5..56b589294 100644 --- a/content/en/api/python/beta/skills/versions/create.md +++ b/content/en/api/python/beta/skills/versions/create.md @@ -26,7 +26,7 @@ Create Skill Version - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -70,8 +70,6 @@ Create Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class VersionCreateResponse: …` diff --git a/content/en/api/python/beta/skills/versions/delete.md b/content/en/api/python/beta/skills/versions/delete.md index dded09232..cc8726c2e 100644 --- a/content/en/api/python/beta/skills/versions/delete.md +++ b/content/en/api/python/beta/skills/versions/delete.md @@ -26,7 +26,7 @@ Delete Skill Version - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -70,8 +70,6 @@ Delete Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class VersionDeleteResponse: …` diff --git a/content/en/api/python/beta/skills/versions/list.md b/content/en/api/python/beta/skills/versions/list.md index f05b870fc..64d55d88a 100644 --- a/content/en/api/python/beta/skills/versions/list.md +++ b/content/en/api/python/beta/skills/versions/list.md @@ -30,7 +30,7 @@ List Skill Versions - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -74,8 +74,6 @@ List Skill Versions - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class VersionListResponse: …` diff --git a/content/en/api/python/beta/skills/versions/retrieve.md b/content/en/api/python/beta/skills/versions/retrieve.md index 49b50c4a1..f887da8e2 100644 --- a/content/en/api/python/beta/skills/versions/retrieve.md +++ b/content/en/api/python/beta/skills/versions/retrieve.md @@ -26,7 +26,7 @@ Get Skill Version - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -70,8 +70,6 @@ Get Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class VersionRetrieveResponse: …` diff --git a/content/en/api/python/beta/vaults.md b/content/en/api/python/beta/vaults.md new file mode 100644 index 000000000..86e29c783 --- /dev/null +++ b/content/en/api/python/beta/vaults.md @@ -0,0 +1,2642 @@ +# Vaults + +## Create + +`beta.vaults.create(VaultCreateParams**kwargs) -> BetaManagedAgentsVault` + +**post** `/v1/vaults` + +Create Vault + +### Parameters + +- `display_name: str` + + Human-readable name for the vault. 1-255 characters. + +- `metadata: Optional[Dict[str, str]]` + + Arbitrary key-value metadata to attach to the vault. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsVault: …` + + A vault that stores credentials for use by agents during sessions. + + - `id: str` + + Unique identifier for the vault. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `display_name: str` + + Human-readable name for the vault. + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the vault. + + - `type: Literal["vault"]` + + - `"vault"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_vault = client.beta.vaults.create( + display_name="Example vault", +) +print(beta_managed_agents_vault.id) +``` + +## List + +`beta.vaults.list(VaultListParams**kwargs) -> SyncPageCursor[BetaManagedAgentsVault]` + +**get** `/v1/vaults` + +List Vaults + +### Parameters + +- `include_archived: Optional[bool]` + + Whether to include archived vaults in the results. + +- `limit: Optional[int]` + + Maximum number of vaults to return per page. Defaults to 20, maximum 100. + +- `page: Optional[str]` + + Opaque pagination token from a previous `list_vaults` response. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsVault: …` + + A vault that stores credentials for use by agents during sessions. + + - `id: str` + + Unique identifier for the vault. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `display_name: str` + + Human-readable name for the vault. + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the vault. + + - `type: Literal["vault"]` + + - `"vault"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +page = client.beta.vaults.list() +page = page.data[0] +print(page.id) +``` + +## Retrieve + +`beta.vaults.retrieve(strvault_id, VaultRetrieveParams**kwargs) -> BetaManagedAgentsVault` + +**get** `/v1/vaults/{vault_id}` + +Get Vault + +### Parameters + +- `vault_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsVault: …` + + A vault that stores credentials for use by agents during sessions. + + - `id: str` + + Unique identifier for the vault. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `display_name: str` + + Human-readable name for the vault. + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the vault. + + - `type: Literal["vault"]` + + - `"vault"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_vault = client.beta.vaults.retrieve( + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", +) +print(beta_managed_agents_vault.id) +``` + +## Update + +`beta.vaults.update(strvault_id, VaultUpdateParams**kwargs) -> BetaManagedAgentsVault` + +**post** `/v1/vaults/{vault_id}` + +Update Vault + +### Parameters + +- `vault_id: str` + +- `display_name: Optional[str]` + + Updated human-readable name for the vault. 1-255 characters. + +- `metadata: Optional[Dict[str, Optional[str]]]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsVault: …` + + A vault that stores credentials for use by agents during sessions. + + - `id: str` + + Unique identifier for the vault. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `display_name: str` + + Human-readable name for the vault. + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the vault. + + - `type: Literal["vault"]` + + - `"vault"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_vault = client.beta.vaults.update( + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", +) +print(beta_managed_agents_vault.id) +``` + +## Delete + +`beta.vaults.delete(strvault_id, VaultDeleteParams**kwargs) -> BetaManagedAgentsDeletedVault` + +**delete** `/v1/vaults/{vault_id}` + +Delete Vault + +### Parameters + +- `vault_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsDeletedVault: …` + + Confirmation of a deleted vault. + + - `id: str` + + Unique identifier of the deleted vault. + + - `type: Literal["vault_deleted"]` + + - `"vault_deleted"` + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_deleted_vault = client.beta.vaults.delete( + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", +) +print(beta_managed_agents_deleted_vault.id) +``` + +## Archive + +`beta.vaults.archive(strvault_id, VaultArchiveParams**kwargs) -> BetaManagedAgentsVault` + +**post** `/v1/vaults/{vault_id}/archive` + +Archive Vault + +### Parameters + +- `vault_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsVault: …` + + A vault that stores credentials for use by agents during sessions. + + - `id: str` + + Unique identifier for the vault. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `display_name: str` + + Human-readable name for the vault. + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the vault. + + - `type: Literal["vault"]` + + - `"vault"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_vault = client.beta.vaults.archive( + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", +) +print(beta_managed_agents_vault.id) +``` + +## Domain Types + +### Beta Managed Agents Deleted Vault + +- `class BetaManagedAgentsDeletedVault: …` + + Confirmation of a deleted vault. + + - `id: str` + + Unique identifier of the deleted vault. + + - `type: Literal["vault_deleted"]` + + - `"vault_deleted"` + +### Beta Managed Agents Vault + +- `class BetaManagedAgentsVault: …` + + A vault that stores credentials for use by agents during sessions. + + - `id: str` + + Unique identifier for the vault. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `display_name: str` + + Human-readable name for the vault. + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the vault. + + - `type: Literal["vault"]` + + - `"vault"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +# Credentials + +## Create + +`beta.vaults.credentials.create(strvault_id, CredentialCreateParams**kwargs) -> BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials` + +Create Credential + +### Parameters + +- `vault_id: str` + +- `auth: Auth` + + Authentication details for creating a credential. + + - `class BetaManagedAgentsMCPOAuthCreateParams: …` + + Parameters for creating an MCP OAuth credential. + + - `access_token: str` + + OAuth access token. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshParams]` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: str` + + OAuth client ID. + + - `refresh_token: str` + + OAuth refresh token. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: str` + + OAuth client secret. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam: …` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: str` + + OAuth client secret. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerCreateParams: …` + + Parameters for creating a static bearer token credential. + + - `token: str` + + Static bearer token value. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + +- `display_name: Optional[str]` + + Human-readable name for the credential. Up to 255 characters. + +- `metadata: Optional[Dict[str, str]]` + + Arbitrary key-value metadata to attach to the credential. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential: …` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: str` + + Unique identifier for the credential. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `auth: Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse: …` + + OAuth credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshResponse]` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: str` + + OAuth client ID. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse: …` + + Token endpoint uses POST body authentication with client credentials. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse: …` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the credential. + + - `type: Literal["vault_credential"]` + + - `"vault_credential"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `vault_id: str` + + Identifier of the vault this credential belongs to. + + - `display_name: Optional[str]` + + Human-readable name for the credential. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_credential = client.beta.vaults.credentials.create( + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", + auth={ + "token": "bearer_exampletoken", + "mcp_server_url": "https://example-server.modelcontextprotocol.io/sse", + "type": "static_bearer", + }, +) +print(beta_managed_agents_credential.id) +``` + +## List + +`beta.vaults.credentials.list(strvault_id, CredentialListParams**kwargs) -> SyncPageCursor[BetaManagedAgentsCredential]` + +**get** `/v1/vaults/{vault_id}/credentials` + +List Credentials + +### Parameters + +- `vault_id: str` + +- `include_archived: Optional[bool]` + + Whether to include archived credentials in the results. + +- `limit: Optional[int]` + + Maximum number of credentials to return per page. Defaults to 20, maximum 100. + +- `page: Optional[str]` + + Opaque pagination token from a previous `list_credentials` response. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential: …` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: str` + + Unique identifier for the credential. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `auth: Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse: …` + + OAuth credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshResponse]` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: str` + + OAuth client ID. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse: …` + + Token endpoint uses POST body authentication with client credentials. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse: …` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the credential. + + - `type: Literal["vault_credential"]` + + - `"vault_credential"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `vault_id: str` + + Identifier of the vault this credential belongs to. + + - `display_name: Optional[str]` + + Human-readable name for the credential. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +page = client.beta.vaults.credentials.list( + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", +) +page = page.data[0] +print(page.id) +``` + +## Retrieve + +`beta.vaults.credentials.retrieve(strcredential_id, CredentialRetrieveParams**kwargs) -> BetaManagedAgentsCredential` + +**get** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Get Credential + +### Parameters + +- `vault_id: str` + +- `credential_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential: …` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: str` + + Unique identifier for the credential. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `auth: Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse: …` + + OAuth credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshResponse]` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: str` + + OAuth client ID. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse: …` + + Token endpoint uses POST body authentication with client credentials. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse: …` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the credential. + + - `type: Literal["vault_credential"]` + + - `"vault_credential"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `vault_id: str` + + Identifier of the vault this credential belongs to. + + - `display_name: Optional[str]` + + Human-readable name for the credential. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_credential = client.beta.vaults.credentials.retrieve( + credential_id="vcrd_011CZkZEMt8gZan2iYOQfSkw", + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", +) +print(beta_managed_agents_credential.id) +``` + +## Update + +`beta.vaults.credentials.update(strcredential_id, CredentialUpdateParams**kwargs) -> BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Update Credential + +### Parameters + +- `vault_id: str` + +- `credential_id: str` + +- `auth: Optional[Auth]` + + Updated authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthUpdateParams: …` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `access_token: Optional[str]` + + Updated OAuth access token. + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshUpdateParams]` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: Optional[str]` + + Updated OAuth refresh token. + + - `scope: Optional[str]` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: Optional[TokenEndpointAuth]` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam: …` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `client_secret: Optional[str]` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam: …` + + Updated POST body authentication parameters for the token endpoint. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `client_secret: Optional[str]` + + Updated OAuth client secret. + + - `class BetaManagedAgentsStaticBearerUpdateParams: …` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + + - `token: Optional[str]` + + Updated static bearer token value. + +- `display_name: Optional[str]` + + Updated human-readable name for the credential. 1-255 characters. + +- `metadata: Optional[Dict[str, Optional[str]]]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential: …` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: str` + + Unique identifier for the credential. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `auth: Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse: …` + + OAuth credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshResponse]` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: str` + + OAuth client ID. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse: …` + + Token endpoint uses POST body authentication with client credentials. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse: …` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the credential. + + - `type: Literal["vault_credential"]` + + - `"vault_credential"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `vault_id: str` + + Identifier of the vault this credential belongs to. + + - `display_name: Optional[str]` + + Human-readable name for the credential. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_credential = client.beta.vaults.credentials.update( + credential_id="vcrd_011CZkZEMt8gZan2iYOQfSkw", + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", +) +print(beta_managed_agents_credential.id) +``` + +## Delete + +`beta.vaults.credentials.delete(strcredential_id, CredentialDeleteParams**kwargs) -> BetaManagedAgentsDeletedCredential` + +**delete** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Delete Credential + +### Parameters + +- `vault_id: str` + +- `credential_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsDeletedCredential: …` + + Confirmation of a deleted credential. + + - `id: str` + + Unique identifier of the deleted credential. + + - `type: Literal["vault_credential_deleted"]` + + - `"vault_credential_deleted"` + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_deleted_credential = client.beta.vaults.credentials.delete( + credential_id="vcrd_011CZkZEMt8gZan2iYOQfSkw", + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", +) +print(beta_managed_agents_deleted_credential.id) +``` + +## Archive + +`beta.vaults.credentials.archive(strcredential_id, CredentialArchiveParams**kwargs) -> BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}/archive` + +Archive Credential + +### Parameters + +- `vault_id: str` + +- `credential_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential: …` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: str` + + Unique identifier for the credential. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `auth: Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse: …` + + OAuth credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshResponse]` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: str` + + OAuth client ID. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse: …` + + Token endpoint uses POST body authentication with client credentials. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse: …` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the credential. + + - `type: Literal["vault_credential"]` + + - `"vault_credential"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `vault_id: str` + + Identifier of the vault this credential belongs to. + + - `display_name: Optional[str]` + + Human-readable name for the credential. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_credential = client.beta.vaults.credentials.archive( + credential_id="vcrd_011CZkZEMt8gZan2iYOQfSkw", + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", +) +print(beta_managed_agents_credential.id) +``` + +## Domain Types + +### Beta Managed Agents Credential + +- `class BetaManagedAgentsCredential: …` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: str` + + Unique identifier for the credential. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `auth: Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse: …` + + OAuth credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshResponse]` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: str` + + OAuth client ID. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse: …` + + Token endpoint uses POST body authentication with client credentials. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse: …` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the credential. + + - `type: Literal["vault_credential"]` + + - `"vault_credential"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `vault_id: str` + + Identifier of the vault this credential belongs to. + + - `display_name: Optional[str]` + + Human-readable name for the credential. + +### Beta Managed Agents Deleted Credential + +- `class BetaManagedAgentsDeletedCredential: …` + + Confirmation of a deleted credential. + + - `id: str` + + Unique identifier of the deleted credential. + + - `type: Literal["vault_credential_deleted"]` + + - `"vault_credential_deleted"` + +### Beta Managed Agents MCP OAuth Auth Response + +- `class BetaManagedAgentsMCPOAuthAuthResponse: …` + + OAuth credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshResponse]` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: str` + + OAuth client ID. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse: …` + + Token endpoint uses POST body authentication with client credentials. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Create Params + +- `class BetaManagedAgentsMCPOAuthCreateParams: …` + + Parameters for creating an MCP OAuth credential. + + - `access_token: str` + + OAuth access token. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshParams]` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: str` + + OAuth client ID. + + - `refresh_token: str` + + OAuth refresh token. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: str` + + OAuth client secret. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam: …` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: str` + + OAuth client secret. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Params + +- `class BetaManagedAgentsMCPOAuthRefreshParams: …` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: str` + + OAuth client ID. + + - `refresh_token: str` + + OAuth refresh token. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: str` + + OAuth client secret. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam: …` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: str` + + OAuth client secret. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Response + +- `class BetaManagedAgentsMCPOAuthRefreshResponse: …` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: str` + + OAuth client ID. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse: …` + + Token endpoint uses POST body authentication with client credentials. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Update Params + +- `class BetaManagedAgentsMCPOAuthRefreshUpdateParams: …` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: Optional[str]` + + Updated OAuth refresh token. + + - `scope: Optional[str]` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: Optional[TokenEndpointAuth]` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam: …` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `client_secret: Optional[str]` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam: …` + + Updated POST body authentication parameters for the token endpoint. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `client_secret: Optional[str]` + + Updated OAuth client secret. + +### Beta Managed Agents MCP OAuth Update Params + +- `class BetaManagedAgentsMCPOAuthUpdateParams: …` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `access_token: Optional[str]` + + Updated OAuth access token. + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshUpdateParams]` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: Optional[str]` + + Updated OAuth refresh token. + + - `scope: Optional[str]` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: Optional[TokenEndpointAuth]` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam: …` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `client_secret: Optional[str]` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam: …` + + Updated POST body authentication parameters for the token endpoint. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `client_secret: Optional[str]` + + Updated OAuth client secret. + +### Beta Managed Agents Static Bearer Auth Response + +- `class BetaManagedAgentsStaticBearerAuthResponse: …` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + +### Beta Managed Agents Static Bearer Create Params + +- `class BetaManagedAgentsStaticBearerCreateParams: …` + + Parameters for creating a static bearer token credential. + + - `token: str` + + Static bearer token value. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + +### Beta Managed Agents Static Bearer Update Params + +- `class BetaManagedAgentsStaticBearerUpdateParams: …` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + + - `token: Optional[str]` + + Updated static bearer token value. + +### Beta Managed Agents Token Endpoint Auth Basic Param + +- `class BetaManagedAgentsTokenEndpointAuthBasicParam: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: str` + + OAuth client secret. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + +### Beta Managed Agents Token Endpoint Auth Basic Response + +- `class BetaManagedAgentsTokenEndpointAuthBasicResponse: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + +### Beta Managed Agents Token Endpoint Auth Basic Update Param + +- `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam: …` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `client_secret: Optional[str]` + + Updated OAuth client secret. + +### Beta Managed Agents Token Endpoint Auth None Param + +- `class BetaManagedAgentsTokenEndpointAuthNoneParam: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + +### Beta Managed Agents Token Endpoint Auth None Response + +- `class BetaManagedAgentsTokenEndpointAuthNoneResponse: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + +### Beta Managed Agents Token Endpoint Auth Post Param + +- `class BetaManagedAgentsTokenEndpointAuthPostParam: …` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: str` + + OAuth client secret. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + +### Beta Managed Agents Token Endpoint Auth Post Response + +- `class BetaManagedAgentsTokenEndpointAuthPostResponse: …` + + Token endpoint uses POST body authentication with client credentials. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + +### Beta Managed Agents Token Endpoint Auth Post Update Param + +- `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam: …` + + Updated POST body authentication parameters for the token endpoint. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `client_secret: Optional[str]` + + Updated OAuth client secret. diff --git a/content/en/api/python/beta/vaults/archive.md b/content/en/api/python/beta/vaults/archive.md new file mode 100644 index 000000000..53484d96d --- /dev/null +++ b/content/en/api/python/beta/vaults/archive.md @@ -0,0 +1,110 @@ +## Archive + +`beta.vaults.archive(strvault_id, VaultArchiveParams**kwargs) -> BetaManagedAgentsVault` + +**post** `/v1/vaults/{vault_id}/archive` + +Archive Vault + +### Parameters + +- `vault_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsVault: …` + + A vault that stores credentials for use by agents during sessions. + + - `id: str` + + Unique identifier for the vault. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `display_name: str` + + Human-readable name for the vault. + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the vault. + + - `type: Literal["vault"]` + + - `"vault"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_vault = client.beta.vaults.archive( + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", +) +print(beta_managed_agents_vault.id) +``` diff --git a/content/en/api/python/beta/vaults/create.md b/content/en/api/python/beta/vaults/create.md new file mode 100644 index 000000000..427f3236f --- /dev/null +++ b/content/en/api/python/beta/vaults/create.md @@ -0,0 +1,116 @@ +## Create + +`beta.vaults.create(VaultCreateParams**kwargs) -> BetaManagedAgentsVault` + +**post** `/v1/vaults` + +Create Vault + +### Parameters + +- `display_name: str` + + Human-readable name for the vault. 1-255 characters. + +- `metadata: Optional[Dict[str, str]]` + + Arbitrary key-value metadata to attach to the vault. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsVault: …` + + A vault that stores credentials for use by agents during sessions. + + - `id: str` + + Unique identifier for the vault. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `display_name: str` + + Human-readable name for the vault. + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the vault. + + - `type: Literal["vault"]` + + - `"vault"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_vault = client.beta.vaults.create( + display_name="Example vault", +) +print(beta_managed_agents_vault.id) +``` diff --git a/content/en/api/python/beta/vaults/credentials.md b/content/en/api/python/beta/vaults/credentials.md new file mode 100644 index 000000000..c5cd348c4 --- /dev/null +++ b/content/en/api/python/beta/vaults/credentials.md @@ -0,0 +1,1921 @@ +# Credentials + +## Create + +`beta.vaults.credentials.create(strvault_id, CredentialCreateParams**kwargs) -> BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials` + +Create Credential + +### Parameters + +- `vault_id: str` + +- `auth: Auth` + + Authentication details for creating a credential. + + - `class BetaManagedAgentsMCPOAuthCreateParams: …` + + Parameters for creating an MCP OAuth credential. + + - `access_token: str` + + OAuth access token. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshParams]` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: str` + + OAuth client ID. + + - `refresh_token: str` + + OAuth refresh token. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: str` + + OAuth client secret. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam: …` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: str` + + OAuth client secret. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerCreateParams: …` + + Parameters for creating a static bearer token credential. + + - `token: str` + + Static bearer token value. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + +- `display_name: Optional[str]` + + Human-readable name for the credential. Up to 255 characters. + +- `metadata: Optional[Dict[str, str]]` + + Arbitrary key-value metadata to attach to the credential. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential: …` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: str` + + Unique identifier for the credential. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `auth: Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse: …` + + OAuth credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshResponse]` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: str` + + OAuth client ID. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse: …` + + Token endpoint uses POST body authentication with client credentials. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse: …` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the credential. + + - `type: Literal["vault_credential"]` + + - `"vault_credential"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `vault_id: str` + + Identifier of the vault this credential belongs to. + + - `display_name: Optional[str]` + + Human-readable name for the credential. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_credential = client.beta.vaults.credentials.create( + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", + auth={ + "token": "bearer_exampletoken", + "mcp_server_url": "https://example-server.modelcontextprotocol.io/sse", + "type": "static_bearer", + }, +) +print(beta_managed_agents_credential.id) +``` + +## List + +`beta.vaults.credentials.list(strvault_id, CredentialListParams**kwargs) -> SyncPageCursor[BetaManagedAgentsCredential]` + +**get** `/v1/vaults/{vault_id}/credentials` + +List Credentials + +### Parameters + +- `vault_id: str` + +- `include_archived: Optional[bool]` + + Whether to include archived credentials in the results. + +- `limit: Optional[int]` + + Maximum number of credentials to return per page. Defaults to 20, maximum 100. + +- `page: Optional[str]` + + Opaque pagination token from a previous `list_credentials` response. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential: …` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: str` + + Unique identifier for the credential. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `auth: Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse: …` + + OAuth credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshResponse]` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: str` + + OAuth client ID. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse: …` + + Token endpoint uses POST body authentication with client credentials. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse: …` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the credential. + + - `type: Literal["vault_credential"]` + + - `"vault_credential"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `vault_id: str` + + Identifier of the vault this credential belongs to. + + - `display_name: Optional[str]` + + Human-readable name for the credential. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +page = client.beta.vaults.credentials.list( + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", +) +page = page.data[0] +print(page.id) +``` + +## Retrieve + +`beta.vaults.credentials.retrieve(strcredential_id, CredentialRetrieveParams**kwargs) -> BetaManagedAgentsCredential` + +**get** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Get Credential + +### Parameters + +- `vault_id: str` + +- `credential_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential: …` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: str` + + Unique identifier for the credential. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `auth: Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse: …` + + OAuth credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshResponse]` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: str` + + OAuth client ID. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse: …` + + Token endpoint uses POST body authentication with client credentials. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse: …` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the credential. + + - `type: Literal["vault_credential"]` + + - `"vault_credential"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `vault_id: str` + + Identifier of the vault this credential belongs to. + + - `display_name: Optional[str]` + + Human-readable name for the credential. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_credential = client.beta.vaults.credentials.retrieve( + credential_id="vcrd_011CZkZEMt8gZan2iYOQfSkw", + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", +) +print(beta_managed_agents_credential.id) +``` + +## Update + +`beta.vaults.credentials.update(strcredential_id, CredentialUpdateParams**kwargs) -> BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Update Credential + +### Parameters + +- `vault_id: str` + +- `credential_id: str` + +- `auth: Optional[Auth]` + + Updated authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthUpdateParams: …` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `access_token: Optional[str]` + + Updated OAuth access token. + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshUpdateParams]` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: Optional[str]` + + Updated OAuth refresh token. + + - `scope: Optional[str]` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: Optional[TokenEndpointAuth]` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam: …` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `client_secret: Optional[str]` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam: …` + + Updated POST body authentication parameters for the token endpoint. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `client_secret: Optional[str]` + + Updated OAuth client secret. + + - `class BetaManagedAgentsStaticBearerUpdateParams: …` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + + - `token: Optional[str]` + + Updated static bearer token value. + +- `display_name: Optional[str]` + + Updated human-readable name for the credential. 1-255 characters. + +- `metadata: Optional[Dict[str, Optional[str]]]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential: …` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: str` + + Unique identifier for the credential. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `auth: Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse: …` + + OAuth credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshResponse]` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: str` + + OAuth client ID. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse: …` + + Token endpoint uses POST body authentication with client credentials. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse: …` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the credential. + + - `type: Literal["vault_credential"]` + + - `"vault_credential"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `vault_id: str` + + Identifier of the vault this credential belongs to. + + - `display_name: Optional[str]` + + Human-readable name for the credential. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_credential = client.beta.vaults.credentials.update( + credential_id="vcrd_011CZkZEMt8gZan2iYOQfSkw", + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", +) +print(beta_managed_agents_credential.id) +``` + +## Delete + +`beta.vaults.credentials.delete(strcredential_id, CredentialDeleteParams**kwargs) -> BetaManagedAgentsDeletedCredential` + +**delete** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Delete Credential + +### Parameters + +- `vault_id: str` + +- `credential_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsDeletedCredential: …` + + Confirmation of a deleted credential. + + - `id: str` + + Unique identifier of the deleted credential. + + - `type: Literal["vault_credential_deleted"]` + + - `"vault_credential_deleted"` + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_deleted_credential = client.beta.vaults.credentials.delete( + credential_id="vcrd_011CZkZEMt8gZan2iYOQfSkw", + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", +) +print(beta_managed_agents_deleted_credential.id) +``` + +## Archive + +`beta.vaults.credentials.archive(strcredential_id, CredentialArchiveParams**kwargs) -> BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}/archive` + +Archive Credential + +### Parameters + +- `vault_id: str` + +- `credential_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential: …` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: str` + + Unique identifier for the credential. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `auth: Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse: …` + + OAuth credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshResponse]` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: str` + + OAuth client ID. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse: …` + + Token endpoint uses POST body authentication with client credentials. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse: …` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the credential. + + - `type: Literal["vault_credential"]` + + - `"vault_credential"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `vault_id: str` + + Identifier of the vault this credential belongs to. + + - `display_name: Optional[str]` + + Human-readable name for the credential. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_credential = client.beta.vaults.credentials.archive( + credential_id="vcrd_011CZkZEMt8gZan2iYOQfSkw", + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", +) +print(beta_managed_agents_credential.id) +``` + +## Domain Types + +### Beta Managed Agents Credential + +- `class BetaManagedAgentsCredential: …` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: str` + + Unique identifier for the credential. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `auth: Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse: …` + + OAuth credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshResponse]` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: str` + + OAuth client ID. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse: …` + + Token endpoint uses POST body authentication with client credentials. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse: …` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the credential. + + - `type: Literal["vault_credential"]` + + - `"vault_credential"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `vault_id: str` + + Identifier of the vault this credential belongs to. + + - `display_name: Optional[str]` + + Human-readable name for the credential. + +### Beta Managed Agents Deleted Credential + +- `class BetaManagedAgentsDeletedCredential: …` + + Confirmation of a deleted credential. + + - `id: str` + + Unique identifier of the deleted credential. + + - `type: Literal["vault_credential_deleted"]` + + - `"vault_credential_deleted"` + +### Beta Managed Agents MCP OAuth Auth Response + +- `class BetaManagedAgentsMCPOAuthAuthResponse: …` + + OAuth credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshResponse]` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: str` + + OAuth client ID. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse: …` + + Token endpoint uses POST body authentication with client credentials. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Create Params + +- `class BetaManagedAgentsMCPOAuthCreateParams: …` + + Parameters for creating an MCP OAuth credential. + + - `access_token: str` + + OAuth access token. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshParams]` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: str` + + OAuth client ID. + + - `refresh_token: str` + + OAuth refresh token. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: str` + + OAuth client secret. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam: …` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: str` + + OAuth client secret. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Params + +- `class BetaManagedAgentsMCPOAuthRefreshParams: …` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: str` + + OAuth client ID. + + - `refresh_token: str` + + OAuth refresh token. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: str` + + OAuth client secret. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam: …` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: str` + + OAuth client secret. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Response + +- `class BetaManagedAgentsMCPOAuthRefreshResponse: …` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: str` + + OAuth client ID. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse: …` + + Token endpoint uses POST body authentication with client credentials. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Update Params + +- `class BetaManagedAgentsMCPOAuthRefreshUpdateParams: …` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: Optional[str]` + + Updated OAuth refresh token. + + - `scope: Optional[str]` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: Optional[TokenEndpointAuth]` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam: …` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `client_secret: Optional[str]` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam: …` + + Updated POST body authentication parameters for the token endpoint. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `client_secret: Optional[str]` + + Updated OAuth client secret. + +### Beta Managed Agents MCP OAuth Update Params + +- `class BetaManagedAgentsMCPOAuthUpdateParams: …` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `access_token: Optional[str]` + + Updated OAuth access token. + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshUpdateParams]` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: Optional[str]` + + Updated OAuth refresh token. + + - `scope: Optional[str]` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: Optional[TokenEndpointAuth]` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam: …` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `client_secret: Optional[str]` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam: …` + + Updated POST body authentication parameters for the token endpoint. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `client_secret: Optional[str]` + + Updated OAuth client secret. + +### Beta Managed Agents Static Bearer Auth Response + +- `class BetaManagedAgentsStaticBearerAuthResponse: …` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + +### Beta Managed Agents Static Bearer Create Params + +- `class BetaManagedAgentsStaticBearerCreateParams: …` + + Parameters for creating a static bearer token credential. + + - `token: str` + + Static bearer token value. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + +### Beta Managed Agents Static Bearer Update Params + +- `class BetaManagedAgentsStaticBearerUpdateParams: …` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + + - `token: Optional[str]` + + Updated static bearer token value. + +### Beta Managed Agents Token Endpoint Auth Basic Param + +- `class BetaManagedAgentsTokenEndpointAuthBasicParam: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: str` + + OAuth client secret. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + +### Beta Managed Agents Token Endpoint Auth Basic Response + +- `class BetaManagedAgentsTokenEndpointAuthBasicResponse: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + +### Beta Managed Agents Token Endpoint Auth Basic Update Param + +- `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam: …` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `client_secret: Optional[str]` + + Updated OAuth client secret. + +### Beta Managed Agents Token Endpoint Auth None Param + +- `class BetaManagedAgentsTokenEndpointAuthNoneParam: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + +### Beta Managed Agents Token Endpoint Auth None Response + +- `class BetaManagedAgentsTokenEndpointAuthNoneResponse: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + +### Beta Managed Agents Token Endpoint Auth Post Param + +- `class BetaManagedAgentsTokenEndpointAuthPostParam: …` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: str` + + OAuth client secret. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + +### Beta Managed Agents Token Endpoint Auth Post Response + +- `class BetaManagedAgentsTokenEndpointAuthPostResponse: …` + + Token endpoint uses POST body authentication with client credentials. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + +### Beta Managed Agents Token Endpoint Auth Post Update Param + +- `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam: …` + + Updated POST body authentication parameters for the token endpoint. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `client_secret: Optional[str]` + + Updated OAuth client secret. diff --git a/content/en/api/python/beta/vaults/credentials/archive.md b/content/en/api/python/beta/vaults/credentials/archive.md new file mode 100644 index 000000000..b59ad6fd7 --- /dev/null +++ b/content/en/api/python/beta/vaults/credentials/archive.md @@ -0,0 +1,197 @@ +## Archive + +`beta.vaults.credentials.archive(strcredential_id, CredentialArchiveParams**kwargs) -> BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}/archive` + +Archive Credential + +### Parameters + +- `vault_id: str` + +- `credential_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential: …` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: str` + + Unique identifier for the credential. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `auth: Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse: …` + + OAuth credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshResponse]` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: str` + + OAuth client ID. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse: …` + + Token endpoint uses POST body authentication with client credentials. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse: …` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the credential. + + - `type: Literal["vault_credential"]` + + - `"vault_credential"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `vault_id: str` + + Identifier of the vault this credential belongs to. + + - `display_name: Optional[str]` + + Human-readable name for the credential. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_credential = client.beta.vaults.credentials.archive( + credential_id="vcrd_011CZkZEMt8gZan2iYOQfSkw", + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", +) +print(beta_managed_agents_credential.id) +``` diff --git a/content/en/api/python/beta/vaults/credentials/create.md b/content/en/api/python/beta/vaults/credentials/create.md new file mode 100644 index 000000000..92c0b50d7 --- /dev/null +++ b/content/en/api/python/beta/vaults/credentials/create.md @@ -0,0 +1,307 @@ +## Create + +`beta.vaults.credentials.create(strvault_id, CredentialCreateParams**kwargs) -> BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials` + +Create Credential + +### Parameters + +- `vault_id: str` + +- `auth: Auth` + + Authentication details for creating a credential. + + - `class BetaManagedAgentsMCPOAuthCreateParams: …` + + Parameters for creating an MCP OAuth credential. + + - `access_token: str` + + OAuth access token. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshParams]` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: str` + + OAuth client ID. + + - `refresh_token: str` + + OAuth refresh token. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: str` + + OAuth client secret. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam: …` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: str` + + OAuth client secret. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerCreateParams: …` + + Parameters for creating a static bearer token credential. + + - `token: str` + + Static bearer token value. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + +- `display_name: Optional[str]` + + Human-readable name for the credential. Up to 255 characters. + +- `metadata: Optional[Dict[str, str]]` + + Arbitrary key-value metadata to attach to the credential. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential: …` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: str` + + Unique identifier for the credential. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `auth: Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse: …` + + OAuth credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshResponse]` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: str` + + OAuth client ID. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse: …` + + Token endpoint uses POST body authentication with client credentials. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse: …` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the credential. + + - `type: Literal["vault_credential"]` + + - `"vault_credential"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `vault_id: str` + + Identifier of the vault this credential belongs to. + + - `display_name: Optional[str]` + + Human-readable name for the credential. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_credential = client.beta.vaults.credentials.create( + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", + auth={ + "token": "bearer_exampletoken", + "mcp_server_url": "https://example-server.modelcontextprotocol.io/sse", + "type": "static_bearer", + }, +) +print(beta_managed_agents_credential.id) +``` diff --git a/content/en/api/python/beta/vaults/credentials/delete.md b/content/en/api/python/beta/vaults/credentials/delete.md new file mode 100644 index 000000000..2d41aed43 --- /dev/null +++ b/content/en/api/python/beta/vaults/credentials/delete.md @@ -0,0 +1,93 @@ +## Delete + +`beta.vaults.credentials.delete(strcredential_id, CredentialDeleteParams**kwargs) -> BetaManagedAgentsDeletedCredential` + +**delete** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Delete Credential + +### Parameters + +- `vault_id: str` + +- `credential_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsDeletedCredential: …` + + Confirmation of a deleted credential. + + - `id: str` + + Unique identifier of the deleted credential. + + - `type: Literal["vault_credential_deleted"]` + + - `"vault_credential_deleted"` + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_deleted_credential = client.beta.vaults.credentials.delete( + credential_id="vcrd_011CZkZEMt8gZan2iYOQfSkw", + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", +) +print(beta_managed_agents_deleted_credential.id) +``` diff --git a/content/en/api/python/beta/vaults/credentials/list.md b/content/en/api/python/beta/vaults/credentials/list.md new file mode 100644 index 000000000..854ab92be --- /dev/null +++ b/content/en/api/python/beta/vaults/credentials/list.md @@ -0,0 +1,207 @@ +## List + +`beta.vaults.credentials.list(strvault_id, CredentialListParams**kwargs) -> SyncPageCursor[BetaManagedAgentsCredential]` + +**get** `/v1/vaults/{vault_id}/credentials` + +List Credentials + +### Parameters + +- `vault_id: str` + +- `include_archived: Optional[bool]` + + Whether to include archived credentials in the results. + +- `limit: Optional[int]` + + Maximum number of credentials to return per page. Defaults to 20, maximum 100. + +- `page: Optional[str]` + + Opaque pagination token from a previous `list_credentials` response. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential: …` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: str` + + Unique identifier for the credential. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `auth: Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse: …` + + OAuth credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshResponse]` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: str` + + OAuth client ID. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse: …` + + Token endpoint uses POST body authentication with client credentials. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse: …` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the credential. + + - `type: Literal["vault_credential"]` + + - `"vault_credential"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `vault_id: str` + + Identifier of the vault this credential belongs to. + + - `display_name: Optional[str]` + + Human-readable name for the credential. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +page = client.beta.vaults.credentials.list( + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", +) +page = page.data[0] +print(page.id) +``` diff --git a/content/en/api/python/beta/vaults/credentials/retrieve.md b/content/en/api/python/beta/vaults/credentials/retrieve.md new file mode 100644 index 000000000..e83412a13 --- /dev/null +++ b/content/en/api/python/beta/vaults/credentials/retrieve.md @@ -0,0 +1,197 @@ +## Retrieve + +`beta.vaults.credentials.retrieve(strcredential_id, CredentialRetrieveParams**kwargs) -> BetaManagedAgentsCredential` + +**get** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Get Credential + +### Parameters + +- `vault_id: str` + +- `credential_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential: …` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: str` + + Unique identifier for the credential. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `auth: Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse: …` + + OAuth credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshResponse]` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: str` + + OAuth client ID. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse: …` + + Token endpoint uses POST body authentication with client credentials. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse: …` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the credential. + + - `type: Literal["vault_credential"]` + + - `"vault_credential"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `vault_id: str` + + Identifier of the vault this credential belongs to. + + - `display_name: Optional[str]` + + Human-readable name for the credential. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_credential = client.beta.vaults.credentials.retrieve( + credential_id="vcrd_011CZkZEMt8gZan2iYOQfSkw", + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", +) +print(beta_managed_agents_credential.id) +``` diff --git a/content/en/api/python/beta/vaults/credentials/update.md b/content/en/api/python/beta/vaults/credentials/update.md new file mode 100644 index 000000000..40006fd50 --- /dev/null +++ b/content/en/api/python/beta/vaults/credentials/update.md @@ -0,0 +1,277 @@ +## Update + +`beta.vaults.credentials.update(strcredential_id, CredentialUpdateParams**kwargs) -> BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Update Credential + +### Parameters + +- `vault_id: str` + +- `credential_id: str` + +- `auth: Optional[Auth]` + + Updated authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthUpdateParams: …` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `access_token: Optional[str]` + + Updated OAuth access token. + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshUpdateParams]` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: Optional[str]` + + Updated OAuth refresh token. + + - `scope: Optional[str]` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: Optional[TokenEndpointAuth]` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam: …` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `client_secret: Optional[str]` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam: …` + + Updated POST body authentication parameters for the token endpoint. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `client_secret: Optional[str]` + + Updated OAuth client secret. + + - `class BetaManagedAgentsStaticBearerUpdateParams: …` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + + - `token: Optional[str]` + + Updated static bearer token value. + +- `display_name: Optional[str]` + + Updated human-readable name for the credential. 1-255 characters. + +- `metadata: Optional[Dict[str, Optional[str]]]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential: …` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: str` + + Unique identifier for the credential. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `auth: Auth` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse: …` + + OAuth credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["mcp_oauth"]` + + - `"mcp_oauth"` + + - `expires_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `refresh: Optional[BetaManagedAgentsMCPOAuthRefreshResponse]` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: str` + + OAuth client ID. + + - `token_endpoint: str` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: TokenEndpointAuth` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse: …` + + Token endpoint requires no client authentication. + + - `type: Literal["none"]` + + - `"none"` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse: …` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: Literal["client_secret_basic"]` + + - `"client_secret_basic"` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse: …` + + Token endpoint uses POST body authentication with client credentials. + + - `type: Literal["client_secret_post"]` + + - `"client_secret_post"` + + - `resource: Optional[str]` + + OAuth resource indicator. + + - `scope: Optional[str]` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse: …` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: str` + + URL of the MCP server this credential authenticates against. + + - `type: Literal["static_bearer"]` + + - `"static_bearer"` + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the credential. + + - `type: Literal["vault_credential"]` + + - `"vault_credential"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + + - `vault_id: str` + + Identifier of the vault this credential belongs to. + + - `display_name: Optional[str]` + + Human-readable name for the credential. + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_credential = client.beta.vaults.credentials.update( + credential_id="vcrd_011CZkZEMt8gZan2iYOQfSkw", + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", +) +print(beta_managed_agents_credential.id) +``` diff --git a/content/en/api/python/beta/vaults/delete.md b/content/en/api/python/beta/vaults/delete.md new file mode 100644 index 000000000..963f70a8a --- /dev/null +++ b/content/en/api/python/beta/vaults/delete.md @@ -0,0 +1,90 @@ +## Delete + +`beta.vaults.delete(strvault_id, VaultDeleteParams**kwargs) -> BetaManagedAgentsDeletedVault` + +**delete** `/v1/vaults/{vault_id}` + +Delete Vault + +### Parameters + +- `vault_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsDeletedVault: …` + + Confirmation of a deleted vault. + + - `id: str` + + Unique identifier of the deleted vault. + + - `type: Literal["vault_deleted"]` + + - `"vault_deleted"` + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_deleted_vault = client.beta.vaults.delete( + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", +) +print(beta_managed_agents_deleted_vault.id) +``` diff --git a/content/en/api/python/beta/vaults/list.md b/content/en/api/python/beta/vaults/list.md new file mode 100644 index 000000000..ae8690d34 --- /dev/null +++ b/content/en/api/python/beta/vaults/list.md @@ -0,0 +1,119 @@ +## List + +`beta.vaults.list(VaultListParams**kwargs) -> SyncPageCursor[BetaManagedAgentsVault]` + +**get** `/v1/vaults` + +List Vaults + +### Parameters + +- `include_archived: Optional[bool]` + + Whether to include archived vaults in the results. + +- `limit: Optional[int]` + + Maximum number of vaults to return per page. Defaults to 20, maximum 100. + +- `page: Optional[str]` + + Opaque pagination token from a previous `list_vaults` response. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsVault: …` + + A vault that stores credentials for use by agents during sessions. + + - `id: str` + + Unique identifier for the vault. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `display_name: str` + + Human-readable name for the vault. + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the vault. + + - `type: Literal["vault"]` + + - `"vault"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +page = client.beta.vaults.list() +page = page.data[0] +print(page.id) +``` diff --git a/content/en/api/python/beta/vaults/retrieve.md b/content/en/api/python/beta/vaults/retrieve.md new file mode 100644 index 000000000..e01ed571b --- /dev/null +++ b/content/en/api/python/beta/vaults/retrieve.md @@ -0,0 +1,110 @@ +## Retrieve + +`beta.vaults.retrieve(strvault_id, VaultRetrieveParams**kwargs) -> BetaManagedAgentsVault` + +**get** `/v1/vaults/{vault_id}` + +Get Vault + +### Parameters + +- `vault_id: str` + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsVault: …` + + A vault that stores credentials for use by agents during sessions. + + - `id: str` + + Unique identifier for the vault. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `display_name: str` + + Human-readable name for the vault. + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the vault. + + - `type: Literal["vault"]` + + - `"vault"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_vault = client.beta.vaults.retrieve( + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", +) +print(beta_managed_agents_vault.id) +``` diff --git a/content/en/api/python/beta/vaults/update.md b/content/en/api/python/beta/vaults/update.md new file mode 100644 index 000000000..e9657afbc --- /dev/null +++ b/content/en/api/python/beta/vaults/update.md @@ -0,0 +1,118 @@ +## Update + +`beta.vaults.update(strvault_id, VaultUpdateParams**kwargs) -> BetaManagedAgentsVault` + +**post** `/v1/vaults/{vault_id}` + +Update Vault + +### Parameters + +- `vault_id: str` + +- `display_name: Optional[str]` + + Updated human-readable name for the vault. 1-255 characters. + +- `metadata: Optional[Dict[str, Optional[str]]]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + +- `betas: Optional[List[AnthropicBetaParam]]` + + Optional header to specify the beta version(s) you want to use. + + - `str` + + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsVault: …` + + A vault that stores credentials for use by agents during sessions. + + - `id: str` + + Unique identifier for the vault. + + - `archived_at: Optional[datetime]` + + A timestamp in RFC 3339 format + + - `created_at: datetime` + + A timestamp in RFC 3339 format + + - `display_name: str` + + Human-readable name for the vault. + + - `metadata: Dict[str, str]` + + Arbitrary key-value metadata attached to the vault. + + - `type: Literal["vault"]` + + - `"vault"` + + - `updated_at: datetime` + + A timestamp in RFC 3339 format + +### Example + +```python +import os +from anthropic import Anthropic + +client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted +) +beta_managed_agents_vault = client.beta.vaults.update( + vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", +) +print(beta_managed_agents_vault.id) +``` diff --git a/content/en/api/python/completions.md b/content/en/api/python/completions.md index 903a9f0c2..599c1aa1a 100644 --- a/content/en/api/python/completions.md +++ b/content/en/api/python/completions.md @@ -26,13 +26,14 @@ Future models and features will not be compatible with Text Completions. See our See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -48,9 +49,13 @@ Future models and features will not be compatible with Text Completions. See our - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -186,7 +191,7 @@ Future models and features will not be compatible with Text Completions. See our - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -230,8 +235,6 @@ Future models and features will not be compatible with Text Completions. See our - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class Completion: …` @@ -252,13 +255,14 @@ Future models and features will not be compatible with Text Completions. See our See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -274,9 +278,13 @@ Future models and features will not be compatible with Text Completions. See our - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -364,7 +372,7 @@ client = Anthropic( ) for completion in client.completions.create( max_tokens_to_sample=256, - model="claude-opus-4-6", + model="claude-mythos-preview", prompt="\n\nHuman: Hello, world!\n\nAssistant:", ): print(completion) @@ -392,13 +400,14 @@ for completion in client.completions.create( See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -414,9 +423,13 @@ for completion in client.completions.create( - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` diff --git a/content/en/api/python/completions/create.md b/content/en/api/python/completions/create.md index 94f23ae08..e61960d54 100644 --- a/content/en/api/python/completions/create.md +++ b/content/en/api/python/completions/create.md @@ -24,13 +24,14 @@ Future models and features will not be compatible with Text Completions. See our See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -46,9 +47,13 @@ Future models and features will not be compatible with Text Completions. See our - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -184,7 +189,7 @@ Future models and features will not be compatible with Text Completions. See our - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -228,8 +233,6 @@ Future models and features will not be compatible with Text Completions. See our - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class Completion: …` @@ -250,13 +253,14 @@ Future models and features will not be compatible with Text Completions. See our See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -272,9 +276,13 @@ Future models and features will not be compatible with Text Completions. See our - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -362,7 +370,7 @@ client = Anthropic( ) for completion in client.completions.create( max_tokens_to_sample=256, - model="claude-opus-4-6", + model="claude-mythos-preview", prompt="\n\nHuman: Hello, world!\n\nAssistant:", ): print(completion) diff --git a/content/en/api/python/messages.md b/content/en/api/python/messages.md index 712d03af3..bf7ad2bc1 100644 --- a/content/en/api/python/messages.md +++ b/content/en/api/python/messages.md @@ -2305,13 +2305,14 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -2327,9 +2328,13 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -4550,13 +4555,14 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -4572,9 +4578,13 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -7090,13 +7100,14 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -7112,9 +7123,13 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -8576,7 +8591,7 @@ message_tokens_count = client.messages.count_tokens( "content": "string", "role": "user", }], - model="claude-opus-4-6", + model="claude-mythos-preview", ) print(message_tokens_count.input_tokens) ``` @@ -14271,13 +14286,14 @@ print(message_tokens_count.input_tokens) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -14293,9 +14309,13 @@ print(message_tokens_count.input_tokens) - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -17818,19 +17838,20 @@ print(message_tokens_count.input_tokens) ### Model -- `Union[Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more], str]` +- `Union[Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more], str]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -17846,9 +17867,13 @@ print(message_tokens_count.input_tokens) - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -19715,13 +19740,14 @@ print(message_tokens_count.input_tokens) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -19737,9 +19763,13 @@ print(message_tokens_count.input_tokens) - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -20667,13 +20697,14 @@ print(message_tokens_count.input_tokens) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -20689,9 +20720,13 @@ print(message_tokens_count.input_tokens) - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -29778,13 +29813,14 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -29800,9 +29836,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -32595,13 +32635,14 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -32617,9 +32658,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -33882,13 +33927,14 @@ for batch in client.messages.batches.results( See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -33904,9 +33950,13 @@ for batch in client.messages.batches.results( - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -34962,13 +35012,14 @@ for batch in client.messages.batches.results( See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -34984,9 +35035,13 @@ for batch in client.messages.batches.results( - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -36004,13 +36059,14 @@ for batch in client.messages.batches.results( See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -36026,9 +36082,13 @@ for batch in client.messages.batches.results( - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` diff --git a/content/en/api/python/messages/batches.md b/content/en/api/python/messages/batches.md index a9eedf8a9..1a1ca9e64 100644 --- a/content/en/api/python/messages/batches.md +++ b/content/en/api/python/messages/batches.md @@ -2321,13 +2321,14 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -2343,9 +2344,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -5138,13 +5143,14 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -5160,9 +5166,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -6425,13 +6435,14 @@ for batch in client.messages.batches.results( See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -6447,9 +6458,13 @@ for batch in client.messages.batches.results( - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -7505,13 +7520,14 @@ for batch in client.messages.batches.results( See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -7527,9 +7543,13 @@ for batch in client.messages.batches.results( - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -8547,13 +8567,14 @@ for batch in client.messages.batches.results( See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -8569,9 +8590,13 @@ for batch in client.messages.batches.results( - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` diff --git a/content/en/api/python/messages/batches/create.md b/content/en/api/python/messages/batches/create.md index 04abee270..e504825df 100644 --- a/content/en/api/python/messages/batches/create.md +++ b/content/en/api/python/messages/batches/create.md @@ -2319,13 +2319,14 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -2341,9 +2342,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` diff --git a/content/en/api/python/messages/batches/results.md b/content/en/api/python/messages/batches/results.md index 6320c8324..b2346da08 100644 --- a/content/en/api/python/messages/batches/results.md +++ b/content/en/api/python/messages/batches/results.md @@ -747,13 +747,14 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -769,9 +770,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` diff --git a/content/en/api/python/messages/count_tokens.md b/content/en/api/python/messages/count_tokens.md index cf20e0ded..09a3f6a48 100644 --- a/content/en/api/python/messages/count_tokens.md +++ b/content/en/api/python/messages/count_tokens.md @@ -2295,13 +2295,14 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -2317,9 +2318,13 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -3781,7 +3786,7 @@ message_tokens_count = client.messages.count_tokens( "content": "string", "role": "user", }], - model="claude-opus-4-6", + model="claude-mythos-preview", ) print(message_tokens_count.input_tokens) ``` diff --git a/content/en/api/python/messages/create.md b/content/en/api/python/messages/create.md index e2d944652..3763e26b7 100644 --- a/content/en/api/python/messages/create.md +++ b/content/en/api/python/messages/create.md @@ -2303,13 +2303,14 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -2325,9 +2326,13 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -4548,13 +4553,14 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]` + - `Literal["claude-mythos-preview", "claude-opus-4-6", "claude-sonnet-4-6", 13 more]` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `claude-opus-4-6` - Most intelligent model for building agents and coding + - `claude-mythos-preview` - New class of intelligence, strongest in coding and cybersecurity + - `claude-opus-4-6` - Frontier intelligence for long-running agents and coding - `claude-sonnet-4-6` - Best combination of speed and intelligence - `claude-haiku-4-5` - Fastest model with near-frontier intelligence - `claude-haiku-4-5-20251001` - Fastest model with near-frontier intelligence @@ -4570,9 +4576,13 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en - `claude-sonnet-4-20250514` - High-performance model with extended thinking - `claude-3-haiku-20240307` - Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` diff --git a/content/en/api/python/models.md b/content/en/api/python/models.md index 92b33cde7..885c09937 100644 --- a/content/en/api/python/models.md +++ b/content/en/api/python/models.md @@ -32,7 +32,7 @@ The Models API response can be used to determine which models are available for - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -76,8 +76,6 @@ The Models API response can be used to determine which models are available for - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class ModelInfo: …` @@ -298,7 +296,7 @@ The Models API response can be used to determine information about a specific mo - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -342,8 +340,6 @@ The Models API response can be used to determine information about a specific mo - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class ModelInfo: …` diff --git a/content/en/api/python/models/list.md b/content/en/api/python/models/list.md index 3e489433d..8f88ac217 100644 --- a/content/en/api/python/models/list.md +++ b/content/en/api/python/models/list.md @@ -30,7 +30,7 @@ The Models API response can be used to determine which models are available for - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -74,8 +74,6 @@ The Models API response can be used to determine which models are available for - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class ModelInfo: …` diff --git a/content/en/api/python/models/retrieve.md b/content/en/api/python/models/retrieve.md index b7c7a9308..7d65e9f60 100644 --- a/content/en/api/python/models/retrieve.md +++ b/content/en/api/python/models/retrieve.md @@ -20,7 +20,7 @@ The Models API response can be used to determine information about a specific mo - `str` - - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 19 more]` + - `Literal["message-batches-2024-09-24", "prompt-caching-2024-07-31", "computer-use-2024-10-22", 18 more]` - `"message-batches-2024-09-24"` @@ -64,8 +64,6 @@ The Models API response can be used to determine information about a specific mo - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `class ModelInfo: …` diff --git a/content/en/api/rate-limits.md b/content/en/api/rate-limits.md index 220dcb420..77f5bb006 100644 --- a/content/en/api/rate-limits.md +++ b/content/en/api/rate-limits.md @@ -259,6 +259,15 @@ If you're seeking higher limits for an Enterprise use case, contact sales throug
                                                                                                                                                                                                                                                                                                                                                                                    +### Managed Agents + +[Claude Managed Agents](/docs/en/managed-agents/overview) endpoints are rate-limited per organization. These limits are separate from the Messages API rate limits above. + +| Operation | Limit | +| --- | --- | +| Create endpoints (agents, sessions, environments, etc.) | 60 requests per minute | +| Read endpoints (retrieve, list, stream, etc.) | 600 requests per minute | + ### Fast mode rate limits When using [fast mode](/docs/en/build-with-claude/fast-mode) (beta: research preview) with `speed: "fast"` on Opus 4.6, dedicated rate limits apply that are separate from standard Opus rate limits. When fast mode rate limits are exceeded, the API returns a `429` error with a `retry-after` header. diff --git a/content/en/api/ruby/beta.md b/content/en/api/ruby/beta.md index 50797a9f3..e758d5d28 100644 --- a/content/en/api/ruby/beta.md +++ b/content/en/api/ruby/beta.md @@ -4,11 +4,11 @@ ### Anthropic Beta -- `AnthropicBeta = String | :"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` +- `AnthropicBeta = String | :"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -52,8 +52,6 @@ - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Beta API Error - `class BetaAPIError` @@ -338,7 +336,7 @@ The Models API response can be used to determine which models are available for - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -382,8 +380,6 @@ The Models API response can be used to determine which models are available for - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaModelInfo` @@ -602,7 +598,7 @@ The Models API response can be used to determine information about a specific mo - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -646,8 +642,6 @@ The Models API response can be used to determine information about a specific mo - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaModelInfo` @@ -3923,15 +3917,19 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -6000,17 +5998,13 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en Recommended for advanced use cases only. You usually only need to use `temperature`. -- `user_profile_id: String` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `betas: Array[AnthropicBeta]` Optional header to specify the beta version(s) you want to use. - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -6054,8 +6048,6 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaMessage` @@ -6979,15 +6971,19 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -9891,15 +9887,19 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -11878,7 +11878,7 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -11922,8 +11922,6 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageTokensCount` @@ -11949,7 +11947,7 @@ anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") beta_message_tokens_count = anthropic.beta.messages.count_tokens( messages: [{content: "string", role: :user}], - model: :"claude-opus-4-6" + model: :"claude-mythos-preview" ) puts(beta_message_tokens_count) @@ -19140,15 +19138,19 @@ puts(beta_message_tokens_count) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -24484,15 +24486,19 @@ puts(beta_message_tokens_count) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -25728,15 +25734,19 @@ puts(beta_message_tokens_count) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -34277,7 +34287,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Must be unique for each request within the Message Batch. - - `params: { max_tokens, messages, model, 20 more}` + - `params: { max_tokens, messages, model, 19 more}` Messages API creation parameters for the individual request. @@ -36868,15 +36878,19 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -38945,17 +38959,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Recommended for advanced use cases only. You usually only need to use `temperature`. - - `user_profile_id: String` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `betas: Array[AnthropicBeta]` Optional header to specify the beta version(s) you want to use. - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -38999,8 +39009,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatch` @@ -39132,7 +39140,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -39176,8 +39184,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatch` @@ -39312,7 +39318,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -39356,8 +39362,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatch` @@ -39484,7 +39488,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -39528,8 +39532,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatch` @@ -39656,7 +39658,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -39700,8 +39702,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaDeletedMessageBatch` @@ -39754,7 +39754,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -39798,8 +39798,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatchIndividualResponse` @@ -40741,15 +40739,19 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -42317,15 +42319,19 @@ puts(beta_message_batch_individual_response) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -43689,15 +43695,19 @@ puts(beta_message_batch_individual_response) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -45023,15 +45033,19 @@ puts(beta_message_batch_individual_response) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -45332,345 +45346,387 @@ puts(beta_message_batch_individual_response) - `:succeeded` -# Files +# Agents -## Upload +## Create -`beta.files.upload(**kwargs) -> FileMetadata` +`beta.agents.create(**kwargs) -> BetaManagedAgentsAgent` -**post** `/v1/files` +**post** `/v1/agents` -Upload File +Create Agent ### Parameters -- `file: String` +- `model: BetaManagedAgentsModel | BetaManagedAgentsModelConfigParams` - The file to upload + Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control -- `betas: Array[AnthropicBeta]` + - `BetaManagedAgentsModel = :"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more | String` - Optional header to specify the beta version(s) you want to use. + The model that will power your agent. - - `String` + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` - - `:"message-batches-2024-09-24"` + The model that will power your agent. - - `:"prompt-caching-2024-07-31"` + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"computer-use-2024-10-22"` + - `:"claude-opus-4-6"` - - `:"computer-use-2025-01-24"` + Most intelligent model for building agents and coding - - `:"pdfs-2024-09-25"` + - `:"claude-sonnet-4-6"` - - `:"token-counting-2024-11-01"` + Best combination of speed and intelligence - - `:"token-efficient-tools-2025-02-19"` + - `:"claude-haiku-4-5"` - - `:"output-128k-2025-02-19"` + Fastest model with near-frontier intelligence - - `:"files-api-2025-04-14"` + - `:"claude-haiku-4-5-20251001"` - - `:"mcp-client-2025-04-04"` + Fastest model with near-frontier intelligence - - `:"mcp-client-2025-11-20"` + - `:"claude-opus-4-5"` - - `:"dev-full-thinking-2025-05-14"` + Premium model combining maximum intelligence with practical performance - - `:"interleaved-thinking-2025-05-14"` + - `:"claude-opus-4-5-20251101"` - - `:"code-execution-2025-05-22"` + Premium model combining maximum intelligence with practical performance - - `:"extended-cache-ttl-2025-04-11"` + - `:"claude-sonnet-4-5"` - - `:"context-1m-2025-08-07"` + High-performance model for agents and coding - - `:"context-management-2025-06-27"` + - `:"claude-sonnet-4-5-20250929"` - - `:"model-context-window-exceeded-2025-08-26"` + High-performance model for agents and coding - - `:"skills-2025-10-02"` + - `String` - - `:"fast-mode-2026-02-01"` + - `class BetaManagedAgentsModelConfigParams` - - `:"output-300k-2026-03-24"` + An object that defines additional configuration control over model use - - `:"user-profiles-2026-03-24"` + - `id: BetaManagedAgentsModel` -### Returns + The model that will power your agent. -- `class FileMetadata` + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `id: String` + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` - Unique object identifier. + The model that will power your agent. - The format and length of IDs may change over time. + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `created_at: Time` + - `:"claude-opus-4-6"` - RFC 3339 datetime string representing when the file was created. + Most intelligent model for building agents and coding - - `filename: String` + - `:"claude-sonnet-4-6"` - Original filename of the uploaded file. + Best combination of speed and intelligence - - `mime_type: String` + - `:"claude-haiku-4-5"` - MIME type of the file. + Fastest model with near-frontier intelligence - - `size_bytes: Integer` + - `:"claude-haiku-4-5-20251001"` - Size of the file in bytes. + Fastest model with near-frontier intelligence - - `type: :file` + - `:"claude-opus-4-5"` - Object type. + Premium model combining maximum intelligence with practical performance - For files, this is always `"file"`. + - `:"claude-opus-4-5-20251101"` - - `:file` + Premium model combining maximum intelligence with practical performance - - `downloadable: bool` + - `:"claude-sonnet-4-5"` - Whether the file can be downloaded. + High-performance model for agents and coding -### Example + - `:"claude-sonnet-4-5-20250929"` -```ruby -require "anthropic" + High-performance model for agents and coding -anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + - `String` -file_metadata = anthropic.beta.files.upload(file: StringIO.new("Example data")) + - `speed: :standard | :fast` -puts(file_metadata) -``` + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. -## List + - `:standard` -`beta.files.list(**kwargs) -> Page` + - `:fast` -**get** `/v1/files` +- `name: String` -List Files + Human-readable name for the agent. 1-256 characters. -### Parameters +- `description: String` -- `after_id: String` + Description of what the agent does. Up to 2048 characters. - ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object. +- `mcp_servers: Array[BetaManagedAgentsURLMCPServerParams]` -- `before_id: String` + MCP servers this agent connects to. Maximum 20. Names must be unique within the array. - ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object. + - `name: String` -- `limit: Integer` + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. - Number of items to return per page. + - `type: :url` - Defaults to `20`. Ranges from `1` to `1000`. + - `:url` -- `betas: Array[AnthropicBeta]` + - `url: String` - Optional header to specify the beta version(s) you want to use. + Endpoint URL for the MCP server. - - `String` +- `metadata: Hash[Symbol, String]` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars. - - `:"message-batches-2024-09-24"` +- `skills: Array[BetaManagedAgentsSkillParams]` - - `:"prompt-caching-2024-07-31"` + Skills available to the agent. Maximum 20. - - `:"computer-use-2024-10-22"` + - `class BetaManagedAgentsAnthropicSkillParams` - - `:"computer-use-2025-01-24"` + An Anthropic-managed skill. - - `:"pdfs-2024-09-25"` + - `skill_id: String` - - `:"token-counting-2024-11-01"` + Identifier of the Anthropic skill (e.g., "xlsx"). - - `:"token-efficient-tools-2025-02-19"` + - `type: :anthropic` - - `:"output-128k-2025-02-19"` + - `:anthropic` - - `:"files-api-2025-04-14"` + - `version: String` - - `:"mcp-client-2025-04-04"` + Version to pin. Defaults to latest if omitted. - - `:"mcp-client-2025-11-20"` + - `class BetaManagedAgentsCustomSkillParams` - - `:"dev-full-thinking-2025-05-14"` + A user-created custom skill. - - `:"interleaved-thinking-2025-05-14"` + - `skill_id: String` - - `:"code-execution-2025-05-22"` + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). - - `:"extended-cache-ttl-2025-04-11"` + - `type: :custom` - - `:"context-1m-2025-08-07"` + - `:custom` - - `:"context-management-2025-06-27"` + - `version: String` - - `:"model-context-window-exceeded-2025-08-26"` + Version to pin. Defaults to latest if omitted. - - `:"skills-2025-10-02"` +- `system_: String` - - `:"fast-mode-2026-02-01"` + System prompt for the agent. Up to 100,000 characters. - - `:"output-300k-2026-03-24"` +- `tools: Array[BetaManagedAgentsAgentToolset20260401Params | BetaManagedAgentsMCPToolsetParams | BetaManagedAgentsCustomToolParams]` - - `:"user-profiles-2026-03-24"` + Tool configurations available to the agent. Maximum of 128 tools across all toolsets allowed. -### Returns + - `class BetaManagedAgentsAgentToolset20260401Params` -- `class FileMetadata` + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. - - `id: String` + - `type: :agent_toolset_20260401` - Unique object identifier. + - `:agent_toolset_20260401` - The format and length of IDs may change over time. + - `configs: Array[BetaManagedAgentsAgentToolConfigParams]` - - `created_at: Time` + Per-tool configuration overrides. - RFC 3339 datetime string representing when the file was created. + - `name: :bash | :edit | :read | 5 more` - - `filename: String` + Built-in agent tool identifier. - Original filename of the uploaded file. + - `:bash` - - `mime_type: String` + - `:edit` - MIME type of the file. + - `:read` - - `size_bytes: Integer` + - `:write` - Size of the file in bytes. + - `:glob` - - `type: :file` + - `:grep` - Object type. + - `:web_fetch` - For files, this is always `"file"`. + - `:web_search` - - `:file` + - `enabled: bool` - - `downloadable: bool` + Whether this tool is enabled and available to Claude. Overrides the default_config setting. - Whether the file can be downloaded. + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` -### Example + Permission policy for tool execution. -```ruby -require "anthropic" + - `class BetaManagedAgentsAlwaysAllowPolicy` -anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + Tool calls are automatically approved without user confirmation. -page = anthropic.beta.files.list + - `type: :always_allow` -puts(page) -``` + - `:always_allow` -## Download + - `class BetaManagedAgentsAlwaysAskPolicy` -`beta.files.download(file_id, **kwargs) -> StringIO` + Tool calls require user confirmation before execution. -**get** `/v1/files/{file_id}/content` + - `type: :always_ask` -Download File + - `:always_ask` -### Parameters + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfigParams` -- `file_id: String` + Default configuration for all tools in a toolset. - ID of the File. + - `enabled: bool` -- `betas: Array[AnthropicBeta]` + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. - Optional header to specify the beta version(s) you want to use. + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` - - `String` + Permission policy for tool execution. - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `class BetaManagedAgentsAlwaysAllowPolicy` - - `:"message-batches-2024-09-24"` + Tool calls are automatically approved without user confirmation. - - `:"prompt-caching-2024-07-31"` + - `type: :always_allow` - - `:"computer-use-2024-10-22"` + - `:always_allow` - - `:"computer-use-2025-01-24"` + - `class BetaManagedAgentsAlwaysAskPolicy` - - `:"pdfs-2024-09-25"` + Tool calls require user confirmation before execution. - - `:"token-counting-2024-11-01"` + - `type: :always_ask` - - `:"token-efficient-tools-2025-02-19"` + - `:always_ask` - - `:"output-128k-2025-02-19"` + - `class BetaManagedAgentsMCPToolsetParams` - - `:"files-api-2025-04-14"` + Configuration for tools from an MCP server defined in `mcp_servers`. - - `:"mcp-client-2025-04-04"` + - `mcp_server_name: String` - - `:"mcp-client-2025-11-20"` + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. - - `:"dev-full-thinking-2025-05-14"` + - `type: :mcp_toolset` - - `:"interleaved-thinking-2025-05-14"` + - `:mcp_toolset` - - `:"code-execution-2025-05-22"` + - `configs: Array[BetaManagedAgentsMCPToolConfigParams]` - - `:"extended-cache-ttl-2025-04-11"` + Per-tool configuration overrides. - - `:"context-1m-2025-08-07"` + - `name: String` - - `:"context-management-2025-06-27"` + Name of the MCP tool to configure. 1-128 characters. - - `:"model-context-window-exceeded-2025-08-26"` + - `enabled: bool` - - `:"skills-2025-10-02"` + Whether this tool is enabled. Overrides the `default_config` setting. - - `:"fast-mode-2026-02-01"` + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` - - `:"output-300k-2026-03-24"` + Permission policy for tool execution. - - `:"user-profiles-2026-03-24"` + - `class BetaManagedAgentsAlwaysAllowPolicy` -### Returns + Tool calls are automatically approved without user confirmation. -- `StringIO` + - `type: :always_allow` -### Example + - `:always_allow` -```ruby -require "anthropic" + - `class BetaManagedAgentsAlwaysAskPolicy` -anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + Tool calls require user confirmation before execution. -response = anthropic.beta.files.download("file_id") + - `type: :always_ask` -puts(response) -``` + - `:always_ask` -## Retrieve Metadata + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfigParams` -`beta.files.retrieve_metadata(file_id, **kwargs) -> FileMetadata` + Default configuration for all tools from an MCP server. -**get** `/v1/files/{file_id}` + - `enabled: bool` -Get File Metadata + Whether tools are enabled by default. Defaults to true if not specified. -### Parameters + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` -- `file_id: String` + Permission policy for tool execution. - ID of the File. + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `class BetaManagedAgentsCustomToolParams` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: String` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: :custom` + + - `:custom` - `betas: Array[AnthropicBeta]` @@ -45678,7 +45734,7 @@ Get File Metadata - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -45722,7 +45778,22835 @@ Get File Metadata - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` +### Returns + +- `class BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: String` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `metadata: Hash[Symbol, String]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `version: Integer` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_agent = anthropic.beta.agents.create(model: :"claude-sonnet-4-6", name: "My First Agent") + +puts(beta_managed_agents_agent) +``` + +## List + +`beta.agents.list(**kwargs) -> PageCursor` + +**get** `/v1/agents` + +List Agents + +### Parameters + +- `created_at_gte: Time` + + Return agents created at or after this time (inclusive). + +- `created_at_lte: Time` + + Return agents created at or before this time (inclusive). + +- `include_archived: bool` + + Include archived agents in results. Defaults to false. + +- `limit: Integer` + + Maximum results per page. Default 20, maximum 100. + +- `page: String` + + Opaque pagination cursor from a previous response. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: String` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `metadata: Hash[Symbol, String]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `version: Integer` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +page = anthropic.beta.agents.list + +puts(page) +``` + +## Retrieve + +`beta.agents.retrieve(agent_id, **kwargs) -> BetaManagedAgentsAgent` + +**get** `/v1/agents/{agent_id}` + +Get Agent + +### Parameters + +- `agent_id: String` + +- `version: Integer` + + Agent version. Omit for the most recent version. Must be at least 1 if specified. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: String` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `metadata: Hash[Symbol, String]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `version: Integer` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_agent = anthropic.beta.agents.retrieve("agent_011CZkYpogX7uDKUyvBTophP") + +puts(beta_managed_agents_agent) +``` + +## Update + +`beta.agents.update(agent_id, **kwargs) -> BetaManagedAgentsAgent` + +**post** `/v1/agents/{agent_id}` + +Update Agent + +### Parameters + +- `agent_id: String` + +- `version: Integer` + + The agent's current version, used to prevent concurrent overwrites. Obtain this value from a create or retrieve response. The request fails if this does not match the server's current version. + +- `description: String` + + Description. Up to 2048 characters. Omit to preserve; send empty string or null to clear. + +- `mcp_servers: Array[BetaManagedAgentsURLMCPServerParams]` + + MCP servers. Full replacement. Omit to preserve; send empty array or null to clear. Names must be unique. Maximum 20. + + - `name: String` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `type: :url` + + - `:url` + + - `url: String` + + Endpoint URL for the MCP server. + +- `metadata: Hash[Symbol, String]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. The stored bag is limited to 16 keys (up to 64 chars each) with values up to 512 chars. + +- `model: BetaManagedAgentsModel | BetaManagedAgentsModelConfigParams` + + Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control. Omit to preserve. Cannot be cleared. + + - `BetaManagedAgentsModel = :"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more | String` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `class BetaManagedAgentsModelConfigParams` + + An object that defines additional configuration control over model use + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + +- `name: String` + + Human-readable name. 1-256 characters. Omit to preserve. Cannot be cleared. + +- `skills: Array[BetaManagedAgentsSkillParams]` + + Skills. Full replacement. Omit to preserve; send empty array or null to clear. Maximum 20. + + - `class BetaManagedAgentsAnthropicSkillParams` + + An Anthropic-managed skill. + + - `skill_id: String` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + Version to pin. Defaults to latest if omitted. + + - `class BetaManagedAgentsCustomSkillParams` + + A user-created custom skill. + + - `skill_id: String` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: :custom` + + - `:custom` + + - `version: String` + + Version to pin. Defaults to latest if omitted. + +- `system_: String` + + System prompt. Up to 100,000 characters. Omit to preserve; send empty string or null to clear. + +- `tools: Array[BetaManagedAgentsAgentToolset20260401Params | BetaManagedAgentsMCPToolsetParams | BetaManagedAgentsCustomToolParams]` + + Tool configurations available to the agent. Full replacement. Omit to preserve; send empty array or null to clear. Maximum of 128 tools across all toolsets allowed. + + - `class BetaManagedAgentsAgentToolset20260401Params` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfigParams]` + + Per-tool configuration overrides. + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `enabled: bool` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfigParams` + + Default configuration for all tools in a toolset. + + - `enabled: bool` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `class BetaManagedAgentsMCPToolsetParams` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `mcp_server_name: String` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfigParams]` + + Per-tool configuration overrides. + + - `name: String` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled: bool` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfigParams` + + Default configuration for all tools from an MCP server. + + - `enabled: bool` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `class BetaManagedAgentsCustomToolParams` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: String` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: :custom` + + - `:custom` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: String` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `metadata: Hash[Symbol, String]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `version: Integer` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_agent = anthropic.beta.agents.update("agent_011CZkYpogX7uDKUyvBTophP", version: 1) + +puts(beta_managed_agents_agent) +``` + +## Archive + +`beta.agents.archive(agent_id, **kwargs) -> BetaManagedAgentsAgent` + +**post** `/v1/agents/{agent_id}/archive` + +Archive Agent + +### Parameters + +- `agent_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: String` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `metadata: Hash[Symbol, String]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `version: Integer` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_agent = anthropic.beta.agents.archive("agent_011CZkYpogX7uDKUyvBTophP") + +puts(beta_managed_agents_agent) +``` + +## Domain Types + +### Beta Managed Agents Agent + +- `class BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: String` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `metadata: Hash[Symbol, String]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `version: Integer` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Beta Managed Agents Agent Tool Config + +- `class BetaManagedAgentsAgentToolConfig` + + Configuration for a specific agent tool. + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + +### Beta Managed Agents Agent Tool Config Params + +- `class BetaManagedAgentsAgentToolConfigParams` + + Configuration override for a specific tool within a toolset. + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `enabled: bool` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + +### Beta Managed Agents Agent Toolset Default Config + +- `class BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + +### Beta Managed Agents Agent Toolset Default Config Params + +- `class BetaManagedAgentsAgentToolsetDefaultConfigParams` + + Default configuration for all tools in a toolset. + + - `enabled: bool` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + +### Beta Managed Agents Agent Toolset20260401 + +- `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + +### Beta Managed Agents Agent Toolset20260401 Params + +- `class BetaManagedAgentsAgentToolset20260401Params` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfigParams]` + + Per-tool configuration overrides. + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `enabled: bool` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfigParams` + + Default configuration for all tools in a toolset. + + - `enabled: bool` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + +### Beta Managed Agents Always Allow Policy + +- `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + +### Beta Managed Agents Always Ask Policy + +- `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + +### Beta Managed Agents Anthropic Skill + +- `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + +### Beta Managed Agents Anthropic Skill Params + +- `class BetaManagedAgentsAnthropicSkillParams` + + An Anthropic-managed skill. + + - `skill_id: String` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents Custom Skill + +- `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + +### Beta Managed Agents Custom Skill Params + +- `class BetaManagedAgentsCustomSkillParams` + + A user-created custom skill. + + - `skill_id: String` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: :custom` + + - `:custom` + + - `version: String` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents Custom Tool + +- `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + +### Beta Managed Agents Custom Tool Input Schema + +- `class BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + +### Beta Managed Agents Custom Tool Params + +- `class BetaManagedAgentsCustomToolParams` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: String` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: :custom` + + - `:custom` + +### Beta Managed Agents MCP Server URL Definition + +- `class BetaManagedAgentsMCPServerURLDefinition` + + URL-based MCP server connection as returned in API responses. + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + +### Beta Managed Agents MCP Tool Config + +- `class BetaManagedAgentsMCPToolConfig` + + Resolved configuration for a specific MCP tool. + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + +### Beta Managed Agents MCP Tool Config Params + +- `class BetaManagedAgentsMCPToolConfigParams` + + Configuration override for a specific MCP tool. + + - `name: String` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled: bool` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + +### Beta Managed Agents MCP Toolset + +- `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + +### Beta Managed Agents MCP Toolset Default Config + +- `class BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + +### Beta Managed Agents MCP Toolset Default Config Params + +- `class BetaManagedAgentsMCPToolsetDefaultConfigParams` + + Default configuration for all tools from an MCP server. + + - `enabled: bool` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + +### Beta Managed Agents MCP Toolset Params + +- `class BetaManagedAgentsMCPToolsetParams` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `mcp_server_name: String` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfigParams]` + + Per-tool configuration overrides. + + - `name: String` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled: bool` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfigParams` + + Default configuration for all tools from an MCP server. + + - `enabled: bool` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + +### Beta Managed Agents Model + +- `BetaManagedAgentsModel = :"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more | String` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + +### Beta Managed Agents Model Config + +- `class BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + +### Beta Managed Agents Model Config Params + +- `class BetaManagedAgentsModelConfigParams` + + An object that defines additional configuration control over model use + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + +### Beta Managed Agents Skill Params + +- `BetaManagedAgentsSkillParams = BetaManagedAgentsAnthropicSkillParams | BetaManagedAgentsCustomSkillParams` + + Skill to load in the session container. + + - `class BetaManagedAgentsAnthropicSkillParams` + + An Anthropic-managed skill. + + - `skill_id: String` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + Version to pin. Defaults to latest if omitted. + + - `class BetaManagedAgentsCustomSkillParams` + + A user-created custom skill. + + - `skill_id: String` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: :custom` + + - `:custom` + + - `version: String` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents URL MCP Server Params + +- `class BetaManagedAgentsURLMCPServerParams` + + URL-based MCP server connection. + + - `name: String` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `type: :url` + + - `:url` + + - `url: String` + + Endpoint URL for the MCP server. + +# Versions + +## List + +`beta.agents.versions.list(agent_id, **kwargs) -> PageCursor` + +**get** `/v1/agents/{agent_id}/versions` + +List Agent Versions + +### Parameters + +- `agent_id: String` + +- `limit: Integer` + + Maximum results per page. Default 20, maximum 100. + +- `page: String` + + Opaque pagination cursor. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: String` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `metadata: Hash[Symbol, String]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `version: Integer` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +page = anthropic.beta.agents.versions.list("agent_011CZkYpogX7uDKUyvBTophP") + +puts(page) +``` + +# Environments + +## Create + +`beta.environments.create(**kwargs) -> BetaEnvironment` + +**post** `/v1/environments` + +Create a new environment with the specified configuration. + +### Parameters + +- `name: String` + + Human-readable name for the environment + +- `config: BetaCloudConfigParams` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: :cloud` + + Environment type + + - `:cloud` + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetworkParams` + + Network configuration policy. Omit on update to preserve the existing value. + + - `class BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: :unrestricted` + + Network policy type + + - `:unrestricted` + + - `class BetaLimitedNetworkParams` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: :limited` + + Network policy type + + - `:limited` + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: Array[String]` + + Specifies domains the container can reach. + + - `packages: BetaPackagesParams` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: Array[String]` + + Ubuntu/Debian packages to install + + - `cargo: Array[String]` + + Rust packages to install + + - `gem_: Array[String]` + + Ruby packages to install + + - `go: Array[String]` + + Go packages to install + + - `npm: Array[String]` + + Node.js packages to install + + - `pip: Array[String]` + + Python packages to install + + - `type: :packages` + + Package configuration type + + - `:packages` + +- `description: String` + + Optional description of the environment + +- `metadata: Hash[Symbol, String]` + + User-provided metadata key-value pairs + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: String` + + Environment identifier (e.g., 'env_...') + + - `archived_at: String` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: :unrestricted` + + Network policy type + + - `:unrestricted` + + - `class BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array[String]` + + Specifies domains the container can reach. + + - `type: :limited` + + Network policy type + + - `:limited` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array[String]` + + Ubuntu/Debian packages to install + + - `cargo: Array[String]` + + Rust packages to install + + - `gem_: Array[String]` + + Ruby packages to install + + - `go: Array[String]` + + Go packages to install + + - `npm: Array[String]` + + Node.js packages to install + + - `pip: Array[String]` + + Python packages to install + + - `type: :packages` + + Package configuration type + + - `:packages` + + - `type: :cloud` + + Environment type + + - `:cloud` + + - `created_at: String` + + RFC 3339 timestamp when environment was created + + - `description: String` + + User-provided description for the environment + + - `metadata: Hash[Symbol, String]` + + User-provided metadata key-value pairs + + - `name: String` + + Human-readable name for the environment + + - `type: :environment` + + The type of object (always 'environment') + + - `:environment` + + - `updated_at: String` + + RFC 3339 timestamp when environment was last updated + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_environment = anthropic.beta.environments.create(name: "python-data-analysis") + +puts(beta_environment) +``` + +## List + +`beta.environments.list(**kwargs) -> PageCursor` + +**get** `/v1/environments` + +List environments with pagination support. + +### Parameters + +- `include_archived: bool` + + Include archived environments in the response + +- `limit: Integer` + + Maximum number of environments to return + +- `page: String` + + Opaque cursor from previous response for pagination. Pass the `next_page` value from the previous response. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: String` + + Environment identifier (e.g., 'env_...') + + - `archived_at: String` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: :unrestricted` + + Network policy type + + - `:unrestricted` + + - `class BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array[String]` + + Specifies domains the container can reach. + + - `type: :limited` + + Network policy type + + - `:limited` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array[String]` + + Ubuntu/Debian packages to install + + - `cargo: Array[String]` + + Rust packages to install + + - `gem_: Array[String]` + + Ruby packages to install + + - `go: Array[String]` + + Go packages to install + + - `npm: Array[String]` + + Node.js packages to install + + - `pip: Array[String]` + + Python packages to install + + - `type: :packages` + + Package configuration type + + - `:packages` + + - `type: :cloud` + + Environment type + + - `:cloud` + + - `created_at: String` + + RFC 3339 timestamp when environment was created + + - `description: String` + + User-provided description for the environment + + - `metadata: Hash[Symbol, String]` + + User-provided metadata key-value pairs + + - `name: String` + + Human-readable name for the environment + + - `type: :environment` + + The type of object (always 'environment') + + - `:environment` + + - `updated_at: String` + + RFC 3339 timestamp when environment was last updated + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +page = anthropic.beta.environments.list + +puts(page) +``` + +## Retrieve + +`beta.environments.retrieve(environment_id, **kwargs) -> BetaEnvironment` + +**get** `/v1/environments/{environment_id}` + +Retrieve a specific environment by ID. + +### Parameters + +- `environment_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: String` + + Environment identifier (e.g., 'env_...') + + - `archived_at: String` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: :unrestricted` + + Network policy type + + - `:unrestricted` + + - `class BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array[String]` + + Specifies domains the container can reach. + + - `type: :limited` + + Network policy type + + - `:limited` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array[String]` + + Ubuntu/Debian packages to install + + - `cargo: Array[String]` + + Rust packages to install + + - `gem_: Array[String]` + + Ruby packages to install + + - `go: Array[String]` + + Go packages to install + + - `npm: Array[String]` + + Node.js packages to install + + - `pip: Array[String]` + + Python packages to install + + - `type: :packages` + + Package configuration type + + - `:packages` + + - `type: :cloud` + + Environment type + + - `:cloud` + + - `created_at: String` + + RFC 3339 timestamp when environment was created + + - `description: String` + + User-provided description for the environment + + - `metadata: Hash[Symbol, String]` + + User-provided metadata key-value pairs + + - `name: String` + + Human-readable name for the environment + + - `type: :environment` + + The type of object (always 'environment') + + - `:environment` + + - `updated_at: String` + + RFC 3339 timestamp when environment was last updated + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_environment = anthropic.beta.environments.retrieve("env_011CZkZ9X2dpNyB7HsEFoRfW") + +puts(beta_environment) +``` + +## Update + +`beta.environments.update(environment_id, **kwargs) -> BetaEnvironment` + +**post** `/v1/environments/{environment_id}` + +Update an existing environment's configuration. + +### Parameters + +- `environment_id: String` + +- `config: BetaCloudConfigParams` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: :cloud` + + Environment type + + - `:cloud` + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetworkParams` + + Network configuration policy. Omit on update to preserve the existing value. + + - `class BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: :unrestricted` + + Network policy type + + - `:unrestricted` + + - `class BetaLimitedNetworkParams` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: :limited` + + Network policy type + + - `:limited` + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: Array[String]` + + Specifies domains the container can reach. + + - `packages: BetaPackagesParams` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: Array[String]` + + Ubuntu/Debian packages to install + + - `cargo: Array[String]` + + Rust packages to install + + - `gem_: Array[String]` + + Ruby packages to install + + - `go: Array[String]` + + Go packages to install + + - `npm: Array[String]` + + Node.js packages to install + + - `pip: Array[String]` + + Python packages to install + + - `type: :packages` + + Package configuration type + + - `:packages` + +- `description: String` + + Updated description of the environment + +- `metadata: Hash[Symbol, String]` + + User-provided metadata key-value pairs. Set a value to null or empty string to delete the key. + +- `name: String` + + Updated name for the environment + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: String` + + Environment identifier (e.g., 'env_...') + + - `archived_at: String` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: :unrestricted` + + Network policy type + + - `:unrestricted` + + - `class BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array[String]` + + Specifies domains the container can reach. + + - `type: :limited` + + Network policy type + + - `:limited` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array[String]` + + Ubuntu/Debian packages to install + + - `cargo: Array[String]` + + Rust packages to install + + - `gem_: Array[String]` + + Ruby packages to install + + - `go: Array[String]` + + Go packages to install + + - `npm: Array[String]` + + Node.js packages to install + + - `pip: Array[String]` + + Python packages to install + + - `type: :packages` + + Package configuration type + + - `:packages` + + - `type: :cloud` + + Environment type + + - `:cloud` + + - `created_at: String` + + RFC 3339 timestamp when environment was created + + - `description: String` + + User-provided description for the environment + + - `metadata: Hash[Symbol, String]` + + User-provided metadata key-value pairs + + - `name: String` + + Human-readable name for the environment + + - `type: :environment` + + The type of object (always 'environment') + + - `:environment` + + - `updated_at: String` + + RFC 3339 timestamp when environment was last updated + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_environment = anthropic.beta.environments.update("env_011CZkZ9X2dpNyB7HsEFoRfW") + +puts(beta_environment) +``` + +## Delete + +`beta.environments.delete(environment_id, **kwargs) -> BetaEnvironmentDeleteResponse` + +**delete** `/v1/environments/{environment_id}` + +Delete an environment by ID. Returns a confirmation of the deletion. + +### Parameters + +- `environment_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironmentDeleteResponse` + + Response after deleting an environment. + + - `id: String` + + Environment identifier + + - `type: :environment_deleted` + + The type of response + + - `:environment_deleted` + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_environment_delete_response = anthropic.beta.environments.delete("env_011CZkZ9X2dpNyB7HsEFoRfW") + +puts(beta_environment_delete_response) +``` + +## Archive + +`beta.environments.archive(environment_id, **kwargs) -> BetaEnvironment` + +**post** `/v1/environments/{environment_id}/archive` + +Archive an environment by ID. Archived environments cannot be used to create new sessions. + +### Parameters + +- `environment_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: String` + + Environment identifier (e.g., 'env_...') + + - `archived_at: String` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: :unrestricted` + + Network policy type + + - `:unrestricted` + + - `class BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array[String]` + + Specifies domains the container can reach. + + - `type: :limited` + + Network policy type + + - `:limited` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array[String]` + + Ubuntu/Debian packages to install + + - `cargo: Array[String]` + + Rust packages to install + + - `gem_: Array[String]` + + Ruby packages to install + + - `go: Array[String]` + + Go packages to install + + - `npm: Array[String]` + + Node.js packages to install + + - `pip: Array[String]` + + Python packages to install + + - `type: :packages` + + Package configuration type + + - `:packages` + + - `type: :cloud` + + Environment type + + - `:cloud` + + - `created_at: String` + + RFC 3339 timestamp when environment was created + + - `description: String` + + User-provided description for the environment + + - `metadata: Hash[Symbol, String]` + + User-provided metadata key-value pairs + + - `name: String` + + Human-readable name for the environment + + - `type: :environment` + + The type of object (always 'environment') + + - `:environment` + + - `updated_at: String` + + RFC 3339 timestamp when environment was last updated + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_environment = anthropic.beta.environments.archive("env_011CZkZ9X2dpNyB7HsEFoRfW") + +puts(beta_environment) +``` + +## Domain Types + +### Beta Cloud Config + +- `class BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: :unrestricted` + + Network policy type + + - `:unrestricted` + + - `class BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array[String]` + + Specifies domains the container can reach. + + - `type: :limited` + + Network policy type + + - `:limited` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array[String]` + + Ubuntu/Debian packages to install + + - `cargo: Array[String]` + + Rust packages to install + + - `gem_: Array[String]` + + Ruby packages to install + + - `go: Array[String]` + + Go packages to install + + - `npm: Array[String]` + + Node.js packages to install + + - `pip: Array[String]` + + Python packages to install + + - `type: :packages` + + Package configuration type + + - `:packages` + + - `type: :cloud` + + Environment type + + - `:cloud` + +### Beta Cloud Config Params + +- `class BetaCloudConfigParams` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: :cloud` + + Environment type + + - `:cloud` + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetworkParams` + + Network configuration policy. Omit on update to preserve the existing value. + + - `class BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: :unrestricted` + + Network policy type + + - `:unrestricted` + + - `class BetaLimitedNetworkParams` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: :limited` + + Network policy type + + - `:limited` + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: Array[String]` + + Specifies domains the container can reach. + + - `packages: BetaPackagesParams` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: Array[String]` + + Ubuntu/Debian packages to install + + - `cargo: Array[String]` + + Rust packages to install + + - `gem_: Array[String]` + + Ruby packages to install + + - `go: Array[String]` + + Go packages to install + + - `npm: Array[String]` + + Node.js packages to install + + - `pip: Array[String]` + + Python packages to install + + - `type: :packages` + + Package configuration type + + - `:packages` + +### Beta Environment + +- `class BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: String` + + Environment identifier (e.g., 'env_...') + + - `archived_at: String` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: :unrestricted` + + Network policy type + + - `:unrestricted` + + - `class BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array[String]` + + Specifies domains the container can reach. + + - `type: :limited` + + Network policy type + + - `:limited` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array[String]` + + Ubuntu/Debian packages to install + + - `cargo: Array[String]` + + Rust packages to install + + - `gem_: Array[String]` + + Ruby packages to install + + - `go: Array[String]` + + Go packages to install + + - `npm: Array[String]` + + Node.js packages to install + + - `pip: Array[String]` + + Python packages to install + + - `type: :packages` + + Package configuration type + + - `:packages` + + - `type: :cloud` + + Environment type + + - `:cloud` + + - `created_at: String` + + RFC 3339 timestamp when environment was created + + - `description: String` + + User-provided description for the environment + + - `metadata: Hash[Symbol, String]` + + User-provided metadata key-value pairs + + - `name: String` + + Human-readable name for the environment + + - `type: :environment` + + The type of object (always 'environment') + + - `:environment` + + - `updated_at: String` + + RFC 3339 timestamp when environment was last updated + +### Beta Environment Delete Response + +- `class BetaEnvironmentDeleteResponse` + + Response after deleting an environment. + + - `id: String` + + Environment identifier + + - `type: :environment_deleted` + + The type of response + + - `:environment_deleted` + +### Beta Limited Network + +- `class BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array[String]` + + Specifies domains the container can reach. + + - `type: :limited` + + Network policy type + + - `:limited` + +### Beta Limited Network Params + +- `class BetaLimitedNetworkParams` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: :limited` + + Network policy type + + - `:limited` + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: Array[String]` + + Specifies domains the container can reach. + +### Beta Packages + +- `class BetaPackages` + + Packages (and their versions) available in this environment. + + - `apt: Array[String]` + + Ubuntu/Debian packages to install + + - `cargo: Array[String]` + + Rust packages to install + + - `gem_: Array[String]` + + Ruby packages to install + + - `go: Array[String]` + + Go packages to install + + - `npm: Array[String]` + + Node.js packages to install + + - `pip: Array[String]` + + Python packages to install + + - `type: :packages` + + Package configuration type + + - `:packages` + +### Beta Packages Params + +- `class BetaPackagesParams` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: Array[String]` + + Ubuntu/Debian packages to install + + - `cargo: Array[String]` + + Rust packages to install + + - `gem_: Array[String]` + + Ruby packages to install + + - `go: Array[String]` + + Go packages to install + + - `npm: Array[String]` + + Node.js packages to install + + - `pip: Array[String]` + + Python packages to install + + - `type: :packages` + + Package configuration type + + - `:packages` + +### Beta Unrestricted Network + +- `class BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: :unrestricted` + + Network policy type + + - `:unrestricted` + +# Sessions + +## Create + +`beta.sessions.create(**kwargs) -> BetaManagedAgentsSession` + +**post** `/v1/sessions` + +Create Session + +### Parameters + +- `agent: String | BetaManagedAgentsAgentParams` + + Agent identifier. Accepts the `agent` ID string, which pins the latest version for the session, or an `agent` object with both id and version specified. + + - `String` + + - `class BetaManagedAgentsAgentParams` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `id: String` + + The `agent` ID. + + - `type: :agent` + + - `:agent` + + - `version: Integer` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + +- `environment_id: String` + + ID of the `environment` defining the container configuration for this session. + +- `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the session. + +- `resources: Array[BetaManagedAgentsGitHubRepositoryResourceParams | BetaManagedAgentsFileResourceParams]` + + Resources (e.g. repositories, files) to mount into the session's container. + + - `class BetaManagedAgentsGitHubRepositoryResourceParams` + + Mount a GitHub repository into the session's container. + + - `authorization_token: String` + + GitHub authorization token used to clone the repository. + + - `type: :github_repository` + + - `:github_repository` + + - `url: String` + + Github URL of the repository + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `mount_path: String` + + Mount path in the container. Defaults to `/workspace/`. + + - `class BetaManagedAgentsFileResourceParams` + + Mount a file uploaded via the Files API into the session. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `mount_path: String` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +- `title: String` + + Human-readable session title. + +- `vault_ids: Array[String]` + + Vault IDs for stored credentials the agent can use during the session. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: String` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: String` + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `version: Integer` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `environment_id: String` + + - `metadata: Hash[Symbol, String]` + + - `resources: Array[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Float` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Float` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: :rescheduling | :running | :idle | :terminated` + + SessionStatus enum + + - `:rescheduling` + + - `:running` + + - `:idle` + + - `:terminated` + + - `title: String` + + - `type: :session` + + - `:session` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Integer` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Integer` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Integer` + + Total tokens read from prompt cache. + + - `input_tokens: Integer` + + Total input tokens consumed across all turns. + + - `output_tokens: Integer` + + Total output tokens generated across all turns. + + - `vault_ids: Array[String]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_session = anthropic.beta.sessions.create( + agent: "agent_011CZkYpogX7uDKUyvBTophP", + environment_id: "env_011CZkZ9X2dpNyB7HsEFoRfW" +) + +puts(beta_managed_agents_session) +``` + +## List + +`beta.sessions.list(**kwargs) -> PageCursor` + +**get** `/v1/sessions` + +List Sessions + +### Parameters + +- `agent_id: String` + + Filter sessions created with this agent ID. + +- `agent_version: Integer` + + Filter by agent version. Only applies when agent_id is also set. + +- `created_at_gt: Time` + + Return sessions created after this time (exclusive). + +- `created_at_gte: Time` + + Return sessions created at or after this time (inclusive). + +- `created_at_lt: Time` + + Return sessions created before this time (exclusive). + +- `created_at_lte: Time` + + Return sessions created at or before this time (inclusive). + +- `include_archived: bool` + + When true, includes archived sessions. Default: false (exclude archived). + +- `limit: Integer` + + Maximum number of results to return. + +- `order: :asc | :desc` + + Sort direction for results, ordered by created_at. Defaults to desc (newest first). + + - `:asc` + + - `:desc` + +- `page: String` + + Opaque pagination cursor from a previous response's next_page. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: String` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: String` + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `version: Integer` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `environment_id: String` + + - `metadata: Hash[Symbol, String]` + + - `resources: Array[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Float` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Float` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: :rescheduling | :running | :idle | :terminated` + + SessionStatus enum + + - `:rescheduling` + + - `:running` + + - `:idle` + + - `:terminated` + + - `title: String` + + - `type: :session` + + - `:session` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Integer` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Integer` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Integer` + + Total tokens read from prompt cache. + + - `input_tokens: Integer` + + Total input tokens consumed across all turns. + + - `output_tokens: Integer` + + Total output tokens generated across all turns. + + - `vault_ids: Array[String]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +page = anthropic.beta.sessions.list + +puts(page) +``` + +## Retrieve + +`beta.sessions.retrieve(session_id, **kwargs) -> BetaManagedAgentsSession` + +**get** `/v1/sessions/{session_id}` + +Get Session + +### Parameters + +- `session_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: String` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: String` + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `version: Integer` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `environment_id: String` + + - `metadata: Hash[Symbol, String]` + + - `resources: Array[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Float` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Float` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: :rescheduling | :running | :idle | :terminated` + + SessionStatus enum + + - `:rescheduling` + + - `:running` + + - `:idle` + + - `:terminated` + + - `title: String` + + - `type: :session` + + - `:session` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Integer` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Integer` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Integer` + + Total tokens read from prompt cache. + + - `input_tokens: Integer` + + Total input tokens consumed across all turns. + + - `output_tokens: Integer` + + Total output tokens generated across all turns. + + - `vault_ids: Array[String]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_session = anthropic.beta.sessions.retrieve("sesn_011CZkZAtmR3yMPDzynEDxu7") + +puts(beta_managed_agents_session) +``` + +## Update + +`beta.sessions.update(session_id, **kwargs) -> BetaManagedAgentsSession` + +**post** `/v1/sessions/{session_id}` + +Update Session + +### Parameters + +- `session_id: String` + +- `metadata: Hash[Symbol, String]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. + +- `title: String` + + Human-readable session title. + +- `vault_ids: Array[String]` + + Vault IDs (`vlt_*`) to attach to the session. Not yet supported; requests setting this field are rejected. Reserved for future use. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: String` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: String` + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `version: Integer` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `environment_id: String` + + - `metadata: Hash[Symbol, String]` + + - `resources: Array[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Float` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Float` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: :rescheduling | :running | :idle | :terminated` + + SessionStatus enum + + - `:rescheduling` + + - `:running` + + - `:idle` + + - `:terminated` + + - `title: String` + + - `type: :session` + + - `:session` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Integer` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Integer` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Integer` + + Total tokens read from prompt cache. + + - `input_tokens: Integer` + + Total input tokens consumed across all turns. + + - `output_tokens: Integer` + + Total output tokens generated across all turns. + + - `vault_ids: Array[String]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_session = anthropic.beta.sessions.update("sesn_011CZkZAtmR3yMPDzynEDxu7") + +puts(beta_managed_agents_session) +``` + +## Delete + +`beta.sessions.delete(session_id, **kwargs) -> BetaManagedAgentsDeletedSession` + +**delete** `/v1/sessions/{session_id}` + +Delete Session + +### Parameters + +- `session_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsDeletedSession` + + Confirmation that a `session` has been permanently deleted. + + - `id: String` + + - `type: :session_deleted` + + - `:session_deleted` + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_deleted_session = anthropic.beta.sessions.delete("sesn_011CZkZAtmR3yMPDzynEDxu7") + +puts(beta_managed_agents_deleted_session) +``` + +## Archive + +`beta.sessions.archive(session_id, **kwargs) -> BetaManagedAgentsSession` + +**post** `/v1/sessions/{session_id}/archive` + +Archive Session + +### Parameters + +- `session_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: String` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: String` + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `version: Integer` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `environment_id: String` + + - `metadata: Hash[Symbol, String]` + + - `resources: Array[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Float` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Float` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: :rescheduling | :running | :idle | :terminated` + + SessionStatus enum + + - `:rescheduling` + + - `:running` + + - `:idle` + + - `:terminated` + + - `title: String` + + - `type: :session` + + - `:session` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Integer` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Integer` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Integer` + + Total tokens read from prompt cache. + + - `input_tokens: Integer` + + Total input tokens consumed across all turns. + + - `output_tokens: Integer` + + Total output tokens generated across all turns. + + - `vault_ids: Array[String]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_session = anthropic.beta.sessions.archive("sesn_011CZkZAtmR3yMPDzynEDxu7") + +puts(beta_managed_agents_session) +``` + +## Domain Types + +### Beta Managed Agents Agent Params + +- `class BetaManagedAgentsAgentParams` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `id: String` + + The `agent` ID. + + - `type: :agent` + + - `:agent` + + - `version: Integer` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + +### Beta Managed Agents Branch Checkout + +- `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + +### Beta Managed Agents Cache Creation Usage + +- `class BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Integer` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Integer` + + Tokens used to create 5-minute ephemeral cache entries. + +### Beta Managed Agents Commit Checkout + +- `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + +### Beta Managed Agents Deleted Session + +- `class BetaManagedAgentsDeletedSession` + + Confirmation that a `session` has been permanently deleted. + + - `id: String` + + - `type: :session_deleted` + + - `:session_deleted` + +### Beta Managed Agents File Resource Params + +- `class BetaManagedAgentsFileResourceParams` + + Mount a file uploaded via the Files API into the session. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `mount_path: String` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +### Beta Managed Agents GitHub Repository Resource Params + +- `class BetaManagedAgentsGitHubRepositoryResourceParams` + + Mount a GitHub repository into the session's container. + + - `authorization_token: String` + + GitHub authorization token used to clone the repository. + + - `type: :github_repository` + + - `:github_repository` + + - `url: String` + + Github URL of the repository + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `mount_path: String` + + Mount path in the container. Defaults to `/workspace/`. + +### Beta Managed Agents Session + +- `class BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: String` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: String` + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `version: Integer` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `environment_id: String` + + - `metadata: Hash[Symbol, String]` + + - `resources: Array[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Float` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Float` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: :rescheduling | :running | :idle | :terminated` + + SessionStatus enum + + - `:rescheduling` + + - `:running` + + - `:idle` + + - `:terminated` + + - `title: String` + + - `type: :session` + + - `:session` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Integer` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Integer` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Integer` + + Total tokens read from prompt cache. + + - `input_tokens: Integer` + + Total input tokens consumed across all turns. + + - `output_tokens: Integer` + + Total output tokens generated across all turns. + + - `vault_ids: Array[String]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Beta Managed Agents Session Agent + +- `class BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: String` + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `version: Integer` + +### Beta Managed Agents Session Stats + +- `class BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Float` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Float` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + +### Beta Managed Agents Session Usage + +- `class BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Integer` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Integer` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Integer` + + Total tokens read from prompt cache. + + - `input_tokens: Integer` + + Total input tokens consumed across all turns. + + - `output_tokens: Integer` + + Total output tokens generated across all turns. + +# Events + +## List + +`beta.sessions.events.list(session_id, **kwargs) -> PageCursor` + +**get** `/v1/sessions/{session_id}/events` + +List Events + +### Parameters + +- `session_id: String` + +- `limit: Integer` + + Query parameter for limit + +- `order: :asc | :desc` + + Sort direction for results, ordered by created_at. Defaults to asc (chronological). + + - `:asc` + + - `:desc` + +- `page: String` + + Opaque pagination cursor from a previous response's next_page. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSessionEvent = BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | 17 more` + + Union type for all event types in a session. + + - `class BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: String` + + Unique identifier for this event. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: String` + + Unique identifier for this event. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: String` + + Unique identifier for this event. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the custom tool being called. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.custom_tool_use"` + + - `:"agent.custom_tool_use"` + + - `class BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.message"` + + - `:"agent.message"` + + - `class BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thinking"` + + - `:"agent.thinking"` + + - `class BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `mcp_server_name: String` + + Name of the MCP server providing the tool. + + - `name: String` + + Name of the MCP tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_use"` + + - `:"agent.mcp_tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + + - `class BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: String` + + Unique identifier for this event. + + - `mcp_tool_use_id: String` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_result"` + + - `:"agent.mcp_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the agent tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.tool_use"` + + - `:"agent.tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + + - `class BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `tool_use_id: String` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: :"agent.tool_result"` + + - `:"agent.tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thread_context_compacted"` + + - `:"agent.thread_context_compacted"` + + - `class BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: String` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :unknown_error` + + - `:unknown_error` + + - `class BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_overloaded_error` + + - `:model_overloaded_error` + + - `class BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_rate_limited_error` + + - `:model_rate_limited_error` + + - `class BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_request_failed_error` + + - `:model_request_failed_error` + + - `class BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: String` + + Name of the MCP server that failed to connect. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_connection_failed_error` + + - `:mcp_connection_failed_error` + + - `class BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: String` + + Name of the MCP server that failed authentication. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_authentication_failed_error` + + - `:mcp_authentication_failed_error` + + - `class BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :billing_error` + + - `:billing_error` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.error"` + + - `:"session.error"` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_rescheduled"` + + - `:"session.status_rescheduled"` + + - `class BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_running"` + + - `:"session.status_running"` + + - `class BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: :end_turn` + + - `:end_turn` + + - `class BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array[String]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: :requires_action` + + - `:requires_action` + + - `class BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: :retries_exhausted` + + - `:retries_exhausted` + + - `type: :"session.status_idle"` + + - `:"session.status_idle"` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_terminated"` + + - `:"session.status_terminated"` + + - `class BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_start"` + + - `:"span.model_request_start"` + + - `class BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: String` + + Unique identifier for this event. + + - `is_error: bool` + + Whether the model request resulted in an error. + + - `model_request_start_id: String` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: Integer` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: Integer` + + Tokens read from prompt cache in this request. + + - `input_tokens: Integer` + + Input tokens consumed by this request. + + - `output_tokens: Integer` + + Output tokens generated by this request. + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_end"` + + - `:"span.model_request_end"` + + - `class BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.deleted"` + + - `:"session.deleted"` + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +page = anthropic.beta.sessions.events.list("sesn_011CZkZAtmR3yMPDzynEDxu7") + +puts(page) +``` + +## Send + +`beta.sessions.events.send_(session_id, **kwargs) -> BetaManagedAgentsSendSessionEvents` + +**post** `/v1/sessions/{session_id}/events` + +Send Events + +### Parameters + +- `session_id: String` + +- `events: Array[BetaManagedAgentsEventParams]` + + Events to send to the `session`. + + - `class BetaManagedAgentsUserMessageEventParams` + + Parameters for sending a user message to the session. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + + - `class BetaManagedAgentsUserInterruptEventParams` + + Parameters for sending an interrupt to pause the agent. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + + - `class BetaManagedAgentsUserToolConfirmationEventParams` + + Parameters for confirming or denying a tool execution request. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `class BetaManagedAgentsUserCustomToolResultEventParams` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSendSessionEvents` + + Events that were successfully sent to the session. + + - `data: Array[BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | BetaManagedAgentsUserCustomToolResultEvent]` + + Sent events + + - `class BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: String` + + Unique identifier for this event. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: String` + + Unique identifier for this event. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: String` + + Unique identifier for this event. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_send_session_events = anthropic.beta.sessions.events.send_( + "sesn_011CZkZAtmR3yMPDzynEDxu7", + events: [{content: [{text: "Where is my order #1234?", type: :text}], type: :"user.message"}] +) + +puts(beta_managed_agents_send_session_events) +``` + +## Stream + +`beta.sessions.events.stream(session_id, **kwargs) -> BetaManagedAgentsStreamSessionEvents` + +**get** `/v1/sessions/{session_id}/events/stream` + +Stream Events + +### Parameters + +- `session_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsStreamSessionEvents = BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | 17 more` + + Server-sent event in the session stream. + + - `class BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: String` + + Unique identifier for this event. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: String` + + Unique identifier for this event. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: String` + + Unique identifier for this event. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the custom tool being called. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.custom_tool_use"` + + - `:"agent.custom_tool_use"` + + - `class BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.message"` + + - `:"agent.message"` + + - `class BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thinking"` + + - `:"agent.thinking"` + + - `class BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `mcp_server_name: String` + + Name of the MCP server providing the tool. + + - `name: String` + + Name of the MCP tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_use"` + + - `:"agent.mcp_tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + + - `class BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: String` + + Unique identifier for this event. + + - `mcp_tool_use_id: String` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_result"` + + - `:"agent.mcp_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the agent tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.tool_use"` + + - `:"agent.tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + + - `class BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `tool_use_id: String` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: :"agent.tool_result"` + + - `:"agent.tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thread_context_compacted"` + + - `:"agent.thread_context_compacted"` + + - `class BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: String` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :unknown_error` + + - `:unknown_error` + + - `class BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_overloaded_error` + + - `:model_overloaded_error` + + - `class BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_rate_limited_error` + + - `:model_rate_limited_error` + + - `class BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_request_failed_error` + + - `:model_request_failed_error` + + - `class BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: String` + + Name of the MCP server that failed to connect. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_connection_failed_error` + + - `:mcp_connection_failed_error` + + - `class BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: String` + + Name of the MCP server that failed authentication. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_authentication_failed_error` + + - `:mcp_authentication_failed_error` + + - `class BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :billing_error` + + - `:billing_error` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.error"` + + - `:"session.error"` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_rescheduled"` + + - `:"session.status_rescheduled"` + + - `class BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_running"` + + - `:"session.status_running"` + + - `class BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: :end_turn` + + - `:end_turn` + + - `class BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array[String]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: :requires_action` + + - `:requires_action` + + - `class BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: :retries_exhausted` + + - `:retries_exhausted` + + - `type: :"session.status_idle"` + + - `:"session.status_idle"` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_terminated"` + + - `:"session.status_terminated"` + + - `class BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_start"` + + - `:"span.model_request_start"` + + - `class BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: String` + + Unique identifier for this event. + + - `is_error: bool` + + Whether the model request resulted in an error. + + - `model_request_start_id: String` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: Integer` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: Integer` + + Tokens read from prompt cache in this request. + + - `input_tokens: Integer` + + Input tokens consumed by this request. + + - `output_tokens: Integer` + + Output tokens generated by this request. + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_end"` + + - `:"span.model_request_end"` + + - `class BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.deleted"` + + - `:"session.deleted"` + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_stream_session_events = anthropic.beta.sessions.events.stream("sesn_011CZkZAtmR3yMPDzynEDxu7") + +puts(beta_managed_agents_stream_session_events) +``` + +## Domain Types + +### Beta Managed Agents Agent Custom Tool Use Event + +- `class BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the custom tool being called. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.custom_tool_use"` + + - `:"agent.custom_tool_use"` + +### Beta Managed Agents Agent MCP Tool Result Event + +- `class BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: String` + + Unique identifier for this event. + + - `mcp_tool_use_id: String` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_result"` + + - `:"agent.mcp_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent MCP Tool Use Event + +- `class BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `mcp_server_name: String` + + Name of the MCP server providing the tool. + + - `name: String` + + Name of the MCP tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_use"` + + - `:"agent.mcp_tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + +### Beta Managed Agents Agent Message Event + +- `class BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.message"` + + - `:"agent.message"` + +### Beta Managed Agents Agent Thinking Event + +- `class BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thinking"` + + - `:"agent.thinking"` + +### Beta Managed Agents Agent Thread Context Compacted Event + +- `class BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thread_context_compacted"` + + - `:"agent.thread_context_compacted"` + +### Beta Managed Agents Agent Tool Result Event + +- `class BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `tool_use_id: String` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: :"agent.tool_result"` + + - `:"agent.tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent Tool Use Event + +- `class BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the agent tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.tool_use"` + + - `:"agent.tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + +### Beta Managed Agents Base64 Document Source + +- `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + +### Beta Managed Agents Base64 Image Source + +- `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + +### Beta Managed Agents Billing Error + +- `class BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :billing_error` + + - `:billing_error` + +### Beta Managed Agents Document Block + +- `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + +### Beta Managed Agents Event Params + +- `BetaManagedAgentsEventParams = BetaManagedAgentsUserMessageEventParams | BetaManagedAgentsUserInterruptEventParams | BetaManagedAgentsUserToolConfirmationEventParams | BetaManagedAgentsUserCustomToolResultEventParams` + + Union type for event parameters that can be sent to a session. + + - `class BetaManagedAgentsUserMessageEventParams` + + Parameters for sending a user message to the session. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + + - `class BetaManagedAgentsUserInterruptEventParams` + + Parameters for sending an interrupt to pause the agent. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + + - `class BetaManagedAgentsUserToolConfirmationEventParams` + + Parameters for confirming or denying a tool execution request. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `class BetaManagedAgentsUserCustomToolResultEventParams` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents File Document Source + +- `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + +### Beta Managed Agents File Image Source + +- `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + +### Beta Managed Agents Image Block + +- `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + +### Beta Managed Agents MCP Authentication Failed Error + +- `class BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: String` + + Name of the MCP server that failed authentication. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_authentication_failed_error` + + - `:mcp_authentication_failed_error` + +### Beta Managed Agents MCP Connection Failed Error + +- `class BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: String` + + Name of the MCP server that failed to connect. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_connection_failed_error` + + - `:mcp_connection_failed_error` + +### Beta Managed Agents Model Overloaded Error + +- `class BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_overloaded_error` + + - `:model_overloaded_error` + +### Beta Managed Agents Model Rate Limited Error + +- `class BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_rate_limited_error` + + - `:model_rate_limited_error` + +### Beta Managed Agents Model Request Failed Error + +- `class BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_request_failed_error` + + - `:model_request_failed_error` + +### Beta Managed Agents Plain Text Document Source + +- `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + +### Beta Managed Agents Retry Status Exhausted + +- `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + +### Beta Managed Agents Retry Status Retrying + +- `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + +### Beta Managed Agents Retry Status Terminal + +- `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + +### Beta Managed Agents Send Session Events + +- `class BetaManagedAgentsSendSessionEvents` + + Events that were successfully sent to the session. + + - `data: Array[BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | BetaManagedAgentsUserCustomToolResultEvent]` + + Sent events + + - `class BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: String` + + Unique identifier for this event. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: String` + + Unique identifier for this event. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: String` + + Unique identifier for this event. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents Session Deleted Event + +- `class BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.deleted"` + + - `:"session.deleted"` + +### Beta Managed Agents Session End Turn + +- `class BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: :end_turn` + + - `:end_turn` + +### Beta Managed Agents Session Error Event + +- `class BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: String` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :unknown_error` + + - `:unknown_error` + + - `class BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_overloaded_error` + + - `:model_overloaded_error` + + - `class BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_rate_limited_error` + + - `:model_rate_limited_error` + + - `class BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_request_failed_error` + + - `:model_request_failed_error` + + - `class BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: String` + + Name of the MCP server that failed to connect. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_connection_failed_error` + + - `:mcp_connection_failed_error` + + - `class BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: String` + + Name of the MCP server that failed authentication. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_authentication_failed_error` + + - `:mcp_authentication_failed_error` + + - `class BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :billing_error` + + - `:billing_error` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.error"` + + - `:"session.error"` + +### Beta Managed Agents Session Event + +- `BetaManagedAgentsSessionEvent = BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | 17 more` + + Union type for all event types in a session. + + - `class BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: String` + + Unique identifier for this event. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: String` + + Unique identifier for this event. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: String` + + Unique identifier for this event. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the custom tool being called. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.custom_tool_use"` + + - `:"agent.custom_tool_use"` + + - `class BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.message"` + + - `:"agent.message"` + + - `class BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thinking"` + + - `:"agent.thinking"` + + - `class BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `mcp_server_name: String` + + Name of the MCP server providing the tool. + + - `name: String` + + Name of the MCP tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_use"` + + - `:"agent.mcp_tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + + - `class BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: String` + + Unique identifier for this event. + + - `mcp_tool_use_id: String` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_result"` + + - `:"agent.mcp_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the agent tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.tool_use"` + + - `:"agent.tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + + - `class BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `tool_use_id: String` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: :"agent.tool_result"` + + - `:"agent.tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thread_context_compacted"` + + - `:"agent.thread_context_compacted"` + + - `class BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: String` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :unknown_error` + + - `:unknown_error` + + - `class BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_overloaded_error` + + - `:model_overloaded_error` + + - `class BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_rate_limited_error` + + - `:model_rate_limited_error` + + - `class BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_request_failed_error` + + - `:model_request_failed_error` + + - `class BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: String` + + Name of the MCP server that failed to connect. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_connection_failed_error` + + - `:mcp_connection_failed_error` + + - `class BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: String` + + Name of the MCP server that failed authentication. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_authentication_failed_error` + + - `:mcp_authentication_failed_error` + + - `class BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :billing_error` + + - `:billing_error` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.error"` + + - `:"session.error"` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_rescheduled"` + + - `:"session.status_rescheduled"` + + - `class BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_running"` + + - `:"session.status_running"` + + - `class BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: :end_turn` + + - `:end_turn` + + - `class BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array[String]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: :requires_action` + + - `:requires_action` + + - `class BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: :retries_exhausted` + + - `:retries_exhausted` + + - `type: :"session.status_idle"` + + - `:"session.status_idle"` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_terminated"` + + - `:"session.status_terminated"` + + - `class BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_start"` + + - `:"span.model_request_start"` + + - `class BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: String` + + Unique identifier for this event. + + - `is_error: bool` + + Whether the model request resulted in an error. + + - `model_request_start_id: String` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: Integer` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: Integer` + + Tokens read from prompt cache in this request. + + - `input_tokens: Integer` + + Input tokens consumed by this request. + + - `output_tokens: Integer` + + Output tokens generated by this request. + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_end"` + + - `:"span.model_request_end"` + + - `class BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.deleted"` + + - `:"session.deleted"` + +### Beta Managed Agents Session Requires Action + +- `class BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array[String]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: :requires_action` + + - `:requires_action` + +### Beta Managed Agents Session Retries Exhausted + +- `class BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: :retries_exhausted` + + - `:retries_exhausted` + +### Beta Managed Agents Session Status Idle Event + +- `class BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: :end_turn` + + - `:end_turn` + + - `class BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array[String]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: :requires_action` + + - `:requires_action` + + - `class BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: :retries_exhausted` + + - `:retries_exhausted` + + - `type: :"session.status_idle"` + + - `:"session.status_idle"` + +### Beta Managed Agents Session Status Rescheduled Event + +- `class BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_rescheduled"` + + - `:"session.status_rescheduled"` + +### Beta Managed Agents Session Status Running Event + +- `class BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_running"` + + - `:"session.status_running"` + +### Beta Managed Agents Session Status Terminated Event + +- `class BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_terminated"` + + - `:"session.status_terminated"` + +### Beta Managed Agents Span Model Request End Event + +- `class BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: String` + + Unique identifier for this event. + + - `is_error: bool` + + Whether the model request resulted in an error. + + - `model_request_start_id: String` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: Integer` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: Integer` + + Tokens read from prompt cache in this request. + + - `input_tokens: Integer` + + Input tokens consumed by this request. + + - `output_tokens: Integer` + + Output tokens generated by this request. + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_end"` + + - `:"span.model_request_end"` + +### Beta Managed Agents Span Model Request Start Event + +- `class BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_start"` + + - `:"span.model_request_start"` + +### Beta Managed Agents Span Model Usage + +- `class BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: Integer` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: Integer` + + Tokens read from prompt cache in this request. + + - `input_tokens: Integer` + + Input tokens consumed by this request. + + - `output_tokens: Integer` + + Output tokens generated by this request. + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + +### Beta Managed Agents Stream Session Events + +- `BetaManagedAgentsStreamSessionEvents = BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | 17 more` + + Server-sent event in the session stream. + + - `class BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: String` + + Unique identifier for this event. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: String` + + Unique identifier for this event. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: String` + + Unique identifier for this event. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the custom tool being called. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.custom_tool_use"` + + - `:"agent.custom_tool_use"` + + - `class BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.message"` + + - `:"agent.message"` + + - `class BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thinking"` + + - `:"agent.thinking"` + + - `class BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `mcp_server_name: String` + + Name of the MCP server providing the tool. + + - `name: String` + + Name of the MCP tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_use"` + + - `:"agent.mcp_tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + + - `class BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: String` + + Unique identifier for this event. + + - `mcp_tool_use_id: String` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_result"` + + - `:"agent.mcp_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the agent tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.tool_use"` + + - `:"agent.tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + + - `class BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `tool_use_id: String` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: :"agent.tool_result"` + + - `:"agent.tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thread_context_compacted"` + + - `:"agent.thread_context_compacted"` + + - `class BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: String` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :unknown_error` + + - `:unknown_error` + + - `class BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_overloaded_error` + + - `:model_overloaded_error` + + - `class BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_rate_limited_error` + + - `:model_rate_limited_error` + + - `class BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_request_failed_error` + + - `:model_request_failed_error` + + - `class BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: String` + + Name of the MCP server that failed to connect. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_connection_failed_error` + + - `:mcp_connection_failed_error` + + - `class BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: String` + + Name of the MCP server that failed authentication. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_authentication_failed_error` + + - `:mcp_authentication_failed_error` + + - `class BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :billing_error` + + - `:billing_error` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.error"` + + - `:"session.error"` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_rescheduled"` + + - `:"session.status_rescheduled"` + + - `class BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_running"` + + - `:"session.status_running"` + + - `class BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: :end_turn` + + - `:end_turn` + + - `class BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array[String]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: :requires_action` + + - `:requires_action` + + - `class BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: :retries_exhausted` + + - `:retries_exhausted` + + - `type: :"session.status_idle"` + + - `:"session.status_idle"` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_terminated"` + + - `:"session.status_terminated"` + + - `class BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_start"` + + - `:"span.model_request_start"` + + - `class BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: String` + + Unique identifier for this event. + + - `is_error: bool` + + Whether the model request resulted in an error. + + - `model_request_start_id: String` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: Integer` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: Integer` + + Tokens read from prompt cache in this request. + + - `input_tokens: Integer` + + Input tokens consumed by this request. + + - `output_tokens: Integer` + + Output tokens generated by this request. + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_end"` + + - `:"span.model_request_end"` + + - `class BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.deleted"` + + - `:"session.deleted"` + +### Beta Managed Agents Text Block + +- `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + +### Beta Managed Agents Unknown Error + +- `class BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :unknown_error` + + - `:unknown_error` + +### Beta Managed Agents URL Document Source + +- `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + +### Beta Managed Agents URL Image Source + +- `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + +### Beta Managed Agents User Custom Tool Result Event + +- `class BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: String` + + Unique identifier for this event. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Custom Tool Result Event Params + +- `class BetaManagedAgentsUserCustomToolResultEventParams` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents User Interrupt Event + +- `class BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: String` + + Unique identifier for this event. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Interrupt Event Params + +- `class BetaManagedAgentsUserInterruptEventParams` + + Parameters for sending an interrupt to pause the agent. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + +### Beta Managed Agents User Message Event + +- `class BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Message Event Params + +- `class BetaManagedAgentsUserMessageEventParams` + + Parameters for sending a user message to the session. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + +### Beta Managed Agents User Tool Confirmation Event + +- `class BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: String` + + Unique identifier for this event. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Tool Confirmation Event Params + +- `class BetaManagedAgentsUserToolConfirmationEventParams` + + Parameters for confirming or denying a tool execution request. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + +# Resources + +## Add + +`beta.sessions.resources.add(session_id, **kwargs) -> BetaManagedAgentsFileResource` + +**post** `/v1/sessions/{session_id}/resources` + +Add Session Resource + +### Parameters + +- `session_id: String` + +- `file_id: String` + + ID of a previously uploaded file. + +- `type: :file` + + - `:file` + +- `mount_path: String` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_file_resource = anthropic.beta.sessions.resources.add( + "sesn_011CZkZAtmR3yMPDzynEDxu7", + file_id: "file_011CNha8iCJcU1wXNR6q4V8w", + type: :file +) + +puts(beta_managed_agents_file_resource) +``` + +## List + +`beta.sessions.resources.list(session_id, **kwargs) -> PageCursor` + +**get** `/v1/sessions/{session_id}/resources` + +List Session Resources + +### Parameters + +- `session_id: String` + +- `limit: Integer` + + Maximum number of resources to return per page (max 1000). If omitted, returns all resources. + +- `page: String` + + Opaque cursor from a previous response's next_page field. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSessionResource = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +page = anthropic.beta.sessions.resources.list("sesn_011CZkZAtmR3yMPDzynEDxu7") + +puts(page) +``` + +## Retrieve + +`beta.sessions.resources.retrieve(resource_id, **kwargs) -> ResourceRetrieveResponse` + +**get** `/v1/sessions/{session_id}/resources/{resource_id}` + +Get Session Resource + +### Parameters + +- `session_id: String` + +- `resource_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `ResourceRetrieveResponse = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + The requested session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +resource = anthropic.beta.sessions.resources.retrieve( + "sesrsc_011CZkZBJq5dWxk9fVLNcPht", + session_id: "sesn_011CZkZAtmR3yMPDzynEDxu7" +) + +puts(resource) +``` + +## Update + +`beta.sessions.resources.update(resource_id, **kwargs) -> ResourceUpdateResponse` + +**post** `/v1/sessions/{session_id}/resources/{resource_id}` + +Update Session Resource + +### Parameters + +- `session_id: String` + +- `resource_id: String` + +- `authorization_token: String` + + New authorization token for the resource. Currently only `github_repository` resources support token rotation. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `ResourceUpdateResponse = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + The updated session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +resource = anthropic.beta.sessions.resources.update( + "sesrsc_011CZkZBJq5dWxk9fVLNcPht", + session_id: "sesn_011CZkZAtmR3yMPDzynEDxu7", + authorization_token: "ghp_exampletoken" +) + +puts(resource) +``` + +## Delete + +`beta.sessions.resources.delete(resource_id, **kwargs) -> BetaManagedAgentsDeleteSessionResource` + +**delete** `/v1/sessions/{session_id}/resources/{resource_id}` + +Delete Session Resource + +### Parameters + +- `session_id: String` + +- `resource_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsDeleteSessionResource` + + Confirmation of resource deletion. + + - `id: String` + + - `type: :session_resource_deleted` + + - `:session_resource_deleted` + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_delete_session_resource = anthropic.beta.sessions.resources.delete( + "sesrsc_011CZkZBJq5dWxk9fVLNcPht", + session_id: "sesn_011CZkZAtmR3yMPDzynEDxu7" +) + +puts(beta_managed_agents_delete_session_resource) +``` + +## Domain Types + +### Beta Managed Agents Delete Session Resource + +- `class BetaManagedAgentsDeleteSessionResource` + + Confirmation of resource deletion. + + - `id: String` + + - `type: :session_resource_deleted` + + - `:session_resource_deleted` + +### Beta Managed Agents File Resource + +- `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents GitHub Repository Resource + +- `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + +### Beta Managed Agents Session Resource + +- `BetaManagedAgentsSessionResource = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Resource Retrieve Response + +- `ResourceRetrieveResponse = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + The requested session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Resource Update Response + +- `ResourceUpdateResponse = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + The updated session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +# Vaults + +## Create + +`beta.vaults.create(**kwargs) -> BetaManagedAgentsVault` + +**post** `/v1/vaults` + +Create Vault + +### Parameters + +- `display_name: String` + + Human-readable name for the vault. 1-255 characters. + +- `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata to attach to the vault. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: String` + + Unique identifier for the vault. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `display_name: String` + + Human-readable name for the vault. + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the vault. + + - `type: :vault` + + - `:vault` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_vault = anthropic.beta.vaults.create(display_name: "Example vault") + +puts(beta_managed_agents_vault) +``` + +## List + +`beta.vaults.list(**kwargs) -> PageCursor` + +**get** `/v1/vaults` + +List Vaults + +### Parameters + +- `include_archived: bool` + + Whether to include archived vaults in the results. + +- `limit: Integer` + + Maximum number of vaults to return per page. Defaults to 20, maximum 100. + +- `page: String` + + Opaque pagination token from a previous `list_vaults` response. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: String` + + Unique identifier for the vault. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `display_name: String` + + Human-readable name for the vault. + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the vault. + + - `type: :vault` + + - `:vault` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +page = anthropic.beta.vaults.list + +puts(page) +``` + +## Retrieve + +`beta.vaults.retrieve(vault_id, **kwargs) -> BetaManagedAgentsVault` + +**get** `/v1/vaults/{vault_id}` + +Get Vault + +### Parameters + +- `vault_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: String` + + Unique identifier for the vault. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `display_name: String` + + Human-readable name for the vault. + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the vault. + + - `type: :vault` + + - `:vault` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_vault = anthropic.beta.vaults.retrieve("vlt_011CZkZDLs7fYzm1hXNPeRjv") + +puts(beta_managed_agents_vault) +``` + +## Update + +`beta.vaults.update(vault_id, **kwargs) -> BetaManagedAgentsVault` + +**post** `/v1/vaults/{vault_id}` + +Update Vault + +### Parameters + +- `vault_id: String` + +- `display_name: String` + + Updated human-readable name for the vault. 1-255 characters. + +- `metadata: Hash[Symbol, String]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: String` + + Unique identifier for the vault. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `display_name: String` + + Human-readable name for the vault. + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the vault. + + - `type: :vault` + + - `:vault` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_vault = anthropic.beta.vaults.update("vlt_011CZkZDLs7fYzm1hXNPeRjv") + +puts(beta_managed_agents_vault) +``` + +## Delete + +`beta.vaults.delete(vault_id, **kwargs) -> BetaManagedAgentsDeletedVault` + +**delete** `/v1/vaults/{vault_id}` + +Delete Vault + +### Parameters + +- `vault_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsDeletedVault` + + Confirmation of a deleted vault. + + - `id: String` + + Unique identifier of the deleted vault. + + - `type: :vault_deleted` + + - `:vault_deleted` + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_deleted_vault = anthropic.beta.vaults.delete("vlt_011CZkZDLs7fYzm1hXNPeRjv") + +puts(beta_managed_agents_deleted_vault) +``` + +## Archive + +`beta.vaults.archive(vault_id, **kwargs) -> BetaManagedAgentsVault` + +**post** `/v1/vaults/{vault_id}/archive` + +Archive Vault + +### Parameters + +- `vault_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: String` + + Unique identifier for the vault. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `display_name: String` + + Human-readable name for the vault. + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the vault. + + - `type: :vault` + + - `:vault` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_vault = anthropic.beta.vaults.archive("vlt_011CZkZDLs7fYzm1hXNPeRjv") + +puts(beta_managed_agents_vault) +``` + +## Domain Types + +### Beta Managed Agents Deleted Vault + +- `class BetaManagedAgentsDeletedVault` + + Confirmation of a deleted vault. + + - `id: String` + + Unique identifier of the deleted vault. + + - `type: :vault_deleted` + + - `:vault_deleted` + +### Beta Managed Agents Vault + +- `class BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: String` + + Unique identifier for the vault. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `display_name: String` + + Human-readable name for the vault. + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the vault. + + - `type: :vault` + + - `:vault` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +# Credentials + +## Create + +`beta.vaults.credentials.create(vault_id, **kwargs) -> BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials` + +Create Credential + +### Parameters + +- `vault_id: String` + +- `auth: BetaManagedAgentsMCPOAuthCreateParams | BetaManagedAgentsStaticBearerCreateParams` + + Authentication details for creating a credential. + + - `class BetaManagedAgentsMCPOAuthCreateParams` + + Parameters for creating an MCP OAuth credential. + + - `access_token: String` + + OAuth access token. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshParams` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: String` + + OAuth client ID. + + - `refresh_token: String` + + OAuth refresh token. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam | BetaManagedAgentsTokenEndpointAuthBasicParam | BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: String` + + OAuth client secret. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: String` + + OAuth client secret. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerCreateParams` + + Parameters for creating a static bearer token credential. + + - `token: String` + + Static bearer token value. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :static_bearer` + + - `:static_bearer` + +- `display_name: String` + + Human-readable name for the credential. Up to 255 characters. + +- `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata to attach to the credential. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: String` + + Unique identifier for the credential. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: String` + + OAuth client ID. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :static_bearer` + + - `:static_bearer` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the credential. + + - `type: :vault_credential` + + - `:vault_credential` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `vault_id: String` + + Identifier of the vault this credential belongs to. + + - `display_name: String` + + Human-readable name for the credential. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_credential = anthropic.beta.vaults.credentials.create( + "vlt_011CZkZDLs7fYzm1hXNPeRjv", + auth: { + token: "bearer_exampletoken", + mcp_server_url: "https://example-server.modelcontextprotocol.io/sse", + type: :static_bearer + } +) + +puts(beta_managed_agents_credential) +``` + +## List + +`beta.vaults.credentials.list(vault_id, **kwargs) -> PageCursor` + +**get** `/v1/vaults/{vault_id}/credentials` + +List Credentials + +### Parameters + +- `vault_id: String` + +- `include_archived: bool` + + Whether to include archived credentials in the results. + +- `limit: Integer` + + Maximum number of credentials to return per page. Defaults to 20, maximum 100. + +- `page: String` + + Opaque pagination token from a previous `list_credentials` response. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: String` + + Unique identifier for the credential. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: String` + + OAuth client ID. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :static_bearer` + + - `:static_bearer` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the credential. + + - `type: :vault_credential` + + - `:vault_credential` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `vault_id: String` + + Identifier of the vault this credential belongs to. + + - `display_name: String` + + Human-readable name for the credential. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +page = anthropic.beta.vaults.credentials.list("vlt_011CZkZDLs7fYzm1hXNPeRjv") + +puts(page) +``` + +## Retrieve + +`beta.vaults.credentials.retrieve(credential_id, **kwargs) -> BetaManagedAgentsCredential` + +**get** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Get Credential + +### Parameters + +- `vault_id: String` + +- `credential_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: String` + + Unique identifier for the credential. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: String` + + OAuth client ID. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :static_bearer` + + - `:static_bearer` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the credential. + + - `type: :vault_credential` + + - `:vault_credential` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `vault_id: String` + + Identifier of the vault this credential belongs to. + + - `display_name: String` + + Human-readable name for the credential. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_credential = anthropic.beta.vaults.credentials.retrieve( + "vcrd_011CZkZEMt8gZan2iYOQfSkw", + vault_id: "vlt_011CZkZDLs7fYzm1hXNPeRjv" +) + +puts(beta_managed_agents_credential) +``` + +## Update + +`beta.vaults.credentials.update(credential_id, **kwargs) -> BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Update Credential + +### Parameters + +- `vault_id: String` + +- `credential_id: String` + +- `auth: BetaManagedAgentsMCPOAuthUpdateParams | BetaManagedAgentsStaticBearerUpdateParams` + + Updated authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthUpdateParams` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `access_token: String` + + Updated OAuth access token. + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshUpdateParams` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: String` + + Updated OAuth refresh token. + + - `scope: String` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthBasicUpdateParam | BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `client_secret: String` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated POST body authentication parameters for the token endpoint. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `client_secret: String` + + Updated OAuth client secret. + + - `class BetaManagedAgentsStaticBearerUpdateParams` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `type: :static_bearer` + + - `:static_bearer` + + - `token: String` + + Updated static bearer token value. + +- `display_name: String` + + Updated human-readable name for the credential. 1-255 characters. + +- `metadata: Hash[Symbol, String]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: String` + + Unique identifier for the credential. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: String` + + OAuth client ID. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :static_bearer` + + - `:static_bearer` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the credential. + + - `type: :vault_credential` + + - `:vault_credential` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `vault_id: String` + + Identifier of the vault this credential belongs to. + + - `display_name: String` + + Human-readable name for the credential. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_credential = anthropic.beta.vaults.credentials.update( + "vcrd_011CZkZEMt8gZan2iYOQfSkw", + vault_id: "vlt_011CZkZDLs7fYzm1hXNPeRjv" +) + +puts(beta_managed_agents_credential) +``` + +## Delete + +`beta.vaults.credentials.delete(credential_id, **kwargs) -> BetaManagedAgentsDeletedCredential` + +**delete** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Delete Credential + +### Parameters + +- `vault_id: String` + +- `credential_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsDeletedCredential` + + Confirmation of a deleted credential. + + - `id: String` + + Unique identifier of the deleted credential. + + - `type: :vault_credential_deleted` + + - `:vault_credential_deleted` + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_deleted_credential = anthropic.beta.vaults.credentials.delete( + "vcrd_011CZkZEMt8gZan2iYOQfSkw", + vault_id: "vlt_011CZkZDLs7fYzm1hXNPeRjv" +) + +puts(beta_managed_agents_deleted_credential) +``` + +## Archive + +`beta.vaults.credentials.archive(credential_id, **kwargs) -> BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}/archive` + +Archive Credential + +### Parameters + +- `vault_id: String` + +- `credential_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: String` + + Unique identifier for the credential. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: String` + + OAuth client ID. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :static_bearer` + + - `:static_bearer` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the credential. + + - `type: :vault_credential` + + - `:vault_credential` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `vault_id: String` + + Identifier of the vault this credential belongs to. + + - `display_name: String` + + Human-readable name for the credential. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_credential = anthropic.beta.vaults.credentials.archive( + "vcrd_011CZkZEMt8gZan2iYOQfSkw", + vault_id: "vlt_011CZkZDLs7fYzm1hXNPeRjv" +) + +puts(beta_managed_agents_credential) +``` + +## Domain Types + +### Beta Managed Agents Credential + +- `class BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: String` + + Unique identifier for the credential. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: String` + + OAuth client ID. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :static_bearer` + + - `:static_bearer` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the credential. + + - `type: :vault_credential` + + - `:vault_credential` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `vault_id: String` + + Identifier of the vault this credential belongs to. + + - `display_name: String` + + Human-readable name for the credential. + +### Beta Managed Agents Deleted Credential + +- `class BetaManagedAgentsDeletedCredential` + + Confirmation of a deleted credential. + + - `id: String` + + Unique identifier of the deleted credential. + + - `type: :vault_credential_deleted` + + - `:vault_credential_deleted` + +### Beta Managed Agents MCP OAuth Auth Response + +- `class BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: String` + + OAuth client ID. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Create Params + +- `class BetaManagedAgentsMCPOAuthCreateParams` + + Parameters for creating an MCP OAuth credential. + + - `access_token: String` + + OAuth access token. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshParams` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: String` + + OAuth client ID. + + - `refresh_token: String` + + OAuth refresh token. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam | BetaManagedAgentsTokenEndpointAuthBasicParam | BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: String` + + OAuth client secret. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: String` + + OAuth client secret. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Params + +- `class BetaManagedAgentsMCPOAuthRefreshParams` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: String` + + OAuth client ID. + + - `refresh_token: String` + + OAuth refresh token. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam | BetaManagedAgentsTokenEndpointAuthBasicParam | BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: String` + + OAuth client secret. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: String` + + OAuth client secret. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Response + +- `class BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: String` + + OAuth client ID. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Update Params + +- `class BetaManagedAgentsMCPOAuthRefreshUpdateParams` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: String` + + Updated OAuth refresh token. + + - `scope: String` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthBasicUpdateParam | BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `client_secret: String` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated POST body authentication parameters for the token endpoint. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `client_secret: String` + + Updated OAuth client secret. + +### Beta Managed Agents MCP OAuth Update Params + +- `class BetaManagedAgentsMCPOAuthUpdateParams` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `access_token: String` + + Updated OAuth access token. + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshUpdateParams` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: String` + + Updated OAuth refresh token. + + - `scope: String` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthBasicUpdateParam | BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `client_secret: String` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated POST body authentication parameters for the token endpoint. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `client_secret: String` + + Updated OAuth client secret. + +### Beta Managed Agents Static Bearer Auth Response + +- `class BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :static_bearer` + + - `:static_bearer` + +### Beta Managed Agents Static Bearer Create Params + +- `class BetaManagedAgentsStaticBearerCreateParams` + + Parameters for creating a static bearer token credential. + + - `token: String` + + Static bearer token value. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :static_bearer` + + - `:static_bearer` + +### Beta Managed Agents Static Bearer Update Params + +- `class BetaManagedAgentsStaticBearerUpdateParams` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `type: :static_bearer` + + - `:static_bearer` + + - `token: String` + + Updated static bearer token value. + +### Beta Managed Agents Token Endpoint Auth Basic Param + +- `class BetaManagedAgentsTokenEndpointAuthBasicParam` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: String` + + OAuth client secret. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + +### Beta Managed Agents Token Endpoint Auth Basic Response + +- `class BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + +### Beta Managed Agents Token Endpoint Auth Basic Update Param + +- `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `client_secret: String` + + Updated OAuth client secret. + +### Beta Managed Agents Token Endpoint Auth None Param + +- `class BetaManagedAgentsTokenEndpointAuthNoneParam` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + +### Beta Managed Agents Token Endpoint Auth None Response + +- `class BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + +### Beta Managed Agents Token Endpoint Auth Post Param + +- `class BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: String` + + OAuth client secret. + + - `type: :client_secret_post` + + - `:client_secret_post` + +### Beta Managed Agents Token Endpoint Auth Post Response + +- `class BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: :client_secret_post` + + - `:client_secret_post` + +### Beta Managed Agents Token Endpoint Auth Post Update Param + +- `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated POST body authentication parameters for the token endpoint. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `client_secret: String` + + Updated OAuth client secret. + +# Files + +## Upload + +`beta.files.upload(**kwargs) -> FileMetadata` + +**post** `/v1/files` + +Upload File + +### Parameters + +- `file: String` + + The file to upload + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class FileMetadata` + + - `id: String` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `created_at: Time` + + RFC 3339 datetime string representing when the file was created. + + - `filename: String` + + Original filename of the uploaded file. + + - `mime_type: String` + + MIME type of the file. + + - `size_bytes: Integer` + + Size of the file in bytes. + + - `type: :file` + + Object type. + + For files, this is always `"file"`. + + - `:file` + + - `downloadable: bool` + + Whether the file can be downloaded. + + - `scope: BetaFileScope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: String` + + The ID of the scoping resource (e.g., the session ID). + + - `type: :session` + + The type of scope (e.g., `"session"`). + + - `:session` + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +file_metadata = anthropic.beta.files.upload(file: StringIO.new("Example data")) + +puts(file_metadata) +``` + +## List + +`beta.files.list(**kwargs) -> Page` + +**get** `/v1/files` + +List Files + +### Parameters + +- `after_id: String` + + ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object. + +- `before_id: String` + + ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object. + +- `limit: Integer` + + Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + +- `scope_id: String` + + Filter by scope ID. Only returns files associated with the specified scope (e.g., a session ID). + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class FileMetadata` + + - `id: String` + + Unique object identifier. + + The format and length of IDs may change over time. + + - `created_at: Time` + + RFC 3339 datetime string representing when the file was created. + + - `filename: String` + + Original filename of the uploaded file. + + - `mime_type: String` + + MIME type of the file. + + - `size_bytes: Integer` + + Size of the file in bytes. + + - `type: :file` + + Object type. + + For files, this is always `"file"`. + + - `:file` + + - `downloadable: bool` + + Whether the file can be downloaded. + + - `scope: BetaFileScope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: String` + + The ID of the scoping resource (e.g., the session ID). + + - `type: :session` + + The type of scope (e.g., `"session"`). + + - `:session` + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +page = anthropic.beta.files.list + +puts(page) +``` + +## Download + +`beta.files.download(file_id, **kwargs) -> StringIO` + +**get** `/v1/files/{file_id}/content` + +Download File + +### Parameters + +- `file_id: String` + + ID of the File. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `StringIO` + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +response = anthropic.beta.files.download("file_id") + +puts(response) +``` + +## Retrieve Metadata + +`beta.files.retrieve_metadata(file_id, **kwargs) -> FileMetadata` + +**get** `/v1/files/{file_id}` + +Get File Metadata + +### Parameters + +- `file_id: String` + + ID of the File. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` ### Returns @@ -45762,6 +68646,20 @@ Get File Metadata Whether the file can be downloaded. + - `scope: BetaFileScope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: String` + + The ID of the scoping resource (e.g., the session ID). + + - `type: :session` + + The type of scope (e.g., `"session"`). + + - `:session` + ### Example ```ruby @@ -45794,7 +68692,7 @@ Delete File - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -45838,8 +68736,6 @@ Delete File - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class DeletedFile` @@ -45870,6 +68766,20 @@ puts(deleted_file) ## Domain Types +### Beta File Scope + +- `class BetaFileScope` + + - `id: String` + + The ID of the scoping resource (e.g., the session ID). + + - `type: :session` + + The type of scope (e.g., `"session"`). + + - `:session` + ### Deleted File - `class DeletedFile` @@ -45924,6 +68834,20 @@ puts(deleted_file) Whether the file can be downloaded. + - `scope: BetaFileScope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: String` + + The ID of the scoping resource (e.g., the session ID). + + - `type: :session` + + The type of scope (e.g., `"session"`). + + - `:session` + # Skills ## Create @@ -45954,7 +68878,7 @@ Create Skill - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -45998,8 +68922,6 @@ Create Skill - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class SkillCreateResponse` @@ -46094,7 +69016,7 @@ List Skills - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -46138,8 +69060,6 @@ List Skills - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class SkillListResponse` @@ -46219,7 +69139,7 @@ Get Skill - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -46263,8 +69183,6 @@ Get Skill - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class SkillRetrieveResponse` @@ -46344,7 +69262,7 @@ Delete Skill - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -46388,8 +69306,6 @@ Delete Skill - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class SkillDeleteResponse` @@ -46601,7 +69517,7 @@ Create Skill Version - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -46645,8 +69561,6 @@ Create Skill Version - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class VersionCreateResponse` @@ -46739,7 +69653,7 @@ List Skill Versions - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -46783,8 +69697,6 @@ List Skill Versions - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class VersionListResponse` @@ -46873,7 +69785,7 @@ Get Skill Version - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -46917,8 +69829,6 @@ Get Skill Version - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class VersionRetrieveResponse` @@ -47007,7 +69917,7 @@ Delete Skill Version - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -47051,8 +69961,6 @@ Delete Skill Version - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class VersionDeleteResponse` @@ -47242,561 +70150,3 @@ puts(version) Deleted object type. For Skill Versions, this is always `"skill_version_deleted"`. - -# User Profiles - -## Create - -`beta.user_profiles.create(**kwargs) -> BetaUserProfile` - -**post** `/v1/user_profiles` - -Create User Profile - -### Parameters - -- `external_id: String` - -- `metadata: Hash[Symbol, String]` - - Free-form key-value data to attach to this user profile. Maximum 16 keys, with keys up to 64 characters and values up to 512 characters. Values must be non-empty strings. - -- `betas: Array[AnthropicBeta]` - - Optional header to specify the beta version(s) you want to use. - - - `String` - - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` - - - `:"message-batches-2024-09-24"` - - - `:"prompt-caching-2024-07-31"` - - - `:"computer-use-2024-10-22"` - - - `:"computer-use-2025-01-24"` - - - `:"pdfs-2024-09-25"` - - - `:"token-counting-2024-11-01"` - - - `:"token-efficient-tools-2025-02-19"` - - - `:"output-128k-2025-02-19"` - - - `:"files-api-2025-04-14"` - - - `:"mcp-client-2025-04-04"` - - - `:"mcp-client-2025-11-20"` - - - `:"dev-full-thinking-2025-05-14"` - - - `:"interleaved-thinking-2025-05-14"` - - - `:"code-execution-2025-05-22"` - - - `:"extended-cache-ttl-2025-04-11"` - - - `:"context-1m-2025-08-07"` - - - `:"context-management-2025-06-27"` - - - `:"model-context-window-exceeded-2025-08-26"` - - - `:"skills-2025-10-02"` - - - `:"fast-mode-2026-02-01"` - - - `:"output-300k-2026-03-24"` - - - `:"user-profiles-2026-03-24"` - -### Returns - -- `class BetaUserProfile` - - - `id: String` - - - `created_at: Time` - - A timestamp in RFC 3339 format - - - `metadata: Hash[Symbol, String]` - - - `trust_grants: Hash[Symbol, BetaUserProfileTrustGrant]` - - - `status: String` - - - `type: String` - - - `updated_at: Time` - - A timestamp in RFC 3339 format - - - `external_id: String` - -### Example - -```ruby -require "anthropic" - -anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") - -beta_user_profile = anthropic.beta.user_profiles.create - -puts(beta_user_profile) -``` - -## List - -`beta.user_profiles.list(**kwargs) -> PageCursorV2` - -**get** `/v1/user_profiles` - -List User Profiles - -### Parameters - -- `limit: Integer` - - Query parameter for limit - -- `order: :asc | :desc` - - Query parameter for order - - - `:asc` - - - `:desc` - -- `page: String` - - Query parameter for page - -- `betas: Array[AnthropicBeta]` - - Optional header to specify the beta version(s) you want to use. - - - `String` - - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` - - - `:"message-batches-2024-09-24"` - - - `:"prompt-caching-2024-07-31"` - - - `:"computer-use-2024-10-22"` - - - `:"computer-use-2025-01-24"` - - - `:"pdfs-2024-09-25"` - - - `:"token-counting-2024-11-01"` - - - `:"token-efficient-tools-2025-02-19"` - - - `:"output-128k-2025-02-19"` - - - `:"files-api-2025-04-14"` - - - `:"mcp-client-2025-04-04"` - - - `:"mcp-client-2025-11-20"` - - - `:"dev-full-thinking-2025-05-14"` - - - `:"interleaved-thinking-2025-05-14"` - - - `:"code-execution-2025-05-22"` - - - `:"extended-cache-ttl-2025-04-11"` - - - `:"context-1m-2025-08-07"` - - - `:"context-management-2025-06-27"` - - - `:"model-context-window-exceeded-2025-08-26"` - - - `:"skills-2025-10-02"` - - - `:"fast-mode-2026-02-01"` - - - `:"output-300k-2026-03-24"` - - - `:"user-profiles-2026-03-24"` - -### Returns - -- `class BetaUserProfile` - - - `id: String` - - - `created_at: Time` - - A timestamp in RFC 3339 format - - - `metadata: Hash[Symbol, String]` - - - `trust_grants: Hash[Symbol, BetaUserProfileTrustGrant]` - - - `status: String` - - - `type: String` - - - `updated_at: Time` - - A timestamp in RFC 3339 format - - - `external_id: String` - -### Example - -```ruby -require "anthropic" - -anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") - -page = anthropic.beta.user_profiles.list - -puts(page) -``` - -## Retrieve - -`beta.user_profiles.retrieve(id, **kwargs) -> BetaUserProfile` - -**get** `/v1/user_profiles/{id}` - -Get User Profile - -### Parameters - -- `id: String` - -- `betas: Array[AnthropicBeta]` - - Optional header to specify the beta version(s) you want to use. - - - `String` - - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` - - - `:"message-batches-2024-09-24"` - - - `:"prompt-caching-2024-07-31"` - - - `:"computer-use-2024-10-22"` - - - `:"computer-use-2025-01-24"` - - - `:"pdfs-2024-09-25"` - - - `:"token-counting-2024-11-01"` - - - `:"token-efficient-tools-2025-02-19"` - - - `:"output-128k-2025-02-19"` - - - `:"files-api-2025-04-14"` - - - `:"mcp-client-2025-04-04"` - - - `:"mcp-client-2025-11-20"` - - - `:"dev-full-thinking-2025-05-14"` - - - `:"interleaved-thinking-2025-05-14"` - - - `:"code-execution-2025-05-22"` - - - `:"extended-cache-ttl-2025-04-11"` - - - `:"context-1m-2025-08-07"` - - - `:"context-management-2025-06-27"` - - - `:"model-context-window-exceeded-2025-08-26"` - - - `:"skills-2025-10-02"` - - - `:"fast-mode-2026-02-01"` - - - `:"output-300k-2026-03-24"` - - - `:"user-profiles-2026-03-24"` - -### Returns - -- `class BetaUserProfile` - - - `id: String` - - - `created_at: Time` - - A timestamp in RFC 3339 format - - - `metadata: Hash[Symbol, String]` - - - `trust_grants: Hash[Symbol, BetaUserProfileTrustGrant]` - - - `status: String` - - - `type: String` - - - `updated_at: Time` - - A timestamp in RFC 3339 format - - - `external_id: String` - -### Example - -```ruby -require "anthropic" - -anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") - -beta_user_profile = anthropic.beta.user_profiles.retrieve("id") - -puts(beta_user_profile) -``` - -## Update - -`beta.user_profiles.update(id, **kwargs) -> BetaUserProfile` - -**post** `/v1/user_profiles/{id}` - -Update User Profile - -### Parameters - -- `id: String` - -- `external_id: String` - -- `metadata: Hash[Symbol, String]` - - Key-value pairs to merge into the stored metadata. Keys provided overwrite existing values. To remove a key, set its value to an empty string. Keys not provided are left unchanged. Maximum 16 keys, with keys up to 64 characters and values up to 512 characters. - -- `betas: Array[AnthropicBeta]` - - Optional header to specify the beta version(s) you want to use. - - - `String` - - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` - - - `:"message-batches-2024-09-24"` - - - `:"prompt-caching-2024-07-31"` - - - `:"computer-use-2024-10-22"` - - - `:"computer-use-2025-01-24"` - - - `:"pdfs-2024-09-25"` - - - `:"token-counting-2024-11-01"` - - - `:"token-efficient-tools-2025-02-19"` - - - `:"output-128k-2025-02-19"` - - - `:"files-api-2025-04-14"` - - - `:"mcp-client-2025-04-04"` - - - `:"mcp-client-2025-11-20"` - - - `:"dev-full-thinking-2025-05-14"` - - - `:"interleaved-thinking-2025-05-14"` - - - `:"code-execution-2025-05-22"` - - - `:"extended-cache-ttl-2025-04-11"` - - - `:"context-1m-2025-08-07"` - - - `:"context-management-2025-06-27"` - - - `:"model-context-window-exceeded-2025-08-26"` - - - `:"skills-2025-10-02"` - - - `:"fast-mode-2026-02-01"` - - - `:"output-300k-2026-03-24"` - - - `:"user-profiles-2026-03-24"` - -### Returns - -- `class BetaUserProfile` - - - `id: String` - - - `created_at: Time` - - A timestamp in RFC 3339 format - - - `metadata: Hash[Symbol, String]` - - - `trust_grants: Hash[Symbol, BetaUserProfileTrustGrant]` - - - `status: String` - - - `type: String` - - - `updated_at: Time` - - A timestamp in RFC 3339 format - - - `external_id: String` - -### Example - -```ruby -require "anthropic" - -anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") - -beta_user_profile = anthropic.beta.user_profiles.update("id") - -puts(beta_user_profile) -``` - -## Create Enrollment URL - -`beta.user_profiles.create_enrollment_url(id, **kwargs) -> BetaUserProfileEnrollmentURL` - -**post** `/v1/user_profiles/{id}/enrollment_url` - -Create Enrollment URL - -### Parameters - -- `id: String` - -- `betas: Array[AnthropicBeta]` - - Optional header to specify the beta version(s) you want to use. - - - `String` - - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` - - - `:"message-batches-2024-09-24"` - - - `:"prompt-caching-2024-07-31"` - - - `:"computer-use-2024-10-22"` - - - `:"computer-use-2025-01-24"` - - - `:"pdfs-2024-09-25"` - - - `:"token-counting-2024-11-01"` - - - `:"token-efficient-tools-2025-02-19"` - - - `:"output-128k-2025-02-19"` - - - `:"files-api-2025-04-14"` - - - `:"mcp-client-2025-04-04"` - - - `:"mcp-client-2025-11-20"` - - - `:"dev-full-thinking-2025-05-14"` - - - `:"interleaved-thinking-2025-05-14"` - - - `:"code-execution-2025-05-22"` - - - `:"extended-cache-ttl-2025-04-11"` - - - `:"context-1m-2025-08-07"` - - - `:"context-management-2025-06-27"` - - - `:"model-context-window-exceeded-2025-08-26"` - - - `:"skills-2025-10-02"` - - - `:"fast-mode-2026-02-01"` - - - `:"output-300k-2026-03-24"` - - - `:"user-profiles-2026-03-24"` - -### Returns - -- `class BetaUserProfileEnrollmentURL` - - - `expires_at: Time` - - A timestamp in RFC 3339 format - - - `type: String` - - - `url: String` - -### Example - -```ruby -require "anthropic" - -anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") - -beta_user_profile_enrollment_url = anthropic.beta.user_profiles.create_enrollment_url("id") - -puts(beta_user_profile_enrollment_url) -``` - -## Domain Types - -### Beta User Profile - -- `class BetaUserProfile` - - - `id: String` - - - `created_at: Time` - - A timestamp in RFC 3339 format - - - `metadata: Hash[Symbol, String]` - - - `trust_grants: Hash[Symbol, BetaUserProfileTrustGrant]` - - - `status: String` - - - `type: String` - - - `updated_at: Time` - - A timestamp in RFC 3339 format - - - `external_id: String` - -### Beta User Profile Enrollment URL - -- `class BetaUserProfileEnrollmentURL` - - - `expires_at: Time` - - A timestamp in RFC 3339 format - - - `type: String` - - - `url: String` - -### Beta User Profile Trust Grant - -- `class BetaUserProfileTrustGrant` - - - `status: String` diff --git a/content/en/api/ruby/beta/agents.md b/content/en/api/ruby/beta/agents.md new file mode 100644 index 000000000..a7759e25a --- /dev/null +++ b/content/en/api/ruby/beta/agents.md @@ -0,0 +1,4295 @@ +# Agents + +## Create + +`beta.agents.create(**kwargs) -> BetaManagedAgentsAgent` + +**post** `/v1/agents` + +Create Agent + +### Parameters + +- `model: BetaManagedAgentsModel | BetaManagedAgentsModelConfigParams` + + Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control + + - `BetaManagedAgentsModel = :"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more | String` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `class BetaManagedAgentsModelConfigParams` + + An object that defines additional configuration control over model use + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + +- `name: String` + + Human-readable name for the agent. 1-256 characters. + +- `description: String` + + Description of what the agent does. Up to 2048 characters. + +- `mcp_servers: Array[BetaManagedAgentsURLMCPServerParams]` + + MCP servers this agent connects to. Maximum 20. Names must be unique within the array. + + - `name: String` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `type: :url` + + - `:url` + + - `url: String` + + Endpoint URL for the MCP server. + +- `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars. + +- `skills: Array[BetaManagedAgentsSkillParams]` + + Skills available to the agent. Maximum 20. + + - `class BetaManagedAgentsAnthropicSkillParams` + + An Anthropic-managed skill. + + - `skill_id: String` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + Version to pin. Defaults to latest if omitted. + + - `class BetaManagedAgentsCustomSkillParams` + + A user-created custom skill. + + - `skill_id: String` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: :custom` + + - `:custom` + + - `version: String` + + Version to pin. Defaults to latest if omitted. + +- `system_: String` + + System prompt for the agent. Up to 100,000 characters. + +- `tools: Array[BetaManagedAgentsAgentToolset20260401Params | BetaManagedAgentsMCPToolsetParams | BetaManagedAgentsCustomToolParams]` + + Tool configurations available to the agent. Maximum of 128 tools across all toolsets allowed. + + - `class BetaManagedAgentsAgentToolset20260401Params` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfigParams]` + + Per-tool configuration overrides. + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `enabled: bool` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfigParams` + + Default configuration for all tools in a toolset. + + - `enabled: bool` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `class BetaManagedAgentsMCPToolsetParams` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `mcp_server_name: String` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfigParams]` + + Per-tool configuration overrides. + + - `name: String` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled: bool` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfigParams` + + Default configuration for all tools from an MCP server. + + - `enabled: bool` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `class BetaManagedAgentsCustomToolParams` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: String` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: :custom` + + - `:custom` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: String` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `metadata: Hash[Symbol, String]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `version: Integer` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_agent = anthropic.beta.agents.create(model: :"claude-sonnet-4-6", name: "My First Agent") + +puts(beta_managed_agents_agent) +``` + +## List + +`beta.agents.list(**kwargs) -> PageCursor` + +**get** `/v1/agents` + +List Agents + +### Parameters + +- `created_at_gte: Time` + + Return agents created at or after this time (inclusive). + +- `created_at_lte: Time` + + Return agents created at or before this time (inclusive). + +- `include_archived: bool` + + Include archived agents in results. Defaults to false. + +- `limit: Integer` + + Maximum results per page. Default 20, maximum 100. + +- `page: String` + + Opaque pagination cursor from a previous response. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: String` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `metadata: Hash[Symbol, String]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `version: Integer` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +page = anthropic.beta.agents.list + +puts(page) +``` + +## Retrieve + +`beta.agents.retrieve(agent_id, **kwargs) -> BetaManagedAgentsAgent` + +**get** `/v1/agents/{agent_id}` + +Get Agent + +### Parameters + +- `agent_id: String` + +- `version: Integer` + + Agent version. Omit for the most recent version. Must be at least 1 if specified. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: String` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `metadata: Hash[Symbol, String]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `version: Integer` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_agent = anthropic.beta.agents.retrieve("agent_011CZkYpogX7uDKUyvBTophP") + +puts(beta_managed_agents_agent) +``` + +## Update + +`beta.agents.update(agent_id, **kwargs) -> BetaManagedAgentsAgent` + +**post** `/v1/agents/{agent_id}` + +Update Agent + +### Parameters + +- `agent_id: String` + +- `version: Integer` + + The agent's current version, used to prevent concurrent overwrites. Obtain this value from a create or retrieve response. The request fails if this does not match the server's current version. + +- `description: String` + + Description. Up to 2048 characters. Omit to preserve; send empty string or null to clear. + +- `mcp_servers: Array[BetaManagedAgentsURLMCPServerParams]` + + MCP servers. Full replacement. Omit to preserve; send empty array or null to clear. Names must be unique. Maximum 20. + + - `name: String` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `type: :url` + + - `:url` + + - `url: String` + + Endpoint URL for the MCP server. + +- `metadata: Hash[Symbol, String]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. The stored bag is limited to 16 keys (up to 64 chars each) with values up to 512 chars. + +- `model: BetaManagedAgentsModel | BetaManagedAgentsModelConfigParams` + + Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control. Omit to preserve. Cannot be cleared. + + - `BetaManagedAgentsModel = :"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more | String` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `class BetaManagedAgentsModelConfigParams` + + An object that defines additional configuration control over model use + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + +- `name: String` + + Human-readable name. 1-256 characters. Omit to preserve. Cannot be cleared. + +- `skills: Array[BetaManagedAgentsSkillParams]` + + Skills. Full replacement. Omit to preserve; send empty array or null to clear. Maximum 20. + + - `class BetaManagedAgentsAnthropicSkillParams` + + An Anthropic-managed skill. + + - `skill_id: String` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + Version to pin. Defaults to latest if omitted. + + - `class BetaManagedAgentsCustomSkillParams` + + A user-created custom skill. + + - `skill_id: String` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: :custom` + + - `:custom` + + - `version: String` + + Version to pin. Defaults to latest if omitted. + +- `system_: String` + + System prompt. Up to 100,000 characters. Omit to preserve; send empty string or null to clear. + +- `tools: Array[BetaManagedAgentsAgentToolset20260401Params | BetaManagedAgentsMCPToolsetParams | BetaManagedAgentsCustomToolParams]` + + Tool configurations available to the agent. Full replacement. Omit to preserve; send empty array or null to clear. Maximum of 128 tools across all toolsets allowed. + + - `class BetaManagedAgentsAgentToolset20260401Params` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfigParams]` + + Per-tool configuration overrides. + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `enabled: bool` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfigParams` + + Default configuration for all tools in a toolset. + + - `enabled: bool` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `class BetaManagedAgentsMCPToolsetParams` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `mcp_server_name: String` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfigParams]` + + Per-tool configuration overrides. + + - `name: String` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled: bool` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfigParams` + + Default configuration for all tools from an MCP server. + + - `enabled: bool` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `class BetaManagedAgentsCustomToolParams` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: String` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: :custom` + + - `:custom` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: String` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `metadata: Hash[Symbol, String]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `version: Integer` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_agent = anthropic.beta.agents.update("agent_011CZkYpogX7uDKUyvBTophP", version: 1) + +puts(beta_managed_agents_agent) +``` + +## Archive + +`beta.agents.archive(agent_id, **kwargs) -> BetaManagedAgentsAgent` + +**post** `/v1/agents/{agent_id}/archive` + +Archive Agent + +### Parameters + +- `agent_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: String` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `metadata: Hash[Symbol, String]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `version: Integer` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_agent = anthropic.beta.agents.archive("agent_011CZkYpogX7uDKUyvBTophP") + +puts(beta_managed_agents_agent) +``` + +## Domain Types + +### Beta Managed Agents Agent + +- `class BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: String` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `metadata: Hash[Symbol, String]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `version: Integer` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Beta Managed Agents Agent Tool Config + +- `class BetaManagedAgentsAgentToolConfig` + + Configuration for a specific agent tool. + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + +### Beta Managed Agents Agent Tool Config Params + +- `class BetaManagedAgentsAgentToolConfigParams` + + Configuration override for a specific tool within a toolset. + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `enabled: bool` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + +### Beta Managed Agents Agent Toolset Default Config + +- `class BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + +### Beta Managed Agents Agent Toolset Default Config Params + +- `class BetaManagedAgentsAgentToolsetDefaultConfigParams` + + Default configuration for all tools in a toolset. + + - `enabled: bool` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + +### Beta Managed Agents Agent Toolset20260401 + +- `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + +### Beta Managed Agents Agent Toolset20260401 Params + +- `class BetaManagedAgentsAgentToolset20260401Params` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfigParams]` + + Per-tool configuration overrides. + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `enabled: bool` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfigParams` + + Default configuration for all tools in a toolset. + + - `enabled: bool` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + +### Beta Managed Agents Always Allow Policy + +- `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + +### Beta Managed Agents Always Ask Policy + +- `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + +### Beta Managed Agents Anthropic Skill + +- `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + +### Beta Managed Agents Anthropic Skill Params + +- `class BetaManagedAgentsAnthropicSkillParams` + + An Anthropic-managed skill. + + - `skill_id: String` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents Custom Skill + +- `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + +### Beta Managed Agents Custom Skill Params + +- `class BetaManagedAgentsCustomSkillParams` + + A user-created custom skill. + + - `skill_id: String` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: :custom` + + - `:custom` + + - `version: String` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents Custom Tool + +- `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + +### Beta Managed Agents Custom Tool Input Schema + +- `class BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + +### Beta Managed Agents Custom Tool Params + +- `class BetaManagedAgentsCustomToolParams` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: String` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: :custom` + + - `:custom` + +### Beta Managed Agents MCP Server URL Definition + +- `class BetaManagedAgentsMCPServerURLDefinition` + + URL-based MCP server connection as returned in API responses. + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + +### Beta Managed Agents MCP Tool Config + +- `class BetaManagedAgentsMCPToolConfig` + + Resolved configuration for a specific MCP tool. + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + +### Beta Managed Agents MCP Tool Config Params + +- `class BetaManagedAgentsMCPToolConfigParams` + + Configuration override for a specific MCP tool. + + - `name: String` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled: bool` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + +### Beta Managed Agents MCP Toolset + +- `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + +### Beta Managed Agents MCP Toolset Default Config + +- `class BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + +### Beta Managed Agents MCP Toolset Default Config Params + +- `class BetaManagedAgentsMCPToolsetDefaultConfigParams` + + Default configuration for all tools from an MCP server. + + - `enabled: bool` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + +### Beta Managed Agents MCP Toolset Params + +- `class BetaManagedAgentsMCPToolsetParams` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `mcp_server_name: String` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfigParams]` + + Per-tool configuration overrides. + + - `name: String` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled: bool` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfigParams` + + Default configuration for all tools from an MCP server. + + - `enabled: bool` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + +### Beta Managed Agents Model + +- `BetaManagedAgentsModel = :"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more | String` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + +### Beta Managed Agents Model Config + +- `class BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + +### Beta Managed Agents Model Config Params + +- `class BetaManagedAgentsModelConfigParams` + + An object that defines additional configuration control over model use + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + +### Beta Managed Agents Skill Params + +- `BetaManagedAgentsSkillParams = BetaManagedAgentsAnthropicSkillParams | BetaManagedAgentsCustomSkillParams` + + Skill to load in the session container. + + - `class BetaManagedAgentsAnthropicSkillParams` + + An Anthropic-managed skill. + + - `skill_id: String` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + Version to pin. Defaults to latest if omitted. + + - `class BetaManagedAgentsCustomSkillParams` + + A user-created custom skill. + + - `skill_id: String` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: :custom` + + - `:custom` + + - `version: String` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents URL MCP Server Params + +- `class BetaManagedAgentsURLMCPServerParams` + + URL-based MCP server connection. + + - `name: String` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `type: :url` + + - `:url` + + - `url: String` + + Endpoint URL for the MCP server. + +# Versions + +## List + +`beta.agents.versions.list(agent_id, **kwargs) -> PageCursor` + +**get** `/v1/agents/{agent_id}/versions` + +List Agent Versions + +### Parameters + +- `agent_id: String` + +- `limit: Integer` + + Maximum results per page. Default 20, maximum 100. + +- `page: String` + + Opaque pagination cursor. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: String` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `metadata: Hash[Symbol, String]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `version: Integer` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +page = anthropic.beta.agents.versions.list("agent_011CZkYpogX7uDKUyvBTophP") + +puts(page) +``` diff --git a/content/en/api/ruby/beta/agents/archive.md b/content/en/api/ruby/beta/agents/archive.md new file mode 100644 index 000000000..059bff2f1 --- /dev/null +++ b/content/en/api/ruby/beta/agents/archive.md @@ -0,0 +1,371 @@ +## Archive + +`beta.agents.archive(agent_id, **kwargs) -> BetaManagedAgentsAgent` + +**post** `/v1/agents/{agent_id}/archive` + +Archive Agent + +### Parameters + +- `agent_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: String` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `metadata: Hash[Symbol, String]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `version: Integer` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_agent = anthropic.beta.agents.archive("agent_011CZkYpogX7uDKUyvBTophP") + +puts(beta_managed_agents_agent) +``` diff --git a/content/en/api/ruby/beta/agents/create.md b/content/en/api/ruby/beta/agents/create.md new file mode 100644 index 000000000..1083036f4 --- /dev/null +++ b/content/en/api/ruby/beta/agents/create.md @@ -0,0 +1,739 @@ +## Create + +`beta.agents.create(**kwargs) -> BetaManagedAgentsAgent` + +**post** `/v1/agents` + +Create Agent + +### Parameters + +- `model: BetaManagedAgentsModel | BetaManagedAgentsModelConfigParams` + + Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control + + - `BetaManagedAgentsModel = :"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more | String` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `class BetaManagedAgentsModelConfigParams` + + An object that defines additional configuration control over model use + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + +- `name: String` + + Human-readable name for the agent. 1-256 characters. + +- `description: String` + + Description of what the agent does. Up to 2048 characters. + +- `mcp_servers: Array[BetaManagedAgentsURLMCPServerParams]` + + MCP servers this agent connects to. Maximum 20. Names must be unique within the array. + + - `name: String` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `type: :url` + + - `:url` + + - `url: String` + + Endpoint URL for the MCP server. + +- `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars. + +- `skills: Array[BetaManagedAgentsSkillParams]` + + Skills available to the agent. Maximum 20. + + - `class BetaManagedAgentsAnthropicSkillParams` + + An Anthropic-managed skill. + + - `skill_id: String` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + Version to pin. Defaults to latest if omitted. + + - `class BetaManagedAgentsCustomSkillParams` + + A user-created custom skill. + + - `skill_id: String` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: :custom` + + - `:custom` + + - `version: String` + + Version to pin. Defaults to latest if omitted. + +- `system_: String` + + System prompt for the agent. Up to 100,000 characters. + +- `tools: Array[BetaManagedAgentsAgentToolset20260401Params | BetaManagedAgentsMCPToolsetParams | BetaManagedAgentsCustomToolParams]` + + Tool configurations available to the agent. Maximum of 128 tools across all toolsets allowed. + + - `class BetaManagedAgentsAgentToolset20260401Params` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfigParams]` + + Per-tool configuration overrides. + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `enabled: bool` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfigParams` + + Default configuration for all tools in a toolset. + + - `enabled: bool` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `class BetaManagedAgentsMCPToolsetParams` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `mcp_server_name: String` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfigParams]` + + Per-tool configuration overrides. + + - `name: String` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled: bool` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfigParams` + + Default configuration for all tools from an MCP server. + + - `enabled: bool` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `class BetaManagedAgentsCustomToolParams` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: String` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: :custom` + + - `:custom` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: String` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `metadata: Hash[Symbol, String]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `version: Integer` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_agent = anthropic.beta.agents.create(model: :"claude-sonnet-4-6", name: "My First Agent") + +puts(beta_managed_agents_agent) +``` diff --git a/content/en/api/ruby/beta/agents/list.md b/content/en/api/ruby/beta/agents/list.md new file mode 100644 index 000000000..86445baf1 --- /dev/null +++ b/content/en/api/ruby/beta/agents/list.md @@ -0,0 +1,389 @@ +## List + +`beta.agents.list(**kwargs) -> PageCursor` + +**get** `/v1/agents` + +List Agents + +### Parameters + +- `created_at_gte: Time` + + Return agents created at or after this time (inclusive). + +- `created_at_lte: Time` + + Return agents created at or before this time (inclusive). + +- `include_archived: bool` + + Include archived agents in results. Defaults to false. + +- `limit: Integer` + + Maximum results per page. Default 20, maximum 100. + +- `page: String` + + Opaque pagination cursor from a previous response. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: String` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `metadata: Hash[Symbol, String]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `version: Integer` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +page = anthropic.beta.agents.list + +puts(page) +``` diff --git a/content/en/api/ruby/beta/agents/retrieve.md b/content/en/api/ruby/beta/agents/retrieve.md new file mode 100644 index 000000000..0a8ba7d5d --- /dev/null +++ b/content/en/api/ruby/beta/agents/retrieve.md @@ -0,0 +1,375 @@ +## Retrieve + +`beta.agents.retrieve(agent_id, **kwargs) -> BetaManagedAgentsAgent` + +**get** `/v1/agents/{agent_id}` + +Get Agent + +### Parameters + +- `agent_id: String` + +- `version: Integer` + + Agent version. Omit for the most recent version. Must be at least 1 if specified. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: String` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `metadata: Hash[Symbol, String]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `version: Integer` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_agent = anthropic.beta.agents.retrieve("agent_011CZkYpogX7uDKUyvBTophP") + +puts(beta_managed_agents_agent) +``` diff --git a/content/en/api/ruby/beta/agents/update.md b/content/en/api/ruby/beta/agents/update.md new file mode 100644 index 000000000..b1caf57be --- /dev/null +++ b/content/en/api/ruby/beta/agents/update.md @@ -0,0 +1,745 @@ +## Update + +`beta.agents.update(agent_id, **kwargs) -> BetaManagedAgentsAgent` + +**post** `/v1/agents/{agent_id}` + +Update Agent + +### Parameters + +- `agent_id: String` + +- `version: Integer` + + The agent's current version, used to prevent concurrent overwrites. Obtain this value from a create or retrieve response. The request fails if this does not match the server's current version. + +- `description: String` + + Description. Up to 2048 characters. Omit to preserve; send empty string or null to clear. + +- `mcp_servers: Array[BetaManagedAgentsURLMCPServerParams]` + + MCP servers. Full replacement. Omit to preserve; send empty array or null to clear. Names must be unique. Maximum 20. + + - `name: String` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `type: :url` + + - `:url` + + - `url: String` + + Endpoint URL for the MCP server. + +- `metadata: Hash[Symbol, String]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. The stored bag is limited to 16 keys (up to 64 chars each) with values up to 512 chars. + +- `model: BetaManagedAgentsModel | BetaManagedAgentsModelConfigParams` + + Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control. Omit to preserve. Cannot be cleared. + + - `BetaManagedAgentsModel = :"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more | String` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `class BetaManagedAgentsModelConfigParams` + + An object that defines additional configuration control over model use + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + +- `name: String` + + Human-readable name. 1-256 characters. Omit to preserve. Cannot be cleared. + +- `skills: Array[BetaManagedAgentsSkillParams]` + + Skills. Full replacement. Omit to preserve; send empty array or null to clear. Maximum 20. + + - `class BetaManagedAgentsAnthropicSkillParams` + + An Anthropic-managed skill. + + - `skill_id: String` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + Version to pin. Defaults to latest if omitted. + + - `class BetaManagedAgentsCustomSkillParams` + + A user-created custom skill. + + - `skill_id: String` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: :custom` + + - `:custom` + + - `version: String` + + Version to pin. Defaults to latest if omitted. + +- `system_: String` + + System prompt. Up to 100,000 characters. Omit to preserve; send empty string or null to clear. + +- `tools: Array[BetaManagedAgentsAgentToolset20260401Params | BetaManagedAgentsMCPToolsetParams | BetaManagedAgentsCustomToolParams]` + + Tool configurations available to the agent. Full replacement. Omit to preserve; send empty array or null to clear. Maximum of 128 tools across all toolsets allowed. + + - `class BetaManagedAgentsAgentToolset20260401Params` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfigParams]` + + Per-tool configuration overrides. + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `enabled: bool` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfigParams` + + Default configuration for all tools in a toolset. + + - `enabled: bool` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `class BetaManagedAgentsMCPToolsetParams` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `mcp_server_name: String` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfigParams]` + + Per-tool configuration overrides. + + - `name: String` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled: bool` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfigParams` + + Default configuration for all tools from an MCP server. + + - `enabled: bool` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `class BetaManagedAgentsCustomToolParams` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: String` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: :custom` + + - `:custom` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: String` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `metadata: Hash[Symbol, String]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `version: Integer` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_agent = anthropic.beta.agents.update("agent_011CZkYpogX7uDKUyvBTophP", version: 1) + +puts(beta_managed_agents_agent) +``` diff --git a/content/en/api/ruby/beta/agents/versions.md b/content/en/api/ruby/beta/agents/versions.md new file mode 100644 index 000000000..72258b6f2 --- /dev/null +++ b/content/en/api/ruby/beta/agents/versions.md @@ -0,0 +1,381 @@ +# Versions + +## List + +`beta.agents.versions.list(agent_id, **kwargs) -> PageCursor` + +**get** `/v1/agents/{agent_id}/versions` + +List Agent Versions + +### Parameters + +- `agent_id: String` + +- `limit: Integer` + + Maximum results per page. Default 20, maximum 100. + +- `page: String` + + Opaque pagination cursor. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: String` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `metadata: Hash[Symbol, String]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `version: Integer` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +page = anthropic.beta.agents.versions.list("agent_011CZkYpogX7uDKUyvBTophP") + +puts(page) +``` diff --git a/content/en/api/ruby/beta/agents/versions/list.md b/content/en/api/ruby/beta/agents/versions/list.md new file mode 100644 index 000000000..33842392c --- /dev/null +++ b/content/en/api/ruby/beta/agents/versions/list.md @@ -0,0 +1,379 @@ +## List + +`beta.agents.versions.list(agent_id, **kwargs) -> PageCursor` + +**get** `/v1/agents/{agent_id}/versions` + +List Agent Versions + +### Parameters + +- `agent_id: String` + +- `limit: Integer` + + Maximum results per page. Default 20, maximum 100. + +- `page: String` + + Opaque pagination cursor. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: String` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `metadata: Hash[Symbol, String]` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `version: Integer` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +page = anthropic.beta.agents.versions.list("agent_011CZkYpogX7uDKUyvBTophP") + +puts(page) +``` diff --git a/content/en/api/ruby/beta/environments.md b/content/en/api/ruby/beta/environments.md new file mode 100644 index 000000000..13ef14626 --- /dev/null +++ b/content/en/api/ruby/beta/environments.md @@ -0,0 +1,1716 @@ +# Environments + +## Create + +`beta.environments.create(**kwargs) -> BetaEnvironment` + +**post** `/v1/environments` + +Create a new environment with the specified configuration. + +### Parameters + +- `name: String` + + Human-readable name for the environment + +- `config: BetaCloudConfigParams` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: :cloud` + + Environment type + + - `:cloud` + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetworkParams` + + Network configuration policy. Omit on update to preserve the existing value. + + - `class BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: :unrestricted` + + Network policy type + + - `:unrestricted` + + - `class BetaLimitedNetworkParams` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: :limited` + + Network policy type + + - `:limited` + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: Array[String]` + + Specifies domains the container can reach. + + - `packages: BetaPackagesParams` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: Array[String]` + + Ubuntu/Debian packages to install + + - `cargo: Array[String]` + + Rust packages to install + + - `gem_: Array[String]` + + Ruby packages to install + + - `go: Array[String]` + + Go packages to install + + - `npm: Array[String]` + + Node.js packages to install + + - `pip: Array[String]` + + Python packages to install + + - `type: :packages` + + Package configuration type + + - `:packages` + +- `description: String` + + Optional description of the environment + +- `metadata: Hash[Symbol, String]` + + User-provided metadata key-value pairs + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: String` + + Environment identifier (e.g., 'env_...') + + - `archived_at: String` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: :unrestricted` + + Network policy type + + - `:unrestricted` + + - `class BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array[String]` + + Specifies domains the container can reach. + + - `type: :limited` + + Network policy type + + - `:limited` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array[String]` + + Ubuntu/Debian packages to install + + - `cargo: Array[String]` + + Rust packages to install + + - `gem_: Array[String]` + + Ruby packages to install + + - `go: Array[String]` + + Go packages to install + + - `npm: Array[String]` + + Node.js packages to install + + - `pip: Array[String]` + + Python packages to install + + - `type: :packages` + + Package configuration type + + - `:packages` + + - `type: :cloud` + + Environment type + + - `:cloud` + + - `created_at: String` + + RFC 3339 timestamp when environment was created + + - `description: String` + + User-provided description for the environment + + - `metadata: Hash[Symbol, String]` + + User-provided metadata key-value pairs + + - `name: String` + + Human-readable name for the environment + + - `type: :environment` + + The type of object (always 'environment') + + - `:environment` + + - `updated_at: String` + + RFC 3339 timestamp when environment was last updated + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_environment = anthropic.beta.environments.create(name: "python-data-analysis") + +puts(beta_environment) +``` + +## List + +`beta.environments.list(**kwargs) -> PageCursor` + +**get** `/v1/environments` + +List environments with pagination support. + +### Parameters + +- `include_archived: bool` + + Include archived environments in the response + +- `limit: Integer` + + Maximum number of environments to return + +- `page: String` + + Opaque cursor from previous response for pagination. Pass the `next_page` value from the previous response. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: String` + + Environment identifier (e.g., 'env_...') + + - `archived_at: String` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: :unrestricted` + + Network policy type + + - `:unrestricted` + + - `class BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array[String]` + + Specifies domains the container can reach. + + - `type: :limited` + + Network policy type + + - `:limited` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array[String]` + + Ubuntu/Debian packages to install + + - `cargo: Array[String]` + + Rust packages to install + + - `gem_: Array[String]` + + Ruby packages to install + + - `go: Array[String]` + + Go packages to install + + - `npm: Array[String]` + + Node.js packages to install + + - `pip: Array[String]` + + Python packages to install + + - `type: :packages` + + Package configuration type + + - `:packages` + + - `type: :cloud` + + Environment type + + - `:cloud` + + - `created_at: String` + + RFC 3339 timestamp when environment was created + + - `description: String` + + User-provided description for the environment + + - `metadata: Hash[Symbol, String]` + + User-provided metadata key-value pairs + + - `name: String` + + Human-readable name for the environment + + - `type: :environment` + + The type of object (always 'environment') + + - `:environment` + + - `updated_at: String` + + RFC 3339 timestamp when environment was last updated + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +page = anthropic.beta.environments.list + +puts(page) +``` + +## Retrieve + +`beta.environments.retrieve(environment_id, **kwargs) -> BetaEnvironment` + +**get** `/v1/environments/{environment_id}` + +Retrieve a specific environment by ID. + +### Parameters + +- `environment_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: String` + + Environment identifier (e.g., 'env_...') + + - `archived_at: String` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: :unrestricted` + + Network policy type + + - `:unrestricted` + + - `class BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array[String]` + + Specifies domains the container can reach. + + - `type: :limited` + + Network policy type + + - `:limited` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array[String]` + + Ubuntu/Debian packages to install + + - `cargo: Array[String]` + + Rust packages to install + + - `gem_: Array[String]` + + Ruby packages to install + + - `go: Array[String]` + + Go packages to install + + - `npm: Array[String]` + + Node.js packages to install + + - `pip: Array[String]` + + Python packages to install + + - `type: :packages` + + Package configuration type + + - `:packages` + + - `type: :cloud` + + Environment type + + - `:cloud` + + - `created_at: String` + + RFC 3339 timestamp when environment was created + + - `description: String` + + User-provided description for the environment + + - `metadata: Hash[Symbol, String]` + + User-provided metadata key-value pairs + + - `name: String` + + Human-readable name for the environment + + - `type: :environment` + + The type of object (always 'environment') + + - `:environment` + + - `updated_at: String` + + RFC 3339 timestamp when environment was last updated + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_environment = anthropic.beta.environments.retrieve("env_011CZkZ9X2dpNyB7HsEFoRfW") + +puts(beta_environment) +``` + +## Update + +`beta.environments.update(environment_id, **kwargs) -> BetaEnvironment` + +**post** `/v1/environments/{environment_id}` + +Update an existing environment's configuration. + +### Parameters + +- `environment_id: String` + +- `config: BetaCloudConfigParams` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: :cloud` + + Environment type + + - `:cloud` + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetworkParams` + + Network configuration policy. Omit on update to preserve the existing value. + + - `class BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: :unrestricted` + + Network policy type + + - `:unrestricted` + + - `class BetaLimitedNetworkParams` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: :limited` + + Network policy type + + - `:limited` + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: Array[String]` + + Specifies domains the container can reach. + + - `packages: BetaPackagesParams` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: Array[String]` + + Ubuntu/Debian packages to install + + - `cargo: Array[String]` + + Rust packages to install + + - `gem_: Array[String]` + + Ruby packages to install + + - `go: Array[String]` + + Go packages to install + + - `npm: Array[String]` + + Node.js packages to install + + - `pip: Array[String]` + + Python packages to install + + - `type: :packages` + + Package configuration type + + - `:packages` + +- `description: String` + + Updated description of the environment + +- `metadata: Hash[Symbol, String]` + + User-provided metadata key-value pairs. Set a value to null or empty string to delete the key. + +- `name: String` + + Updated name for the environment + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: String` + + Environment identifier (e.g., 'env_...') + + - `archived_at: String` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: :unrestricted` + + Network policy type + + - `:unrestricted` + + - `class BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array[String]` + + Specifies domains the container can reach. + + - `type: :limited` + + Network policy type + + - `:limited` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array[String]` + + Ubuntu/Debian packages to install + + - `cargo: Array[String]` + + Rust packages to install + + - `gem_: Array[String]` + + Ruby packages to install + + - `go: Array[String]` + + Go packages to install + + - `npm: Array[String]` + + Node.js packages to install + + - `pip: Array[String]` + + Python packages to install + + - `type: :packages` + + Package configuration type + + - `:packages` + + - `type: :cloud` + + Environment type + + - `:cloud` + + - `created_at: String` + + RFC 3339 timestamp when environment was created + + - `description: String` + + User-provided description for the environment + + - `metadata: Hash[Symbol, String]` + + User-provided metadata key-value pairs + + - `name: String` + + Human-readable name for the environment + + - `type: :environment` + + The type of object (always 'environment') + + - `:environment` + + - `updated_at: String` + + RFC 3339 timestamp when environment was last updated + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_environment = anthropic.beta.environments.update("env_011CZkZ9X2dpNyB7HsEFoRfW") + +puts(beta_environment) +``` + +## Delete + +`beta.environments.delete(environment_id, **kwargs) -> BetaEnvironmentDeleteResponse` + +**delete** `/v1/environments/{environment_id}` + +Delete an environment by ID. Returns a confirmation of the deletion. + +### Parameters + +- `environment_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironmentDeleteResponse` + + Response after deleting an environment. + + - `id: String` + + Environment identifier + + - `type: :environment_deleted` + + The type of response + + - `:environment_deleted` + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_environment_delete_response = anthropic.beta.environments.delete("env_011CZkZ9X2dpNyB7HsEFoRfW") + +puts(beta_environment_delete_response) +``` + +## Archive + +`beta.environments.archive(environment_id, **kwargs) -> BetaEnvironment` + +**post** `/v1/environments/{environment_id}/archive` + +Archive an environment by ID. Archived environments cannot be used to create new sessions. + +### Parameters + +- `environment_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: String` + + Environment identifier (e.g., 'env_...') + + - `archived_at: String` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: :unrestricted` + + Network policy type + + - `:unrestricted` + + - `class BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array[String]` + + Specifies domains the container can reach. + + - `type: :limited` + + Network policy type + + - `:limited` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array[String]` + + Ubuntu/Debian packages to install + + - `cargo: Array[String]` + + Rust packages to install + + - `gem_: Array[String]` + + Ruby packages to install + + - `go: Array[String]` + + Go packages to install + + - `npm: Array[String]` + + Node.js packages to install + + - `pip: Array[String]` + + Python packages to install + + - `type: :packages` + + Package configuration type + + - `:packages` + + - `type: :cloud` + + Environment type + + - `:cloud` + + - `created_at: String` + + RFC 3339 timestamp when environment was created + + - `description: String` + + User-provided description for the environment + + - `metadata: Hash[Symbol, String]` + + User-provided metadata key-value pairs + + - `name: String` + + Human-readable name for the environment + + - `type: :environment` + + The type of object (always 'environment') + + - `:environment` + + - `updated_at: String` + + RFC 3339 timestamp when environment was last updated + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_environment = anthropic.beta.environments.archive("env_011CZkZ9X2dpNyB7HsEFoRfW") + +puts(beta_environment) +``` + +## Domain Types + +### Beta Cloud Config + +- `class BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: :unrestricted` + + Network policy type + + - `:unrestricted` + + - `class BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array[String]` + + Specifies domains the container can reach. + + - `type: :limited` + + Network policy type + + - `:limited` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array[String]` + + Ubuntu/Debian packages to install + + - `cargo: Array[String]` + + Rust packages to install + + - `gem_: Array[String]` + + Ruby packages to install + + - `go: Array[String]` + + Go packages to install + + - `npm: Array[String]` + + Node.js packages to install + + - `pip: Array[String]` + + Python packages to install + + - `type: :packages` + + Package configuration type + + - `:packages` + + - `type: :cloud` + + Environment type + + - `:cloud` + +### Beta Cloud Config Params + +- `class BetaCloudConfigParams` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: :cloud` + + Environment type + + - `:cloud` + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetworkParams` + + Network configuration policy. Omit on update to preserve the existing value. + + - `class BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: :unrestricted` + + Network policy type + + - `:unrestricted` + + - `class BetaLimitedNetworkParams` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: :limited` + + Network policy type + + - `:limited` + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: Array[String]` + + Specifies domains the container can reach. + + - `packages: BetaPackagesParams` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: Array[String]` + + Ubuntu/Debian packages to install + + - `cargo: Array[String]` + + Rust packages to install + + - `gem_: Array[String]` + + Ruby packages to install + + - `go: Array[String]` + + Go packages to install + + - `npm: Array[String]` + + Node.js packages to install + + - `pip: Array[String]` + + Python packages to install + + - `type: :packages` + + Package configuration type + + - `:packages` + +### Beta Environment + +- `class BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: String` + + Environment identifier (e.g., 'env_...') + + - `archived_at: String` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: :unrestricted` + + Network policy type + + - `:unrestricted` + + - `class BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array[String]` + + Specifies domains the container can reach. + + - `type: :limited` + + Network policy type + + - `:limited` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array[String]` + + Ubuntu/Debian packages to install + + - `cargo: Array[String]` + + Rust packages to install + + - `gem_: Array[String]` + + Ruby packages to install + + - `go: Array[String]` + + Go packages to install + + - `npm: Array[String]` + + Node.js packages to install + + - `pip: Array[String]` + + Python packages to install + + - `type: :packages` + + Package configuration type + + - `:packages` + + - `type: :cloud` + + Environment type + + - `:cloud` + + - `created_at: String` + + RFC 3339 timestamp when environment was created + + - `description: String` + + User-provided description for the environment + + - `metadata: Hash[Symbol, String]` + + User-provided metadata key-value pairs + + - `name: String` + + Human-readable name for the environment + + - `type: :environment` + + The type of object (always 'environment') + + - `:environment` + + - `updated_at: String` + + RFC 3339 timestamp when environment was last updated + +### Beta Environment Delete Response + +- `class BetaEnvironmentDeleteResponse` + + Response after deleting an environment. + + - `id: String` + + Environment identifier + + - `type: :environment_deleted` + + The type of response + + - `:environment_deleted` + +### Beta Limited Network + +- `class BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array[String]` + + Specifies domains the container can reach. + + - `type: :limited` + + Network policy type + + - `:limited` + +### Beta Limited Network Params + +- `class BetaLimitedNetworkParams` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: :limited` + + Network policy type + + - `:limited` + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: Array[String]` + + Specifies domains the container can reach. + +### Beta Packages + +- `class BetaPackages` + + Packages (and their versions) available in this environment. + + - `apt: Array[String]` + + Ubuntu/Debian packages to install + + - `cargo: Array[String]` + + Rust packages to install + + - `gem_: Array[String]` + + Ruby packages to install + + - `go: Array[String]` + + Go packages to install + + - `npm: Array[String]` + + Node.js packages to install + + - `pip: Array[String]` + + Python packages to install + + - `type: :packages` + + Package configuration type + + - `:packages` + +### Beta Packages Params + +- `class BetaPackagesParams` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: Array[String]` + + Ubuntu/Debian packages to install + + - `cargo: Array[String]` + + Rust packages to install + + - `gem_: Array[String]` + + Ruby packages to install + + - `go: Array[String]` + + Go packages to install + + - `npm: Array[String]` + + Node.js packages to install + + - `pip: Array[String]` + + Python packages to install + + - `type: :packages` + + Package configuration type + + - `:packages` + +### Beta Unrestricted Network + +- `class BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: :unrestricted` + + Network policy type + + - `:unrestricted` diff --git a/content/en/api/ruby/beta/environments/archive.md b/content/en/api/ruby/beta/environments/archive.md new file mode 100644 index 000000000..b3698aebe --- /dev/null +++ b/content/en/api/ruby/beta/environments/archive.md @@ -0,0 +1,193 @@ +## Archive + +`beta.environments.archive(environment_id, **kwargs) -> BetaEnvironment` + +**post** `/v1/environments/{environment_id}/archive` + +Archive an environment by ID. Archived environments cannot be used to create new sessions. + +### Parameters + +- `environment_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: String` + + Environment identifier (e.g., 'env_...') + + - `archived_at: String` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: :unrestricted` + + Network policy type + + - `:unrestricted` + + - `class BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array[String]` + + Specifies domains the container can reach. + + - `type: :limited` + + Network policy type + + - `:limited` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array[String]` + + Ubuntu/Debian packages to install + + - `cargo: Array[String]` + + Rust packages to install + + - `gem_: Array[String]` + + Ruby packages to install + + - `go: Array[String]` + + Go packages to install + + - `npm: Array[String]` + + Node.js packages to install + + - `pip: Array[String]` + + Python packages to install + + - `type: :packages` + + Package configuration type + + - `:packages` + + - `type: :cloud` + + Environment type + + - `:cloud` + + - `created_at: String` + + RFC 3339 timestamp when environment was created + + - `description: String` + + User-provided description for the environment + + - `metadata: Hash[Symbol, String]` + + User-provided metadata key-value pairs + + - `name: String` + + Human-readable name for the environment + + - `type: :environment` + + The type of object (always 'environment') + + - `:environment` + + - `updated_at: String` + + RFC 3339 timestamp when environment was last updated + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_environment = anthropic.beta.environments.archive("env_011CZkZ9X2dpNyB7HsEFoRfW") + +puts(beta_environment) +``` diff --git a/content/en/api/ruby/beta/environments/create.md b/content/en/api/ruby/beta/environments/create.md new file mode 100644 index 000000000..7fbd1d1fa --- /dev/null +++ b/content/en/api/ruby/beta/environments/create.md @@ -0,0 +1,291 @@ +## Create + +`beta.environments.create(**kwargs) -> BetaEnvironment` + +**post** `/v1/environments` + +Create a new environment with the specified configuration. + +### Parameters + +- `name: String` + + Human-readable name for the environment + +- `config: BetaCloudConfigParams` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: :cloud` + + Environment type + + - `:cloud` + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetworkParams` + + Network configuration policy. Omit on update to preserve the existing value. + + - `class BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: :unrestricted` + + Network policy type + + - `:unrestricted` + + - `class BetaLimitedNetworkParams` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: :limited` + + Network policy type + + - `:limited` + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: Array[String]` + + Specifies domains the container can reach. + + - `packages: BetaPackagesParams` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: Array[String]` + + Ubuntu/Debian packages to install + + - `cargo: Array[String]` + + Rust packages to install + + - `gem_: Array[String]` + + Ruby packages to install + + - `go: Array[String]` + + Go packages to install + + - `npm: Array[String]` + + Node.js packages to install + + - `pip: Array[String]` + + Python packages to install + + - `type: :packages` + + Package configuration type + + - `:packages` + +- `description: String` + + Optional description of the environment + +- `metadata: Hash[Symbol, String]` + + User-provided metadata key-value pairs + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: String` + + Environment identifier (e.g., 'env_...') + + - `archived_at: String` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: :unrestricted` + + Network policy type + + - `:unrestricted` + + - `class BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array[String]` + + Specifies domains the container can reach. + + - `type: :limited` + + Network policy type + + - `:limited` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array[String]` + + Ubuntu/Debian packages to install + + - `cargo: Array[String]` + + Rust packages to install + + - `gem_: Array[String]` + + Ruby packages to install + + - `go: Array[String]` + + Go packages to install + + - `npm: Array[String]` + + Node.js packages to install + + - `pip: Array[String]` + + Python packages to install + + - `type: :packages` + + Package configuration type + + - `:packages` + + - `type: :cloud` + + Environment type + + - `:cloud` + + - `created_at: String` + + RFC 3339 timestamp when environment was created + + - `description: String` + + User-provided description for the environment + + - `metadata: Hash[Symbol, String]` + + User-provided metadata key-value pairs + + - `name: String` + + Human-readable name for the environment + + - `type: :environment` + + The type of object (always 'environment') + + - `:environment` + + - `updated_at: String` + + RFC 3339 timestamp when environment was last updated + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_environment = anthropic.beta.environments.create(name: "python-data-analysis") + +puts(beta_environment) +``` diff --git a/content/en/api/ruby/beta/environments/delete.md b/content/en/api/ruby/beta/environments/delete.md new file mode 100644 index 000000000..dbb70ec91 --- /dev/null +++ b/content/en/api/ruby/beta/environments/delete.md @@ -0,0 +1,89 @@ +## Delete + +`beta.environments.delete(environment_id, **kwargs) -> BetaEnvironmentDeleteResponse` + +**delete** `/v1/environments/{environment_id}` + +Delete an environment by ID. Returns a confirmation of the deletion. + +### Parameters + +- `environment_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironmentDeleteResponse` + + Response after deleting an environment. + + - `id: String` + + Environment identifier + + - `type: :environment_deleted` + + The type of response + + - `:environment_deleted` + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_environment_delete_response = anthropic.beta.environments.delete("env_011CZkZ9X2dpNyB7HsEFoRfW") + +puts(beta_environment_delete_response) +``` diff --git a/content/en/api/ruby/beta/environments/list.md b/content/en/api/ruby/beta/environments/list.md new file mode 100644 index 000000000..9705e8e60 --- /dev/null +++ b/content/en/api/ruby/beta/environments/list.md @@ -0,0 +1,203 @@ +## List + +`beta.environments.list(**kwargs) -> PageCursor` + +**get** `/v1/environments` + +List environments with pagination support. + +### Parameters + +- `include_archived: bool` + + Include archived environments in the response + +- `limit: Integer` + + Maximum number of environments to return + +- `page: String` + + Opaque cursor from previous response for pagination. Pass the `next_page` value from the previous response. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: String` + + Environment identifier (e.g., 'env_...') + + - `archived_at: String` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: :unrestricted` + + Network policy type + + - `:unrestricted` + + - `class BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array[String]` + + Specifies domains the container can reach. + + - `type: :limited` + + Network policy type + + - `:limited` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array[String]` + + Ubuntu/Debian packages to install + + - `cargo: Array[String]` + + Rust packages to install + + - `gem_: Array[String]` + + Ruby packages to install + + - `go: Array[String]` + + Go packages to install + + - `npm: Array[String]` + + Node.js packages to install + + - `pip: Array[String]` + + Python packages to install + + - `type: :packages` + + Package configuration type + + - `:packages` + + - `type: :cloud` + + Environment type + + - `:cloud` + + - `created_at: String` + + RFC 3339 timestamp when environment was created + + - `description: String` + + User-provided description for the environment + + - `metadata: Hash[Symbol, String]` + + User-provided metadata key-value pairs + + - `name: String` + + Human-readable name for the environment + + - `type: :environment` + + The type of object (always 'environment') + + - `:environment` + + - `updated_at: String` + + RFC 3339 timestamp when environment was last updated + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +page = anthropic.beta.environments.list + +puts(page) +``` diff --git a/content/en/api/ruby/beta/environments/retrieve.md b/content/en/api/ruby/beta/environments/retrieve.md new file mode 100644 index 000000000..5f5346135 --- /dev/null +++ b/content/en/api/ruby/beta/environments/retrieve.md @@ -0,0 +1,193 @@ +## Retrieve + +`beta.environments.retrieve(environment_id, **kwargs) -> BetaEnvironment` + +**get** `/v1/environments/{environment_id}` + +Retrieve a specific environment by ID. + +### Parameters + +- `environment_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: String` + + Environment identifier (e.g., 'env_...') + + - `archived_at: String` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: :unrestricted` + + Network policy type + + - `:unrestricted` + + - `class BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array[String]` + + Specifies domains the container can reach. + + - `type: :limited` + + Network policy type + + - `:limited` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array[String]` + + Ubuntu/Debian packages to install + + - `cargo: Array[String]` + + Rust packages to install + + - `gem_: Array[String]` + + Ruby packages to install + + - `go: Array[String]` + + Go packages to install + + - `npm: Array[String]` + + Node.js packages to install + + - `pip: Array[String]` + + Python packages to install + + - `type: :packages` + + Package configuration type + + - `:packages` + + - `type: :cloud` + + Environment type + + - `:cloud` + + - `created_at: String` + + RFC 3339 timestamp when environment was created + + - `description: String` + + User-provided description for the environment + + - `metadata: Hash[Symbol, String]` + + User-provided metadata key-value pairs + + - `name: String` + + Human-readable name for the environment + + - `type: :environment` + + The type of object (always 'environment') + + - `:environment` + + - `updated_at: String` + + RFC 3339 timestamp when environment was last updated + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_environment = anthropic.beta.environments.retrieve("env_011CZkZ9X2dpNyB7HsEFoRfW") + +puts(beta_environment) +``` diff --git a/content/en/api/ruby/beta/environments/update.md b/content/en/api/ruby/beta/environments/update.md new file mode 100644 index 000000000..a653ebab5 --- /dev/null +++ b/content/en/api/ruby/beta/environments/update.md @@ -0,0 +1,293 @@ +## Update + +`beta.environments.update(environment_id, **kwargs) -> BetaEnvironment` + +**post** `/v1/environments/{environment_id}` + +Update an existing environment's configuration. + +### Parameters + +- `environment_id: String` + +- `config: BetaCloudConfigParams` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: :cloud` + + Environment type + + - `:cloud` + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetworkParams` + + Network configuration policy. Omit on update to preserve the existing value. + + - `class BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: :unrestricted` + + Network policy type + + - `:unrestricted` + + - `class BetaLimitedNetworkParams` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: :limited` + + Network policy type + + - `:limited` + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts: Array[String]` + + Specifies domains the container can reach. + + - `packages: BetaPackagesParams` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt: Array[String]` + + Ubuntu/Debian packages to install + + - `cargo: Array[String]` + + Rust packages to install + + - `gem_: Array[String]` + + Ruby packages to install + + - `go: Array[String]` + + Go packages to install + + - `npm: Array[String]` + + Node.js packages to install + + - `pip: Array[String]` + + Python packages to install + + - `type: :packages` + + Package configuration type + + - `:packages` + +- `description: String` + + Updated description of the environment + +- `metadata: Hash[Symbol, String]` + + User-provided metadata key-value pairs. Set a value to null or empty string to delete the key. + +- `name: String` + + Updated name for the environment + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: String` + + Environment identifier (e.g., 'env_...') + + - `archived_at: String` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `class BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: :unrestricted` + + Network policy type + + - `:unrestricted` + + - `class BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: bool` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: bool` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array[String]` + + Specifies domains the container can reach. + + - `type: :limited` + + Network policy type + + - `:limited` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array[String]` + + Ubuntu/Debian packages to install + + - `cargo: Array[String]` + + Rust packages to install + + - `gem_: Array[String]` + + Ruby packages to install + + - `go: Array[String]` + + Go packages to install + + - `npm: Array[String]` + + Node.js packages to install + + - `pip: Array[String]` + + Python packages to install + + - `type: :packages` + + Package configuration type + + - `:packages` + + - `type: :cloud` + + Environment type + + - `:cloud` + + - `created_at: String` + + RFC 3339 timestamp when environment was created + + - `description: String` + + User-provided description for the environment + + - `metadata: Hash[Symbol, String]` + + User-provided metadata key-value pairs + + - `name: String` + + Human-readable name for the environment + + - `type: :environment` + + The type of object (always 'environment') + + - `:environment` + + - `updated_at: String` + + RFC 3339 timestamp when environment was last updated + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_environment = anthropic.beta.environments.update("env_011CZkZ9X2dpNyB7HsEFoRfW") + +puts(beta_environment) +``` diff --git a/content/en/api/ruby/beta/files.md b/content/en/api/ruby/beta/files.md index 8b751e627..b43a1e602 100644 --- a/content/en/api/ruby/beta/files.md +++ b/content/en/api/ruby/beta/files.md @@ -20,7 +20,7 @@ Upload File - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -64,8 +64,6 @@ Upload File - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class FileMetadata` @@ -104,6 +102,20 @@ Upload File Whether the file can be downloaded. + - `scope: BetaFileScope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: String` + + The ID of the scoping resource (e.g., the session ID). + + - `type: :session` + + The type of scope (e.g., `"session"`). + + - `:session` + ### Example ```ruby @@ -140,13 +152,17 @@ List Files Defaults to `20`. Ranges from `1` to `1000`. +- `scope_id: String` + + Filter by scope ID. Only returns files associated with the specified scope (e.g., a session ID). + - `betas: Array[AnthropicBeta]` Optional header to specify the beta version(s) you want to use. - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -190,8 +206,6 @@ List Files - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class FileMetadata` @@ -230,6 +244,20 @@ List Files Whether the file can be downloaded. + - `scope: BetaFileScope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: String` + + The ID of the scoping resource (e.g., the session ID). + + - `type: :session` + + The type of scope (e.g., `"session"`). + + - `:session` + ### Example ```ruby @@ -262,7 +290,7 @@ Download File - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -306,8 +334,6 @@ Download File - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `StringIO` @@ -344,7 +370,7 @@ Get File Metadata - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -388,8 +414,6 @@ Get File Metadata - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class FileMetadata` @@ -428,6 +452,20 @@ Get File Metadata Whether the file can be downloaded. + - `scope: BetaFileScope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: String` + + The ID of the scoping resource (e.g., the session ID). + + - `type: :session` + + The type of scope (e.g., `"session"`). + + - `:session` + ### Example ```ruby @@ -460,7 +498,7 @@ Delete File - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -504,8 +542,6 @@ Delete File - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class DeletedFile` @@ -536,6 +572,20 @@ puts(deleted_file) ## Domain Types +### Beta File Scope + +- `class BetaFileScope` + + - `id: String` + + The ID of the scoping resource (e.g., the session ID). + + - `type: :session` + + The type of scope (e.g., `"session"`). + + - `:session` + ### Deleted File - `class DeletedFile` @@ -589,3 +639,17 @@ puts(deleted_file) - `downloadable: bool` Whether the file can be downloaded. + + - `scope: BetaFileScope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: String` + + The ID of the scoping resource (e.g., the session ID). + + - `type: :session` + + The type of scope (e.g., `"session"`). + + - `:session` diff --git a/content/en/api/ruby/beta/files/delete.md b/content/en/api/ruby/beta/files/delete.md index 281c0fbbf..8d953d26f 100644 --- a/content/en/api/ruby/beta/files/delete.md +++ b/content/en/api/ruby/beta/files/delete.md @@ -18,7 +18,7 @@ Delete File - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -62,8 +62,6 @@ Delete File - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class DeletedFile` diff --git a/content/en/api/ruby/beta/files/download.md b/content/en/api/ruby/beta/files/download.md index 7efe80b36..222f04107 100644 --- a/content/en/api/ruby/beta/files/download.md +++ b/content/en/api/ruby/beta/files/download.md @@ -18,7 +18,7 @@ Download File - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -62,8 +62,6 @@ Download File - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `StringIO` diff --git a/content/en/api/ruby/beta/files/list.md b/content/en/api/ruby/beta/files/list.md index 2c9c8ba39..78a816c8c 100644 --- a/content/en/api/ruby/beta/files/list.md +++ b/content/en/api/ruby/beta/files/list.md @@ -22,13 +22,17 @@ List Files Defaults to `20`. Ranges from `1` to `1000`. +- `scope_id: String` + + Filter by scope ID. Only returns files associated with the specified scope (e.g., a session ID). + - `betas: Array[AnthropicBeta]` Optional header to specify the beta version(s) you want to use. - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -72,8 +76,6 @@ List Files - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class FileMetadata` @@ -112,6 +114,20 @@ List Files Whether the file can be downloaded. + - `scope: BetaFileScope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: String` + + The ID of the scoping resource (e.g., the session ID). + + - `type: :session` + + The type of scope (e.g., `"session"`). + + - `:session` + ### Example ```ruby diff --git a/content/en/api/ruby/beta/files/retrieve_metadata.md b/content/en/api/ruby/beta/files/retrieve_metadata.md index 618a26389..75a2779dd 100644 --- a/content/en/api/ruby/beta/files/retrieve_metadata.md +++ b/content/en/api/ruby/beta/files/retrieve_metadata.md @@ -18,7 +18,7 @@ Get File Metadata - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -62,8 +62,6 @@ Get File Metadata - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class FileMetadata` @@ -102,6 +100,20 @@ Get File Metadata Whether the file can be downloaded. + - `scope: BetaFileScope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: String` + + The ID of the scoping resource (e.g., the session ID). + + - `type: :session` + + The type of scope (e.g., `"session"`). + + - `:session` + ### Example ```ruby diff --git a/content/en/api/ruby/beta/files/upload.md b/content/en/api/ruby/beta/files/upload.md index 079d7bb4e..51d5ae427 100644 --- a/content/en/api/ruby/beta/files/upload.md +++ b/content/en/api/ruby/beta/files/upload.md @@ -18,7 +18,7 @@ Upload File - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -62,8 +62,6 @@ Upload File - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class FileMetadata` @@ -102,6 +100,20 @@ Upload File Whether the file can be downloaded. + - `scope: BetaFileScope` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: String` + + The ID of the scoping resource (e.g., the session ID). + + - `type: :session` + + The type of scope (e.g., `"session"`). + + - `:session` + ### Example ```ruby diff --git a/content/en/api/ruby/beta/messages.md b/content/en/api/ruby/beta/messages.md index f3ce60fc3..6b13f4e59 100644 --- a/content/en/api/ruby/beta/messages.md +++ b/content/en/api/ruby/beta/messages.md @@ -2599,15 +2599,19 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -4676,17 +4680,13 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en Recommended for advanced use cases only. You usually only need to use `temperature`. -- `user_profile_id: String` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `betas: Array[AnthropicBeta]` Optional header to specify the beta version(s) you want to use. - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -4730,8 +4730,6 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaMessage` @@ -5655,15 +5653,19 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -8567,15 +8569,19 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -10554,7 +10560,7 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -10598,8 +10604,6 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageTokensCount` @@ -10625,7 +10629,7 @@ anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") beta_message_tokens_count = anthropic.beta.messages.count_tokens( messages: [{content: "string", role: :user}], - model: :"claude-opus-4-6" + model: :"claude-mythos-preview" ) puts(beta_message_tokens_count) @@ -17816,15 +17820,19 @@ puts(beta_message_tokens_count) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -23160,15 +23168,19 @@ puts(beta_message_tokens_count) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -24404,15 +24416,19 @@ puts(beta_message_tokens_count) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -32953,7 +32969,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Must be unique for each request within the Message Batch. - - `params: { max_tokens, messages, model, 20 more}` + - `params: { max_tokens, messages, model, 19 more}` Messages API creation parameters for the individual request. @@ -35544,15 +35560,19 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -37621,17 +37641,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Recommended for advanced use cases only. You usually only need to use `temperature`. - - `user_profile_id: String` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `betas: Array[AnthropicBeta]` Optional header to specify the beta version(s) you want to use. - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -37675,8 +37691,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatch` @@ -37808,7 +37822,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -37852,8 +37866,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatch` @@ -37988,7 +38000,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -38032,8 +38044,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatch` @@ -38160,7 +38170,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -38204,8 +38214,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatch` @@ -38332,7 +38340,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -38376,8 +38384,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaDeletedMessageBatch` @@ -38430,7 +38436,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -38474,8 +38480,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatchIndividualResponse` @@ -39417,15 +39421,19 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -40993,15 +41001,19 @@ puts(beta_message_batch_individual_response) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -42365,15 +42377,19 @@ puts(beta_message_batch_individual_response) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -43699,15 +43715,19 @@ puts(beta_message_batch_individual_response) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` diff --git a/content/en/api/ruby/beta/messages/batches.md b/content/en/api/ruby/beta/messages/batches.md index 278425dff..d641a4e5a 100644 --- a/content/en/api/ruby/beta/messages/batches.md +++ b/content/en/api/ruby/beta/messages/batches.md @@ -24,7 +24,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Must be unique for each request within the Message Batch. - - `params: { max_tokens, messages, model, 20 more}` + - `params: { max_tokens, messages, model, 19 more}` Messages API creation parameters for the individual request. @@ -2615,15 +2615,19 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -4692,17 +4696,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Recommended for advanced use cases only. You usually only need to use `temperature`. - - `user_profile_id: String` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `betas: Array[AnthropicBeta]` Optional header to specify the beta version(s) you want to use. - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -4746,8 +4746,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatch` @@ -4879,7 +4877,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -4923,8 +4921,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatch` @@ -5059,7 +5055,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -5103,8 +5099,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatch` @@ -5231,7 +5225,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -5275,8 +5269,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatch` @@ -5403,7 +5395,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -5447,8 +5439,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaDeletedMessageBatch` @@ -5501,7 +5491,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -5545,8 +5535,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatchIndividualResponse` @@ -6488,15 +6476,19 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -8064,15 +8056,19 @@ puts(beta_message_batch_individual_response) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -9436,15 +9432,19 @@ puts(beta_message_batch_individual_response) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -10770,15 +10770,19 @@ puts(beta_message_batch_individual_response) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` diff --git a/content/en/api/ruby/beta/messages/batches/cancel.md b/content/en/api/ruby/beta/messages/batches/cancel.md index f85143e38..eee449d0c 100644 --- a/content/en/api/ruby/beta/messages/batches/cancel.md +++ b/content/en/api/ruby/beta/messages/batches/cancel.md @@ -22,7 +22,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -66,8 +66,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatch` diff --git a/content/en/api/ruby/beta/messages/batches/create.md b/content/en/api/ruby/beta/messages/batches/create.md index 39afce823..bd8ce3afa 100644 --- a/content/en/api/ruby/beta/messages/batches/create.md +++ b/content/en/api/ruby/beta/messages/batches/create.md @@ -22,7 +22,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Must be unique for each request within the Message Batch. - - `params: { max_tokens, messages, model, 20 more}` + - `params: { max_tokens, messages, model, 19 more}` Messages API creation parameters for the individual request. @@ -2613,15 +2613,19 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -4690,17 +4694,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Recommended for advanced use cases only. You usually only need to use `temperature`. - - `user_profile_id: String` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `betas: Array[AnthropicBeta]` Optional header to specify the beta version(s) you want to use. - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -4744,8 +4744,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatch` diff --git a/content/en/api/ruby/beta/messages/batches/delete.md b/content/en/api/ruby/beta/messages/batches/delete.md index 29c339da1..b092bd5e0 100644 --- a/content/en/api/ruby/beta/messages/batches/delete.md +++ b/content/en/api/ruby/beta/messages/batches/delete.md @@ -22,7 +22,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -66,8 +66,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaDeletedMessageBatch` diff --git a/content/en/api/ruby/beta/messages/batches/list.md b/content/en/api/ruby/beta/messages/batches/list.md index 0f82da250..530e84f79 100644 --- a/content/en/api/ruby/beta/messages/batches/list.md +++ b/content/en/api/ruby/beta/messages/batches/list.md @@ -30,7 +30,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -74,8 +74,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatch` diff --git a/content/en/api/ruby/beta/messages/batches/results.md b/content/en/api/ruby/beta/messages/batches/results.md index 14181f5a3..061c81daa 100644 --- a/content/en/api/ruby/beta/messages/batches/results.md +++ b/content/en/api/ruby/beta/messages/batches/results.md @@ -22,7 +22,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -66,8 +66,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatchIndividualResponse` @@ -1009,15 +1007,19 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` diff --git a/content/en/api/ruby/beta/messages/batches/retrieve.md b/content/en/api/ruby/beta/messages/batches/retrieve.md index b0f006e5b..67899c044 100644 --- a/content/en/api/ruby/beta/messages/batches/retrieve.md +++ b/content/en/api/ruby/beta/messages/batches/retrieve.md @@ -20,7 +20,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -64,8 +64,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageBatch` diff --git a/content/en/api/ruby/beta/messages/count_tokens.md b/content/en/api/ruby/beta/messages/count_tokens.md index 79a5e2068..3b804ada5 100644 --- a/content/en/api/ruby/beta/messages/count_tokens.md +++ b/content/en/api/ruby/beta/messages/count_tokens.md @@ -2589,15 +2589,19 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -4576,7 +4580,7 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -4620,8 +4624,6 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaMessageTokensCount` @@ -4647,7 +4649,7 @@ anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") beta_message_tokens_count = anthropic.beta.messages.count_tokens( messages: [{content: "string", role: :user}], - model: :"claude-opus-4-6" + model: :"claude-mythos-preview" ) puts(beta_message_tokens_count) diff --git a/content/en/api/ruby/beta/messages/create.md b/content/en/api/ruby/beta/messages/create.md index 67c9d0882..8a0f8ebd4 100644 --- a/content/en/api/ruby/beta/messages/create.md +++ b/content/en/api/ruby/beta/messages/create.md @@ -2597,15 +2597,19 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -4674,17 +4678,13 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en Recommended for advanced use cases only. You usually only need to use `temperature`. -- `user_profile_id: String` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `betas: Array[AnthropicBeta]` Optional header to specify the beta version(s) you want to use. - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -4728,8 +4728,6 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaMessage` @@ -5653,15 +5651,19 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` diff --git a/content/en/api/ruby/beta/models.md b/content/en/api/ruby/beta/models.md index e2824d892..52e90b6a8 100644 --- a/content/en/api/ruby/beta/models.md +++ b/content/en/api/ruby/beta/models.md @@ -32,7 +32,7 @@ The Models API response can be used to determine which models are available for - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -76,8 +76,6 @@ The Models API response can be used to determine which models are available for - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaModelInfo` @@ -296,7 +294,7 @@ The Models API response can be used to determine information about a specific mo - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -340,8 +338,6 @@ The Models API response can be used to determine information about a specific mo - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaModelInfo` diff --git a/content/en/api/ruby/beta/models/list.md b/content/en/api/ruby/beta/models/list.md index d5900d3a3..416efbbee 100644 --- a/content/en/api/ruby/beta/models/list.md +++ b/content/en/api/ruby/beta/models/list.md @@ -30,7 +30,7 @@ The Models API response can be used to determine which models are available for - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -74,8 +74,6 @@ The Models API response can be used to determine which models are available for - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaModelInfo` diff --git a/content/en/api/ruby/beta/models/retrieve.md b/content/en/api/ruby/beta/models/retrieve.md index b088b1088..45bb86e90 100644 --- a/content/en/api/ruby/beta/models/retrieve.md +++ b/content/en/api/ruby/beta/models/retrieve.md @@ -20,7 +20,7 @@ The Models API response can be used to determine information about a specific mo - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -64,8 +64,6 @@ The Models API response can be used to determine information about a specific mo - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class BetaModelInfo` diff --git a/content/en/api/ruby/beta/sessions.md b/content/en/api/ruby/beta/sessions.md new file mode 100644 index 000000000..c99e1ed56 --- /dev/null +++ b/content/en/api/ruby/beta/sessions.md @@ -0,0 +1,14215 @@ +# Sessions + +## Create + +`beta.sessions.create(**kwargs) -> BetaManagedAgentsSession` + +**post** `/v1/sessions` + +Create Session + +### Parameters + +- `agent: String | BetaManagedAgentsAgentParams` + + Agent identifier. Accepts the `agent` ID string, which pins the latest version for the session, or an `agent` object with both id and version specified. + + - `String` + + - `class BetaManagedAgentsAgentParams` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `id: String` + + The `agent` ID. + + - `type: :agent` + + - `:agent` + + - `version: Integer` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + +- `environment_id: String` + + ID of the `environment` defining the container configuration for this session. + +- `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the session. + +- `resources: Array[BetaManagedAgentsGitHubRepositoryResourceParams | BetaManagedAgentsFileResourceParams]` + + Resources (e.g. repositories, files) to mount into the session's container. + + - `class BetaManagedAgentsGitHubRepositoryResourceParams` + + Mount a GitHub repository into the session's container. + + - `authorization_token: String` + + GitHub authorization token used to clone the repository. + + - `type: :github_repository` + + - `:github_repository` + + - `url: String` + + Github URL of the repository + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `mount_path: String` + + Mount path in the container. Defaults to `/workspace/`. + + - `class BetaManagedAgentsFileResourceParams` + + Mount a file uploaded via the Files API into the session. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `mount_path: String` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +- `title: String` + + Human-readable session title. + +- `vault_ids: Array[String]` + + Vault IDs for stored credentials the agent can use during the session. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: String` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: String` + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `version: Integer` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `environment_id: String` + + - `metadata: Hash[Symbol, String]` + + - `resources: Array[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Float` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Float` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: :rescheduling | :running | :idle | :terminated` + + SessionStatus enum + + - `:rescheduling` + + - `:running` + + - `:idle` + + - `:terminated` + + - `title: String` + + - `type: :session` + + - `:session` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Integer` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Integer` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Integer` + + Total tokens read from prompt cache. + + - `input_tokens: Integer` + + Total input tokens consumed across all turns. + + - `output_tokens: Integer` + + Total output tokens generated across all turns. + + - `vault_ids: Array[String]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_session = anthropic.beta.sessions.create( + agent: "agent_011CZkYpogX7uDKUyvBTophP", + environment_id: "env_011CZkZ9X2dpNyB7HsEFoRfW" +) + +puts(beta_managed_agents_session) +``` + +## List + +`beta.sessions.list(**kwargs) -> PageCursor` + +**get** `/v1/sessions` + +List Sessions + +### Parameters + +- `agent_id: String` + + Filter sessions created with this agent ID. + +- `agent_version: Integer` + + Filter by agent version. Only applies when agent_id is also set. + +- `created_at_gt: Time` + + Return sessions created after this time (exclusive). + +- `created_at_gte: Time` + + Return sessions created at or after this time (inclusive). + +- `created_at_lt: Time` + + Return sessions created before this time (exclusive). + +- `created_at_lte: Time` + + Return sessions created at or before this time (inclusive). + +- `include_archived: bool` + + When true, includes archived sessions. Default: false (exclude archived). + +- `limit: Integer` + + Maximum number of results to return. + +- `order: :asc | :desc` + + Sort direction for results, ordered by created_at. Defaults to desc (newest first). + + - `:asc` + + - `:desc` + +- `page: String` + + Opaque pagination cursor from a previous response's next_page. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: String` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: String` + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `version: Integer` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `environment_id: String` + + - `metadata: Hash[Symbol, String]` + + - `resources: Array[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Float` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Float` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: :rescheduling | :running | :idle | :terminated` + + SessionStatus enum + + - `:rescheduling` + + - `:running` + + - `:idle` + + - `:terminated` + + - `title: String` + + - `type: :session` + + - `:session` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Integer` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Integer` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Integer` + + Total tokens read from prompt cache. + + - `input_tokens: Integer` + + Total input tokens consumed across all turns. + + - `output_tokens: Integer` + + Total output tokens generated across all turns. + + - `vault_ids: Array[String]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +page = anthropic.beta.sessions.list + +puts(page) +``` + +## Retrieve + +`beta.sessions.retrieve(session_id, **kwargs) -> BetaManagedAgentsSession` + +**get** `/v1/sessions/{session_id}` + +Get Session + +### Parameters + +- `session_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: String` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: String` + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `version: Integer` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `environment_id: String` + + - `metadata: Hash[Symbol, String]` + + - `resources: Array[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Float` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Float` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: :rescheduling | :running | :idle | :terminated` + + SessionStatus enum + + - `:rescheduling` + + - `:running` + + - `:idle` + + - `:terminated` + + - `title: String` + + - `type: :session` + + - `:session` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Integer` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Integer` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Integer` + + Total tokens read from prompt cache. + + - `input_tokens: Integer` + + Total input tokens consumed across all turns. + + - `output_tokens: Integer` + + Total output tokens generated across all turns. + + - `vault_ids: Array[String]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_session = anthropic.beta.sessions.retrieve("sesn_011CZkZAtmR3yMPDzynEDxu7") + +puts(beta_managed_agents_session) +``` + +## Update + +`beta.sessions.update(session_id, **kwargs) -> BetaManagedAgentsSession` + +**post** `/v1/sessions/{session_id}` + +Update Session + +### Parameters + +- `session_id: String` + +- `metadata: Hash[Symbol, String]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. + +- `title: String` + + Human-readable session title. + +- `vault_ids: Array[String]` + + Vault IDs (`vlt_*`) to attach to the session. Not yet supported; requests setting this field are rejected. Reserved for future use. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: String` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: String` + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `version: Integer` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `environment_id: String` + + - `metadata: Hash[Symbol, String]` + + - `resources: Array[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Float` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Float` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: :rescheduling | :running | :idle | :terminated` + + SessionStatus enum + + - `:rescheduling` + + - `:running` + + - `:idle` + + - `:terminated` + + - `title: String` + + - `type: :session` + + - `:session` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Integer` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Integer` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Integer` + + Total tokens read from prompt cache. + + - `input_tokens: Integer` + + Total input tokens consumed across all turns. + + - `output_tokens: Integer` + + Total output tokens generated across all turns. + + - `vault_ids: Array[String]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_session = anthropic.beta.sessions.update("sesn_011CZkZAtmR3yMPDzynEDxu7") + +puts(beta_managed_agents_session) +``` + +## Delete + +`beta.sessions.delete(session_id, **kwargs) -> BetaManagedAgentsDeletedSession` + +**delete** `/v1/sessions/{session_id}` + +Delete Session + +### Parameters + +- `session_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsDeletedSession` + + Confirmation that a `session` has been permanently deleted. + + - `id: String` + + - `type: :session_deleted` + + - `:session_deleted` + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_deleted_session = anthropic.beta.sessions.delete("sesn_011CZkZAtmR3yMPDzynEDxu7") + +puts(beta_managed_agents_deleted_session) +``` + +## Archive + +`beta.sessions.archive(session_id, **kwargs) -> BetaManagedAgentsSession` + +**post** `/v1/sessions/{session_id}/archive` + +Archive Session + +### Parameters + +- `session_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: String` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: String` + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `version: Integer` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `environment_id: String` + + - `metadata: Hash[Symbol, String]` + + - `resources: Array[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Float` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Float` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: :rescheduling | :running | :idle | :terminated` + + SessionStatus enum + + - `:rescheduling` + + - `:running` + + - `:idle` + + - `:terminated` + + - `title: String` + + - `type: :session` + + - `:session` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Integer` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Integer` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Integer` + + Total tokens read from prompt cache. + + - `input_tokens: Integer` + + Total input tokens consumed across all turns. + + - `output_tokens: Integer` + + Total output tokens generated across all turns. + + - `vault_ids: Array[String]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_session = anthropic.beta.sessions.archive("sesn_011CZkZAtmR3yMPDzynEDxu7") + +puts(beta_managed_agents_session) +``` + +## Domain Types + +### Beta Managed Agents Agent Params + +- `class BetaManagedAgentsAgentParams` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `id: String` + + The `agent` ID. + + - `type: :agent` + + - `:agent` + + - `version: Integer` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + +### Beta Managed Agents Branch Checkout + +- `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + +### Beta Managed Agents Cache Creation Usage + +- `class BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Integer` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Integer` + + Tokens used to create 5-minute ephemeral cache entries. + +### Beta Managed Agents Commit Checkout + +- `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + +### Beta Managed Agents Deleted Session + +- `class BetaManagedAgentsDeletedSession` + + Confirmation that a `session` has been permanently deleted. + + - `id: String` + + - `type: :session_deleted` + + - `:session_deleted` + +### Beta Managed Agents File Resource Params + +- `class BetaManagedAgentsFileResourceParams` + + Mount a file uploaded via the Files API into the session. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `mount_path: String` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +### Beta Managed Agents GitHub Repository Resource Params + +- `class BetaManagedAgentsGitHubRepositoryResourceParams` + + Mount a GitHub repository into the session's container. + + - `authorization_token: String` + + GitHub authorization token used to clone the repository. + + - `type: :github_repository` + + - `:github_repository` + + - `url: String` + + Github URL of the repository + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `mount_path: String` + + Mount path in the container. Defaults to `/workspace/`. + +### Beta Managed Agents Session + +- `class BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: String` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: String` + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `version: Integer` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `environment_id: String` + + - `metadata: Hash[Symbol, String]` + + - `resources: Array[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Float` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Float` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: :rescheduling | :running | :idle | :terminated` + + SessionStatus enum + + - `:rescheduling` + + - `:running` + + - `:idle` + + - `:terminated` + + - `title: String` + + - `type: :session` + + - `:session` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Integer` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Integer` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Integer` + + Total tokens read from prompt cache. + + - `input_tokens: Integer` + + Total input tokens consumed across all turns. + + - `output_tokens: Integer` + + Total output tokens generated across all turns. + + - `vault_ids: Array[String]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Beta Managed Agents Session Agent + +- `class BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: String` + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `version: Integer` + +### Beta Managed Agents Session Stats + +- `class BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Float` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Float` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + +### Beta Managed Agents Session Usage + +- `class BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Integer` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Integer` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Integer` + + Total tokens read from prompt cache. + + - `input_tokens: Integer` + + Total input tokens consumed across all turns. + + - `output_tokens: Integer` + + Total output tokens generated across all turns. + +# Events + +## List + +`beta.sessions.events.list(session_id, **kwargs) -> PageCursor` + +**get** `/v1/sessions/{session_id}/events` + +List Events + +### Parameters + +- `session_id: String` + +- `limit: Integer` + + Query parameter for limit + +- `order: :asc | :desc` + + Sort direction for results, ordered by created_at. Defaults to asc (chronological). + + - `:asc` + + - `:desc` + +- `page: String` + + Opaque pagination cursor from a previous response's next_page. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSessionEvent = BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | 17 more` + + Union type for all event types in a session. + + - `class BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: String` + + Unique identifier for this event. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: String` + + Unique identifier for this event. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: String` + + Unique identifier for this event. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the custom tool being called. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.custom_tool_use"` + + - `:"agent.custom_tool_use"` + + - `class BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.message"` + + - `:"agent.message"` + + - `class BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thinking"` + + - `:"agent.thinking"` + + - `class BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `mcp_server_name: String` + + Name of the MCP server providing the tool. + + - `name: String` + + Name of the MCP tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_use"` + + - `:"agent.mcp_tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + + - `class BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: String` + + Unique identifier for this event. + + - `mcp_tool_use_id: String` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_result"` + + - `:"agent.mcp_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the agent tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.tool_use"` + + - `:"agent.tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + + - `class BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `tool_use_id: String` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: :"agent.tool_result"` + + - `:"agent.tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thread_context_compacted"` + + - `:"agent.thread_context_compacted"` + + - `class BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: String` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :unknown_error` + + - `:unknown_error` + + - `class BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_overloaded_error` + + - `:model_overloaded_error` + + - `class BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_rate_limited_error` + + - `:model_rate_limited_error` + + - `class BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_request_failed_error` + + - `:model_request_failed_error` + + - `class BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: String` + + Name of the MCP server that failed to connect. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_connection_failed_error` + + - `:mcp_connection_failed_error` + + - `class BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: String` + + Name of the MCP server that failed authentication. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_authentication_failed_error` + + - `:mcp_authentication_failed_error` + + - `class BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :billing_error` + + - `:billing_error` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.error"` + + - `:"session.error"` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_rescheduled"` + + - `:"session.status_rescheduled"` + + - `class BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_running"` + + - `:"session.status_running"` + + - `class BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: :end_turn` + + - `:end_turn` + + - `class BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array[String]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: :requires_action` + + - `:requires_action` + + - `class BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: :retries_exhausted` + + - `:retries_exhausted` + + - `type: :"session.status_idle"` + + - `:"session.status_idle"` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_terminated"` + + - `:"session.status_terminated"` + + - `class BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_start"` + + - `:"span.model_request_start"` + + - `class BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: String` + + Unique identifier for this event. + + - `is_error: bool` + + Whether the model request resulted in an error. + + - `model_request_start_id: String` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: Integer` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: Integer` + + Tokens read from prompt cache in this request. + + - `input_tokens: Integer` + + Input tokens consumed by this request. + + - `output_tokens: Integer` + + Output tokens generated by this request. + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_end"` + + - `:"span.model_request_end"` + + - `class BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.deleted"` + + - `:"session.deleted"` + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +page = anthropic.beta.sessions.events.list("sesn_011CZkZAtmR3yMPDzynEDxu7") + +puts(page) +``` + +## Send + +`beta.sessions.events.send_(session_id, **kwargs) -> BetaManagedAgentsSendSessionEvents` + +**post** `/v1/sessions/{session_id}/events` + +Send Events + +### Parameters + +- `session_id: String` + +- `events: Array[BetaManagedAgentsEventParams]` + + Events to send to the `session`. + + - `class BetaManagedAgentsUserMessageEventParams` + + Parameters for sending a user message to the session. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + + - `class BetaManagedAgentsUserInterruptEventParams` + + Parameters for sending an interrupt to pause the agent. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + + - `class BetaManagedAgentsUserToolConfirmationEventParams` + + Parameters for confirming or denying a tool execution request. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `class BetaManagedAgentsUserCustomToolResultEventParams` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSendSessionEvents` + + Events that were successfully sent to the session. + + - `data: Array[BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | BetaManagedAgentsUserCustomToolResultEvent]` + + Sent events + + - `class BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: String` + + Unique identifier for this event. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: String` + + Unique identifier for this event. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: String` + + Unique identifier for this event. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_send_session_events = anthropic.beta.sessions.events.send_( + "sesn_011CZkZAtmR3yMPDzynEDxu7", + events: [{content: [{text: "Where is my order #1234?", type: :text}], type: :"user.message"}] +) + +puts(beta_managed_agents_send_session_events) +``` + +## Stream + +`beta.sessions.events.stream(session_id, **kwargs) -> BetaManagedAgentsStreamSessionEvents` + +**get** `/v1/sessions/{session_id}/events/stream` + +Stream Events + +### Parameters + +- `session_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsStreamSessionEvents = BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | 17 more` + + Server-sent event in the session stream. + + - `class BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: String` + + Unique identifier for this event. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: String` + + Unique identifier for this event. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: String` + + Unique identifier for this event. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the custom tool being called. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.custom_tool_use"` + + - `:"agent.custom_tool_use"` + + - `class BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.message"` + + - `:"agent.message"` + + - `class BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thinking"` + + - `:"agent.thinking"` + + - `class BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `mcp_server_name: String` + + Name of the MCP server providing the tool. + + - `name: String` + + Name of the MCP tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_use"` + + - `:"agent.mcp_tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + + - `class BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: String` + + Unique identifier for this event. + + - `mcp_tool_use_id: String` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_result"` + + - `:"agent.mcp_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the agent tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.tool_use"` + + - `:"agent.tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + + - `class BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `tool_use_id: String` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: :"agent.tool_result"` + + - `:"agent.tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thread_context_compacted"` + + - `:"agent.thread_context_compacted"` + + - `class BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: String` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :unknown_error` + + - `:unknown_error` + + - `class BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_overloaded_error` + + - `:model_overloaded_error` + + - `class BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_rate_limited_error` + + - `:model_rate_limited_error` + + - `class BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_request_failed_error` + + - `:model_request_failed_error` + + - `class BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: String` + + Name of the MCP server that failed to connect. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_connection_failed_error` + + - `:mcp_connection_failed_error` + + - `class BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: String` + + Name of the MCP server that failed authentication. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_authentication_failed_error` + + - `:mcp_authentication_failed_error` + + - `class BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :billing_error` + + - `:billing_error` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.error"` + + - `:"session.error"` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_rescheduled"` + + - `:"session.status_rescheduled"` + + - `class BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_running"` + + - `:"session.status_running"` + + - `class BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: :end_turn` + + - `:end_turn` + + - `class BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array[String]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: :requires_action` + + - `:requires_action` + + - `class BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: :retries_exhausted` + + - `:retries_exhausted` + + - `type: :"session.status_idle"` + + - `:"session.status_idle"` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_terminated"` + + - `:"session.status_terminated"` + + - `class BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_start"` + + - `:"span.model_request_start"` + + - `class BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: String` + + Unique identifier for this event. + + - `is_error: bool` + + Whether the model request resulted in an error. + + - `model_request_start_id: String` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: Integer` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: Integer` + + Tokens read from prompt cache in this request. + + - `input_tokens: Integer` + + Input tokens consumed by this request. + + - `output_tokens: Integer` + + Output tokens generated by this request. + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_end"` + + - `:"span.model_request_end"` + + - `class BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.deleted"` + + - `:"session.deleted"` + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_stream_session_events = anthropic.beta.sessions.events.stream("sesn_011CZkZAtmR3yMPDzynEDxu7") + +puts(beta_managed_agents_stream_session_events) +``` + +## Domain Types + +### Beta Managed Agents Agent Custom Tool Use Event + +- `class BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the custom tool being called. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.custom_tool_use"` + + - `:"agent.custom_tool_use"` + +### Beta Managed Agents Agent MCP Tool Result Event + +- `class BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: String` + + Unique identifier for this event. + + - `mcp_tool_use_id: String` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_result"` + + - `:"agent.mcp_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent MCP Tool Use Event + +- `class BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `mcp_server_name: String` + + Name of the MCP server providing the tool. + + - `name: String` + + Name of the MCP tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_use"` + + - `:"agent.mcp_tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + +### Beta Managed Agents Agent Message Event + +- `class BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.message"` + + - `:"agent.message"` + +### Beta Managed Agents Agent Thinking Event + +- `class BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thinking"` + + - `:"agent.thinking"` + +### Beta Managed Agents Agent Thread Context Compacted Event + +- `class BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thread_context_compacted"` + + - `:"agent.thread_context_compacted"` + +### Beta Managed Agents Agent Tool Result Event + +- `class BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `tool_use_id: String` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: :"agent.tool_result"` + + - `:"agent.tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent Tool Use Event + +- `class BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the agent tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.tool_use"` + + - `:"agent.tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + +### Beta Managed Agents Base64 Document Source + +- `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + +### Beta Managed Agents Base64 Image Source + +- `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + +### Beta Managed Agents Billing Error + +- `class BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :billing_error` + + - `:billing_error` + +### Beta Managed Agents Document Block + +- `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + +### Beta Managed Agents Event Params + +- `BetaManagedAgentsEventParams = BetaManagedAgentsUserMessageEventParams | BetaManagedAgentsUserInterruptEventParams | BetaManagedAgentsUserToolConfirmationEventParams | BetaManagedAgentsUserCustomToolResultEventParams` + + Union type for event parameters that can be sent to a session. + + - `class BetaManagedAgentsUserMessageEventParams` + + Parameters for sending a user message to the session. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + + - `class BetaManagedAgentsUserInterruptEventParams` + + Parameters for sending an interrupt to pause the agent. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + + - `class BetaManagedAgentsUserToolConfirmationEventParams` + + Parameters for confirming or denying a tool execution request. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `class BetaManagedAgentsUserCustomToolResultEventParams` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents File Document Source + +- `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + +### Beta Managed Agents File Image Source + +- `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + +### Beta Managed Agents Image Block + +- `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + +### Beta Managed Agents MCP Authentication Failed Error + +- `class BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: String` + + Name of the MCP server that failed authentication. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_authentication_failed_error` + + - `:mcp_authentication_failed_error` + +### Beta Managed Agents MCP Connection Failed Error + +- `class BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: String` + + Name of the MCP server that failed to connect. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_connection_failed_error` + + - `:mcp_connection_failed_error` + +### Beta Managed Agents Model Overloaded Error + +- `class BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_overloaded_error` + + - `:model_overloaded_error` + +### Beta Managed Agents Model Rate Limited Error + +- `class BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_rate_limited_error` + + - `:model_rate_limited_error` + +### Beta Managed Agents Model Request Failed Error + +- `class BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_request_failed_error` + + - `:model_request_failed_error` + +### Beta Managed Agents Plain Text Document Source + +- `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + +### Beta Managed Agents Retry Status Exhausted + +- `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + +### Beta Managed Agents Retry Status Retrying + +- `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + +### Beta Managed Agents Retry Status Terminal + +- `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + +### Beta Managed Agents Send Session Events + +- `class BetaManagedAgentsSendSessionEvents` + + Events that were successfully sent to the session. + + - `data: Array[BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | BetaManagedAgentsUserCustomToolResultEvent]` + + Sent events + + - `class BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: String` + + Unique identifier for this event. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: String` + + Unique identifier for this event. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: String` + + Unique identifier for this event. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents Session Deleted Event + +- `class BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.deleted"` + + - `:"session.deleted"` + +### Beta Managed Agents Session End Turn + +- `class BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: :end_turn` + + - `:end_turn` + +### Beta Managed Agents Session Error Event + +- `class BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: String` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :unknown_error` + + - `:unknown_error` + + - `class BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_overloaded_error` + + - `:model_overloaded_error` + + - `class BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_rate_limited_error` + + - `:model_rate_limited_error` + + - `class BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_request_failed_error` + + - `:model_request_failed_error` + + - `class BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: String` + + Name of the MCP server that failed to connect. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_connection_failed_error` + + - `:mcp_connection_failed_error` + + - `class BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: String` + + Name of the MCP server that failed authentication. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_authentication_failed_error` + + - `:mcp_authentication_failed_error` + + - `class BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :billing_error` + + - `:billing_error` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.error"` + + - `:"session.error"` + +### Beta Managed Agents Session Event + +- `BetaManagedAgentsSessionEvent = BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | 17 more` + + Union type for all event types in a session. + + - `class BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: String` + + Unique identifier for this event. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: String` + + Unique identifier for this event. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: String` + + Unique identifier for this event. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the custom tool being called. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.custom_tool_use"` + + - `:"agent.custom_tool_use"` + + - `class BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.message"` + + - `:"agent.message"` + + - `class BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thinking"` + + - `:"agent.thinking"` + + - `class BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `mcp_server_name: String` + + Name of the MCP server providing the tool. + + - `name: String` + + Name of the MCP tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_use"` + + - `:"agent.mcp_tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + + - `class BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: String` + + Unique identifier for this event. + + - `mcp_tool_use_id: String` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_result"` + + - `:"agent.mcp_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the agent tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.tool_use"` + + - `:"agent.tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + + - `class BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `tool_use_id: String` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: :"agent.tool_result"` + + - `:"agent.tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thread_context_compacted"` + + - `:"agent.thread_context_compacted"` + + - `class BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: String` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :unknown_error` + + - `:unknown_error` + + - `class BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_overloaded_error` + + - `:model_overloaded_error` + + - `class BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_rate_limited_error` + + - `:model_rate_limited_error` + + - `class BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_request_failed_error` + + - `:model_request_failed_error` + + - `class BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: String` + + Name of the MCP server that failed to connect. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_connection_failed_error` + + - `:mcp_connection_failed_error` + + - `class BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: String` + + Name of the MCP server that failed authentication. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_authentication_failed_error` + + - `:mcp_authentication_failed_error` + + - `class BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :billing_error` + + - `:billing_error` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.error"` + + - `:"session.error"` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_rescheduled"` + + - `:"session.status_rescheduled"` + + - `class BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_running"` + + - `:"session.status_running"` + + - `class BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: :end_turn` + + - `:end_turn` + + - `class BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array[String]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: :requires_action` + + - `:requires_action` + + - `class BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: :retries_exhausted` + + - `:retries_exhausted` + + - `type: :"session.status_idle"` + + - `:"session.status_idle"` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_terminated"` + + - `:"session.status_terminated"` + + - `class BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_start"` + + - `:"span.model_request_start"` + + - `class BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: String` + + Unique identifier for this event. + + - `is_error: bool` + + Whether the model request resulted in an error. + + - `model_request_start_id: String` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: Integer` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: Integer` + + Tokens read from prompt cache in this request. + + - `input_tokens: Integer` + + Input tokens consumed by this request. + + - `output_tokens: Integer` + + Output tokens generated by this request. + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_end"` + + - `:"span.model_request_end"` + + - `class BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.deleted"` + + - `:"session.deleted"` + +### Beta Managed Agents Session Requires Action + +- `class BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array[String]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: :requires_action` + + - `:requires_action` + +### Beta Managed Agents Session Retries Exhausted + +- `class BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: :retries_exhausted` + + - `:retries_exhausted` + +### Beta Managed Agents Session Status Idle Event + +- `class BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: :end_turn` + + - `:end_turn` + + - `class BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array[String]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: :requires_action` + + - `:requires_action` + + - `class BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: :retries_exhausted` + + - `:retries_exhausted` + + - `type: :"session.status_idle"` + + - `:"session.status_idle"` + +### Beta Managed Agents Session Status Rescheduled Event + +- `class BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_rescheduled"` + + - `:"session.status_rescheduled"` + +### Beta Managed Agents Session Status Running Event + +- `class BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_running"` + + - `:"session.status_running"` + +### Beta Managed Agents Session Status Terminated Event + +- `class BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_terminated"` + + - `:"session.status_terminated"` + +### Beta Managed Agents Span Model Request End Event + +- `class BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: String` + + Unique identifier for this event. + + - `is_error: bool` + + Whether the model request resulted in an error. + + - `model_request_start_id: String` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: Integer` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: Integer` + + Tokens read from prompt cache in this request. + + - `input_tokens: Integer` + + Input tokens consumed by this request. + + - `output_tokens: Integer` + + Output tokens generated by this request. + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_end"` + + - `:"span.model_request_end"` + +### Beta Managed Agents Span Model Request Start Event + +- `class BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_start"` + + - `:"span.model_request_start"` + +### Beta Managed Agents Span Model Usage + +- `class BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: Integer` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: Integer` + + Tokens read from prompt cache in this request. + + - `input_tokens: Integer` + + Input tokens consumed by this request. + + - `output_tokens: Integer` + + Output tokens generated by this request. + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + +### Beta Managed Agents Stream Session Events + +- `BetaManagedAgentsStreamSessionEvents = BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | 17 more` + + Server-sent event in the session stream. + + - `class BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: String` + + Unique identifier for this event. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: String` + + Unique identifier for this event. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: String` + + Unique identifier for this event. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the custom tool being called. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.custom_tool_use"` + + - `:"agent.custom_tool_use"` + + - `class BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.message"` + + - `:"agent.message"` + + - `class BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thinking"` + + - `:"agent.thinking"` + + - `class BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `mcp_server_name: String` + + Name of the MCP server providing the tool. + + - `name: String` + + Name of the MCP tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_use"` + + - `:"agent.mcp_tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + + - `class BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: String` + + Unique identifier for this event. + + - `mcp_tool_use_id: String` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_result"` + + - `:"agent.mcp_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the agent tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.tool_use"` + + - `:"agent.tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + + - `class BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `tool_use_id: String` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: :"agent.tool_result"` + + - `:"agent.tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thread_context_compacted"` + + - `:"agent.thread_context_compacted"` + + - `class BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: String` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :unknown_error` + + - `:unknown_error` + + - `class BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_overloaded_error` + + - `:model_overloaded_error` + + - `class BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_rate_limited_error` + + - `:model_rate_limited_error` + + - `class BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_request_failed_error` + + - `:model_request_failed_error` + + - `class BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: String` + + Name of the MCP server that failed to connect. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_connection_failed_error` + + - `:mcp_connection_failed_error` + + - `class BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: String` + + Name of the MCP server that failed authentication. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_authentication_failed_error` + + - `:mcp_authentication_failed_error` + + - `class BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :billing_error` + + - `:billing_error` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.error"` + + - `:"session.error"` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_rescheduled"` + + - `:"session.status_rescheduled"` + + - `class BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_running"` + + - `:"session.status_running"` + + - `class BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: :end_turn` + + - `:end_turn` + + - `class BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array[String]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: :requires_action` + + - `:requires_action` + + - `class BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: :retries_exhausted` + + - `:retries_exhausted` + + - `type: :"session.status_idle"` + + - `:"session.status_idle"` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_terminated"` + + - `:"session.status_terminated"` + + - `class BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_start"` + + - `:"span.model_request_start"` + + - `class BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: String` + + Unique identifier for this event. + + - `is_error: bool` + + Whether the model request resulted in an error. + + - `model_request_start_id: String` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: Integer` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: Integer` + + Tokens read from prompt cache in this request. + + - `input_tokens: Integer` + + Input tokens consumed by this request. + + - `output_tokens: Integer` + + Output tokens generated by this request. + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_end"` + + - `:"span.model_request_end"` + + - `class BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.deleted"` + + - `:"session.deleted"` + +### Beta Managed Agents Text Block + +- `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + +### Beta Managed Agents Unknown Error + +- `class BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :unknown_error` + + - `:unknown_error` + +### Beta Managed Agents URL Document Source + +- `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + +### Beta Managed Agents URL Image Source + +- `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + +### Beta Managed Agents User Custom Tool Result Event + +- `class BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: String` + + Unique identifier for this event. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Custom Tool Result Event Params + +- `class BetaManagedAgentsUserCustomToolResultEventParams` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents User Interrupt Event + +- `class BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: String` + + Unique identifier for this event. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Interrupt Event Params + +- `class BetaManagedAgentsUserInterruptEventParams` + + Parameters for sending an interrupt to pause the agent. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + +### Beta Managed Agents User Message Event + +- `class BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Message Event Params + +- `class BetaManagedAgentsUserMessageEventParams` + + Parameters for sending a user message to the session. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + +### Beta Managed Agents User Tool Confirmation Event + +- `class BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: String` + + Unique identifier for this event. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Tool Confirmation Event Params + +- `class BetaManagedAgentsUserToolConfirmationEventParams` + + Parameters for confirming or denying a tool execution request. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + +# Resources + +## Add + +`beta.sessions.resources.add(session_id, **kwargs) -> BetaManagedAgentsFileResource` + +**post** `/v1/sessions/{session_id}/resources` + +Add Session Resource + +### Parameters + +- `session_id: String` + +- `file_id: String` + + ID of a previously uploaded file. + +- `type: :file` + + - `:file` + +- `mount_path: String` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_file_resource = anthropic.beta.sessions.resources.add( + "sesn_011CZkZAtmR3yMPDzynEDxu7", + file_id: "file_011CNha8iCJcU1wXNR6q4V8w", + type: :file +) + +puts(beta_managed_agents_file_resource) +``` + +## List + +`beta.sessions.resources.list(session_id, **kwargs) -> PageCursor` + +**get** `/v1/sessions/{session_id}/resources` + +List Session Resources + +### Parameters + +- `session_id: String` + +- `limit: Integer` + + Maximum number of resources to return per page (max 1000). If omitted, returns all resources. + +- `page: String` + + Opaque cursor from a previous response's next_page field. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSessionResource = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +page = anthropic.beta.sessions.resources.list("sesn_011CZkZAtmR3yMPDzynEDxu7") + +puts(page) +``` + +## Retrieve + +`beta.sessions.resources.retrieve(resource_id, **kwargs) -> ResourceRetrieveResponse` + +**get** `/v1/sessions/{session_id}/resources/{resource_id}` + +Get Session Resource + +### Parameters + +- `session_id: String` + +- `resource_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `ResourceRetrieveResponse = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + The requested session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +resource = anthropic.beta.sessions.resources.retrieve( + "sesrsc_011CZkZBJq5dWxk9fVLNcPht", + session_id: "sesn_011CZkZAtmR3yMPDzynEDxu7" +) + +puts(resource) +``` + +## Update + +`beta.sessions.resources.update(resource_id, **kwargs) -> ResourceUpdateResponse` + +**post** `/v1/sessions/{session_id}/resources/{resource_id}` + +Update Session Resource + +### Parameters + +- `session_id: String` + +- `resource_id: String` + +- `authorization_token: String` + + New authorization token for the resource. Currently only `github_repository` resources support token rotation. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `ResourceUpdateResponse = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + The updated session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +resource = anthropic.beta.sessions.resources.update( + "sesrsc_011CZkZBJq5dWxk9fVLNcPht", + session_id: "sesn_011CZkZAtmR3yMPDzynEDxu7", + authorization_token: "ghp_exampletoken" +) + +puts(resource) +``` + +## Delete + +`beta.sessions.resources.delete(resource_id, **kwargs) -> BetaManagedAgentsDeleteSessionResource` + +**delete** `/v1/sessions/{session_id}/resources/{resource_id}` + +Delete Session Resource + +### Parameters + +- `session_id: String` + +- `resource_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsDeleteSessionResource` + + Confirmation of resource deletion. + + - `id: String` + + - `type: :session_resource_deleted` + + - `:session_resource_deleted` + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_delete_session_resource = anthropic.beta.sessions.resources.delete( + "sesrsc_011CZkZBJq5dWxk9fVLNcPht", + session_id: "sesn_011CZkZAtmR3yMPDzynEDxu7" +) + +puts(beta_managed_agents_delete_session_resource) +``` + +## Domain Types + +### Beta Managed Agents Delete Session Resource + +- `class BetaManagedAgentsDeleteSessionResource` + + Confirmation of resource deletion. + + - `id: String` + + - `type: :session_resource_deleted` + + - `:session_resource_deleted` + +### Beta Managed Agents File Resource + +- `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents GitHub Repository Resource + +- `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + +### Beta Managed Agents Session Resource + +- `BetaManagedAgentsSessionResource = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Resource Retrieve Response + +- `ResourceRetrieveResponse = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + The requested session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Resource Update Response + +- `ResourceUpdateResponse = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + The updated session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format diff --git a/content/en/api/ruby/beta/sessions/archive.md b/content/en/api/ruby/beta/sessions/archive.md new file mode 100644 index 000000000..81c18e1da --- /dev/null +++ b/content/en/api/ruby/beta/sessions/archive.md @@ -0,0 +1,503 @@ +## Archive + +`beta.sessions.archive(session_id, **kwargs) -> BetaManagedAgentsSession` + +**post** `/v1/sessions/{session_id}/archive` + +Archive Session + +### Parameters + +- `session_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: String` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: String` + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `version: Integer` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `environment_id: String` + + - `metadata: Hash[Symbol, String]` + + - `resources: Array[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Float` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Float` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: :rescheduling | :running | :idle | :terminated` + + SessionStatus enum + + - `:rescheduling` + + - `:running` + + - `:idle` + + - `:terminated` + + - `title: String` + + - `type: :session` + + - `:session` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Integer` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Integer` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Integer` + + Total tokens read from prompt cache. + + - `input_tokens: Integer` + + Total input tokens consumed across all turns. + + - `output_tokens: Integer` + + Total output tokens generated across all turns. + + - `vault_ids: Array[String]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_session = anthropic.beta.sessions.archive("sesn_011CZkZAtmR3yMPDzynEDxu7") + +puts(beta_managed_agents_session) +``` diff --git a/content/en/api/ruby/beta/sessions/create.md b/content/en/api/ruby/beta/sessions/create.md new file mode 100644 index 000000000..853e5771d --- /dev/null +++ b/content/en/api/ruby/beta/sessions/create.md @@ -0,0 +1,606 @@ +## Create + +`beta.sessions.create(**kwargs) -> BetaManagedAgentsSession` + +**post** `/v1/sessions` + +Create Session + +### Parameters + +- `agent: String | BetaManagedAgentsAgentParams` + + Agent identifier. Accepts the `agent` ID string, which pins the latest version for the session, or an `agent` object with both id and version specified. + + - `String` + + - `class BetaManagedAgentsAgentParams` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `id: String` + + The `agent` ID. + + - `type: :agent` + + - `:agent` + + - `version: Integer` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + +- `environment_id: String` + + ID of the `environment` defining the container configuration for this session. + +- `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the session. + +- `resources: Array[BetaManagedAgentsGitHubRepositoryResourceParams | BetaManagedAgentsFileResourceParams]` + + Resources (e.g. repositories, files) to mount into the session's container. + + - `class BetaManagedAgentsGitHubRepositoryResourceParams` + + Mount a GitHub repository into the session's container. + + - `authorization_token: String` + + GitHub authorization token used to clone the repository. + + - `type: :github_repository` + + - `:github_repository` + + - `url: String` + + Github URL of the repository + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `mount_path: String` + + Mount path in the container. Defaults to `/workspace/`. + + - `class BetaManagedAgentsFileResourceParams` + + Mount a file uploaded via the Files API into the session. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `mount_path: String` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +- `title: String` + + Human-readable session title. + +- `vault_ids: Array[String]` + + Vault IDs for stored credentials the agent can use during the session. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: String` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: String` + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `version: Integer` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `environment_id: String` + + - `metadata: Hash[Symbol, String]` + + - `resources: Array[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Float` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Float` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: :rescheduling | :running | :idle | :terminated` + + SessionStatus enum + + - `:rescheduling` + + - `:running` + + - `:idle` + + - `:terminated` + + - `title: String` + + - `type: :session` + + - `:session` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Integer` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Integer` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Integer` + + Total tokens read from prompt cache. + + - `input_tokens: Integer` + + Total input tokens consumed across all turns. + + - `output_tokens: Integer` + + Total output tokens generated across all turns. + + - `vault_ids: Array[String]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_session = anthropic.beta.sessions.create( + agent: "agent_011CZkYpogX7uDKUyvBTophP", + environment_id: "env_011CZkZ9X2dpNyB7HsEFoRfW" +) + +puts(beta_managed_agents_session) +``` diff --git a/content/en/api/ruby/beta/sessions/delete.md b/content/en/api/ruby/beta/sessions/delete.md new file mode 100644 index 000000000..f3cd76833 --- /dev/null +++ b/content/en/api/ruby/beta/sessions/delete.md @@ -0,0 +1,85 @@ +## Delete + +`beta.sessions.delete(session_id, **kwargs) -> BetaManagedAgentsDeletedSession` + +**delete** `/v1/sessions/{session_id}` + +Delete Session + +### Parameters + +- `session_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsDeletedSession` + + Confirmation that a `session` has been permanently deleted. + + - `id: String` + + - `type: :session_deleted` + + - `:session_deleted` + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_deleted_session = anthropic.beta.sessions.delete("sesn_011CZkZAtmR3yMPDzynEDxu7") + +puts(beta_managed_agents_deleted_session) +``` diff --git a/content/en/api/ruby/beta/sessions/events.md b/content/en/api/ruby/beta/sessions/events.md new file mode 100644 index 000000000..586871076 --- /dev/null +++ b/content/en/api/ruby/beta/sessions/events.md @@ -0,0 +1,9626 @@ +# Events + +## List + +`beta.sessions.events.list(session_id, **kwargs) -> PageCursor` + +**get** `/v1/sessions/{session_id}/events` + +List Events + +### Parameters + +- `session_id: String` + +- `limit: Integer` + + Query parameter for limit + +- `order: :asc | :desc` + + Sort direction for results, ordered by created_at. Defaults to asc (chronological). + + - `:asc` + + - `:desc` + +- `page: String` + + Opaque pagination cursor from a previous response's next_page. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSessionEvent = BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | 17 more` + + Union type for all event types in a session. + + - `class BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: String` + + Unique identifier for this event. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: String` + + Unique identifier for this event. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: String` + + Unique identifier for this event. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the custom tool being called. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.custom_tool_use"` + + - `:"agent.custom_tool_use"` + + - `class BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.message"` + + - `:"agent.message"` + + - `class BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thinking"` + + - `:"agent.thinking"` + + - `class BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `mcp_server_name: String` + + Name of the MCP server providing the tool. + + - `name: String` + + Name of the MCP tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_use"` + + - `:"agent.mcp_tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + + - `class BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: String` + + Unique identifier for this event. + + - `mcp_tool_use_id: String` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_result"` + + - `:"agent.mcp_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the agent tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.tool_use"` + + - `:"agent.tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + + - `class BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `tool_use_id: String` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: :"agent.tool_result"` + + - `:"agent.tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thread_context_compacted"` + + - `:"agent.thread_context_compacted"` + + - `class BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: String` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :unknown_error` + + - `:unknown_error` + + - `class BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_overloaded_error` + + - `:model_overloaded_error` + + - `class BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_rate_limited_error` + + - `:model_rate_limited_error` + + - `class BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_request_failed_error` + + - `:model_request_failed_error` + + - `class BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: String` + + Name of the MCP server that failed to connect. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_connection_failed_error` + + - `:mcp_connection_failed_error` + + - `class BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: String` + + Name of the MCP server that failed authentication. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_authentication_failed_error` + + - `:mcp_authentication_failed_error` + + - `class BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :billing_error` + + - `:billing_error` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.error"` + + - `:"session.error"` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_rescheduled"` + + - `:"session.status_rescheduled"` + + - `class BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_running"` + + - `:"session.status_running"` + + - `class BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: :end_turn` + + - `:end_turn` + + - `class BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array[String]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: :requires_action` + + - `:requires_action` + + - `class BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: :retries_exhausted` + + - `:retries_exhausted` + + - `type: :"session.status_idle"` + + - `:"session.status_idle"` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_terminated"` + + - `:"session.status_terminated"` + + - `class BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_start"` + + - `:"span.model_request_start"` + + - `class BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: String` + + Unique identifier for this event. + + - `is_error: bool` + + Whether the model request resulted in an error. + + - `model_request_start_id: String` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: Integer` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: Integer` + + Tokens read from prompt cache in this request. + + - `input_tokens: Integer` + + Input tokens consumed by this request. + + - `output_tokens: Integer` + + Output tokens generated by this request. + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_end"` + + - `:"span.model_request_end"` + + - `class BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.deleted"` + + - `:"session.deleted"` + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +page = anthropic.beta.sessions.events.list("sesn_011CZkZAtmR3yMPDzynEDxu7") + +puts(page) +``` + +## Send + +`beta.sessions.events.send_(session_id, **kwargs) -> BetaManagedAgentsSendSessionEvents` + +**post** `/v1/sessions/{session_id}/events` + +Send Events + +### Parameters + +- `session_id: String` + +- `events: Array[BetaManagedAgentsEventParams]` + + Events to send to the `session`. + + - `class BetaManagedAgentsUserMessageEventParams` + + Parameters for sending a user message to the session. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + + - `class BetaManagedAgentsUserInterruptEventParams` + + Parameters for sending an interrupt to pause the agent. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + + - `class BetaManagedAgentsUserToolConfirmationEventParams` + + Parameters for confirming or denying a tool execution request. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `class BetaManagedAgentsUserCustomToolResultEventParams` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSendSessionEvents` + + Events that were successfully sent to the session. + + - `data: Array[BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | BetaManagedAgentsUserCustomToolResultEvent]` + + Sent events + + - `class BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: String` + + Unique identifier for this event. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: String` + + Unique identifier for this event. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: String` + + Unique identifier for this event. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_send_session_events = anthropic.beta.sessions.events.send_( + "sesn_011CZkZAtmR3yMPDzynEDxu7", + events: [{content: [{text: "Where is my order #1234?", type: :text}], type: :"user.message"}] +) + +puts(beta_managed_agents_send_session_events) +``` + +## Stream + +`beta.sessions.events.stream(session_id, **kwargs) -> BetaManagedAgentsStreamSessionEvents` + +**get** `/v1/sessions/{session_id}/events/stream` + +Stream Events + +### Parameters + +- `session_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsStreamSessionEvents = BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | 17 more` + + Server-sent event in the session stream. + + - `class BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: String` + + Unique identifier for this event. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: String` + + Unique identifier for this event. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: String` + + Unique identifier for this event. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the custom tool being called. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.custom_tool_use"` + + - `:"agent.custom_tool_use"` + + - `class BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.message"` + + - `:"agent.message"` + + - `class BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thinking"` + + - `:"agent.thinking"` + + - `class BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `mcp_server_name: String` + + Name of the MCP server providing the tool. + + - `name: String` + + Name of the MCP tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_use"` + + - `:"agent.mcp_tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + + - `class BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: String` + + Unique identifier for this event. + + - `mcp_tool_use_id: String` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_result"` + + - `:"agent.mcp_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the agent tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.tool_use"` + + - `:"agent.tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + + - `class BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `tool_use_id: String` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: :"agent.tool_result"` + + - `:"agent.tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thread_context_compacted"` + + - `:"agent.thread_context_compacted"` + + - `class BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: String` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :unknown_error` + + - `:unknown_error` + + - `class BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_overloaded_error` + + - `:model_overloaded_error` + + - `class BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_rate_limited_error` + + - `:model_rate_limited_error` + + - `class BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_request_failed_error` + + - `:model_request_failed_error` + + - `class BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: String` + + Name of the MCP server that failed to connect. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_connection_failed_error` + + - `:mcp_connection_failed_error` + + - `class BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: String` + + Name of the MCP server that failed authentication. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_authentication_failed_error` + + - `:mcp_authentication_failed_error` + + - `class BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :billing_error` + + - `:billing_error` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.error"` + + - `:"session.error"` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_rescheduled"` + + - `:"session.status_rescheduled"` + + - `class BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_running"` + + - `:"session.status_running"` + + - `class BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: :end_turn` + + - `:end_turn` + + - `class BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array[String]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: :requires_action` + + - `:requires_action` + + - `class BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: :retries_exhausted` + + - `:retries_exhausted` + + - `type: :"session.status_idle"` + + - `:"session.status_idle"` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_terminated"` + + - `:"session.status_terminated"` + + - `class BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_start"` + + - `:"span.model_request_start"` + + - `class BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: String` + + Unique identifier for this event. + + - `is_error: bool` + + Whether the model request resulted in an error. + + - `model_request_start_id: String` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: Integer` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: Integer` + + Tokens read from prompt cache in this request. + + - `input_tokens: Integer` + + Input tokens consumed by this request. + + - `output_tokens: Integer` + + Output tokens generated by this request. + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_end"` + + - `:"span.model_request_end"` + + - `class BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.deleted"` + + - `:"session.deleted"` + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_stream_session_events = anthropic.beta.sessions.events.stream("sesn_011CZkZAtmR3yMPDzynEDxu7") + +puts(beta_managed_agents_stream_session_events) +``` + +## Domain Types + +### Beta Managed Agents Agent Custom Tool Use Event + +- `class BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the custom tool being called. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.custom_tool_use"` + + - `:"agent.custom_tool_use"` + +### Beta Managed Agents Agent MCP Tool Result Event + +- `class BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: String` + + Unique identifier for this event. + + - `mcp_tool_use_id: String` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_result"` + + - `:"agent.mcp_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent MCP Tool Use Event + +- `class BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `mcp_server_name: String` + + Name of the MCP server providing the tool. + + - `name: String` + + Name of the MCP tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_use"` + + - `:"agent.mcp_tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + +### Beta Managed Agents Agent Message Event + +- `class BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.message"` + + - `:"agent.message"` + +### Beta Managed Agents Agent Thinking Event + +- `class BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thinking"` + + - `:"agent.thinking"` + +### Beta Managed Agents Agent Thread Context Compacted Event + +- `class BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thread_context_compacted"` + + - `:"agent.thread_context_compacted"` + +### Beta Managed Agents Agent Tool Result Event + +- `class BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `tool_use_id: String` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: :"agent.tool_result"` + + - `:"agent.tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent Tool Use Event + +- `class BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the agent tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.tool_use"` + + - `:"agent.tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + +### Beta Managed Agents Base64 Document Source + +- `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + +### Beta Managed Agents Base64 Image Source + +- `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + +### Beta Managed Agents Billing Error + +- `class BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :billing_error` + + - `:billing_error` + +### Beta Managed Agents Document Block + +- `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + +### Beta Managed Agents Event Params + +- `BetaManagedAgentsEventParams = BetaManagedAgentsUserMessageEventParams | BetaManagedAgentsUserInterruptEventParams | BetaManagedAgentsUserToolConfirmationEventParams | BetaManagedAgentsUserCustomToolResultEventParams` + + Union type for event parameters that can be sent to a session. + + - `class BetaManagedAgentsUserMessageEventParams` + + Parameters for sending a user message to the session. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + + - `class BetaManagedAgentsUserInterruptEventParams` + + Parameters for sending an interrupt to pause the agent. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + + - `class BetaManagedAgentsUserToolConfirmationEventParams` + + Parameters for confirming or denying a tool execution request. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `class BetaManagedAgentsUserCustomToolResultEventParams` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents File Document Source + +- `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + +### Beta Managed Agents File Image Source + +- `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + +### Beta Managed Agents Image Block + +- `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + +### Beta Managed Agents MCP Authentication Failed Error + +- `class BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: String` + + Name of the MCP server that failed authentication. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_authentication_failed_error` + + - `:mcp_authentication_failed_error` + +### Beta Managed Agents MCP Connection Failed Error + +- `class BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: String` + + Name of the MCP server that failed to connect. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_connection_failed_error` + + - `:mcp_connection_failed_error` + +### Beta Managed Agents Model Overloaded Error + +- `class BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_overloaded_error` + + - `:model_overloaded_error` + +### Beta Managed Agents Model Rate Limited Error + +- `class BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_rate_limited_error` + + - `:model_rate_limited_error` + +### Beta Managed Agents Model Request Failed Error + +- `class BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_request_failed_error` + + - `:model_request_failed_error` + +### Beta Managed Agents Plain Text Document Source + +- `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + +### Beta Managed Agents Retry Status Exhausted + +- `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + +### Beta Managed Agents Retry Status Retrying + +- `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + +### Beta Managed Agents Retry Status Terminal + +- `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + +### Beta Managed Agents Send Session Events + +- `class BetaManagedAgentsSendSessionEvents` + + Events that were successfully sent to the session. + + - `data: Array[BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | BetaManagedAgentsUserCustomToolResultEvent]` + + Sent events + + - `class BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: String` + + Unique identifier for this event. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: String` + + Unique identifier for this event. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: String` + + Unique identifier for this event. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents Session Deleted Event + +- `class BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.deleted"` + + - `:"session.deleted"` + +### Beta Managed Agents Session End Turn + +- `class BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: :end_turn` + + - `:end_turn` + +### Beta Managed Agents Session Error Event + +- `class BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: String` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :unknown_error` + + - `:unknown_error` + + - `class BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_overloaded_error` + + - `:model_overloaded_error` + + - `class BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_rate_limited_error` + + - `:model_rate_limited_error` + + - `class BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_request_failed_error` + + - `:model_request_failed_error` + + - `class BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: String` + + Name of the MCP server that failed to connect. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_connection_failed_error` + + - `:mcp_connection_failed_error` + + - `class BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: String` + + Name of the MCP server that failed authentication. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_authentication_failed_error` + + - `:mcp_authentication_failed_error` + + - `class BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :billing_error` + + - `:billing_error` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.error"` + + - `:"session.error"` + +### Beta Managed Agents Session Event + +- `BetaManagedAgentsSessionEvent = BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | 17 more` + + Union type for all event types in a session. + + - `class BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: String` + + Unique identifier for this event. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: String` + + Unique identifier for this event. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: String` + + Unique identifier for this event. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the custom tool being called. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.custom_tool_use"` + + - `:"agent.custom_tool_use"` + + - `class BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.message"` + + - `:"agent.message"` + + - `class BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thinking"` + + - `:"agent.thinking"` + + - `class BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `mcp_server_name: String` + + Name of the MCP server providing the tool. + + - `name: String` + + Name of the MCP tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_use"` + + - `:"agent.mcp_tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + + - `class BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: String` + + Unique identifier for this event. + + - `mcp_tool_use_id: String` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_result"` + + - `:"agent.mcp_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the agent tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.tool_use"` + + - `:"agent.tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + + - `class BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `tool_use_id: String` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: :"agent.tool_result"` + + - `:"agent.tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thread_context_compacted"` + + - `:"agent.thread_context_compacted"` + + - `class BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: String` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :unknown_error` + + - `:unknown_error` + + - `class BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_overloaded_error` + + - `:model_overloaded_error` + + - `class BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_rate_limited_error` + + - `:model_rate_limited_error` + + - `class BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_request_failed_error` + + - `:model_request_failed_error` + + - `class BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: String` + + Name of the MCP server that failed to connect. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_connection_failed_error` + + - `:mcp_connection_failed_error` + + - `class BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: String` + + Name of the MCP server that failed authentication. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_authentication_failed_error` + + - `:mcp_authentication_failed_error` + + - `class BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :billing_error` + + - `:billing_error` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.error"` + + - `:"session.error"` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_rescheduled"` + + - `:"session.status_rescheduled"` + + - `class BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_running"` + + - `:"session.status_running"` + + - `class BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: :end_turn` + + - `:end_turn` + + - `class BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array[String]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: :requires_action` + + - `:requires_action` + + - `class BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: :retries_exhausted` + + - `:retries_exhausted` + + - `type: :"session.status_idle"` + + - `:"session.status_idle"` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_terminated"` + + - `:"session.status_terminated"` + + - `class BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_start"` + + - `:"span.model_request_start"` + + - `class BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: String` + + Unique identifier for this event. + + - `is_error: bool` + + Whether the model request resulted in an error. + + - `model_request_start_id: String` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: Integer` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: Integer` + + Tokens read from prompt cache in this request. + + - `input_tokens: Integer` + + Input tokens consumed by this request. + + - `output_tokens: Integer` + + Output tokens generated by this request. + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_end"` + + - `:"span.model_request_end"` + + - `class BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.deleted"` + + - `:"session.deleted"` + +### Beta Managed Agents Session Requires Action + +- `class BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array[String]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: :requires_action` + + - `:requires_action` + +### Beta Managed Agents Session Retries Exhausted + +- `class BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: :retries_exhausted` + + - `:retries_exhausted` + +### Beta Managed Agents Session Status Idle Event + +- `class BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: :end_turn` + + - `:end_turn` + + - `class BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array[String]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: :requires_action` + + - `:requires_action` + + - `class BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: :retries_exhausted` + + - `:retries_exhausted` + + - `type: :"session.status_idle"` + + - `:"session.status_idle"` + +### Beta Managed Agents Session Status Rescheduled Event + +- `class BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_rescheduled"` + + - `:"session.status_rescheduled"` + +### Beta Managed Agents Session Status Running Event + +- `class BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_running"` + + - `:"session.status_running"` + +### Beta Managed Agents Session Status Terminated Event + +- `class BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_terminated"` + + - `:"session.status_terminated"` + +### Beta Managed Agents Span Model Request End Event + +- `class BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: String` + + Unique identifier for this event. + + - `is_error: bool` + + Whether the model request resulted in an error. + + - `model_request_start_id: String` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: Integer` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: Integer` + + Tokens read from prompt cache in this request. + + - `input_tokens: Integer` + + Input tokens consumed by this request. + + - `output_tokens: Integer` + + Output tokens generated by this request. + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_end"` + + - `:"span.model_request_end"` + +### Beta Managed Agents Span Model Request Start Event + +- `class BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_start"` + + - `:"span.model_request_start"` + +### Beta Managed Agents Span Model Usage + +- `class BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: Integer` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: Integer` + + Tokens read from prompt cache in this request. + + - `input_tokens: Integer` + + Input tokens consumed by this request. + + - `output_tokens: Integer` + + Output tokens generated by this request. + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + +### Beta Managed Agents Stream Session Events + +- `BetaManagedAgentsStreamSessionEvents = BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | 17 more` + + Server-sent event in the session stream. + + - `class BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: String` + + Unique identifier for this event. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: String` + + Unique identifier for this event. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: String` + + Unique identifier for this event. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the custom tool being called. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.custom_tool_use"` + + - `:"agent.custom_tool_use"` + + - `class BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.message"` + + - `:"agent.message"` + + - `class BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thinking"` + + - `:"agent.thinking"` + + - `class BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `mcp_server_name: String` + + Name of the MCP server providing the tool. + + - `name: String` + + Name of the MCP tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_use"` + + - `:"agent.mcp_tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + + - `class BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: String` + + Unique identifier for this event. + + - `mcp_tool_use_id: String` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_result"` + + - `:"agent.mcp_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the agent tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.tool_use"` + + - `:"agent.tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + + - `class BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `tool_use_id: String` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: :"agent.tool_result"` + + - `:"agent.tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thread_context_compacted"` + + - `:"agent.thread_context_compacted"` + + - `class BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: String` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :unknown_error` + + - `:unknown_error` + + - `class BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_overloaded_error` + + - `:model_overloaded_error` + + - `class BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_rate_limited_error` + + - `:model_rate_limited_error` + + - `class BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_request_failed_error` + + - `:model_request_failed_error` + + - `class BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: String` + + Name of the MCP server that failed to connect. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_connection_failed_error` + + - `:mcp_connection_failed_error` + + - `class BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: String` + + Name of the MCP server that failed authentication. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_authentication_failed_error` + + - `:mcp_authentication_failed_error` + + - `class BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :billing_error` + + - `:billing_error` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.error"` + + - `:"session.error"` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_rescheduled"` + + - `:"session.status_rescheduled"` + + - `class BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_running"` + + - `:"session.status_running"` + + - `class BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: :end_turn` + + - `:end_turn` + + - `class BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array[String]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: :requires_action` + + - `:requires_action` + + - `class BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: :retries_exhausted` + + - `:retries_exhausted` + + - `type: :"session.status_idle"` + + - `:"session.status_idle"` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_terminated"` + + - `:"session.status_terminated"` + + - `class BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_start"` + + - `:"span.model_request_start"` + + - `class BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: String` + + Unique identifier for this event. + + - `is_error: bool` + + Whether the model request resulted in an error. + + - `model_request_start_id: String` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: Integer` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: Integer` + + Tokens read from prompt cache in this request. + + - `input_tokens: Integer` + + Input tokens consumed by this request. + + - `output_tokens: Integer` + + Output tokens generated by this request. + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_end"` + + - `:"span.model_request_end"` + + - `class BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.deleted"` + + - `:"session.deleted"` + +### Beta Managed Agents Text Block + +- `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + +### Beta Managed Agents Unknown Error + +- `class BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :unknown_error` + + - `:unknown_error` + +### Beta Managed Agents URL Document Source + +- `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + +### Beta Managed Agents URL Image Source + +- `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + +### Beta Managed Agents User Custom Tool Result Event + +- `class BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: String` + + Unique identifier for this event. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Custom Tool Result Event Params + +- `class BetaManagedAgentsUserCustomToolResultEventParams` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents User Interrupt Event + +- `class BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: String` + + Unique identifier for this event. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Interrupt Event Params + +- `class BetaManagedAgentsUserInterruptEventParams` + + Parameters for sending an interrupt to pause the agent. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + +### Beta Managed Agents User Message Event + +- `class BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Message Event Params + +- `class BetaManagedAgentsUserMessageEventParams` + + Parameters for sending a user message to the session. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + +### Beta Managed Agents User Tool Confirmation Event + +- `class BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: String` + + Unique identifier for this event. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Tool Confirmation Event Params + +- `class BetaManagedAgentsUserToolConfirmationEventParams` + + Parameters for confirming or denying a tool execution request. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. diff --git a/content/en/api/ruby/beta/sessions/events/list.md b/content/en/api/ruby/beta/sessions/events/list.md new file mode 100644 index 000000000..1c30a4dbd --- /dev/null +++ b/content/en/api/ruby/beta/sessions/events/list.md @@ -0,0 +1,1459 @@ +## List + +`beta.sessions.events.list(session_id, **kwargs) -> PageCursor` + +**get** `/v1/sessions/{session_id}/events` + +List Events + +### Parameters + +- `session_id: String` + +- `limit: Integer` + + Query parameter for limit + +- `order: :asc | :desc` + + Sort direction for results, ordered by created_at. Defaults to asc (chronological). + + - `:asc` + + - `:desc` + +- `page: String` + + Opaque pagination cursor from a previous response's next_page. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSessionEvent = BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | 17 more` + + Union type for all event types in a session. + + - `class BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: String` + + Unique identifier for this event. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: String` + + Unique identifier for this event. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: String` + + Unique identifier for this event. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the custom tool being called. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.custom_tool_use"` + + - `:"agent.custom_tool_use"` + + - `class BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.message"` + + - `:"agent.message"` + + - `class BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thinking"` + + - `:"agent.thinking"` + + - `class BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `mcp_server_name: String` + + Name of the MCP server providing the tool. + + - `name: String` + + Name of the MCP tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_use"` + + - `:"agent.mcp_tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + + - `class BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: String` + + Unique identifier for this event. + + - `mcp_tool_use_id: String` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_result"` + + - `:"agent.mcp_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the agent tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.tool_use"` + + - `:"agent.tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + + - `class BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `tool_use_id: String` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: :"agent.tool_result"` + + - `:"agent.tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thread_context_compacted"` + + - `:"agent.thread_context_compacted"` + + - `class BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: String` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :unknown_error` + + - `:unknown_error` + + - `class BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_overloaded_error` + + - `:model_overloaded_error` + + - `class BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_rate_limited_error` + + - `:model_rate_limited_error` + + - `class BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_request_failed_error` + + - `:model_request_failed_error` + + - `class BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: String` + + Name of the MCP server that failed to connect. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_connection_failed_error` + + - `:mcp_connection_failed_error` + + - `class BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: String` + + Name of the MCP server that failed authentication. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_authentication_failed_error` + + - `:mcp_authentication_failed_error` + + - `class BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :billing_error` + + - `:billing_error` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.error"` + + - `:"session.error"` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_rescheduled"` + + - `:"session.status_rescheduled"` + + - `class BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_running"` + + - `:"session.status_running"` + + - `class BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: :end_turn` + + - `:end_turn` + + - `class BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array[String]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: :requires_action` + + - `:requires_action` + + - `class BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: :retries_exhausted` + + - `:retries_exhausted` + + - `type: :"session.status_idle"` + + - `:"session.status_idle"` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_terminated"` + + - `:"session.status_terminated"` + + - `class BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_start"` + + - `:"span.model_request_start"` + + - `class BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: String` + + Unique identifier for this event. + + - `is_error: bool` + + Whether the model request resulted in an error. + + - `model_request_start_id: String` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: Integer` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: Integer` + + Tokens read from prompt cache in this request. + + - `input_tokens: Integer` + + Input tokens consumed by this request. + + - `output_tokens: Integer` + + Output tokens generated by this request. + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_end"` + + - `:"span.model_request_end"` + + - `class BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.deleted"` + + - `:"session.deleted"` + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +page = anthropic.beta.sessions.events.list("sesn_011CZkZAtmR3yMPDzynEDxu7") + +puts(page) +``` diff --git a/content/en/api/ruby/beta/sessions/events/send.md b/content/en/api/ruby/beta/sessions/events/send.md new file mode 100644 index 000000000..86031d465 --- /dev/null +++ b/content/en/api/ruby/beta/sessions/events/send.md @@ -0,0 +1,818 @@ +## Send + +`beta.sessions.events.send_(session_id, **kwargs) -> BetaManagedAgentsSendSessionEvents` + +**post** `/v1/sessions/{session_id}/events` + +Send Events + +### Parameters + +- `session_id: String` + +- `events: Array[BetaManagedAgentsEventParams]` + + Events to send to the `session`. + + - `class BetaManagedAgentsUserMessageEventParams` + + Parameters for sending a user message to the session. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks for the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + + - `class BetaManagedAgentsUserInterruptEventParams` + + Parameters for sending an interrupt to pause the agent. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + + - `class BetaManagedAgentsUserToolConfirmationEventParams` + + Parameters for confirming or denying a tool execution request. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `class BetaManagedAgentsUserCustomToolResultEventParams` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSendSessionEvents` + + Events that were successfully sent to the session. + + - `data: Array[BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | BetaManagedAgentsUserCustomToolResultEvent]` + + Sent events + + - `class BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: String` + + Unique identifier for this event. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: String` + + Unique identifier for this event. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: String` + + Unique identifier for this event. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_send_session_events = anthropic.beta.sessions.events.send_( + "sesn_011CZkZAtmR3yMPDzynEDxu7", + events: [{content: [{text: "Where is my order #1234?", type: :text}], type: :"user.message"}] +) + +puts(beta_managed_agents_send_session_events) +``` diff --git a/content/en/api/ruby/beta/sessions/events/stream.md b/content/en/api/ruby/beta/sessions/events/stream.md new file mode 100644 index 000000000..5d36a57ef --- /dev/null +++ b/content/en/api/ruby/beta/sessions/events/stream.md @@ -0,0 +1,1443 @@ +## Stream + +`beta.sessions.events.stream(session_id, **kwargs) -> BetaManagedAgentsStreamSessionEvents` + +**get** `/v1/sessions/{session_id}/events/stream` + +Stream Events + +### Parameters + +- `session_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsStreamSessionEvents = BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | 17 more` + + Server-sent event in the session stream. + + - `class BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + Array of content blocks comprising the user message. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `type: :"user.message"` + + - `:"user.message"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: String` + + Unique identifier for this event. + + - `type: :"user.interrupt"` + + - `:"user.interrupt"` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: String` + + Unique identifier for this event. + + - `result: :allow | :deny` + + UserToolConfirmationResult enum + + - `:allow` + + - `:deny` + + - `tool_use_id: String` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.tool_confirmation"` + + - `:"user.tool_confirmation"` + + - `deny_message: String` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: String` + + Unique identifier for this event. + + - `custom_tool_use_id: String` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: :"user.custom_tool_result"` + + - `:"user.custom_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `class BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the custom tool being called. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.custom_tool_use"` + + - `:"agent.custom_tool_use"` + + - `class BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: String` + + Unique identifier for this event. + + - `content: Array[BetaManagedAgentsTextBlock]` + + Array of text blocks comprising the agent response. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.message"` + + - `:"agent.message"` + + - `class BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thinking"` + + - `:"agent.thinking"` + + - `class BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `mcp_server_name: String` + + Name of the MCP server providing the tool. + + - `name: String` + + Name of the MCP tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_use"` + + - `:"agent.mcp_tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + + - `class BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: String` + + Unique identifier for this event. + + - `mcp_tool_use_id: String` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.mcp_tool_result"` + + - `:"agent.mcp_tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: String` + + Unique identifier for this event. + + - `input: Hash[Symbol, untyped]` + + Input parameters for the tool call. + + - `name: String` + + Name of the agent tool being used. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.tool_use"` + + - `:"agent.tool_use"` + + - `evaluated_permission: :allow | :ask | :deny` + + AgentEvaluatedPermission enum + + - `:allow` + + - `:ask` + + - `:deny` + + - `class BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `tool_use_id: String` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: :"agent.tool_result"` + + - `:"agent.tool_result"` + + - `content: Array[BetaManagedAgentsTextBlock | BetaManagedAgentsImageBlock | BetaManagedAgentsDocumentBlock]` + + The result content returned by the tool. + + - `class BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: String` + + The text content. + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `class BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: String` + + Base64-encoded image data. + + - `media_type: String` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the image to fetch. + + - `class BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :image` + + - `:image` + + - `class BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `class BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: String` + + Base64-encoded document data. + + - `media_type: String` + + MIME type of the document (e.g., "application/pdf"). + + - `type: :base64` + + - `:base64` + + - `class BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: String` + + The plain text content. + + - `media_type: :"text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `:"text/plain"` + + - `type: :text` + + - `:text` + + - `class BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: :url` + + - `:url` + + - `url: String` + + URL of the document to fetch. + + - `class BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: String` + + ID of a previously uploaded file. + + - `type: :file` + + - `:file` + + - `type: :document` + + - `:document` + + - `context: String` + + Additional context about the document for the model. + + - `title: String` + + The title of the document. + + - `is_error: bool` + + Whether the tool execution resulted in an error. + + - `class BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"agent.thread_context_compacted"` + + - `:"agent.thread_context_compacted"` + + - `class BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: String` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `class BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :unknown_error` + + - `:unknown_error` + + - `class BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_overloaded_error` + + - `:model_overloaded_error` + + - `class BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_rate_limited_error` + + - `:model_rate_limited_error` + + - `class BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :model_request_failed_error` + + - `:model_request_failed_error` + + - `class BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: String` + + Name of the MCP server that failed to connect. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_connection_failed_error` + + - `:mcp_connection_failed_error` + + - `class BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: String` + + Name of the MCP server that failed authentication. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :mcp_authentication_failed_error` + + - `:mcp_authentication_failed_error` + + - `class BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: String` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `class BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: :retrying` + + - `:retrying` + + - `class BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: :exhausted` + + - `:exhausted` + + - `class BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: :terminal` + + - `:terminal` + + - `type: :billing_error` + + - `:billing_error` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.error"` + + - `:"session.error"` + + - `class BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_rescheduled"` + + - `:"session.status_rescheduled"` + + - `class BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_running"` + + - `:"session.status_running"` + + - `class BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `class BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: :end_turn` + + - `:end_turn` + + - `class BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array[String]` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: :requires_action` + + - `:requires_action` + + - `class BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: :retries_exhausted` + + - `:retries_exhausted` + + - `type: :"session.status_idle"` + + - `:"session.status_idle"` + + - `class BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.status_terminated"` + + - `:"session.status_terminated"` + + - `class BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_start"` + + - `:"span.model_request_start"` + + - `class BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: String` + + Unique identifier for this event. + + - `is_error: bool` + + Whether the model request resulted in an error. + + - `model_request_start_id: String` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: Integer` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: Integer` + + Tokens read from prompt cache in this request. + + - `input_tokens: Integer` + + Input tokens consumed by this request. + + - `output_tokens: Integer` + + Output tokens generated by this request. + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"span.model_request_end"` + + - `:"span.model_request_end"` + + - `class BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: String` + + Unique identifier for this event. + + - `processed_at: Time` + + A timestamp in RFC 3339 format + + - `type: :"session.deleted"` + + - `:"session.deleted"` + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_stream_session_events = anthropic.beta.sessions.events.stream("sesn_011CZkZAtmR3yMPDzynEDxu7") + +puts(beta_managed_agents_stream_session_events) +``` diff --git a/content/en/api/ruby/beta/sessions/list.md b/content/en/api/ruby/beta/sessions/list.md new file mode 100644 index 000000000..f0b6e54cc --- /dev/null +++ b/content/en/api/ruby/beta/sessions/list.md @@ -0,0 +1,545 @@ +## List + +`beta.sessions.list(**kwargs) -> PageCursor` + +**get** `/v1/sessions` + +List Sessions + +### Parameters + +- `agent_id: String` + + Filter sessions created with this agent ID. + +- `agent_version: Integer` + + Filter by agent version. Only applies when agent_id is also set. + +- `created_at_gt: Time` + + Return sessions created after this time (exclusive). + +- `created_at_gte: Time` + + Return sessions created at or after this time (inclusive). + +- `created_at_lt: Time` + + Return sessions created before this time (exclusive). + +- `created_at_lte: Time` + + Return sessions created at or before this time (inclusive). + +- `include_archived: bool` + + When true, includes archived sessions. Default: false (exclude archived). + +- `limit: Integer` + + Maximum number of results to return. + +- `order: :asc | :desc` + + Sort direction for results, ordered by created_at. Defaults to desc (newest first). + + - `:asc` + + - `:desc` + +- `page: String` + + Opaque pagination cursor from a previous response's next_page. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: String` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: String` + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `version: Integer` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `environment_id: String` + + - `metadata: Hash[Symbol, String]` + + - `resources: Array[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Float` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Float` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: :rescheduling | :running | :idle | :terminated` + + SessionStatus enum + + - `:rescheduling` + + - `:running` + + - `:idle` + + - `:terminated` + + - `title: String` + + - `type: :session` + + - `:session` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Integer` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Integer` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Integer` + + Total tokens read from prompt cache. + + - `input_tokens: Integer` + + Total input tokens consumed across all turns. + + - `output_tokens: Integer` + + Total output tokens generated across all turns. + + - `vault_ids: Array[String]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +page = anthropic.beta.sessions.list + +puts(page) +``` diff --git a/content/en/api/ruby/beta/sessions/resources.md b/content/en/api/ruby/beta/sessions/resources.md new file mode 100644 index 000000000..3f97dab2d --- /dev/null +++ b/content/en/api/ruby/beta/sessions/resources.md @@ -0,0 +1,933 @@ +# Resources + +## Add + +`beta.sessions.resources.add(session_id, **kwargs) -> BetaManagedAgentsFileResource` + +**post** `/v1/sessions/{session_id}/resources` + +Add Session Resource + +### Parameters + +- `session_id: String` + +- `file_id: String` + + ID of a previously uploaded file. + +- `type: :file` + + - `:file` + +- `mount_path: String` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_file_resource = anthropic.beta.sessions.resources.add( + "sesn_011CZkZAtmR3yMPDzynEDxu7", + file_id: "file_011CNha8iCJcU1wXNR6q4V8w", + type: :file +) + +puts(beta_managed_agents_file_resource) +``` + +## List + +`beta.sessions.resources.list(session_id, **kwargs) -> PageCursor` + +**get** `/v1/sessions/{session_id}/resources` + +List Session Resources + +### Parameters + +- `session_id: String` + +- `limit: Integer` + + Maximum number of resources to return per page (max 1000). If omitted, returns all resources. + +- `page: String` + + Opaque cursor from a previous response's next_page field. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSessionResource = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +page = anthropic.beta.sessions.resources.list("sesn_011CZkZAtmR3yMPDzynEDxu7") + +puts(page) +``` + +## Retrieve + +`beta.sessions.resources.retrieve(resource_id, **kwargs) -> ResourceRetrieveResponse` + +**get** `/v1/sessions/{session_id}/resources/{resource_id}` + +Get Session Resource + +### Parameters + +- `session_id: String` + +- `resource_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `ResourceRetrieveResponse = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + The requested session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +resource = anthropic.beta.sessions.resources.retrieve( + "sesrsc_011CZkZBJq5dWxk9fVLNcPht", + session_id: "sesn_011CZkZAtmR3yMPDzynEDxu7" +) + +puts(resource) +``` + +## Update + +`beta.sessions.resources.update(resource_id, **kwargs) -> ResourceUpdateResponse` + +**post** `/v1/sessions/{session_id}/resources/{resource_id}` + +Update Session Resource + +### Parameters + +- `session_id: String` + +- `resource_id: String` + +- `authorization_token: String` + + New authorization token for the resource. Currently only `github_repository` resources support token rotation. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `ResourceUpdateResponse = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + The updated session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +resource = anthropic.beta.sessions.resources.update( + "sesrsc_011CZkZBJq5dWxk9fVLNcPht", + session_id: "sesn_011CZkZAtmR3yMPDzynEDxu7", + authorization_token: "ghp_exampletoken" +) + +puts(resource) +``` + +## Delete + +`beta.sessions.resources.delete(resource_id, **kwargs) -> BetaManagedAgentsDeleteSessionResource` + +**delete** `/v1/sessions/{session_id}/resources/{resource_id}` + +Delete Session Resource + +### Parameters + +- `session_id: String` + +- `resource_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsDeleteSessionResource` + + Confirmation of resource deletion. + + - `id: String` + + - `type: :session_resource_deleted` + + - `:session_resource_deleted` + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_delete_session_resource = anthropic.beta.sessions.resources.delete( + "sesrsc_011CZkZBJq5dWxk9fVLNcPht", + session_id: "sesn_011CZkZAtmR3yMPDzynEDxu7" +) + +puts(beta_managed_agents_delete_session_resource) +``` + +## Domain Types + +### Beta Managed Agents Delete Session Resource + +- `class BetaManagedAgentsDeleteSessionResource` + + Confirmation of resource deletion. + + - `id: String` + + - `type: :session_resource_deleted` + + - `:session_resource_deleted` + +### Beta Managed Agents File Resource + +- `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Beta Managed Agents GitHub Repository Resource + +- `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + +### Beta Managed Agents Session Resource + +- `BetaManagedAgentsSessionResource = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Resource Retrieve Response + +- `ResourceRetrieveResponse = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + The requested session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Resource Update Response + +- `ResourceUpdateResponse = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + The updated session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format diff --git a/content/en/api/ruby/beta/sessions/resources/add.md b/content/en/api/ruby/beta/sessions/resources/add.md new file mode 100644 index 000000000..9ccebd41c --- /dev/null +++ b/content/en/api/ruby/beta/sessions/resources/add.md @@ -0,0 +1,111 @@ +## Add + +`beta.sessions.resources.add(session_id, **kwargs) -> BetaManagedAgentsFileResource` + +**post** `/v1/sessions/{session_id}/resources` + +Add Session Resource + +### Parameters + +- `session_id: String` + +- `file_id: String` + + ID of a previously uploaded file. + +- `type: :file` + + - `:file` + +- `mount_path: String` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_file_resource = anthropic.beta.sessions.resources.add( + "sesn_011CZkZAtmR3yMPDzynEDxu7", + file_id: "file_011CNha8iCJcU1wXNR6q4V8w", + type: :file +) + +puts(beta_managed_agents_file_resource) +``` diff --git a/content/en/api/ruby/beta/sessions/resources/delete.md b/content/en/api/ruby/beta/sessions/resources/delete.md new file mode 100644 index 000000000..2ed7a2dc9 --- /dev/null +++ b/content/en/api/ruby/beta/sessions/resources/delete.md @@ -0,0 +1,90 @@ +## Delete + +`beta.sessions.resources.delete(resource_id, **kwargs) -> BetaManagedAgentsDeleteSessionResource` + +**delete** `/v1/sessions/{session_id}/resources/{resource_id}` + +Delete Session Resource + +### Parameters + +- `session_id: String` + +- `resource_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsDeleteSessionResource` + + Confirmation of resource deletion. + + - `id: String` + + - `type: :session_resource_deleted` + + - `:session_resource_deleted` + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_delete_session_resource = anthropic.beta.sessions.resources.delete( + "sesrsc_011CZkZBJq5dWxk9fVLNcPht", + session_id: "sesn_011CZkZAtmR3yMPDzynEDxu7" +) + +puts(beta_managed_agents_delete_session_resource) +``` diff --git a/content/en/api/ruby/beta/sessions/resources/list.md b/content/en/api/ruby/beta/sessions/resources/list.md new file mode 100644 index 000000000..a04a30826 --- /dev/null +++ b/content/en/api/ruby/beta/sessions/resources/list.md @@ -0,0 +1,147 @@ +## List + +`beta.sessions.resources.list(session_id, **kwargs) -> PageCursor` + +**get** `/v1/sessions/{session_id}/resources` + +List Session Resources + +### Parameters + +- `session_id: String` + +- `limit: Integer` + + Maximum number of resources to return per page (max 1000). If omitted, returns all resources. + +- `page: String` + + Opaque cursor from a previous response's next_page field. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSessionResource = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +page = anthropic.beta.sessions.resources.list("sesn_011CZkZAtmR3yMPDzynEDxu7") + +puts(page) +``` diff --git a/content/en/api/ruby/beta/sessions/resources/retrieve.md b/content/en/api/ruby/beta/sessions/resources/retrieve.md new file mode 100644 index 000000000..92edb6f11 --- /dev/null +++ b/content/en/api/ruby/beta/sessions/resources/retrieve.md @@ -0,0 +1,146 @@ +## Retrieve + +`beta.sessions.resources.retrieve(resource_id, **kwargs) -> ResourceRetrieveResponse` + +**get** `/v1/sessions/{session_id}/resources/{resource_id}` + +Get Session Resource + +### Parameters + +- `session_id: String` + +- `resource_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `ResourceRetrieveResponse = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + The requested session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +resource = anthropic.beta.sessions.resources.retrieve( + "sesrsc_011CZkZBJq5dWxk9fVLNcPht", + session_id: "sesn_011CZkZAtmR3yMPDzynEDxu7" +) + +puts(resource) +``` diff --git a/content/en/api/ruby/beta/sessions/resources/update.md b/content/en/api/ruby/beta/sessions/resources/update.md new file mode 100644 index 000000000..2529da5b5 --- /dev/null +++ b/content/en/api/ruby/beta/sessions/resources/update.md @@ -0,0 +1,151 @@ +## Update + +`beta.sessions.resources.update(resource_id, **kwargs) -> ResourceUpdateResponse` + +**post** `/v1/sessions/{session_id}/resources/{resource_id}` + +Update Session Resource + +### Parameters + +- `session_id: String` + +- `resource_id: String` + +- `authorization_token: String` + + New authorization token for the resource. Currently only `github_repository` resources support token rotation. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `ResourceUpdateResponse = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + The updated session resource. + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +resource = anthropic.beta.sessions.resources.update( + "sesrsc_011CZkZBJq5dWxk9fVLNcPht", + session_id: "sesn_011CZkZAtmR3yMPDzynEDxu7", + authorization_token: "ghp_exampletoken" +) + +puts(resource) +``` diff --git a/content/en/api/ruby/beta/sessions/retrieve.md b/content/en/api/ruby/beta/sessions/retrieve.md new file mode 100644 index 000000000..c22d132b6 --- /dev/null +++ b/content/en/api/ruby/beta/sessions/retrieve.md @@ -0,0 +1,503 @@ +## Retrieve + +`beta.sessions.retrieve(session_id, **kwargs) -> BetaManagedAgentsSession` + +**get** `/v1/sessions/{session_id}` + +Get Session + +### Parameters + +- `session_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: String` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: String` + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `version: Integer` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `environment_id: String` + + - `metadata: Hash[Symbol, String]` + + - `resources: Array[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Float` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Float` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: :rescheduling | :running | :idle | :terminated` + + SessionStatus enum + + - `:rescheduling` + + - `:running` + + - `:idle` + + - `:terminated` + + - `title: String` + + - `type: :session` + + - `:session` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Integer` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Integer` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Integer` + + Total tokens read from prompt cache. + + - `input_tokens: Integer` + + Total input tokens consumed across all turns. + + - `output_tokens: Integer` + + Total output tokens generated across all turns. + + - `vault_ids: Array[String]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_session = anthropic.beta.sessions.retrieve("sesn_011CZkZAtmR3yMPDzynEDxu7") + +puts(beta_managed_agents_session) +``` diff --git a/content/en/api/ruby/beta/sessions/update.md b/content/en/api/ruby/beta/sessions/update.md new file mode 100644 index 000000000..abd563b36 --- /dev/null +++ b/content/en/api/ruby/beta/sessions/update.md @@ -0,0 +1,515 @@ +## Update + +`beta.sessions.update(session_id, **kwargs) -> BetaManagedAgentsSession` + +**post** `/v1/sessions/{session_id}` + +Update Session + +### Parameters + +- `session_id: String` + +- `metadata: Hash[Symbol, String]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. + +- `title: String` + + Human-readable session title. + +- `vault_ids: Array[String]` + + Vault IDs (`vlt_*`) to attach to the session. Not yet supported; requests setting this field are rejected. Reserved for future use. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: String` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: String` + + - `description: String` + + - `mcp_servers: Array[BetaManagedAgentsMCPServerURLDefinition]` + + - `name: String` + + - `type: :url` + + - `:url` + + - `url: String` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 5 more` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `:"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `:"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `:"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `:"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `:"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `:"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `:"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `String` + + - `speed: :standard | :fast` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `:standard` + + - `:fast` + + - `name: String` + + - `skills: Array[BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill]` + + - `class BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: String` + + - `type: :anthropic` + + - `:anthropic` + + - `version: String` + + - `class BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: String` + + - `type: :custom` + + - `:custom` + + - `version: String` + + - `system_: String` + + - `tools: Array[BetaManagedAgentsAgentToolset20260401 | BetaManagedAgentsMCPToolset | BetaManagedAgentsCustomTool]` + + - `class BetaManagedAgentsAgentToolset20260401` + + - `configs: Array[BetaManagedAgentsAgentToolConfig]` + + - `enabled: bool` + + - `name: :bash | :edit | :read | 5 more` + + Built-in agent tool identifier. + + - `:bash` + + - `:edit` + + - `:read` + + - `:write` + + - `:glob` + + - `:grep` + + - `:web_fetch` + + - `:web_search` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `type: :agent_toolset_20260401` + + - `:agent_toolset_20260401` + + - `class BetaManagedAgentsMCPToolset` + + - `configs: Array[BetaManagedAgentsMCPToolConfig]` + + - `enabled: bool` + + - `name: String` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: bool` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `class BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: :always_allow` + + - `:always_allow` + + - `class BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: :always_ask` + + - `:always_ask` + + - `mcp_server_name: String` + + - `type: :mcp_toolset` + + - `:mcp_toolset` + + - `class BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: String` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties: Hash[Symbol, untyped]` + + JSON Schema properties defining the tool's input parameters. + + - `required: Array[String]` + + List of required property names. + + - `type: :object` + + Must be 'object' for tool input schemas. + + - `:object` + + - `name: String` + + - `type: :custom` + + - `:custom` + + - `type: :agent` + + - `:agent` + + - `version: Integer` + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `environment_id: String` + + - `metadata: Hash[Symbol, String]` + + - `resources: Array[BetaManagedAgentsSessionResource]` + + - `class BetaManagedAgentsGitHubRepositoryResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `mount_path: String` + + - `type: :github_repository` + + - `:github_repository` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `url: String` + + - `checkout: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout` + + - `class BetaManagedAgentsBranchCheckout` + + - `name: String` + + Branch name to check out. + + - `type: :branch` + + - `:branch` + + - `class BetaManagedAgentsCommitCheckout` + + - `sha: String` + + Full commit SHA to check out. + + - `type: :commit` + + - `:commit` + + - `class BetaManagedAgentsFileResource` + + - `id: String` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `file_id: String` + + - `mount_path: String` + + - `type: :file` + + - `:file` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds: Float` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds: Float` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: :rescheduling | :running | :idle | :terminated` + + SessionStatus enum + + - `:rescheduling` + + - `:running` + + - `:idle` + + - `:terminated` + + - `title: String` + + - `type: :session` + + - `:session` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens: Integer` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens: Integer` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens: Integer` + + Total tokens read from prompt cache. + + - `input_tokens: Integer` + + Total input tokens consumed across all turns. + + - `output_tokens: Integer` + + Total output tokens generated across all turns. + + - `vault_ids: Array[String]` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_session = anthropic.beta.sessions.update("sesn_011CZkZAtmR3yMPDzynEDxu7") + +puts(beta_managed_agents_session) +``` diff --git a/content/en/api/ruby/beta/skills.md b/content/en/api/ruby/beta/skills.md index 8cd66573d..812536a3a 100644 --- a/content/en/api/ruby/beta/skills.md +++ b/content/en/api/ruby/beta/skills.md @@ -28,7 +28,7 @@ Create Skill - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -72,8 +72,6 @@ Create Skill - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class SkillCreateResponse` @@ -168,7 +166,7 @@ List Skills - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -212,8 +210,6 @@ List Skills - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class SkillListResponse` @@ -293,7 +289,7 @@ Get Skill - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -337,8 +333,6 @@ Get Skill - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class SkillRetrieveResponse` @@ -418,7 +412,7 @@ Delete Skill - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -462,8 +456,6 @@ Delete Skill - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class SkillDeleteResponse` @@ -675,7 +667,7 @@ Create Skill Version - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -719,8 +711,6 @@ Create Skill Version - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class VersionCreateResponse` @@ -813,7 +803,7 @@ List Skill Versions - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -857,8 +847,6 @@ List Skill Versions - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class VersionListResponse` @@ -947,7 +935,7 @@ Get Skill Version - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -991,8 +979,6 @@ Get Skill Version - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class VersionRetrieveResponse` @@ -1081,7 +1067,7 @@ Delete Skill Version - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -1125,8 +1111,6 @@ Delete Skill Version - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class VersionDeleteResponse` diff --git a/content/en/api/ruby/beta/skills/create.md b/content/en/api/ruby/beta/skills/create.md index 9faa93783..401c02e79 100644 --- a/content/en/api/ruby/beta/skills/create.md +++ b/content/en/api/ruby/beta/skills/create.md @@ -26,7 +26,7 @@ Create Skill - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -70,8 +70,6 @@ Create Skill - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class SkillCreateResponse` diff --git a/content/en/api/ruby/beta/skills/delete.md b/content/en/api/ruby/beta/skills/delete.md index 37a673fda..856c41f23 100644 --- a/content/en/api/ruby/beta/skills/delete.md +++ b/content/en/api/ruby/beta/skills/delete.md @@ -20,7 +20,7 @@ Delete Skill - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -64,8 +64,6 @@ Delete Skill - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class SkillDeleteResponse` diff --git a/content/en/api/ruby/beta/skills/list.md b/content/en/api/ruby/beta/skills/list.md index bbf318c76..d8f6da160 100644 --- a/content/en/api/ruby/beta/skills/list.md +++ b/content/en/api/ruby/beta/skills/list.md @@ -35,7 +35,7 @@ List Skills - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -79,8 +79,6 @@ List Skills - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class SkillListResponse` diff --git a/content/en/api/ruby/beta/skills/retrieve.md b/content/en/api/ruby/beta/skills/retrieve.md index 23943eec5..b11a883ea 100644 --- a/content/en/api/ruby/beta/skills/retrieve.md +++ b/content/en/api/ruby/beta/skills/retrieve.md @@ -20,7 +20,7 @@ Get Skill - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -64,8 +64,6 @@ Get Skill - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class SkillRetrieveResponse` diff --git a/content/en/api/ruby/beta/skills/versions.md b/content/en/api/ruby/beta/skills/versions.md index cc02625b2..50ea65a71 100644 --- a/content/en/api/ruby/beta/skills/versions.md +++ b/content/en/api/ruby/beta/skills/versions.md @@ -28,7 +28,7 @@ Create Skill Version - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -72,8 +72,6 @@ Create Skill Version - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class VersionCreateResponse` @@ -166,7 +164,7 @@ List Skill Versions - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -210,8 +208,6 @@ List Skill Versions - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class VersionListResponse` @@ -300,7 +296,7 @@ Get Skill Version - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -344,8 +340,6 @@ Get Skill Version - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class VersionRetrieveResponse` @@ -434,7 +428,7 @@ Delete Skill Version - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -478,8 +472,6 @@ Delete Skill Version - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class VersionDeleteResponse` diff --git a/content/en/api/ruby/beta/skills/versions/create.md b/content/en/api/ruby/beta/skills/versions/create.md index 0c72e169b..e6cb486de 100644 --- a/content/en/api/ruby/beta/skills/versions/create.md +++ b/content/en/api/ruby/beta/skills/versions/create.md @@ -26,7 +26,7 @@ Create Skill Version - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -70,8 +70,6 @@ Create Skill Version - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class VersionCreateResponse` diff --git a/content/en/api/ruby/beta/skills/versions/delete.md b/content/en/api/ruby/beta/skills/versions/delete.md index 543221a40..3f22bb13a 100644 --- a/content/en/api/ruby/beta/skills/versions/delete.md +++ b/content/en/api/ruby/beta/skills/versions/delete.md @@ -26,7 +26,7 @@ Delete Skill Version - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -70,8 +70,6 @@ Delete Skill Version - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class VersionDeleteResponse` diff --git a/content/en/api/ruby/beta/skills/versions/list.md b/content/en/api/ruby/beta/skills/versions/list.md index da57543fa..d0ea1c415 100644 --- a/content/en/api/ruby/beta/skills/versions/list.md +++ b/content/en/api/ruby/beta/skills/versions/list.md @@ -30,7 +30,7 @@ List Skill Versions - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -74,8 +74,6 @@ List Skill Versions - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class VersionListResponse` diff --git a/content/en/api/ruby/beta/skills/versions/retrieve.md b/content/en/api/ruby/beta/skills/versions/retrieve.md index f978b5772..738d445db 100644 --- a/content/en/api/ruby/beta/skills/versions/retrieve.md +++ b/content/en/api/ruby/beta/skills/versions/retrieve.md @@ -26,7 +26,7 @@ Get Skill Version - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -70,8 +70,6 @@ Get Skill Version - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class VersionRetrieveResponse` diff --git a/content/en/api/ruby/beta/vaults.md b/content/en/api/ruby/beta/vaults.md new file mode 100644 index 000000000..9100a7412 --- /dev/null +++ b/content/en/api/ruby/beta/vaults.md @@ -0,0 +1,2616 @@ +# Vaults + +## Create + +`beta.vaults.create(**kwargs) -> BetaManagedAgentsVault` + +**post** `/v1/vaults` + +Create Vault + +### Parameters + +- `display_name: String` + + Human-readable name for the vault. 1-255 characters. + +- `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata to attach to the vault. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: String` + + Unique identifier for the vault. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `display_name: String` + + Human-readable name for the vault. + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the vault. + + - `type: :vault` + + - `:vault` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_vault = anthropic.beta.vaults.create(display_name: "Example vault") + +puts(beta_managed_agents_vault) +``` + +## List + +`beta.vaults.list(**kwargs) -> PageCursor` + +**get** `/v1/vaults` + +List Vaults + +### Parameters + +- `include_archived: bool` + + Whether to include archived vaults in the results. + +- `limit: Integer` + + Maximum number of vaults to return per page. Defaults to 20, maximum 100. + +- `page: String` + + Opaque pagination token from a previous `list_vaults` response. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: String` + + Unique identifier for the vault. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `display_name: String` + + Human-readable name for the vault. + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the vault. + + - `type: :vault` + + - `:vault` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +page = anthropic.beta.vaults.list + +puts(page) +``` + +## Retrieve + +`beta.vaults.retrieve(vault_id, **kwargs) -> BetaManagedAgentsVault` + +**get** `/v1/vaults/{vault_id}` + +Get Vault + +### Parameters + +- `vault_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: String` + + Unique identifier for the vault. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `display_name: String` + + Human-readable name for the vault. + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the vault. + + - `type: :vault` + + - `:vault` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_vault = anthropic.beta.vaults.retrieve("vlt_011CZkZDLs7fYzm1hXNPeRjv") + +puts(beta_managed_agents_vault) +``` + +## Update + +`beta.vaults.update(vault_id, **kwargs) -> BetaManagedAgentsVault` + +**post** `/v1/vaults/{vault_id}` + +Update Vault + +### Parameters + +- `vault_id: String` + +- `display_name: String` + + Updated human-readable name for the vault. 1-255 characters. + +- `metadata: Hash[Symbol, String]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: String` + + Unique identifier for the vault. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `display_name: String` + + Human-readable name for the vault. + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the vault. + + - `type: :vault` + + - `:vault` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_vault = anthropic.beta.vaults.update("vlt_011CZkZDLs7fYzm1hXNPeRjv") + +puts(beta_managed_agents_vault) +``` + +## Delete + +`beta.vaults.delete(vault_id, **kwargs) -> BetaManagedAgentsDeletedVault` + +**delete** `/v1/vaults/{vault_id}` + +Delete Vault + +### Parameters + +- `vault_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsDeletedVault` + + Confirmation of a deleted vault. + + - `id: String` + + Unique identifier of the deleted vault. + + - `type: :vault_deleted` + + - `:vault_deleted` + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_deleted_vault = anthropic.beta.vaults.delete("vlt_011CZkZDLs7fYzm1hXNPeRjv") + +puts(beta_managed_agents_deleted_vault) +``` + +## Archive + +`beta.vaults.archive(vault_id, **kwargs) -> BetaManagedAgentsVault` + +**post** `/v1/vaults/{vault_id}/archive` + +Archive Vault + +### Parameters + +- `vault_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: String` + + Unique identifier for the vault. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `display_name: String` + + Human-readable name for the vault. + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the vault. + + - `type: :vault` + + - `:vault` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_vault = anthropic.beta.vaults.archive("vlt_011CZkZDLs7fYzm1hXNPeRjv") + +puts(beta_managed_agents_vault) +``` + +## Domain Types + +### Beta Managed Agents Deleted Vault + +- `class BetaManagedAgentsDeletedVault` + + Confirmation of a deleted vault. + + - `id: String` + + Unique identifier of the deleted vault. + + - `type: :vault_deleted` + + - `:vault_deleted` + +### Beta Managed Agents Vault + +- `class BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: String` + + Unique identifier for the vault. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `display_name: String` + + Human-readable name for the vault. + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the vault. + + - `type: :vault` + + - `:vault` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +# Credentials + +## Create + +`beta.vaults.credentials.create(vault_id, **kwargs) -> BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials` + +Create Credential + +### Parameters + +- `vault_id: String` + +- `auth: BetaManagedAgentsMCPOAuthCreateParams | BetaManagedAgentsStaticBearerCreateParams` + + Authentication details for creating a credential. + + - `class BetaManagedAgentsMCPOAuthCreateParams` + + Parameters for creating an MCP OAuth credential. + + - `access_token: String` + + OAuth access token. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshParams` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: String` + + OAuth client ID. + + - `refresh_token: String` + + OAuth refresh token. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam | BetaManagedAgentsTokenEndpointAuthBasicParam | BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: String` + + OAuth client secret. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: String` + + OAuth client secret. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerCreateParams` + + Parameters for creating a static bearer token credential. + + - `token: String` + + Static bearer token value. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :static_bearer` + + - `:static_bearer` + +- `display_name: String` + + Human-readable name for the credential. Up to 255 characters. + +- `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata to attach to the credential. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: String` + + Unique identifier for the credential. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: String` + + OAuth client ID. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :static_bearer` + + - `:static_bearer` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the credential. + + - `type: :vault_credential` + + - `:vault_credential` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `vault_id: String` + + Identifier of the vault this credential belongs to. + + - `display_name: String` + + Human-readable name for the credential. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_credential = anthropic.beta.vaults.credentials.create( + "vlt_011CZkZDLs7fYzm1hXNPeRjv", + auth: { + token: "bearer_exampletoken", + mcp_server_url: "https://example-server.modelcontextprotocol.io/sse", + type: :static_bearer + } +) + +puts(beta_managed_agents_credential) +``` + +## List + +`beta.vaults.credentials.list(vault_id, **kwargs) -> PageCursor` + +**get** `/v1/vaults/{vault_id}/credentials` + +List Credentials + +### Parameters + +- `vault_id: String` + +- `include_archived: bool` + + Whether to include archived credentials in the results. + +- `limit: Integer` + + Maximum number of credentials to return per page. Defaults to 20, maximum 100. + +- `page: String` + + Opaque pagination token from a previous `list_credentials` response. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: String` + + Unique identifier for the credential. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: String` + + OAuth client ID. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :static_bearer` + + - `:static_bearer` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the credential. + + - `type: :vault_credential` + + - `:vault_credential` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `vault_id: String` + + Identifier of the vault this credential belongs to. + + - `display_name: String` + + Human-readable name for the credential. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +page = anthropic.beta.vaults.credentials.list("vlt_011CZkZDLs7fYzm1hXNPeRjv") + +puts(page) +``` + +## Retrieve + +`beta.vaults.credentials.retrieve(credential_id, **kwargs) -> BetaManagedAgentsCredential` + +**get** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Get Credential + +### Parameters + +- `vault_id: String` + +- `credential_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: String` + + Unique identifier for the credential. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: String` + + OAuth client ID. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :static_bearer` + + - `:static_bearer` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the credential. + + - `type: :vault_credential` + + - `:vault_credential` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `vault_id: String` + + Identifier of the vault this credential belongs to. + + - `display_name: String` + + Human-readable name for the credential. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_credential = anthropic.beta.vaults.credentials.retrieve( + "vcrd_011CZkZEMt8gZan2iYOQfSkw", + vault_id: "vlt_011CZkZDLs7fYzm1hXNPeRjv" +) + +puts(beta_managed_agents_credential) +``` + +## Update + +`beta.vaults.credentials.update(credential_id, **kwargs) -> BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Update Credential + +### Parameters + +- `vault_id: String` + +- `credential_id: String` + +- `auth: BetaManagedAgentsMCPOAuthUpdateParams | BetaManagedAgentsStaticBearerUpdateParams` + + Updated authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthUpdateParams` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `access_token: String` + + Updated OAuth access token. + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshUpdateParams` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: String` + + Updated OAuth refresh token. + + - `scope: String` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthBasicUpdateParam | BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `client_secret: String` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated POST body authentication parameters for the token endpoint. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `client_secret: String` + + Updated OAuth client secret. + + - `class BetaManagedAgentsStaticBearerUpdateParams` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `type: :static_bearer` + + - `:static_bearer` + + - `token: String` + + Updated static bearer token value. + +- `display_name: String` + + Updated human-readable name for the credential. 1-255 characters. + +- `metadata: Hash[Symbol, String]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: String` + + Unique identifier for the credential. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: String` + + OAuth client ID. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :static_bearer` + + - `:static_bearer` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the credential. + + - `type: :vault_credential` + + - `:vault_credential` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `vault_id: String` + + Identifier of the vault this credential belongs to. + + - `display_name: String` + + Human-readable name for the credential. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_credential = anthropic.beta.vaults.credentials.update( + "vcrd_011CZkZEMt8gZan2iYOQfSkw", + vault_id: "vlt_011CZkZDLs7fYzm1hXNPeRjv" +) + +puts(beta_managed_agents_credential) +``` + +## Delete + +`beta.vaults.credentials.delete(credential_id, **kwargs) -> BetaManagedAgentsDeletedCredential` + +**delete** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Delete Credential + +### Parameters + +- `vault_id: String` + +- `credential_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsDeletedCredential` + + Confirmation of a deleted credential. + + - `id: String` + + Unique identifier of the deleted credential. + + - `type: :vault_credential_deleted` + + - `:vault_credential_deleted` + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_deleted_credential = anthropic.beta.vaults.credentials.delete( + "vcrd_011CZkZEMt8gZan2iYOQfSkw", + vault_id: "vlt_011CZkZDLs7fYzm1hXNPeRjv" +) + +puts(beta_managed_agents_deleted_credential) +``` + +## Archive + +`beta.vaults.credentials.archive(credential_id, **kwargs) -> BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}/archive` + +Archive Credential + +### Parameters + +- `vault_id: String` + +- `credential_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: String` + + Unique identifier for the credential. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: String` + + OAuth client ID. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :static_bearer` + + - `:static_bearer` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the credential. + + - `type: :vault_credential` + + - `:vault_credential` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `vault_id: String` + + Identifier of the vault this credential belongs to. + + - `display_name: String` + + Human-readable name for the credential. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_credential = anthropic.beta.vaults.credentials.archive( + "vcrd_011CZkZEMt8gZan2iYOQfSkw", + vault_id: "vlt_011CZkZDLs7fYzm1hXNPeRjv" +) + +puts(beta_managed_agents_credential) +``` + +## Domain Types + +### Beta Managed Agents Credential + +- `class BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: String` + + Unique identifier for the credential. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: String` + + OAuth client ID. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :static_bearer` + + - `:static_bearer` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the credential. + + - `type: :vault_credential` + + - `:vault_credential` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `vault_id: String` + + Identifier of the vault this credential belongs to. + + - `display_name: String` + + Human-readable name for the credential. + +### Beta Managed Agents Deleted Credential + +- `class BetaManagedAgentsDeletedCredential` + + Confirmation of a deleted credential. + + - `id: String` + + Unique identifier of the deleted credential. + + - `type: :vault_credential_deleted` + + - `:vault_credential_deleted` + +### Beta Managed Agents MCP OAuth Auth Response + +- `class BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: String` + + OAuth client ID. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Create Params + +- `class BetaManagedAgentsMCPOAuthCreateParams` + + Parameters for creating an MCP OAuth credential. + + - `access_token: String` + + OAuth access token. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshParams` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: String` + + OAuth client ID. + + - `refresh_token: String` + + OAuth refresh token. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam | BetaManagedAgentsTokenEndpointAuthBasicParam | BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: String` + + OAuth client secret. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: String` + + OAuth client secret. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Params + +- `class BetaManagedAgentsMCPOAuthRefreshParams` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: String` + + OAuth client ID. + + - `refresh_token: String` + + OAuth refresh token. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam | BetaManagedAgentsTokenEndpointAuthBasicParam | BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: String` + + OAuth client secret. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: String` + + OAuth client secret. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Response + +- `class BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: String` + + OAuth client ID. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Update Params + +- `class BetaManagedAgentsMCPOAuthRefreshUpdateParams` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: String` + + Updated OAuth refresh token. + + - `scope: String` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthBasicUpdateParam | BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `client_secret: String` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated POST body authentication parameters for the token endpoint. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `client_secret: String` + + Updated OAuth client secret. + +### Beta Managed Agents MCP OAuth Update Params + +- `class BetaManagedAgentsMCPOAuthUpdateParams` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `access_token: String` + + Updated OAuth access token. + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshUpdateParams` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: String` + + Updated OAuth refresh token. + + - `scope: String` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthBasicUpdateParam | BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `client_secret: String` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated POST body authentication parameters for the token endpoint. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `client_secret: String` + + Updated OAuth client secret. + +### Beta Managed Agents Static Bearer Auth Response + +- `class BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :static_bearer` + + - `:static_bearer` + +### Beta Managed Agents Static Bearer Create Params + +- `class BetaManagedAgentsStaticBearerCreateParams` + + Parameters for creating a static bearer token credential. + + - `token: String` + + Static bearer token value. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :static_bearer` + + - `:static_bearer` + +### Beta Managed Agents Static Bearer Update Params + +- `class BetaManagedAgentsStaticBearerUpdateParams` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `type: :static_bearer` + + - `:static_bearer` + + - `token: String` + + Updated static bearer token value. + +### Beta Managed Agents Token Endpoint Auth Basic Param + +- `class BetaManagedAgentsTokenEndpointAuthBasicParam` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: String` + + OAuth client secret. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + +### Beta Managed Agents Token Endpoint Auth Basic Response + +- `class BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + +### Beta Managed Agents Token Endpoint Auth Basic Update Param + +- `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `client_secret: String` + + Updated OAuth client secret. + +### Beta Managed Agents Token Endpoint Auth None Param + +- `class BetaManagedAgentsTokenEndpointAuthNoneParam` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + +### Beta Managed Agents Token Endpoint Auth None Response + +- `class BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + +### Beta Managed Agents Token Endpoint Auth Post Param + +- `class BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: String` + + OAuth client secret. + + - `type: :client_secret_post` + + - `:client_secret_post` + +### Beta Managed Agents Token Endpoint Auth Post Response + +- `class BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: :client_secret_post` + + - `:client_secret_post` + +### Beta Managed Agents Token Endpoint Auth Post Update Param + +- `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated POST body authentication parameters for the token endpoint. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `client_secret: String` + + Updated OAuth client secret. diff --git a/content/en/api/ruby/beta/vaults/archive.md b/content/en/api/ruby/beta/vaults/archive.md new file mode 100644 index 000000000..53f4621ff --- /dev/null +++ b/content/en/api/ruby/beta/vaults/archive.md @@ -0,0 +1,107 @@ +## Archive + +`beta.vaults.archive(vault_id, **kwargs) -> BetaManagedAgentsVault` + +**post** `/v1/vaults/{vault_id}/archive` + +Archive Vault + +### Parameters + +- `vault_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: String` + + Unique identifier for the vault. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `display_name: String` + + Human-readable name for the vault. + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the vault. + + - `type: :vault` + + - `:vault` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_vault = anthropic.beta.vaults.archive("vlt_011CZkZDLs7fYzm1hXNPeRjv") + +puts(beta_managed_agents_vault) +``` diff --git a/content/en/api/ruby/beta/vaults/create.md b/content/en/api/ruby/beta/vaults/create.md new file mode 100644 index 000000000..9ae5ade68 --- /dev/null +++ b/content/en/api/ruby/beta/vaults/create.md @@ -0,0 +1,113 @@ +## Create + +`beta.vaults.create(**kwargs) -> BetaManagedAgentsVault` + +**post** `/v1/vaults` + +Create Vault + +### Parameters + +- `display_name: String` + + Human-readable name for the vault. 1-255 characters. + +- `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata to attach to the vault. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: String` + + Unique identifier for the vault. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `display_name: String` + + Human-readable name for the vault. + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the vault. + + - `type: :vault` + + - `:vault` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_vault = anthropic.beta.vaults.create(display_name: "Example vault") + +puts(beta_managed_agents_vault) +``` diff --git a/content/en/api/ruby/beta/vaults/credentials.md b/content/en/api/ruby/beta/vaults/credentials.md new file mode 100644 index 000000000..04dcabd85 --- /dev/null +++ b/content/en/api/ruby/beta/vaults/credentials.md @@ -0,0 +1,1912 @@ +# Credentials + +## Create + +`beta.vaults.credentials.create(vault_id, **kwargs) -> BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials` + +Create Credential + +### Parameters + +- `vault_id: String` + +- `auth: BetaManagedAgentsMCPOAuthCreateParams | BetaManagedAgentsStaticBearerCreateParams` + + Authentication details for creating a credential. + + - `class BetaManagedAgentsMCPOAuthCreateParams` + + Parameters for creating an MCP OAuth credential. + + - `access_token: String` + + OAuth access token. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshParams` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: String` + + OAuth client ID. + + - `refresh_token: String` + + OAuth refresh token. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam | BetaManagedAgentsTokenEndpointAuthBasicParam | BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: String` + + OAuth client secret. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: String` + + OAuth client secret. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerCreateParams` + + Parameters for creating a static bearer token credential. + + - `token: String` + + Static bearer token value. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :static_bearer` + + - `:static_bearer` + +- `display_name: String` + + Human-readable name for the credential. Up to 255 characters. + +- `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata to attach to the credential. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: String` + + Unique identifier for the credential. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: String` + + OAuth client ID. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :static_bearer` + + - `:static_bearer` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the credential. + + - `type: :vault_credential` + + - `:vault_credential` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `vault_id: String` + + Identifier of the vault this credential belongs to. + + - `display_name: String` + + Human-readable name for the credential. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_credential = anthropic.beta.vaults.credentials.create( + "vlt_011CZkZDLs7fYzm1hXNPeRjv", + auth: { + token: "bearer_exampletoken", + mcp_server_url: "https://example-server.modelcontextprotocol.io/sse", + type: :static_bearer + } +) + +puts(beta_managed_agents_credential) +``` + +## List + +`beta.vaults.credentials.list(vault_id, **kwargs) -> PageCursor` + +**get** `/v1/vaults/{vault_id}/credentials` + +List Credentials + +### Parameters + +- `vault_id: String` + +- `include_archived: bool` + + Whether to include archived credentials in the results. + +- `limit: Integer` + + Maximum number of credentials to return per page. Defaults to 20, maximum 100. + +- `page: String` + + Opaque pagination token from a previous `list_credentials` response. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: String` + + Unique identifier for the credential. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: String` + + OAuth client ID. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :static_bearer` + + - `:static_bearer` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the credential. + + - `type: :vault_credential` + + - `:vault_credential` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `vault_id: String` + + Identifier of the vault this credential belongs to. + + - `display_name: String` + + Human-readable name for the credential. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +page = anthropic.beta.vaults.credentials.list("vlt_011CZkZDLs7fYzm1hXNPeRjv") + +puts(page) +``` + +## Retrieve + +`beta.vaults.credentials.retrieve(credential_id, **kwargs) -> BetaManagedAgentsCredential` + +**get** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Get Credential + +### Parameters + +- `vault_id: String` + +- `credential_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: String` + + Unique identifier for the credential. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: String` + + OAuth client ID. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :static_bearer` + + - `:static_bearer` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the credential. + + - `type: :vault_credential` + + - `:vault_credential` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `vault_id: String` + + Identifier of the vault this credential belongs to. + + - `display_name: String` + + Human-readable name for the credential. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_credential = anthropic.beta.vaults.credentials.retrieve( + "vcrd_011CZkZEMt8gZan2iYOQfSkw", + vault_id: "vlt_011CZkZDLs7fYzm1hXNPeRjv" +) + +puts(beta_managed_agents_credential) +``` + +## Update + +`beta.vaults.credentials.update(credential_id, **kwargs) -> BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Update Credential + +### Parameters + +- `vault_id: String` + +- `credential_id: String` + +- `auth: BetaManagedAgentsMCPOAuthUpdateParams | BetaManagedAgentsStaticBearerUpdateParams` + + Updated authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthUpdateParams` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `access_token: String` + + Updated OAuth access token. + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshUpdateParams` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: String` + + Updated OAuth refresh token. + + - `scope: String` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthBasicUpdateParam | BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `client_secret: String` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated POST body authentication parameters for the token endpoint. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `client_secret: String` + + Updated OAuth client secret. + + - `class BetaManagedAgentsStaticBearerUpdateParams` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `type: :static_bearer` + + - `:static_bearer` + + - `token: String` + + Updated static bearer token value. + +- `display_name: String` + + Updated human-readable name for the credential. 1-255 characters. + +- `metadata: Hash[Symbol, String]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: String` + + Unique identifier for the credential. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: String` + + OAuth client ID. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :static_bearer` + + - `:static_bearer` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the credential. + + - `type: :vault_credential` + + - `:vault_credential` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `vault_id: String` + + Identifier of the vault this credential belongs to. + + - `display_name: String` + + Human-readable name for the credential. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_credential = anthropic.beta.vaults.credentials.update( + "vcrd_011CZkZEMt8gZan2iYOQfSkw", + vault_id: "vlt_011CZkZDLs7fYzm1hXNPeRjv" +) + +puts(beta_managed_agents_credential) +``` + +## Delete + +`beta.vaults.credentials.delete(credential_id, **kwargs) -> BetaManagedAgentsDeletedCredential` + +**delete** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Delete Credential + +### Parameters + +- `vault_id: String` + +- `credential_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsDeletedCredential` + + Confirmation of a deleted credential. + + - `id: String` + + Unique identifier of the deleted credential. + + - `type: :vault_credential_deleted` + + - `:vault_credential_deleted` + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_deleted_credential = anthropic.beta.vaults.credentials.delete( + "vcrd_011CZkZEMt8gZan2iYOQfSkw", + vault_id: "vlt_011CZkZDLs7fYzm1hXNPeRjv" +) + +puts(beta_managed_agents_deleted_credential) +``` + +## Archive + +`beta.vaults.credentials.archive(credential_id, **kwargs) -> BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}/archive` + +Archive Credential + +### Parameters + +- `vault_id: String` + +- `credential_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: String` + + Unique identifier for the credential. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: String` + + OAuth client ID. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :static_bearer` + + - `:static_bearer` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the credential. + + - `type: :vault_credential` + + - `:vault_credential` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `vault_id: String` + + Identifier of the vault this credential belongs to. + + - `display_name: String` + + Human-readable name for the credential. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_credential = anthropic.beta.vaults.credentials.archive( + "vcrd_011CZkZEMt8gZan2iYOQfSkw", + vault_id: "vlt_011CZkZDLs7fYzm1hXNPeRjv" +) + +puts(beta_managed_agents_credential) +``` + +## Domain Types + +### Beta Managed Agents Credential + +- `class BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: String` + + Unique identifier for the credential. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: String` + + OAuth client ID. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :static_bearer` + + - `:static_bearer` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the credential. + + - `type: :vault_credential` + + - `:vault_credential` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `vault_id: String` + + Identifier of the vault this credential belongs to. + + - `display_name: String` + + Human-readable name for the credential. + +### Beta Managed Agents Deleted Credential + +- `class BetaManagedAgentsDeletedCredential` + + Confirmation of a deleted credential. + + - `id: String` + + Unique identifier of the deleted credential. + + - `type: :vault_credential_deleted` + + - `:vault_credential_deleted` + +### Beta Managed Agents MCP OAuth Auth Response + +- `class BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: String` + + OAuth client ID. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Create Params + +- `class BetaManagedAgentsMCPOAuthCreateParams` + + Parameters for creating an MCP OAuth credential. + + - `access_token: String` + + OAuth access token. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshParams` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: String` + + OAuth client ID. + + - `refresh_token: String` + + OAuth refresh token. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam | BetaManagedAgentsTokenEndpointAuthBasicParam | BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: String` + + OAuth client secret. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: String` + + OAuth client secret. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Params + +- `class BetaManagedAgentsMCPOAuthRefreshParams` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: String` + + OAuth client ID. + + - `refresh_token: String` + + OAuth refresh token. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam | BetaManagedAgentsTokenEndpointAuthBasicParam | BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: String` + + OAuth client secret. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: String` + + OAuth client secret. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Response + +- `class BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: String` + + OAuth client ID. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Update Params + +- `class BetaManagedAgentsMCPOAuthRefreshUpdateParams` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: String` + + Updated OAuth refresh token. + + - `scope: String` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthBasicUpdateParam | BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `client_secret: String` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated POST body authentication parameters for the token endpoint. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `client_secret: String` + + Updated OAuth client secret. + +### Beta Managed Agents MCP OAuth Update Params + +- `class BetaManagedAgentsMCPOAuthUpdateParams` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `access_token: String` + + Updated OAuth access token. + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshUpdateParams` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: String` + + Updated OAuth refresh token. + + - `scope: String` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthBasicUpdateParam | BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `client_secret: String` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated POST body authentication parameters for the token endpoint. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `client_secret: String` + + Updated OAuth client secret. + +### Beta Managed Agents Static Bearer Auth Response + +- `class BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :static_bearer` + + - `:static_bearer` + +### Beta Managed Agents Static Bearer Create Params + +- `class BetaManagedAgentsStaticBearerCreateParams` + + Parameters for creating a static bearer token credential. + + - `token: String` + + Static bearer token value. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :static_bearer` + + - `:static_bearer` + +### Beta Managed Agents Static Bearer Update Params + +- `class BetaManagedAgentsStaticBearerUpdateParams` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `type: :static_bearer` + + - `:static_bearer` + + - `token: String` + + Updated static bearer token value. + +### Beta Managed Agents Token Endpoint Auth Basic Param + +- `class BetaManagedAgentsTokenEndpointAuthBasicParam` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: String` + + OAuth client secret. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + +### Beta Managed Agents Token Endpoint Auth Basic Response + +- `class BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + +### Beta Managed Agents Token Endpoint Auth Basic Update Param + +- `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `client_secret: String` + + Updated OAuth client secret. + +### Beta Managed Agents Token Endpoint Auth None Param + +- `class BetaManagedAgentsTokenEndpointAuthNoneParam` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + +### Beta Managed Agents Token Endpoint Auth None Response + +- `class BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + +### Beta Managed Agents Token Endpoint Auth Post Param + +- `class BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: String` + + OAuth client secret. + + - `type: :client_secret_post` + + - `:client_secret_post` + +### Beta Managed Agents Token Endpoint Auth Post Response + +- `class BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: :client_secret_post` + + - `:client_secret_post` + +### Beta Managed Agents Token Endpoint Auth Post Update Param + +- `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated POST body authentication parameters for the token endpoint. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `client_secret: String` + + Updated OAuth client secret. diff --git a/content/en/api/ruby/beta/vaults/credentials/archive.md b/content/en/api/ruby/beta/vaults/credentials/archive.md new file mode 100644 index 000000000..d9d2ea466 --- /dev/null +++ b/content/en/api/ruby/beta/vaults/credentials/archive.md @@ -0,0 +1,196 @@ +## Archive + +`beta.vaults.credentials.archive(credential_id, **kwargs) -> BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}/archive` + +Archive Credential + +### Parameters + +- `vault_id: String` + +- `credential_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: String` + + Unique identifier for the credential. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: String` + + OAuth client ID. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :static_bearer` + + - `:static_bearer` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the credential. + + - `type: :vault_credential` + + - `:vault_credential` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `vault_id: String` + + Identifier of the vault this credential belongs to. + + - `display_name: String` + + Human-readable name for the credential. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_credential = anthropic.beta.vaults.credentials.archive( + "vcrd_011CZkZEMt8gZan2iYOQfSkw", + vault_id: "vlt_011CZkZDLs7fYzm1hXNPeRjv" +) + +puts(beta_managed_agents_credential) +``` diff --git a/content/en/api/ruby/beta/vaults/credentials/create.md b/content/en/api/ruby/beta/vaults/credentials/create.md new file mode 100644 index 000000000..9a77872be --- /dev/null +++ b/content/en/api/ruby/beta/vaults/credentials/create.md @@ -0,0 +1,306 @@ +## Create + +`beta.vaults.credentials.create(vault_id, **kwargs) -> BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials` + +Create Credential + +### Parameters + +- `vault_id: String` + +- `auth: BetaManagedAgentsMCPOAuthCreateParams | BetaManagedAgentsStaticBearerCreateParams` + + Authentication details for creating a credential. + + - `class BetaManagedAgentsMCPOAuthCreateParams` + + Parameters for creating an MCP OAuth credential. + + - `access_token: String` + + OAuth access token. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshParams` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: String` + + OAuth client ID. + + - `refresh_token: String` + + OAuth refresh token. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam | BetaManagedAgentsTokenEndpointAuthBasicParam | BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneParam` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicParam` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: String` + + OAuth client secret. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: String` + + OAuth client secret. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerCreateParams` + + Parameters for creating a static bearer token credential. + + - `token: String` + + Static bearer token value. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :static_bearer` + + - `:static_bearer` + +- `display_name: String` + + Human-readable name for the credential. Up to 255 characters. + +- `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata to attach to the credential. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: String` + + Unique identifier for the credential. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: String` + + OAuth client ID. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :static_bearer` + + - `:static_bearer` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the credential. + + - `type: :vault_credential` + + - `:vault_credential` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `vault_id: String` + + Identifier of the vault this credential belongs to. + + - `display_name: String` + + Human-readable name for the credential. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_credential = anthropic.beta.vaults.credentials.create( + "vlt_011CZkZDLs7fYzm1hXNPeRjv", + auth: { + token: "bearer_exampletoken", + mcp_server_url: "https://example-server.modelcontextprotocol.io/sse", + type: :static_bearer + } +) + +puts(beta_managed_agents_credential) +``` diff --git a/content/en/api/ruby/beta/vaults/credentials/delete.md b/content/en/api/ruby/beta/vaults/credentials/delete.md new file mode 100644 index 000000000..7d995835c --- /dev/null +++ b/content/en/api/ruby/beta/vaults/credentials/delete.md @@ -0,0 +1,92 @@ +## Delete + +`beta.vaults.credentials.delete(credential_id, **kwargs) -> BetaManagedAgentsDeletedCredential` + +**delete** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Delete Credential + +### Parameters + +- `vault_id: String` + +- `credential_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsDeletedCredential` + + Confirmation of a deleted credential. + + - `id: String` + + Unique identifier of the deleted credential. + + - `type: :vault_credential_deleted` + + - `:vault_credential_deleted` + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_deleted_credential = anthropic.beta.vaults.credentials.delete( + "vcrd_011CZkZEMt8gZan2iYOQfSkw", + vault_id: "vlt_011CZkZDLs7fYzm1hXNPeRjv" +) + +puts(beta_managed_agents_deleted_credential) +``` diff --git a/content/en/api/ruby/beta/vaults/credentials/list.md b/content/en/api/ruby/beta/vaults/credentials/list.md new file mode 100644 index 000000000..9b95c035b --- /dev/null +++ b/content/en/api/ruby/beta/vaults/credentials/list.md @@ -0,0 +1,203 @@ +## List + +`beta.vaults.credentials.list(vault_id, **kwargs) -> PageCursor` + +**get** `/v1/vaults/{vault_id}/credentials` + +List Credentials + +### Parameters + +- `vault_id: String` + +- `include_archived: bool` + + Whether to include archived credentials in the results. + +- `limit: Integer` + + Maximum number of credentials to return per page. Defaults to 20, maximum 100. + +- `page: String` + + Opaque pagination token from a previous `list_credentials` response. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: String` + + Unique identifier for the credential. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: String` + + OAuth client ID. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :static_bearer` + + - `:static_bearer` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the credential. + + - `type: :vault_credential` + + - `:vault_credential` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `vault_id: String` + + Identifier of the vault this credential belongs to. + + - `display_name: String` + + Human-readable name for the credential. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +page = anthropic.beta.vaults.credentials.list("vlt_011CZkZDLs7fYzm1hXNPeRjv") + +puts(page) +``` diff --git a/content/en/api/ruby/beta/vaults/credentials/retrieve.md b/content/en/api/ruby/beta/vaults/credentials/retrieve.md new file mode 100644 index 000000000..296752c07 --- /dev/null +++ b/content/en/api/ruby/beta/vaults/credentials/retrieve.md @@ -0,0 +1,196 @@ +## Retrieve + +`beta.vaults.credentials.retrieve(credential_id, **kwargs) -> BetaManagedAgentsCredential` + +**get** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Get Credential + +### Parameters + +- `vault_id: String` + +- `credential_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: String` + + Unique identifier for the credential. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: String` + + OAuth client ID. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :static_bearer` + + - `:static_bearer` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the credential. + + - `type: :vault_credential` + + - `:vault_credential` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `vault_id: String` + + Identifier of the vault this credential belongs to. + + - `display_name: String` + + Human-readable name for the credential. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_credential = anthropic.beta.vaults.credentials.retrieve( + "vcrd_011CZkZEMt8gZan2iYOQfSkw", + vault_id: "vlt_011CZkZDLs7fYzm1hXNPeRjv" +) + +puts(beta_managed_agents_credential) +``` diff --git a/content/en/api/ruby/beta/vaults/credentials/update.md b/content/en/api/ruby/beta/vaults/credentials/update.md new file mode 100644 index 000000000..a397097d3 --- /dev/null +++ b/content/en/api/ruby/beta/vaults/credentials/update.md @@ -0,0 +1,276 @@ +## Update + +`beta.vaults.credentials.update(credential_id, **kwargs) -> BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Update Credential + +### Parameters + +- `vault_id: String` + +- `credential_id: String` + +- `auth: BetaManagedAgentsMCPOAuthUpdateParams | BetaManagedAgentsStaticBearerUpdateParams` + + Updated authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthUpdateParams` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `access_token: String` + + Updated OAuth access token. + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshUpdateParams` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token: String` + + Updated OAuth refresh token. + + - `scope: String` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthBasicUpdateParam | BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `client_secret: String` + + Updated OAuth client secret. + + - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated POST body authentication parameters for the token endpoint. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `client_secret: String` + + Updated OAuth client secret. + + - `class BetaManagedAgentsStaticBearerUpdateParams` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `type: :static_bearer` + + - `:static_bearer` + + - `token: String` + + Updated static bearer token value. + +- `display_name: String` + + Updated human-readable name for the credential. 1-255 characters. + +- `metadata: Hash[Symbol, String]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: String` + + Unique identifier for the credential. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `class BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :mcp_oauth` + + - `:mcp_oauth` + + - `expires_at: Time` + + A timestamp in RFC 3339 format + + - `refresh: BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: String` + + OAuth client ID. + + - `token_endpoint: String` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `class BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: :none` + + - `:none` + + - `class BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: :client_secret_basic` + + - `:client_secret_basic` + + - `class BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: :client_secret_post` + + - `:client_secret_post` + + - `resource: String` + + OAuth resource indicator. + + - `scope: String` + + OAuth scope for the refresh request. + + - `class BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: String` + + URL of the MCP server this credential authenticates against. + + - `type: :static_bearer` + + - `:static_bearer` + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the credential. + + - `type: :vault_credential` + + - `:vault_credential` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + + - `vault_id: String` + + Identifier of the vault this credential belongs to. + + - `display_name: String` + + Human-readable name for the credential. + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_credential = anthropic.beta.vaults.credentials.update( + "vcrd_011CZkZEMt8gZan2iYOQfSkw", + vault_id: "vlt_011CZkZDLs7fYzm1hXNPeRjv" +) + +puts(beta_managed_agents_credential) +``` diff --git a/content/en/api/ruby/beta/vaults/delete.md b/content/en/api/ruby/beta/vaults/delete.md new file mode 100644 index 000000000..6c8d60a76 --- /dev/null +++ b/content/en/api/ruby/beta/vaults/delete.md @@ -0,0 +1,87 @@ +## Delete + +`beta.vaults.delete(vault_id, **kwargs) -> BetaManagedAgentsDeletedVault` + +**delete** `/v1/vaults/{vault_id}` + +Delete Vault + +### Parameters + +- `vault_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsDeletedVault` + + Confirmation of a deleted vault. + + - `id: String` + + Unique identifier of the deleted vault. + + - `type: :vault_deleted` + + - `:vault_deleted` + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_deleted_vault = anthropic.beta.vaults.delete("vlt_011CZkZDLs7fYzm1hXNPeRjv") + +puts(beta_managed_agents_deleted_vault) +``` diff --git a/content/en/api/ruby/beta/vaults/list.md b/content/en/api/ruby/beta/vaults/list.md new file mode 100644 index 000000000..73d3c8837 --- /dev/null +++ b/content/en/api/ruby/beta/vaults/list.md @@ -0,0 +1,117 @@ +## List + +`beta.vaults.list(**kwargs) -> PageCursor` + +**get** `/v1/vaults` + +List Vaults + +### Parameters + +- `include_archived: bool` + + Whether to include archived vaults in the results. + +- `limit: Integer` + + Maximum number of vaults to return per page. Defaults to 20, maximum 100. + +- `page: String` + + Opaque pagination token from a previous `list_vaults` response. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: String` + + Unique identifier for the vault. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `display_name: String` + + Human-readable name for the vault. + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the vault. + + - `type: :vault` + + - `:vault` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +page = anthropic.beta.vaults.list + +puts(page) +``` diff --git a/content/en/api/ruby/beta/vaults/retrieve.md b/content/en/api/ruby/beta/vaults/retrieve.md new file mode 100644 index 000000000..7b614deab --- /dev/null +++ b/content/en/api/ruby/beta/vaults/retrieve.md @@ -0,0 +1,107 @@ +## Retrieve + +`beta.vaults.retrieve(vault_id, **kwargs) -> BetaManagedAgentsVault` + +**get** `/v1/vaults/{vault_id}` + +Get Vault + +### Parameters + +- `vault_id: String` + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: String` + + Unique identifier for the vault. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `display_name: String` + + Human-readable name for the vault. + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the vault. + + - `type: :vault` + + - `:vault` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_vault = anthropic.beta.vaults.retrieve("vlt_011CZkZDLs7fYzm1hXNPeRjv") + +puts(beta_managed_agents_vault) +``` diff --git a/content/en/api/ruby/beta/vaults/update.md b/content/en/api/ruby/beta/vaults/update.md new file mode 100644 index 000000000..24658052b --- /dev/null +++ b/content/en/api/ruby/beta/vaults/update.md @@ -0,0 +1,115 @@ +## Update + +`beta.vaults.update(vault_id, **kwargs) -> BetaManagedAgentsVault` + +**post** `/v1/vaults/{vault_id}` + +Update Vault + +### Parameters + +- `vault_id: String` + +- `display_name: String` + + Updated human-readable name for the vault. 1-255 characters. + +- `metadata: Hash[Symbol, String]` + + Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + +- `betas: Array[AnthropicBeta]` + + Optional header to specify the beta version(s) you want to use. + + - `String` + + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` + + - `:"message-batches-2024-09-24"` + + - `:"prompt-caching-2024-07-31"` + + - `:"computer-use-2024-10-22"` + + - `:"computer-use-2025-01-24"` + + - `:"pdfs-2024-09-25"` + + - `:"token-counting-2024-11-01"` + + - `:"token-efficient-tools-2025-02-19"` + + - `:"output-128k-2025-02-19"` + + - `:"files-api-2025-04-14"` + + - `:"mcp-client-2025-04-04"` + + - `:"mcp-client-2025-11-20"` + + - `:"dev-full-thinking-2025-05-14"` + + - `:"interleaved-thinking-2025-05-14"` + + - `:"code-execution-2025-05-22"` + + - `:"extended-cache-ttl-2025-04-11"` + + - `:"context-1m-2025-08-07"` + + - `:"context-management-2025-06-27"` + + - `:"model-context-window-exceeded-2025-08-26"` + + - `:"skills-2025-10-02"` + + - `:"fast-mode-2026-02-01"` + + - `:"output-300k-2026-03-24"` + +### Returns + +- `class BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: String` + + Unique identifier for the vault. + + - `archived_at: Time` + + A timestamp in RFC 3339 format + + - `created_at: Time` + + A timestamp in RFC 3339 format + + - `display_name: String` + + Human-readable name for the vault. + + - `metadata: Hash[Symbol, String]` + + Arbitrary key-value metadata attached to the vault. + + - `type: :vault` + + - `:vault` + + - `updated_at: Time` + + A timestamp in RFC 3339 format + +### Example + +```ruby +require "anthropic" + +anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + +beta_managed_agents_vault = anthropic.beta.vaults.update("vlt_011CZkZDLs7fYzm1hXNPeRjv") + +puts(beta_managed_agents_vault) +``` diff --git a/content/en/api/ruby/completions.md b/content/en/api/ruby/completions.md index 197e463e1..dfda2d186 100644 --- a/content/en/api/ruby/completions.md +++ b/content/en/api/ruby/completions.md @@ -26,15 +26,19 @@ Future models and features will not be compatible with Text Completions. See our See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -168,7 +172,7 @@ Future models and features will not be compatible with Text Completions. See our - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -212,8 +216,6 @@ Future models and features will not be compatible with Text Completions. See our - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class Completion` @@ -234,15 +236,19 @@ Future models and features will not be compatible with Text Completions. See our See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -328,7 +334,7 @@ anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") completion = anthropic.completions.create( max_tokens_to_sample: 256, - model: :"claude-opus-4-6", + model: :"claude-mythos-preview", prompt: "\n\nHuman: Hello, world!\n\nAssistant:" ) @@ -357,15 +363,19 @@ puts(completion) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` diff --git a/content/en/api/ruby/completions/create.md b/content/en/api/ruby/completions/create.md index 4a10a6330..6151cb4c2 100644 --- a/content/en/api/ruby/completions/create.md +++ b/content/en/api/ruby/completions/create.md @@ -24,15 +24,19 @@ Future models and features will not be compatible with Text Completions. See our See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -166,7 +170,7 @@ Future models and features will not be compatible with Text Completions. See our - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -210,8 +214,6 @@ Future models and features will not be compatible with Text Completions. See our - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class Completion` @@ -232,15 +234,19 @@ Future models and features will not be compatible with Text Completions. See our See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -326,7 +332,7 @@ anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") completion = anthropic.completions.create( max_tokens_to_sample: 256, - model: :"claude-opus-4-6", + model: :"claude-mythos-preview", prompt: "\n\nHuman: Hello, world!\n\nAssistant:" ) diff --git a/content/en/api/ruby/messages.md b/content/en/api/ruby/messages.md index 7d78be1b9..ba97950c6 100644 --- a/content/en/api/ruby/messages.md +++ b/content/en/api/ruby/messages.md @@ -2305,15 +2305,19 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -4532,15 +4536,19 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -7052,15 +7060,19 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -8515,7 +8527,10 @@ require "anthropic" anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") -message_tokens_count = anthropic.messages.count_tokens(messages: [{content: "string", role: :user}], model: :"claude-opus-4-6") +message_tokens_count = anthropic.messages.count_tokens( + messages: [{content: "string", role: :user}], + model: :"claude-mythos-preview" +) puts(message_tokens_count) ``` @@ -14210,15 +14225,19 @@ puts(message_tokens_count) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -17741,21 +17760,25 @@ puts(message_tokens_count) ### Model -- `Model = :"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more | String` +- `Model = :"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more | String` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -19622,15 +19645,19 @@ puts(message_tokens_count) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -20558,15 +20585,19 @@ puts(message_tokens_count) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -29653,15 +29684,19 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -32437,15 +32472,19 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -33705,15 +33744,19 @@ puts(message_batch_individual_response) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -34769,15 +34812,19 @@ puts(message_batch_individual_response) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -35795,15 +35842,19 @@ puts(message_batch_individual_response) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` diff --git a/content/en/api/ruby/messages/batches.md b/content/en/api/ruby/messages/batches.md index ef0287ef3..e4c88d460 100644 --- a/content/en/api/ruby/messages/batches.md +++ b/content/en/api/ruby/messages/batches.md @@ -2321,15 +2321,19 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -5105,15 +5109,19 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -6373,15 +6381,19 @@ puts(message_batch_individual_response) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -7437,15 +7449,19 @@ puts(message_batch_individual_response) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -8463,15 +8479,19 @@ puts(message_batch_individual_response) See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` diff --git a/content/en/api/ruby/messages/batches/create.md b/content/en/api/ruby/messages/batches/create.md index a9efd1d1d..4653536d9 100644 --- a/content/en/api/ruby/messages/batches/create.md +++ b/content/en/api/ruby/messages/batches/create.md @@ -2319,15 +2319,19 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` diff --git a/content/en/api/ruby/messages/batches/results.md b/content/en/api/ruby/messages/batches/results.md index 0b673d040..0fdb6c4bf 100644 --- a/content/en/api/ruby/messages/batches/results.md +++ b/content/en/api/ruby/messages/batches/results.md @@ -747,15 +747,19 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` diff --git a/content/en/api/ruby/messages/count_tokens.md b/content/en/api/ruby/messages/count_tokens.md index 07430eda0..b967fecf6 100644 --- a/content/en/api/ruby/messages/count_tokens.md +++ b/content/en/api/ruby/messages/count_tokens.md @@ -2295,15 +2295,19 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -3758,7 +3762,10 @@ require "anthropic" anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") -message_tokens_count = anthropic.messages.count_tokens(messages: [{content: "string", role: :user}], model: :"claude-opus-4-6") +message_tokens_count = anthropic.messages.count_tokens( + messages: [{content: "string", role: :user}], + model: :"claude-mythos-preview" +) puts(message_tokens_count) ``` diff --git a/content/en/api/ruby/messages/create.md b/content/en/api/ruby/messages/create.md index 4ac905929..5af1243e7 100644 --- a/content/en/api/ruby/messages/create.md +++ b/content/en/api/ruby/messages/create.md @@ -2303,15 +2303,19 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` @@ -4530,15 +4534,19 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `:"claude-opus-4-6" | :"claude-sonnet-4-6" | :"claude-haiku-4-5" | 12 more` + - `:"claude-mythos-preview" | :"claude-opus-4-6" | :"claude-sonnet-4-6" | 13 more` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + - `:"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity + - `:"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `:"claude-sonnet-4-6"` diff --git a/content/en/api/ruby/models.md b/content/en/api/ruby/models.md index cce4b7d15..07955dccb 100644 --- a/content/en/api/ruby/models.md +++ b/content/en/api/ruby/models.md @@ -32,7 +32,7 @@ The Models API response can be used to determine which models are available for - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -76,8 +76,6 @@ The Models API response can be used to determine which models are available for - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class ModelInfo` @@ -296,7 +294,7 @@ The Models API response can be used to determine information about a specific mo - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -340,8 +338,6 @@ The Models API response can be used to determine information about a specific mo - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class ModelInfo` diff --git a/content/en/api/ruby/models/list.md b/content/en/api/ruby/models/list.md index e8562a007..3803cce3d 100644 --- a/content/en/api/ruby/models/list.md +++ b/content/en/api/ruby/models/list.md @@ -30,7 +30,7 @@ The Models API response can be used to determine which models are available for - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -74,8 +74,6 @@ The Models API response can be used to determine which models are available for - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class ModelInfo` diff --git a/content/en/api/ruby/models/retrieve.md b/content/en/api/ruby/models/retrieve.md index f0ed7a6cf..8ed0bb9ce 100644 --- a/content/en/api/ruby/models/retrieve.md +++ b/content/en/api/ruby/models/retrieve.md @@ -20,7 +20,7 @@ The Models API response can be used to determine information about a specific mo - `String` - - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 19 more` + - `:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 18 more` - `:"message-batches-2024-09-24"` @@ -64,8 +64,6 @@ The Models API response can be used to determine information about a specific mo - `:"output-300k-2026-03-24"` - - `:"user-profiles-2026-03-24"` - ### Returns - `class ModelInfo` diff --git a/content/en/api/sdks/cli.md b/content/en/api/sdks/cli.md new file mode 100644 index 000000000..6f1ace163 --- /dev/null +++ b/content/en/api/sdks/cli.md @@ -0,0 +1,531 @@ +# CLI + +Interact with the Claude API directly from your terminal with the ant command-line tool + +--- + +The `ant` CLI provides access to the Claude API from your terminal. Every API resource is exposed as a subcommand, with output formatting, response filtering, and support for YAML or JSON file input that make it practical for both interactive exploration and automation. + +Compared to calling the API with `curl`, `ant` lets you build request bodies from typed flags or piped YAML rather than hand-written JSON, inline file contents into string fields with an `@path` reference, and extract fields from the response with a built-in `--transform` query — no separate JSON tooling required. List endpoints paginate automatically. Claude Code understands how to use `ant` natively. + + +For endpoint-specific parameters and response schemas, see the [API reference](/docs/en/api/cli/messages/create). This page covers CLI-specific features and workflows that apply across all endpoints. + + +## Installation + + + + +```bash +brew install anthropics/tap/ant +``` + + + + +Requires Go 1.22 or later. + +```bash +go install github.com/anthropics/anthropic-cli/cmd/ant@latest +``` + +The binary is placed in `$(go env GOPATH)/bin`. Add it to your `PATH` if it isn't already: + +```bash +export PATH="$PATH:$(go env GOPATH)/bin" +``` + + + + +For Linux containers or environments without Homebrew or Go, download the release binary directly: + +```bash +curl -fsSL "https://github.com/anthropics/anthropic-cli/releases/latest/download/ant_$(uname -s)_$(uname -m).tar.gz" \ + | sudo tar -xz -C /usr/local/bin ant +``` + + + + +Check the installation: + +```bash +ant --version +``` + +## Authentication + +The CLI reads your API key from the `ANTHROPIC_API_KEY` environment variable. + + + + +```bash +echo 'export ANTHROPIC_API_KEY=sk-ant-api03-...' >> ~/.zshrc +source ~/.zshrc +``` + + + + +```bash +echo 'export ANTHROPIC_API_KEY=sk-ant-api03-...' >> ~/.bashrc +source ~/.bashrc +``` + + + + +```powershell +setx ANTHROPIC_API_KEY "sk-ant-api03-..." +``` + +Open a new terminal for the change to take effect. + + + + +Get a key from the [Claude Console](https://platform.claude.com/settings/keys). To point at a different API host, set `ANTHROPIC_BASE_URL` or pass `--base-url` on any command. + +## Send your first request + +With the binary installed and `ANTHROPIC_API_KEY` set, call the [Messages API](/docs/en/api/cli/messages/create): + +```bash +ant messages create \ + --model claude-opus-4-6 \ + --max-tokens 1024 \ + --message '{role: user, content: "Hello, Claude"}' +``` + +```json Output +{ + "model": "claude-opus-4-6", + "id": "msg_01YMmR5XodC5nTqMxLZMKaq6", + "type": "message", + "role": "assistant", + "content": [ + { + "type": "text", + "text": "Hello! How are you doing today? Is there something I can help you with?" + } + ], + "stop_reason": "end_turn", + "usage": { "input_tokens": 27, "output_tokens": 20 /*, ... */ } +} +``` + +The response is the full API object, pretty-printed because stdout is a terminal. The rest of this page covers how to reshape that output, pass complex request bodies, and chain commands together. + +## Command structure + +Commands follow a `resource action` pattern. Nested resources use colons: + +```text +ant [:] [flags] +``` + +Run `ant --help` for the full resource list, or append `--help` to any subcommand for its flags. + +Resources currently in beta — including agents, sessions, deployments, environments, and skills — live under the `beta:` prefix. Commands in this namespace automatically send the appropriate `anthropic-beta` header for that resource, so you don't need to pass it yourself. Use `--beta
                                                                                                                                                                                                                                                                                                                                                                                    ` only to override the default — for example, to opt into a different schema version. + +```bash +ant models list +ant messages create --model claude-opus-4-6 --max-tokens 1024 ... +ant beta:agents retrieve --agent-id agent_01... +ant beta:sessions:events list --session-id session_01... +``` + +### Global flags + +| Flag | Description | +| --- | --- | +| `--format` | Output format: `auto`, `json`, `jsonl`, `yaml`, `pretty`, `raw`, `explore` | +| `--transform` | Filter or reshape the response with a [GJSON path](#transform-output-with-gjson) | +| `--base-url` | Override the API base URL | +| `--debug` | Print full HTTP request and response to stderr | +| `--format-error`, `--transform-error` | Same as `--format` and `--transform` but applied to [error responses](#inspect-errors) | + +## Output formats + +The default `auto` format pretty-prints JSON when writing to a terminal and emits compact JSON when piped. Override it with `--format`: + +```bash +ant models retrieve --model-id claude-opus-4-6 --format yaml +``` + +```yaml Output +type: model +id: claude-opus-4-6 +display_name: Claude Opus 4.6 +created_at: "2026-02-04T00:00:00Z" +... +``` + +List endpoints auto-paginate. In the default formats each item is written separately (one compact JSON object per line in `jsonl` mode, a stream of YAML documents in `yaml` mode), which streams cleanly into `head`, `grep`, and `--transform` filters. + +### Interactive explorer + +When connected to a terminal, `--format explore` opens a fold-and-search TUI for browsing large responses. Arrow keys expand and collapse nodes, `/` searches, `q` exits. + +```bash +ant models list --format explore +``` + +## Transform output with GJSON + +Use `--transform` to reshape responses before printing. The expression is a [GJSON path](https://github.com/tidwall/gjson/blob/master/SYNTAX.md). For list endpoints the transform runs against each item individually, not the envelope: + +```bash +ant beta:agents list \ + --transform "{id,name,model}" \ + --format jsonl +``` + +```jsonl Output +{"id": "agent_011CYm1BLqPX...", "name": "Docs CLI Test Agent", "model": "claude-sonnet-4-6"} +{"id": "agent_011CYkVwfaEt...", "name": "Coffee Making Assistant", "model": "claude-sonnet-4-6"} +{"id": "agent_011CYixHhtUP...", "name": "Coding Assistant", "model": "claude-opus-4-5"} +``` + +### Extract a scalar + +To capture a single field as an unquoted string — for example, the ID of a newly created resource — pair `--transform` with `--format yaml`. YAML emits scalar values without quotes, so the result is ready to assign to a shell variable: + +```bash +AGENT_ID=$(ant beta:agents create \ + --name "My Agent" \ + --model claude-sonnet-4-6 \ + --transform id --format yaml) + +printf '%s\n' "$AGENT_ID" +``` + +```text Output +agent_011CYm1BLqPXpQRk5khsSXrs +``` + + +`--transform` is not applied when `--format raw` is set. Use `--format yaml` for unquoted scalars, or `--format jsonl` to keep the result as structured data for further processing. + + +## Passing request bodies + +The right input mechanism depends on the shape of the data: use **flags** for scalar fields and short structured values, pipe a **stdin** document for nested or multi-line bodies, and use **`@file` references** to pull file contents into any string or binary field. + +### Flags + +Scalar fields map directly to flags. Structured fields accept a relaxed YAML-like syntax (unquoted keys, optional quotes around strings) or strict JSON: + +```bash +ant beta:sessions create \ + --agent '{type: agent, id: agent_011CYm1BLqPXpQRk5khsSXrs, version: 1}' \ + --environment env_01595EKxaaTTGwwY3kyXdtbs \ + --title "CLI docs test session" +``` + +Repeatable flags build arrays. Each `--tool` or `--event` appends one element: + +```bash +ant beta:agents create \ + --name "Research Agent" \ + --model claude-opus-4-6 \ + --tool '{type: agent_toolset_20260401}' \ + --tool '{type: custom, name: search_docs, input_schema: {type: object, properties: {query: {type: string}}}}' +``` + +### Stdin + +Pipe a JSON or YAML document to stdin to supply the full request body. Fields from stdin are merged with flags, with flags taking precedence. Here `version` is the optimistic-locking token returned by an earlier `retrieve`, and `$AGENT_ID` was captured as in [Extract a scalar](#extract-a-scalar): + +```bash +echo '{"description": "Updated test agent.", "version": 1}' | \ + ant beta:agents update --agent-id "$AGENT_ID" +``` + +Heredocs work the same way and are convenient for multi-line YAML. Quote the delimiter (as in `<<'YAML'`) to disable variable expansion inside the body. + +```bash +ant beta:agents create <<'YAML' +name: Research Agent +model: claude-opus-4-6 +system: | + You are a research assistant. Cite sources for every claim. +tools: + - type: agent_toolset_20260401 +YAML +``` + +### File references + +Flags that take a file path, such as `--file` on the upload command, accept a bare path: + +```bash +ant beta:files upload --file ./report.pdf +``` + +To inline a file's contents into a string-valued field, prefix the path with `@`: + +```bash +ant beta:agents create \ + --name "Researcher" --model claude-sonnet-4-6 \ + --system @./prompts/researcher.txt +``` + +Inside structured flag values, wrap the path in quotes. To send a PDF to the Messages API: + +```bash +ant messages create \ + --model claude-opus-4-6 \ + --max-tokens 1024 \ + --message '{role: user, content: [ + {type: document, source: {type: base64, media_type: application/pdf, data: "@./scan.pdf"}}, + {type: text, text: "Extract the text from this scanned document."} + ]}' \ + --transform 'content.0.text' --format yaml +``` + +The CLI detects the file type and encodes binary files as base64 automatically. To force a specific encoding use `@file://` for plain text or `@data://` for base64. Escape a literal leading `@` with a backslash (`\@username`). + +## Version-controlling API resources + +You can use the CLI to version control API resources such as skills, agents, environments, or deployments as YAML files in your repository and keep them in sync with the Claude API. + + +For more information on these resources, see [Managed Agents](/docs/en/managed-agents/overview). + + + + + +Write the agent definition to `summarizer.agent.yaml`: + +```yaml summarizer.agent.yaml +name: Summarizer +model: claude-sonnet-4-6 +system: | + You are a helpful assistant that writes concise summaries. +tools: + - type: agent_toolset_20260401 +``` + + + + +```bash +ant beta:agents create < summarizer.agent.yaml +``` + +```json Output +{ + "id": "agent_011CYm1BLqPXpQRk5khsSXrs", + "version": 1, + "name": "Summarizer", + "model": "claude-sonnet-4-6" + /* ... */ +} +``` + +Note the `id` from the response — you'll pass it to the session create command below. + + +Check `summarizer.agent.yaml` into your repository and keep it in sync with the API in your CI pipeline. The update command needs the agent ID and current version as flags: + +```bash CLI +ant beta:agents update --agent-id agent_011CYm1BLqPXpQRk5khsSXrs --version 1 < summarizer.agent.yaml +``` + + + + + +A session runs in an [environment](/docs/en/api/cli/beta/environments), which defines the container it executes in. Write the environment definition to `summarizer.environment.yaml`: + +```yaml summarizer.environment.yaml +name: summarizer-env +config: + type: cloud + networking: + type: unrestricted +``` + + + + +```bash +ant beta:environments create < summarizer.environment.yaml +``` + +```json Output +{ + "id": "env_01595EKxaaTTGwwY3kyXdtbs", + "name": "summarizer-env" + /* ... */ +} +``` + +Note the `id` from the response — you'll pass it to the session create command below. + + +Check `summarizer.environment.yaml` into your repository and keep it in sync with the API in your CI pipeline. The update command needs the environment ID as a flag: + +```bash CLI +ant beta:environments update --environment-id env_01595EKxaaTTGwwY3kyXdtbs < summarizer.environment.yaml +``` + + + + + +Paste the agent `id` and environment `id` from the previous outputs into the session create command: + +```bash highlight={2..3} +ant beta:sessions create \ + --agent agent_011CYm1BLqPXpQRk5khsSXrs \ + --environment env_01595EKxaaTTGwwY3kyXdtbs \ + --title "Summarization task" +``` + +```json Output +{ + "id": "session_01JZCh78XvmxJjiXVy3oSi7K", + "status": "running" + /* ... */ +} +``` + + + + +Copy the session `id` from the previous output into `--session-id`: + +```bash highlight={2} +ant beta:sessions:events send \ + --session-id session_01JZCh78XvmxJjiXVy3oSi7K \ + --event '{type: user.message, content: [{type: text, text: "Summarize the benefits of type safety in one sentence."}]}' +``` + + + + +`--transform` runs against each listed event, so this prints the text of every message in order: + +```bash highlight={2} +ant beta:sessions:events list \ + --session-id session_01JZCh78XvmxJjiXVy3oSi7K \ + --transform 'content.0.text' --format yaml +``` + +```text Output +Summarize the benefits of type safety in one sentence. +Type safety catches errors at compile time rather than runtime, reducing bugs, improving code clarity, enabling better tooling support, and making codebases easier to maintain and refactor with confidence. +``` + + +To watch a session as it runs, use `ant beta:sessions stream --session-id session_01JZCh78XvmxJjiXVy3oSi7K`. Events are written to stdout as they arrive. + + + + + +## Scripting patterns + +The CLI is designed to compose with standard shell tooling. + +### Chain list output into a second command + +`--transform id --format yaml` on a list endpoint emits one bare ID per line, so standard tools such as `head` and `xargs` apply directly. Capture the first result, then pass it to a follow-up command: + +```bash +FIRST_AGENT=$(ant beta:agents list \ + --transform id --format yaml | head -1) + +ant beta:agents:versions list \ + --agent-id "$FIRST_AGENT" \ + --transform "{version,created_at}" --format jsonl +``` + +### Inspect errors + +The `--transform-error` and `--format-error` flags mirror their success-path counterparts and follow the same rule — pair with `yaml`, not `raw`, to apply the transform. Extract only the error message: + +```bash +ant beta:agents retrieve --agent-id bogus \ + --transform-error error.message --format-error yaml 2>&1 +``` + +```text Output +GET "https://api.anthropic.com/v1/agents/bogus?beta=true": 404 Not Found +Agent not found. +``` + +## Use the CLI from Claude Code + +[Claude Code](https://docs.claude.com/en/docs/claude-code/overview) knows out of the box how to use the `ant` CLI. With the CLI installed and `ANTHROPIC_API_KEY` set, you can ask Claude Code to operate on your API resources directly — for example: + +- "List my recent agent sessions and summarize which ones errored." +- "Upload every PDF in `./reports` to the Files API and print the resulting IDs." +- "Pull the events for session `session_01...` and tell me where the agent got stuck." + +Claude Code shells out to `ant`, parses the structured output, and reasons over the results — no custom integration code required. + +## Debugging + +Add `--debug` to any command to print the exact HTTP request and response (headers and body) to stderr. API keys are redacted. + +```bash +ant --debug beta:agents list +``` + +```text Output +GET /v1/agents?beta=true HTTP/1.1 +Host: api.anthropic.com +Anthropic-Beta: managed-agents-2026-04-01 +Anthropic-Version: 2023-06-01 +X-Api-Key: +... +``` + +## Shell completion + +The CLI ships completion scripts for bash, zsh, fish, and PowerShell. Generate and install one for your shell: + + + + +```bash +ant @completion zsh > "${fpath[1]}/_ant" +# Restart your shell or run: autoload -U compinit && compinit +``` + + + + +```bash +ant @completion bash > /etc/bash_completion.d/ant +``` + + + + +```bash +ant @completion fish > ~/.config/fish/completions/ant.fish +``` + + + + +```powershell +ant @completion powershell | Out-String | Invoke-Expression +# To persist across sessions: +# ant @completion powershell >> $PROFILE +``` + + + + +## Available resources + +Every API resource the CLI exposes is documented in the [API reference](/docs/en/api/cli/messages/create). For a local listing, run `ant --help`, and append `--help` to any subcommand for its flags and parameters. \ No newline at end of file diff --git a/content/en/api/sdks/java.md b/content/en/api/sdks/java.md index cc4de6f9b..0e70456dc 100644 --- a/content/en/api/sdks/java.md +++ b/content/en/api/sdks/java.md @@ -15,7 +15,7 @@ For API feature documentation with code examples, see the [API reference](/docs/ ```kotlin -implementation("com.anthropic:anthropic-java:2.18.0") +implementation("com.anthropic:anthropic-java:2.20.0") ``` @@ -23,7 +23,7 @@ implementation("com.anthropic:anthropic-java:2.18.0") com.anthropic anthropic-java - 2.18.0 + 2.20.0 ``` diff --git a/content/en/api/sdks/ruby.md b/content/en/api/sdks/ruby.md index cb799e7ce..c3d27a76a 100644 --- a/content/en/api/sdks/ruby.md +++ b/content/en/api/sdks/ruby.md @@ -12,10 +12,10 @@ For API feature documentation with code examples, see the [API reference](/docs/ ## Installation -To use this gem, install via Bundler by adding the following to your application's `Gemfile`: +Add the gem to your application's `Gemfile` with Bundler: -```ruby -gem "anthropic", "~> 1.25.0" +```bash +bundle add anthropic ``` ## Requirements diff --git a/content/en/api/service-tiers.md b/content/en/api/service-tiers.md index 5b145059e..9ee1512f4 100644 --- a/content/en/api/service-tiers.md +++ b/content/en/api/service-tiers.md @@ -53,7 +53,7 @@ If servicing the request would exceed the rate limits, the request is declined. You can control which service tiers can be used for a request by setting the `service_tier` parameter: -```python +```python Python message = client.messages.create( model="claude-opus-4-6", max_tokens=1024, diff --git a/content/en/api/terraform/beta.md b/content/en/api/terraform/beta.md index dc93e3831..f9de24e98 100644 --- a/content/en/api/terraform/beta.md +++ b/content/en/api/terraform/beta.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                      \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                        \ No newline at end of file diff --git a/content/en/api/terraform/beta/agents.md b/content/en/api/terraform/beta/agents.md new file mode 100644 index 000000000..c4a90c695 --- /dev/null +++ b/content/en/api/terraform/beta/agents.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                          \ No newline at end of file diff --git a/content/en/api/terraform/beta/agents/archive.md b/content/en/api/terraform/beta/agents/archive.md new file mode 100644 index 000000000..53f6f9cc0 --- /dev/null +++ b/content/en/api/terraform/beta/agents/archive.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                            \ No newline at end of file diff --git a/content/en/api/terraform/beta/agents/create.md b/content/en/api/terraform/beta/agents/create.md new file mode 100644 index 000000000..390a71b9a --- /dev/null +++ b/content/en/api/terraform/beta/agents/create.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                              \ No newline at end of file diff --git a/content/en/api/terraform/beta/agents/list.md b/content/en/api/terraform/beta/agents/list.md new file mode 100644 index 000000000..0bb706c31 --- /dev/null +++ b/content/en/api/terraform/beta/agents/list.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                \ No newline at end of file diff --git a/content/en/api/terraform/beta/agents/retrieve.md b/content/en/api/terraform/beta/agents/retrieve.md new file mode 100644 index 000000000..10a219f91 --- /dev/null +++ b/content/en/api/terraform/beta/agents/retrieve.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                  \ No newline at end of file diff --git a/content/en/api/terraform/beta/agents/update.md b/content/en/api/terraform/beta/agents/update.md new file mode 100644 index 000000000..faf243414 --- /dev/null +++ b/content/en/api/terraform/beta/agents/update.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                    \ No newline at end of file diff --git a/content/en/api/terraform/beta/agents/versions.md b/content/en/api/terraform/beta/agents/versions.md new file mode 100644 index 000000000..9fc043d01 --- /dev/null +++ b/content/en/api/terraform/beta/agents/versions.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                      \ No newline at end of file diff --git a/content/en/api/terraform/beta/agents/versions/list.md b/content/en/api/terraform/beta/agents/versions/list.md new file mode 100644 index 000000000..6d3c99cf1 --- /dev/null +++ b/content/en/api/terraform/beta/agents/versions/list.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                        \ No newline at end of file diff --git a/content/en/api/terraform/beta/environments.md b/content/en/api/terraform/beta/environments.md new file mode 100644 index 000000000..966d54033 --- /dev/null +++ b/content/en/api/terraform/beta/environments.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                          \ No newline at end of file diff --git a/content/en/api/terraform/beta/environments/archive.md b/content/en/api/terraform/beta/environments/archive.md new file mode 100644 index 000000000..fd032f03d --- /dev/null +++ b/content/en/api/terraform/beta/environments/archive.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                            \ No newline at end of file diff --git a/content/en/api/terraform/beta/environments/create.md b/content/en/api/terraform/beta/environments/create.md new file mode 100644 index 000000000..8b0a474ba --- /dev/null +++ b/content/en/api/terraform/beta/environments/create.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                              \ No newline at end of file diff --git a/content/en/api/terraform/beta/environments/delete.md b/content/en/api/terraform/beta/environments/delete.md new file mode 100644 index 000000000..58edcc096 --- /dev/null +++ b/content/en/api/terraform/beta/environments/delete.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                \ No newline at end of file diff --git a/content/en/api/terraform/beta/environments/list.md b/content/en/api/terraform/beta/environments/list.md new file mode 100644 index 000000000..37d0e1c4c --- /dev/null +++ b/content/en/api/terraform/beta/environments/list.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                  \ No newline at end of file diff --git a/content/en/api/terraform/beta/environments/retrieve.md b/content/en/api/terraform/beta/environments/retrieve.md new file mode 100644 index 000000000..b992eb765 --- /dev/null +++ b/content/en/api/terraform/beta/environments/retrieve.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                    \ No newline at end of file diff --git a/content/en/api/terraform/beta/environments/update.md b/content/en/api/terraform/beta/environments/update.md new file mode 100644 index 000000000..d7fb4ef76 --- /dev/null +++ b/content/en/api/terraform/beta/environments/update.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                      \ No newline at end of file diff --git a/content/en/api/terraform/beta/files.md b/content/en/api/terraform/beta/files.md index 6f670025d..303b50a17 100644 --- a/content/en/api/terraform/beta/files.md +++ b/content/en/api/terraform/beta/files.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                        \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                          \ No newline at end of file diff --git a/content/en/api/terraform/beta/files/delete.md b/content/en/api/terraform/beta/files/delete.md index 828a357cf..fa9538a02 100644 --- a/content/en/api/terraform/beta/files/delete.md +++ b/content/en/api/terraform/beta/files/delete.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                            \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                              \ No newline at end of file diff --git a/content/en/api/terraform/beta/files/download.md b/content/en/api/terraform/beta/files/download.md index 9f88e1acb..eb1244ee8 100644 --- a/content/en/api/terraform/beta/files/download.md +++ b/content/en/api/terraform/beta/files/download.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                  \ No newline at end of file diff --git a/content/en/api/terraform/beta/files/list.md b/content/en/api/terraform/beta/files/list.md index c821b45eb..823e20600 100644 --- a/content/en/api/terraform/beta/files/list.md +++ b/content/en/api/terraform/beta/files/list.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                    \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                      \ No newline at end of file diff --git a/content/en/api/terraform/beta/files/retrieve_metadata.md b/content/en/api/terraform/beta/files/retrieve_metadata.md index 57fe64f4c..b46dc9331 100644 --- a/content/en/api/terraform/beta/files/retrieve_metadata.md +++ b/content/en/api/terraform/beta/files/retrieve_metadata.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                        \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                          \ No newline at end of file diff --git a/content/en/api/terraform/beta/files/upload.md b/content/en/api/terraform/beta/files/upload.md index d9c28f0f0..0efe433ce 100644 --- a/content/en/api/terraform/beta/files/upload.md +++ b/content/en/api/terraform/beta/files/upload.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                            \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                              \ No newline at end of file diff --git a/content/en/api/terraform/beta/messages.md b/content/en/api/terraform/beta/messages.md index 6902e46bd..afe912292 100644 --- a/content/en/api/terraform/beta/messages.md +++ b/content/en/api/terraform/beta/messages.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                  \ No newline at end of file diff --git a/content/en/api/terraform/beta/messages/batches.md b/content/en/api/terraform/beta/messages/batches.md index ad657b4da..2c0ec8d4c 100644 --- a/content/en/api/terraform/beta/messages/batches.md +++ b/content/en/api/terraform/beta/messages/batches.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                    \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                      \ No newline at end of file diff --git a/content/en/api/terraform/beta/messages/batches/cancel.md b/content/en/api/terraform/beta/messages/batches/cancel.md index 2ad9c1872..1b77fb7e1 100644 --- a/content/en/api/terraform/beta/messages/batches/cancel.md +++ b/content/en/api/terraform/beta/messages/batches/cancel.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                        \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                          \ No newline at end of file diff --git a/content/en/api/terraform/beta/messages/batches/create.md b/content/en/api/terraform/beta/messages/batches/create.md index 1286fdd98..80baf7a98 100644 --- a/content/en/api/terraform/beta/messages/batches/create.md +++ b/content/en/api/terraform/beta/messages/batches/create.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                            \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                              \ No newline at end of file diff --git a/content/en/api/terraform/beta/messages/batches/delete.md b/content/en/api/terraform/beta/messages/batches/delete.md index 2a95a4297..1680654a3 100644 --- a/content/en/api/terraform/beta/messages/batches/delete.md +++ b/content/en/api/terraform/beta/messages/batches/delete.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  \ No newline at end of file diff --git a/content/en/api/terraform/beta/messages/batches/list.md b/content/en/api/terraform/beta/messages/batches/list.md index 3b3895a2b..568439d73 100644 --- a/content/en/api/terraform/beta/messages/batches/list.md +++ b/content/en/api/terraform/beta/messages/batches/list.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      \ No newline at end of file diff --git a/content/en/api/terraform/beta/messages/batches/results.md b/content/en/api/terraform/beta/messages/batches/results.md index e8174026f..de07deb2e 100644 --- a/content/en/api/terraform/beta/messages/batches/results.md +++ b/content/en/api/terraform/beta/messages/batches/results.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          \ No newline at end of file diff --git a/content/en/api/terraform/beta/messages/batches/retrieve.md b/content/en/api/terraform/beta/messages/batches/retrieve.md index 9dd920090..1eedb7618 100644 --- a/content/en/api/terraform/beta/messages/batches/retrieve.md +++ b/content/en/api/terraform/beta/messages/batches/retrieve.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              \ No newline at end of file diff --git a/content/en/api/terraform/beta/messages/count_tokens.md b/content/en/api/terraform/beta/messages/count_tokens.md index bafa06e21..ff102afc9 100644 --- a/content/en/api/terraform/beta/messages/count_tokens.md +++ b/content/en/api/terraform/beta/messages/count_tokens.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  \ No newline at end of file diff --git a/content/en/api/terraform/beta/messages/create.md b/content/en/api/terraform/beta/messages/create.md index e385e4aaf..d891a9bbf 100644 --- a/content/en/api/terraform/beta/messages/create.md +++ b/content/en/api/terraform/beta/messages/create.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      \ No newline at end of file diff --git a/content/en/api/terraform/beta/models.md b/content/en/api/terraform/beta/models.md index 48a083e9e..fbf2b9ab3 100644 --- a/content/en/api/terraform/beta/models.md +++ b/content/en/api/terraform/beta/models.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          \ No newline at end of file diff --git a/content/en/api/terraform/beta/models/list.md b/content/en/api/terraform/beta/models/list.md index 526e53467..32ba8f005 100644 --- a/content/en/api/terraform/beta/models/list.md +++ b/content/en/api/terraform/beta/models/list.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              \ No newline at end of file diff --git a/content/en/api/terraform/beta/models/retrieve.md b/content/en/api/terraform/beta/models/retrieve.md index 0ae2c7a88..e84fd158c 100644 --- a/content/en/api/terraform/beta/models/retrieve.md +++ b/content/en/api/terraform/beta/models/retrieve.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  \ No newline at end of file diff --git a/content/en/api/terraform/beta/sessions.md b/content/en/api/terraform/beta/sessions.md new file mode 100644 index 000000000..99e065220 --- /dev/null +++ b/content/en/api/terraform/beta/sessions.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    \ No newline at end of file diff --git a/content/en/api/terraform/beta/sessions/archive.md b/content/en/api/terraform/beta/sessions/archive.md new file mode 100644 index 000000000..04237b6f1 --- /dev/null +++ b/content/en/api/terraform/beta/sessions/archive.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      \ No newline at end of file diff --git a/content/en/api/terraform/beta/sessions/create.md b/content/en/api/terraform/beta/sessions/create.md new file mode 100644 index 000000000..5cddd6fb9 --- /dev/null +++ b/content/en/api/terraform/beta/sessions/create.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        \ No newline at end of file diff --git a/content/en/api/terraform/beta/sessions/delete.md b/content/en/api/terraform/beta/sessions/delete.md new file mode 100644 index 000000000..4e40eeaeb --- /dev/null +++ b/content/en/api/terraform/beta/sessions/delete.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          \ No newline at end of file diff --git a/content/en/api/terraform/beta/sessions/events.md b/content/en/api/terraform/beta/sessions/events.md new file mode 100644 index 000000000..8d752606e --- /dev/null +++ b/content/en/api/terraform/beta/sessions/events.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            \ No newline at end of file diff --git a/content/en/api/terraform/beta/sessions/events/list.md b/content/en/api/terraform/beta/sessions/events/list.md new file mode 100644 index 000000000..1eda6e363 --- /dev/null +++ b/content/en/api/terraform/beta/sessions/events/list.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              \ No newline at end of file diff --git a/content/en/api/terraform/beta/sessions/events/send.md b/content/en/api/terraform/beta/sessions/events/send.md new file mode 100644 index 000000000..1d9f5b18f --- /dev/null +++ b/content/en/api/terraform/beta/sessions/events/send.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                \ No newline at end of file diff --git a/content/en/api/terraform/beta/sessions/events/stream.md b/content/en/api/terraform/beta/sessions/events/stream.md new file mode 100644 index 000000000..baa800854 --- /dev/null +++ b/content/en/api/terraform/beta/sessions/events/stream.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  \ No newline at end of file diff --git a/content/en/api/terraform/beta/sessions/list.md b/content/en/api/terraform/beta/sessions/list.md new file mode 100644 index 000000000..22fa1560f --- /dev/null +++ b/content/en/api/terraform/beta/sessions/list.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    \ No newline at end of file diff --git a/content/en/api/terraform/beta/sessions/resources.md b/content/en/api/terraform/beta/sessions/resources.md new file mode 100644 index 000000000..959f2e0b3 --- /dev/null +++ b/content/en/api/terraform/beta/sessions/resources.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      \ No newline at end of file diff --git a/content/en/api/terraform/beta/sessions/resources/add.md b/content/en/api/terraform/beta/sessions/resources/add.md new file mode 100644 index 000000000..b30bfa4f6 --- /dev/null +++ b/content/en/api/terraform/beta/sessions/resources/add.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        \ No newline at end of file diff --git a/content/en/api/terraform/beta/sessions/resources/delete.md b/content/en/api/terraform/beta/sessions/resources/delete.md new file mode 100644 index 000000000..a2f6224fa --- /dev/null +++ b/content/en/api/terraform/beta/sessions/resources/delete.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          \ No newline at end of file diff --git a/content/en/api/terraform/beta/sessions/resources/list.md b/content/en/api/terraform/beta/sessions/resources/list.md new file mode 100644 index 000000000..364f403e5 --- /dev/null +++ b/content/en/api/terraform/beta/sessions/resources/list.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            \ No newline at end of file diff --git a/content/en/api/terraform/beta/sessions/resources/retrieve.md b/content/en/api/terraform/beta/sessions/resources/retrieve.md new file mode 100644 index 000000000..e81a4f376 --- /dev/null +++ b/content/en/api/terraform/beta/sessions/resources/retrieve.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              \ No newline at end of file diff --git a/content/en/api/terraform/beta/sessions/resources/update.md b/content/en/api/terraform/beta/sessions/resources/update.md new file mode 100644 index 000000000..159528bb2 --- /dev/null +++ b/content/en/api/terraform/beta/sessions/resources/update.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                \ No newline at end of file diff --git a/content/en/api/terraform/beta/sessions/retrieve.md b/content/en/api/terraform/beta/sessions/retrieve.md new file mode 100644 index 000000000..a18305381 --- /dev/null +++ b/content/en/api/terraform/beta/sessions/retrieve.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  \ No newline at end of file diff --git a/content/en/api/terraform/beta/sessions/update.md b/content/en/api/terraform/beta/sessions/update.md new file mode 100644 index 000000000..bd0469fe8 --- /dev/null +++ b/content/en/api/terraform/beta/sessions/update.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    \ No newline at end of file diff --git a/content/en/api/terraform/beta/skills.md b/content/en/api/terraform/beta/skills.md index 18d83ef6a..3edacbc5f 100644 --- a/content/en/api/terraform/beta/skills.md +++ b/content/en/api/terraform/beta/skills.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        \ No newline at end of file diff --git a/content/en/api/terraform/beta/skills/create.md b/content/en/api/terraform/beta/skills/create.md index 3bbd6e565..7b78d5f2f 100644 --- a/content/en/api/terraform/beta/skills/create.md +++ b/content/en/api/terraform/beta/skills/create.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            \ No newline at end of file diff --git a/content/en/api/terraform/beta/skills/delete.md b/content/en/api/terraform/beta/skills/delete.md index 633194019..1c3d86d78 100644 --- a/content/en/api/terraform/beta/skills/delete.md +++ b/content/en/api/terraform/beta/skills/delete.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                \ No newline at end of file diff --git a/content/en/api/terraform/beta/skills/list.md b/content/en/api/terraform/beta/skills/list.md index 07f0c50e5..0b7c4c47f 100644 --- a/content/en/api/terraform/beta/skills/list.md +++ b/content/en/api/terraform/beta/skills/list.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    \ No newline at end of file diff --git a/content/en/api/terraform/beta/skills/retrieve.md b/content/en/api/terraform/beta/skills/retrieve.md index 18e0a5770..2e2c5a59f 100644 --- a/content/en/api/terraform/beta/skills/retrieve.md +++ b/content/en/api/terraform/beta/skills/retrieve.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        \ No newline at end of file diff --git a/content/en/api/terraform/beta/skills/versions.md b/content/en/api/terraform/beta/skills/versions.md index 62555094f..e9f28dd0d 100644 --- a/content/en/api/terraform/beta/skills/versions.md +++ b/content/en/api/terraform/beta/skills/versions.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            \ No newline at end of file diff --git a/content/en/api/terraform/beta/skills/versions/create.md b/content/en/api/terraform/beta/skills/versions/create.md index 731164857..ff501b1ee 100644 --- a/content/en/api/terraform/beta/skills/versions/create.md +++ b/content/en/api/terraform/beta/skills/versions/create.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                \ No newline at end of file diff --git a/content/en/api/terraform/beta/skills/versions/delete.md b/content/en/api/terraform/beta/skills/versions/delete.md index bbab78072..07e12a211 100644 --- a/content/en/api/terraform/beta/skills/versions/delete.md +++ b/content/en/api/terraform/beta/skills/versions/delete.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    \ No newline at end of file diff --git a/content/en/api/terraform/beta/skills/versions/list.md b/content/en/api/terraform/beta/skills/versions/list.md index 1d81a3ec7..7b26a7116 100644 --- a/content/en/api/terraform/beta/skills/versions/list.md +++ b/content/en/api/terraform/beta/skills/versions/list.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        \ No newline at end of file diff --git a/content/en/api/terraform/beta/skills/versions/retrieve.md b/content/en/api/terraform/beta/skills/versions/retrieve.md index 09d2bc8c0..d915c56d9 100644 --- a/content/en/api/terraform/beta/skills/versions/retrieve.md +++ b/content/en/api/terraform/beta/skills/versions/retrieve.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            \ No newline at end of file diff --git a/content/en/api/terraform/beta/vaults.md b/content/en/api/terraform/beta/vaults.md new file mode 100644 index 000000000..3510afc05 --- /dev/null +++ b/content/en/api/terraform/beta/vaults.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              \ No newline at end of file diff --git a/content/en/api/terraform/beta/vaults/archive.md b/content/en/api/terraform/beta/vaults/archive.md new file mode 100644 index 000000000..8659360c3 --- /dev/null +++ b/content/en/api/terraform/beta/vaults/archive.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                \ No newline at end of file diff --git a/content/en/api/terraform/beta/vaults/create.md b/content/en/api/terraform/beta/vaults/create.md new file mode 100644 index 000000000..d2c50a225 --- /dev/null +++ b/content/en/api/terraform/beta/vaults/create.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  \ No newline at end of file diff --git a/content/en/api/terraform/beta/vaults/credentials.md b/content/en/api/terraform/beta/vaults/credentials.md new file mode 100644 index 000000000..49a29addf --- /dev/null +++ b/content/en/api/terraform/beta/vaults/credentials.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    \ No newline at end of file diff --git a/content/en/api/terraform/beta/vaults/credentials/archive.md b/content/en/api/terraform/beta/vaults/credentials/archive.md new file mode 100644 index 000000000..f6d9743ba --- /dev/null +++ b/content/en/api/terraform/beta/vaults/credentials/archive.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      \ No newline at end of file diff --git a/content/en/api/terraform/beta/vaults/credentials/create.md b/content/en/api/terraform/beta/vaults/credentials/create.md new file mode 100644 index 000000000..8c9a41048 --- /dev/null +++ b/content/en/api/terraform/beta/vaults/credentials/create.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        \ No newline at end of file diff --git a/content/en/api/terraform/beta/vaults/credentials/delete.md b/content/en/api/terraform/beta/vaults/credentials/delete.md new file mode 100644 index 000000000..dcae62921 --- /dev/null +++ b/content/en/api/terraform/beta/vaults/credentials/delete.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          \ No newline at end of file diff --git a/content/en/api/terraform/beta/vaults/credentials/list.md b/content/en/api/terraform/beta/vaults/credentials/list.md new file mode 100644 index 000000000..03bc16f37 --- /dev/null +++ b/content/en/api/terraform/beta/vaults/credentials/list.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            \ No newline at end of file diff --git a/content/en/api/terraform/beta/vaults/credentials/retrieve.md b/content/en/api/terraform/beta/vaults/credentials/retrieve.md new file mode 100644 index 000000000..958fc8671 --- /dev/null +++ b/content/en/api/terraform/beta/vaults/credentials/retrieve.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              \ No newline at end of file diff --git a/content/en/api/terraform/beta/vaults/credentials/update.md b/content/en/api/terraform/beta/vaults/credentials/update.md new file mode 100644 index 000000000..c08b2844e --- /dev/null +++ b/content/en/api/terraform/beta/vaults/credentials/update.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                \ No newline at end of file diff --git a/content/en/api/terraform/beta/vaults/delete.md b/content/en/api/terraform/beta/vaults/delete.md new file mode 100644 index 000000000..2f40eac72 --- /dev/null +++ b/content/en/api/terraform/beta/vaults/delete.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  \ No newline at end of file diff --git a/content/en/api/terraform/beta/vaults/list.md b/content/en/api/terraform/beta/vaults/list.md new file mode 100644 index 000000000..77c21ab92 --- /dev/null +++ b/content/en/api/terraform/beta/vaults/list.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    \ No newline at end of file diff --git a/content/en/api/terraform/beta/vaults/retrieve.md b/content/en/api/terraform/beta/vaults/retrieve.md new file mode 100644 index 000000000..12fe707aa --- /dev/null +++ b/content/en/api/terraform/beta/vaults/retrieve.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      \ No newline at end of file diff --git a/content/en/api/terraform/beta/vaults/update.md b/content/en/api/terraform/beta/vaults/update.md new file mode 100644 index 000000000..39cf86aab --- /dev/null +++ b/content/en/api/terraform/beta/vaults/update.md @@ -0,0 +1 @@ +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        \ No newline at end of file diff --git a/content/en/api/terraform/completions.md b/content/en/api/terraform/completions.md index 6f06c6359..c73b2cad1 100644 --- a/content/en/api/terraform/completions.md +++ b/content/en/api/terraform/completions.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            \ No newline at end of file diff --git a/content/en/api/terraform/completions/create.md b/content/en/api/terraform/completions/create.md index 078ba5ada..114db7fc0 100644 --- a/content/en/api/terraform/completions/create.md +++ b/content/en/api/terraform/completions/create.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                \ No newline at end of file diff --git a/content/en/api/terraform/messages.md b/content/en/api/terraform/messages.md index ecd84a91f..b508d6ff6 100644 --- a/content/en/api/terraform/messages.md +++ b/content/en/api/terraform/messages.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    \ No newline at end of file diff --git a/content/en/api/terraform/messages/batches.md b/content/en/api/terraform/messages/batches.md index 42e147bc3..c5a09f253 100644 --- a/content/en/api/terraform/messages/batches.md +++ b/content/en/api/terraform/messages/batches.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        \ No newline at end of file diff --git a/content/en/api/terraform/messages/batches/cancel.md b/content/en/api/terraform/messages/batches/cancel.md index 7ccb7491d..6de00ce89 100644 --- a/content/en/api/terraform/messages/batches/cancel.md +++ b/content/en/api/terraform/messages/batches/cancel.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            \ No newline at end of file diff --git a/content/en/api/terraform/messages/batches/create.md b/content/en/api/terraform/messages/batches/create.md index 3ee6e46c1..861bb7c33 100644 --- a/content/en/api/terraform/messages/batches/create.md +++ b/content/en/api/terraform/messages/batches/create.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                \ No newline at end of file diff --git a/content/en/api/terraform/messages/batches/delete.md b/content/en/api/terraform/messages/batches/delete.md index 0043cad98..fe2dbba3e 100644 --- a/content/en/api/terraform/messages/batches/delete.md +++ b/content/en/api/terraform/messages/batches/delete.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    \ No newline at end of file diff --git a/content/en/api/terraform/messages/batches/list.md b/content/en/api/terraform/messages/batches/list.md index 541f3ce93..ed4ba2d89 100644 --- a/content/en/api/terraform/messages/batches/list.md +++ b/content/en/api/terraform/messages/batches/list.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        \ No newline at end of file diff --git a/content/en/api/terraform/messages/batches/results.md b/content/en/api/terraform/messages/batches/results.md index 2d4e934d7..7649f063c 100644 --- a/content/en/api/terraform/messages/batches/results.md +++ b/content/en/api/terraform/messages/batches/results.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            \ No newline at end of file diff --git a/content/en/api/terraform/messages/batches/retrieve.md b/content/en/api/terraform/messages/batches/retrieve.md index f519fef79..b6ae32a7a 100644 --- a/content/en/api/terraform/messages/batches/retrieve.md +++ b/content/en/api/terraform/messages/batches/retrieve.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                \ No newline at end of file diff --git a/content/en/api/terraform/messages/count_tokens.md b/content/en/api/terraform/messages/count_tokens.md index a8d4d39f7..1b42084d0 100644 --- a/content/en/api/terraform/messages/count_tokens.md +++ b/content/en/api/terraform/messages/count_tokens.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    \ No newline at end of file diff --git a/content/en/api/terraform/messages/create.md b/content/en/api/terraform/messages/create.md index 19ca14a24..150954911 100644 --- a/content/en/api/terraform/messages/create.md +++ b/content/en/api/terraform/messages/create.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        \ No newline at end of file diff --git a/content/en/api/terraform/models.md b/content/en/api/terraform/models.md index 0bbc3c8fb..29811c353 100644 --- a/content/en/api/terraform/models.md +++ b/content/en/api/terraform/models.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            \ No newline at end of file diff --git a/content/en/api/terraform/models/list.md b/content/en/api/terraform/models/list.md index b9dc440e0..ba15f25cd 100644 --- a/content/en/api/terraform/models/list.md +++ b/content/en/api/terraform/models/list.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                \ No newline at end of file diff --git a/content/en/api/terraform/models/retrieve.md b/content/en/api/terraform/models/retrieve.md index e5f17d910..40735a135 100644 --- a/content/en/api/terraform/models/retrieve.md +++ b/content/en/api/terraform/models/retrieve.md @@ -1 +1 @@ -Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  \ No newline at end of file +Not Found - Claude API Docs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    \ No newline at end of file diff --git a/content/en/api/typescript/beta.md b/content/en/api/typescript/beta.md index ee45d768f..460a1fc46 100644 --- a/content/en/api/typescript/beta.md +++ b/content/en/api/typescript/beta.md @@ -4,11 +4,11 @@ ### Anthropic Beta -- `AnthropicBeta = (string & {}) | "message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` +- `AnthropicBeta = (string & {}) | "message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -52,8 +52,6 @@ - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Beta API Error - `BetaAPIError` @@ -340,7 +338,7 @@ The Models API response can be used to determine which models are available for - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -384,8 +382,6 @@ The Models API response can be used to determine which models are available for - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaModelInfo` @@ -609,7 +605,7 @@ The Models API response can be used to determine information about a specific mo - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -653,8 +649,6 @@ The Models API response can be used to determine information about a specific mo - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaModelInfo` @@ -3936,11 +3930,15 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -6011,17 +6009,13 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en Recommended for advanced use cases only. You usually only need to use `temperature`. - - `user_profile_id?: string | null` - - Body param: The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `betas?: Array` Header param: Optional header to specify the beta version(s) you want to use. - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -6065,8 +6059,6 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - - `MessageCreateParamsNonStreaming extends MessageCreateParamsBase` - `stream?: false` @@ -7010,11 +7002,15 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -9922,11 +9918,15 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -11905,7 +11905,7 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -11949,8 +11949,6 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaMessageTokensCount` @@ -11978,7 +11976,7 @@ const client = new Anthropic({ const betaMessageTokensCount = await client.beta.messages.countTokens({ messages: [{ content: 'string', role: 'user' }], - model: 'claude-opus-4-6', + model: 'claude-mythos-preview', }); console.log(betaMessageTokensCount.context_management); @@ -19169,11 +19167,15 @@ console.log(betaMessageTokensCount.context_management); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -24509,11 +24511,15 @@ console.log(betaMessageTokensCount.context_management); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -25749,11 +25755,15 @@ console.log(betaMessageTokensCount.context_management); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -36887,11 +36897,15 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -38960,17 +38974,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Recommended for advanced use cases only. You usually only need to use `temperature`. - - `user_profile_id?: string | null` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `betas?: Array` Header param: Optional header to specify the beta version(s) you want to use. - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -39014,8 +39024,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaMessageBatch` @@ -39155,7 +39163,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -39199,8 +39207,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaMessageBatch` @@ -39339,7 +39345,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -39383,8 +39389,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaMessageBatch` @@ -39516,7 +39520,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -39560,8 +39564,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaMessageBatch` @@ -39692,7 +39694,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -39736,8 +39738,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaDeletedMessageBatch` @@ -39794,7 +39794,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -39838,8 +39838,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaMessageBatchIndividualResponse` @@ -40781,11 +40779,15 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -42357,11 +42359,15 @@ console.log(betaMessageBatchIndividualResponse.custom_id); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -43725,11 +43731,15 @@ console.log(betaMessageBatchIndividualResponse.custom_id); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -45055,11 +45065,15 @@ console.log(betaMessageBatchIndividualResponse.custom_id); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -45360,23 +45374,381 @@ console.log(betaMessageBatchIndividualResponse.custom_id); - `"succeeded"` -# Files +# Agents -## Upload +## Create -`client.beta.files.upload(FileUploadParamsparams, RequestOptionsoptions?): FileMetadata` +`client.beta.agents.create(AgentCreateParamsparams, RequestOptionsoptions?): BetaManagedAgentsAgent` -**post** `/v1/files` +**post** `/v1/agents` -Upload File +Create Agent ### Parameters -- `params: FileUploadParams` +- `params: AgentCreateParams` - - `file: Uploadable` + - `model: BetaManagedAgentsModel | BetaManagedAgentsModelConfigParams` - Body param: The file to upload + Body param: Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control + + - `BetaManagedAgentsModel = "claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more | (string & {})` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `BetaManagedAgentsModelConfigParams` + + An object that defines additional configuration control over model use + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast" | null` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + Body param: Human-readable name for the agent. 1-256 characters. + + - `description?: string | null` + + Body param: Description of what the agent does. Up to 2048 characters. + + - `mcp_servers?: Array` + + Body param: MCP servers this agent connects to. Maximum 20. Names must be unique within the array. + + - `name: string` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `type: "url"` + + - `"url"` + + - `url: string` + + Endpoint URL for the MCP server. + + - `metadata?: Record` + + Body param: Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars. + + - `skills?: Array` + + Body param: Skills available to the agent. Maximum 20. + + - `BetaManagedAgentsAnthropicSkillParams` + + An Anthropic-managed skill. + + - `skill_id: string` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: "anthropic"` + + - `"anthropic"` + + - `version?: string | null` + + Version to pin. Defaults to latest if omitted. + + - `BetaManagedAgentsCustomSkillParams` + + A user-created custom skill. + + - `skill_id: string` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: "custom"` + + - `"custom"` + + - `version?: string | null` + + Version to pin. Defaults to latest if omitted. + + - `system?: string | null` + + Body param: System prompt for the agent. Up to 100,000 characters. + + - `tools?: Array` + + Body param: Tool configurations available to the agent. Maximum of 128 tools across all toolsets allowed. + + - `BetaManagedAgentsAgentToolset20260401Params` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `configs?: Array` + + Per-tool configuration overrides. + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled?: boolean | null` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config?: BetaManagedAgentsAgentToolsetDefaultConfigParams | null` + + Default configuration for all tools in a toolset. + + - `enabled?: boolean | null` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `BetaManagedAgentsMCPToolsetParams` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `mcp_server_name: string` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `configs?: Array` + + Per-tool configuration overrides. + + - `name: string` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled?: boolean | null` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config?: BetaManagedAgentsMCPToolsetDefaultConfigParams | null` + + Default configuration for all tools from an MCP server. + + - `enabled?: boolean | null` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `BetaManagedAgentsCustomToolParams` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: string` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: "custom"` + + - `"custom"` - `betas?: Array` @@ -45384,7 +45756,7 @@ Upload File - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -45428,7 +45800,22613 @@ Upload File - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` +### Returns + +- `BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: Record` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsAgent = await client.beta.agents.create({ + model: 'claude-sonnet-4-6', + name: 'My First Agent', +}); + +console.log(betaManagedAgentsAgent.id); +``` + +## List + +`client.beta.agents.list(AgentListParamsparams?, RequestOptionsoptions?): PageCursor` + +**get** `/v1/agents` + +List Agents + +### Parameters + +- `params: AgentListParams` + + - `createdAtGte?: string` + + Query param: Return agents created at or after this time (inclusive). + + - `createdAtLte?: string` + + Query param: Return agents created at or before this time (inclusive). + + - `include_archived?: boolean` + + Query param: Include archived agents in results. Defaults to false. + + - `limit?: number` + + Query param: Maximum results per page. Default 20, maximum 100. + + - `page?: string` + + Query param: Opaque pagination cursor from a previous response. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: Record` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +// Automatically fetches more pages as needed. +for await (const betaManagedAgentsAgent of client.beta.agents.list()) { + console.log(betaManagedAgentsAgent.id); +} +``` + +## Retrieve + +`client.beta.agents.retrieve(stringagentID, AgentRetrieveParamsparams?, RequestOptionsoptions?): BetaManagedAgentsAgent` + +**get** `/v1/agents/{agent_id}` + +Get Agent + +### Parameters + +- `agentID: string` + +- `params: AgentRetrieveParams` + + - `version?: number` + + Query param: Agent version. Omit for the most recent version. Must be at least 1 if specified. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: Record` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsAgent = await client.beta.agents.retrieve('agent_011CZkYpogX7uDKUyvBTophP'); + +console.log(betaManagedAgentsAgent.id); +``` + +## Update + +`client.beta.agents.update(stringagentID, AgentUpdateParamsparams, RequestOptionsoptions?): BetaManagedAgentsAgent` + +**post** `/v1/agents/{agent_id}` + +Update Agent + +### Parameters + +- `agentID: string` + +- `params: AgentUpdateParams` + + - `version: number` + + Body param: The agent's current version, used to prevent concurrent overwrites. Obtain this value from a create or retrieve response. The request fails if this does not match the server's current version. + + - `description?: string | null` + + Body param: Description. Up to 2048 characters. Omit to preserve; send empty string or null to clear. + + - `mcp_servers?: Array | null` + + Body param: MCP servers. Full replacement. Omit to preserve; send empty array or null to clear. Names must be unique. Maximum 20. + + - `name: string` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `type: "url"` + + - `"url"` + + - `url: string` + + Endpoint URL for the MCP server. + + - `metadata?: Record | null` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. The stored bag is limited to 16 keys (up to 64 chars each) with values up to 512 chars. + + - `model?: BetaManagedAgentsModel | BetaManagedAgentsModelConfigParams` + + Body param: Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control. Omit to preserve. Cannot be cleared. + + - `BetaManagedAgentsModel = "claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more | (string & {})` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `BetaManagedAgentsModelConfigParams` + + An object that defines additional configuration control over model use + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast" | null` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name?: string` + + Body param: Human-readable name. 1-256 characters. Omit to preserve. Cannot be cleared. + + - `skills?: Array | null` + + Body param: Skills. Full replacement. Omit to preserve; send empty array or null to clear. Maximum 20. + + - `BetaManagedAgentsAnthropicSkillParams` + + An Anthropic-managed skill. + + - `skill_id: string` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: "anthropic"` + + - `"anthropic"` + + - `version?: string | null` + + Version to pin. Defaults to latest if omitted. + + - `BetaManagedAgentsCustomSkillParams` + + A user-created custom skill. + + - `skill_id: string` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: "custom"` + + - `"custom"` + + - `version?: string | null` + + Version to pin. Defaults to latest if omitted. + + - `system?: string | null` + + Body param: System prompt. Up to 100,000 characters. Omit to preserve; send empty string or null to clear. + + - `tools?: Array | null` + + Body param: Tool configurations available to the agent. Full replacement. Omit to preserve; send empty array or null to clear. Maximum of 128 tools across all toolsets allowed. + + - `BetaManagedAgentsAgentToolset20260401Params` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `configs?: Array` + + Per-tool configuration overrides. + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled?: boolean | null` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config?: BetaManagedAgentsAgentToolsetDefaultConfigParams | null` + + Default configuration for all tools in a toolset. + + - `enabled?: boolean | null` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `BetaManagedAgentsMCPToolsetParams` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `mcp_server_name: string` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `configs?: Array` + + Per-tool configuration overrides. + + - `name: string` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled?: boolean | null` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config?: BetaManagedAgentsMCPToolsetDefaultConfigParams | null` + + Default configuration for all tools from an MCP server. + + - `enabled?: boolean | null` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `BetaManagedAgentsCustomToolParams` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: string` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: "custom"` + + - `"custom"` + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: Record` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsAgent = await client.beta.agents.update('agent_011CZkYpogX7uDKUyvBTophP', { + version: 1, +}); + +console.log(betaManagedAgentsAgent.id); +``` + +## Archive + +`client.beta.agents.archive(stringagentID, AgentArchiveParamsparams?, RequestOptionsoptions?): BetaManagedAgentsAgent` + +**post** `/v1/agents/{agent_id}/archive` + +Archive Agent + +### Parameters + +- `agentID: string` + +- `params: AgentArchiveParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: Record` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsAgent = await client.beta.agents.archive('agent_011CZkYpogX7uDKUyvBTophP'); + +console.log(betaManagedAgentsAgent.id); +``` + +## Domain Types + +### Beta Managed Agents Agent + +- `BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: Record` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Beta Managed Agents Agent Tool Config + +- `BetaManagedAgentsAgentToolConfig` + + Configuration for a specific agent tool. + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Agent Tool Config Params + +- `BetaManagedAgentsAgentToolConfigParams` + + Configuration override for a specific tool within a toolset. + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled?: boolean | null` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Agent Toolset Default Config + +- `BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Agent Toolset Default Config Params + +- `BetaManagedAgentsAgentToolsetDefaultConfigParams` + + Default configuration for all tools in a toolset. + + - `enabled?: boolean | null` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Agent Toolset20260401 + +- `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + +### Beta Managed Agents Agent Toolset20260401 Params + +- `BetaManagedAgentsAgentToolset20260401Params` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `configs?: Array` + + Per-tool configuration overrides. + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled?: boolean | null` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config?: BetaManagedAgentsAgentToolsetDefaultConfigParams | null` + + Default configuration for all tools in a toolset. + + - `enabled?: boolean | null` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Always Allow Policy + +- `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + +### Beta Managed Agents Always Ask Policy + +- `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Anthropic Skill + +- `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + +### Beta Managed Agents Anthropic Skill Params + +- `BetaManagedAgentsAnthropicSkillParams` + + An Anthropic-managed skill. + + - `skill_id: string` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: "anthropic"` + + - `"anthropic"` + + - `version?: string | null` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents Custom Skill + +- `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + +### Beta Managed Agents Custom Skill Params + +- `BetaManagedAgentsCustomSkillParams` + + A user-created custom skill. + + - `skill_id: string` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: "custom"` + + - `"custom"` + + - `version?: string | null` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents Custom Tool + +- `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + +### Beta Managed Agents Custom Tool Input Schema + +- `BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + +### Beta Managed Agents Custom Tool Params + +- `BetaManagedAgentsCustomToolParams` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: string` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: "custom"` + + - `"custom"` + +### Beta Managed Agents MCP Server URL Definition + +- `BetaManagedAgentsMCPServerURLDefinition` + + URL-based MCP server connection as returned in API responses. + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + +### Beta Managed Agents MCP Tool Config + +- `BetaManagedAgentsMCPToolConfig` + + Resolved configuration for a specific MCP tool. + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents MCP Tool Config Params + +- `BetaManagedAgentsMCPToolConfigParams` + + Configuration override for a specific MCP tool. + + - `name: string` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled?: boolean | null` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents MCP Toolset + +- `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + +### Beta Managed Agents MCP Toolset Default Config + +- `BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents MCP Toolset Default Config Params + +- `BetaManagedAgentsMCPToolsetDefaultConfigParams` + + Default configuration for all tools from an MCP server. + + - `enabled?: boolean | null` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents MCP Toolset Params + +- `BetaManagedAgentsMCPToolsetParams` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `mcp_server_name: string` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `configs?: Array` + + Per-tool configuration overrides. + + - `name: string` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled?: boolean | null` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config?: BetaManagedAgentsMCPToolsetDefaultConfigParams | null` + + Default configuration for all tools from an MCP server. + + - `enabled?: boolean | null` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Model + +- `BetaManagedAgentsModel = "claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more | (string & {})` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + +### Beta Managed Agents Model Config + +- `BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +### Beta Managed Agents Model Config Params + +- `BetaManagedAgentsModelConfigParams` + + An object that defines additional configuration control over model use + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast" | null` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +### Beta Managed Agents Skill Params + +- `BetaManagedAgentsSkillParams = BetaManagedAgentsAnthropicSkillParams | BetaManagedAgentsCustomSkillParams` + + Skill to load in the session container. + + - `BetaManagedAgentsAnthropicSkillParams` + + An Anthropic-managed skill. + + - `skill_id: string` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: "anthropic"` + + - `"anthropic"` + + - `version?: string | null` + + Version to pin. Defaults to latest if omitted. + + - `BetaManagedAgentsCustomSkillParams` + + A user-created custom skill. + + - `skill_id: string` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: "custom"` + + - `"custom"` + + - `version?: string | null` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents URL MCP Server Params + +- `BetaManagedAgentsURLMCPServerParams` + + URL-based MCP server connection. + + - `name: string` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `type: "url"` + + - `"url"` + + - `url: string` + + Endpoint URL for the MCP server. + +# Versions + +## List + +`client.beta.agents.versions.list(stringagentID, VersionListParamsparams?, RequestOptionsoptions?): PageCursor` + +**get** `/v1/agents/{agent_id}/versions` + +List Agent Versions + +### Parameters + +- `agentID: string` + +- `params: VersionListParams` + + - `limit?: number` + + Query param: Maximum results per page. Default 20, maximum 100. + + - `page?: string` + + Query param: Opaque pagination cursor. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: Record` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +// Automatically fetches more pages as needed. +for await (const betaManagedAgentsAgent of client.beta.agents.versions.list( + 'agent_011CZkYpogX7uDKUyvBTophP', +)) { + console.log(betaManagedAgentsAgent.id); +} +``` + +# Environments + +## Create + +`client.beta.environments.create(EnvironmentCreateParamsparams, RequestOptionsoptions?): BetaEnvironment` + +**post** `/v1/environments` + +Create a new environment with the specified configuration. + +### Parameters + +- `params: EnvironmentCreateParams` + + - `name: string` + + Body param: Human-readable name for the environment + + - `config?: BetaCloudConfigParams | null` + + Body param: Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `networking?: BetaUnrestrictedNetwork | BetaLimitedNetworkParams | null` + + Network configuration policy. Omit on update to preserve the existing value. + + - `BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetworkParams` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `allow_mcp_servers?: boolean | null` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers?: boolean | null` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts?: Array | null` + + Specifies domains the container can reach. + + - `packages?: BetaPackagesParams | null` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt?: Array | null` + + Ubuntu/Debian packages to install + + - `cargo?: Array | null` + + Rust packages to install + + - `gem?: Array | null` + + Ruby packages to install + + - `go?: Array | null` + + Go packages to install + + - `npm?: Array | null` + + Node.js packages to install + + - `pip?: Array | null` + + Python packages to install + + - `type?: "packages"` + + Package configuration type + + - `"packages"` + + - `description?: string | null` + + Body param: Optional description of the environment + + - `metadata?: Record` + + Body param: User-provided metadata key-value pairs + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string | null` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array` + + Ubuntu/Debian packages to install + + - `cargo: Array` + + Rust packages to install + + - `gem: Array` + + Ruby packages to install + + - `go: Array` + + Go packages to install + + - `npm: Array` + + Node.js packages to install + + - `pip: Array` + + Python packages to install + + - `type?: "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: Record` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaEnvironment = await client.beta.environments.create({ name: 'python-data-analysis' }); + +console.log(betaEnvironment.id); +``` + +## List + +`client.beta.environments.list(EnvironmentListParamsparams?, RequestOptionsoptions?): PageCursor` + +**get** `/v1/environments` + +List environments with pagination support. + +### Parameters + +- `params: EnvironmentListParams` + + - `include_archived?: boolean` + + Query param: Include archived environments in the response + + - `limit?: number` + + Query param: Maximum number of environments to return + + - `page?: string | null` + + Query param: Opaque cursor from previous response for pagination. Pass the `next_page` value from the previous response. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string | null` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array` + + Ubuntu/Debian packages to install + + - `cargo: Array` + + Rust packages to install + + - `gem: Array` + + Ruby packages to install + + - `go: Array` + + Go packages to install + + - `npm: Array` + + Node.js packages to install + + - `pip: Array` + + Python packages to install + + - `type?: "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: Record` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +// Automatically fetches more pages as needed. +for await (const betaEnvironment of client.beta.environments.list()) { + console.log(betaEnvironment.id); +} +``` + +## Retrieve + +`client.beta.environments.retrieve(stringenvironmentID, EnvironmentRetrieveParamsparams?, RequestOptionsoptions?): BetaEnvironment` + +**get** `/v1/environments/{environment_id}` + +Retrieve a specific environment by ID. + +### Parameters + +- `environmentID: string` + +- `params: EnvironmentRetrieveParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string | null` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array` + + Ubuntu/Debian packages to install + + - `cargo: Array` + + Rust packages to install + + - `gem: Array` + + Ruby packages to install + + - `go: Array` + + Go packages to install + + - `npm: Array` + + Node.js packages to install + + - `pip: Array` + + Python packages to install + + - `type?: "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: Record` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaEnvironment = await client.beta.environments.retrieve('env_011CZkZ9X2dpNyB7HsEFoRfW'); + +console.log(betaEnvironment.id); +``` + +## Update + +`client.beta.environments.update(stringenvironmentID, EnvironmentUpdateParamsparams, RequestOptionsoptions?): BetaEnvironment` + +**post** `/v1/environments/{environment_id}` + +Update an existing environment's configuration. + +### Parameters + +- `environmentID: string` + +- `params: EnvironmentUpdateParams` + + - `config?: BetaCloudConfigParams | null` + + Body param: Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `networking?: BetaUnrestrictedNetwork | BetaLimitedNetworkParams | null` + + Network configuration policy. Omit on update to preserve the existing value. + + - `BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetworkParams` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `allow_mcp_servers?: boolean | null` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers?: boolean | null` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts?: Array | null` + + Specifies domains the container can reach. + + - `packages?: BetaPackagesParams | null` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt?: Array | null` + + Ubuntu/Debian packages to install + + - `cargo?: Array | null` + + Rust packages to install + + - `gem?: Array | null` + + Ruby packages to install + + - `go?: Array | null` + + Go packages to install + + - `npm?: Array | null` + + Node.js packages to install + + - `pip?: Array | null` + + Python packages to install + + - `type?: "packages"` + + Package configuration type + + - `"packages"` + + - `description?: string | null` + + Body param: Updated description of the environment + + - `metadata?: Record` + + Body param: User-provided metadata key-value pairs. Set a value to null or empty string to delete the key. + + - `name?: string | null` + + Body param: Updated name for the environment + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string | null` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array` + + Ubuntu/Debian packages to install + + - `cargo: Array` + + Rust packages to install + + - `gem: Array` + + Ruby packages to install + + - `go: Array` + + Go packages to install + + - `npm: Array` + + Node.js packages to install + + - `pip: Array` + + Python packages to install + + - `type?: "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: Record` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaEnvironment = await client.beta.environments.update('env_011CZkZ9X2dpNyB7HsEFoRfW'); + +console.log(betaEnvironment.id); +``` + +## Delete + +`client.beta.environments.delete(stringenvironmentID, EnvironmentDeleteParamsparams?, RequestOptionsoptions?): BetaEnvironmentDeleteResponse` + +**delete** `/v1/environments/{environment_id}` + +Delete an environment by ID. Returns a confirmation of the deletion. + +### Parameters + +- `environmentID: string` + +- `params: EnvironmentDeleteParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaEnvironmentDeleteResponse` + + Response after deleting an environment. + + - `id: string` + + Environment identifier + + - `type: "environment_deleted"` + + The type of response + + - `"environment_deleted"` + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaEnvironmentDeleteResponse = await client.beta.environments.delete( + 'env_011CZkZ9X2dpNyB7HsEFoRfW', +); + +console.log(betaEnvironmentDeleteResponse.id); +``` + +## Archive + +`client.beta.environments.archive(stringenvironmentID, EnvironmentArchiveParamsparams?, RequestOptionsoptions?): BetaEnvironment` + +**post** `/v1/environments/{environment_id}/archive` + +Archive an environment by ID. Archived environments cannot be used to create new sessions. + +### Parameters + +- `environmentID: string` + +- `params: EnvironmentArchiveParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string | null` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array` + + Ubuntu/Debian packages to install + + - `cargo: Array` + + Rust packages to install + + - `gem: Array` + + Ruby packages to install + + - `go: Array` + + Go packages to install + + - `npm: Array` + + Node.js packages to install + + - `pip: Array` + + Python packages to install + + - `type?: "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: Record` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaEnvironment = await client.beta.environments.archive('env_011CZkZ9X2dpNyB7HsEFoRfW'); + +console.log(betaEnvironment.id); +``` + +## Domain Types + +### Beta Cloud Config + +- `BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array` + + Ubuntu/Debian packages to install + + - `cargo: Array` + + Rust packages to install + + - `gem: Array` + + Ruby packages to install + + - `go: Array` + + Go packages to install + + - `npm: Array` + + Node.js packages to install + + - `pip: Array` + + Python packages to install + + - `type?: "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + +### Beta Cloud Config Params + +- `BetaCloudConfigParams` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `networking?: BetaUnrestrictedNetwork | BetaLimitedNetworkParams | null` + + Network configuration policy. Omit on update to preserve the existing value. + + - `BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetworkParams` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `allow_mcp_servers?: boolean | null` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers?: boolean | null` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts?: Array | null` + + Specifies domains the container can reach. + + - `packages?: BetaPackagesParams | null` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt?: Array | null` + + Ubuntu/Debian packages to install + + - `cargo?: Array | null` + + Rust packages to install + + - `gem?: Array | null` + + Ruby packages to install + + - `go?: Array | null` + + Go packages to install + + - `npm?: Array | null` + + Node.js packages to install + + - `pip?: Array | null` + + Python packages to install + + - `type?: "packages"` + + Package configuration type + + - `"packages"` + +### Beta Environment + +- `BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string | null` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array` + + Ubuntu/Debian packages to install + + - `cargo: Array` + + Rust packages to install + + - `gem: Array` + + Ruby packages to install + + - `go: Array` + + Go packages to install + + - `npm: Array` + + Node.js packages to install + + - `pip: Array` + + Python packages to install + + - `type?: "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: Record` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Beta Environment Delete Response + +- `BetaEnvironmentDeleteResponse` + + Response after deleting an environment. + + - `id: string` + + Environment identifier + + - `type: "environment_deleted"` + + The type of response + + - `"environment_deleted"` + +### Beta Limited Network + +- `BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + +### Beta Limited Network Params + +- `BetaLimitedNetworkParams` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `allow_mcp_servers?: boolean | null` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers?: boolean | null` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts?: Array | null` + + Specifies domains the container can reach. + +### Beta Packages + +- `BetaPackages` + + Packages (and their versions) available in this environment. + + - `apt: Array` + + Ubuntu/Debian packages to install + + - `cargo: Array` + + Rust packages to install + + - `gem: Array` + + Ruby packages to install + + - `go: Array` + + Go packages to install + + - `npm: Array` + + Node.js packages to install + + - `pip: Array` + + Python packages to install + + - `type?: "packages"` + + Package configuration type + + - `"packages"` + +### Beta Packages Params + +- `BetaPackagesParams` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt?: Array | null` + + Ubuntu/Debian packages to install + + - `cargo?: Array | null` + + Rust packages to install + + - `gem?: Array | null` + + Ruby packages to install + + - `go?: Array | null` + + Go packages to install + + - `npm?: Array | null` + + Node.js packages to install + + - `pip?: Array | null` + + Python packages to install + + - `type?: "packages"` + + Package configuration type + + - `"packages"` + +### Beta Unrestricted Network + +- `BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + +# Sessions + +## Create + +`client.beta.sessions.create(SessionCreateParamsparams, RequestOptionsoptions?): BetaManagedAgentsSession` + +**post** `/v1/sessions` + +Create Session + +### Parameters + +- `params: SessionCreateParams` + + - `agent: string | BetaManagedAgentsAgentParams` + + Body param: Agent identifier. Accepts the `agent` ID string, which pins the latest version for the session, or an `agent` object with both id and version specified. + + - `string` + + - `BetaManagedAgentsAgentParams` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `id: string` + + The `agent` ID. + + - `type: "agent"` + + - `"agent"` + + - `version?: number` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + + - `environment_id: string` + + Body param: ID of the `environment` defining the container configuration for this session. + + - `metadata?: Record` + + Body param: Arbitrary key-value metadata attached to the session. + + - `resources?: Array` + + Body param: Resources (e.g. repositories, files) to mount into the session's container. + + - `BetaManagedAgentsGitHubRepositoryResourceParams` + + Mount a GitHub repository into the session's container. + + - `authorization_token: string` + + GitHub authorization token used to clone the repository. + + - `type: "github_repository"` + + - `"github_repository"` + + - `url: string` + + Github URL of the repository + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `mount_path?: string | null` + + Mount path in the container. Defaults to `/workspace/`. + + - `BetaManagedAgentsFileResourceParams` + + Mount a file uploaded via the Files API into the session. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `mount_path?: string | null` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + + - `title?: string | null` + + Body param: Human-readable session title. + + - `vault_ids?: Array` + + Body param: Vault IDs for stored credentials the agent can use during the session. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: Record` + + - `resources: Array` + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds?: number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds?: number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" | "running" | "idle" | "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string | null` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation?: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens?: number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens?: number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens?: number` + + Total tokens read from prompt cache. + + - `input_tokens?: number` + + Total input tokens consumed across all turns. + + - `output_tokens?: number` + + Total output tokens generated across all turns. + + - `vault_ids: Array` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsSession = await client.beta.sessions.create({ + agent: 'agent_011CZkYpogX7uDKUyvBTophP', + environment_id: 'env_011CZkZ9X2dpNyB7HsEFoRfW', +}); + +console.log(betaManagedAgentsSession.id); +``` + +## List + +`client.beta.sessions.list(SessionListParamsparams?, RequestOptionsoptions?): PageCursor` + +**get** `/v1/sessions` + +List Sessions + +### Parameters + +- `params: SessionListParams` + + - `agent_id?: string` + + Query param: Filter sessions created with this agent ID. + + - `agent_version?: number` + + Query param: Filter by agent version. Only applies when agent_id is also set. + + - `createdAtGt?: string` + + Query param: Return sessions created after this time (exclusive). + + - `createdAtGte?: string` + + Query param: Return sessions created at or after this time (inclusive). + + - `createdAtLt?: string` + + Query param: Return sessions created before this time (exclusive). + + - `createdAtLte?: string` + + Query param: Return sessions created at or before this time (inclusive). + + - `include_archived?: boolean` + + Query param: When true, includes archived sessions. Default: false (exclude archived). + + - `limit?: number` + + Query param: Maximum number of results to return. + + - `order?: "asc" | "desc"` + + Query param: Sort direction for results, ordered by created_at. Defaults to desc (newest first). + + - `"asc"` + + - `"desc"` + + - `page?: string` + + Query param: Opaque pagination cursor from a previous response's next_page. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: Record` + + - `resources: Array` + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds?: number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds?: number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" | "running" | "idle" | "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string | null` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation?: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens?: number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens?: number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens?: number` + + Total tokens read from prompt cache. + + - `input_tokens?: number` + + Total input tokens consumed across all turns. + + - `output_tokens?: number` + + Total output tokens generated across all turns. + + - `vault_ids: Array` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +// Automatically fetches more pages as needed. +for await (const betaManagedAgentsSession of client.beta.sessions.list()) { + console.log(betaManagedAgentsSession.id); +} +``` + +## Retrieve + +`client.beta.sessions.retrieve(stringsessionID, SessionRetrieveParamsparams?, RequestOptionsoptions?): BetaManagedAgentsSession` + +**get** `/v1/sessions/{session_id}` + +Get Session + +### Parameters + +- `sessionID: string` + +- `params: SessionRetrieveParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: Record` + + - `resources: Array` + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds?: number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds?: number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" | "running" | "idle" | "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string | null` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation?: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens?: number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens?: number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens?: number` + + Total tokens read from prompt cache. + + - `input_tokens?: number` + + Total input tokens consumed across all turns. + + - `output_tokens?: number` + + Total output tokens generated across all turns. + + - `vault_ids: Array` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsSession = await client.beta.sessions.retrieve( + 'sesn_011CZkZAtmR3yMPDzynEDxu7', +); + +console.log(betaManagedAgentsSession.id); +``` + +## Update + +`client.beta.sessions.update(stringsessionID, SessionUpdateParamsparams, RequestOptionsoptions?): BetaManagedAgentsSession` + +**post** `/v1/sessions/{session_id}` + +Update Session + +### Parameters + +- `sessionID: string` + +- `params: SessionUpdateParams` + + - `metadata?: Record | null` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. + + - `title?: string | null` + + Body param: Human-readable session title. + + - `vault_ids?: Array` + + Body param: Vault IDs (`vlt_*`) to attach to the session. Not yet supported; requests setting this field are rejected. Reserved for future use. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: Record` + + - `resources: Array` + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds?: number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds?: number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" | "running" | "idle" | "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string | null` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation?: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens?: number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens?: number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens?: number` + + Total tokens read from prompt cache. + + - `input_tokens?: number` + + Total input tokens consumed across all turns. + + - `output_tokens?: number` + + Total output tokens generated across all turns. + + - `vault_ids: Array` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsSession = await client.beta.sessions.update('sesn_011CZkZAtmR3yMPDzynEDxu7'); + +console.log(betaManagedAgentsSession.id); +``` + +## Delete + +`client.beta.sessions.delete(stringsessionID, SessionDeleteParamsparams?, RequestOptionsoptions?): BetaManagedAgentsDeletedSession` + +**delete** `/v1/sessions/{session_id}` + +Delete Session + +### Parameters + +- `sessionID: string` + +- `params: SessionDeleteParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsDeletedSession` + + Confirmation that a `session` has been permanently deleted. + + - `id: string` + + - `type: "session_deleted"` + + - `"session_deleted"` + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsDeletedSession = await client.beta.sessions.delete( + 'sesn_011CZkZAtmR3yMPDzynEDxu7', +); + +console.log(betaManagedAgentsDeletedSession.id); +``` + +## Archive + +`client.beta.sessions.archive(stringsessionID, SessionArchiveParamsparams?, RequestOptionsoptions?): BetaManagedAgentsSession` + +**post** `/v1/sessions/{session_id}/archive` + +Archive Session + +### Parameters + +- `sessionID: string` + +- `params: SessionArchiveParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: Record` + + - `resources: Array` + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds?: number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds?: number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" | "running" | "idle" | "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string | null` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation?: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens?: number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens?: number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens?: number` + + Total tokens read from prompt cache. + + - `input_tokens?: number` + + Total input tokens consumed across all turns. + + - `output_tokens?: number` + + Total output tokens generated across all turns. + + - `vault_ids: Array` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsSession = await client.beta.sessions.archive( + 'sesn_011CZkZAtmR3yMPDzynEDxu7', +); + +console.log(betaManagedAgentsSession.id); +``` + +## Domain Types + +### Beta Managed Agents Agent Params + +- `BetaManagedAgentsAgentParams` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `id: string` + + The `agent` ID. + + - `type: "agent"` + + - `"agent"` + + - `version?: number` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + +### Beta Managed Agents Branch Checkout + +- `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + +### Beta Managed Agents Cache Creation Usage + +- `BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens?: number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens?: number` + + Tokens used to create 5-minute ephemeral cache entries. + +### Beta Managed Agents Commit Checkout + +- `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + +### Beta Managed Agents Deleted Session + +- `BetaManagedAgentsDeletedSession` + + Confirmation that a `session` has been permanently deleted. + + - `id: string` + + - `type: "session_deleted"` + + - `"session_deleted"` + +### Beta Managed Agents File Resource Params + +- `BetaManagedAgentsFileResourceParams` + + Mount a file uploaded via the Files API into the session. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `mount_path?: string | null` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +### Beta Managed Agents GitHub Repository Resource Params + +- `BetaManagedAgentsGitHubRepositoryResourceParams` + + Mount a GitHub repository into the session's container. + + - `authorization_token: string` + + GitHub authorization token used to clone the repository. + + - `type: "github_repository"` + + - `"github_repository"` + + - `url: string` + + Github URL of the repository + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `mount_path?: string | null` + + Mount path in the container. Defaults to `/workspace/`. + +### Beta Managed Agents Session + +- `BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: Record` + + - `resources: Array` + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds?: number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds?: number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" | "running" | "idle" | "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string | null` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation?: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens?: number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens?: number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens?: number` + + Total tokens read from prompt cache. + + - `input_tokens?: number` + + Total input tokens consumed across all turns. + + - `output_tokens?: number` + + Total output tokens generated across all turns. + + - `vault_ids: Array` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Beta Managed Agents Session Agent + +- `BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + +### Beta Managed Agents Session Stats + +- `BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds?: number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds?: number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + +### Beta Managed Agents Session Usage + +- `BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation?: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens?: number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens?: number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens?: number` + + Total tokens read from prompt cache. + + - `input_tokens?: number` + + Total input tokens consumed across all turns. + + - `output_tokens?: number` + + Total output tokens generated across all turns. + +# Events + +## List + +`client.beta.sessions.events.list(stringsessionID, EventListParamsparams?, RequestOptionsoptions?): PageCursor` + +**get** `/v1/sessions/{session_id}/events` + +List Events + +### Parameters + +- `sessionID: string` + +- `params: EventListParams` + + - `limit?: number` + + Query param: Query parameter for limit + + - `order?: "asc" | "desc"` + + Query param: Sort direction for results, ordered by created_at. Defaults to asc (chronological). + + - `"asc"` + + - `"desc"` + + - `page?: string` + + Query param: Opaque pagination cursor from a previous response's next_page. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSessionEvent = BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | 17 more` + + Union type for all event types in a session. + + - `BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean | null` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed?: "standard" | "fast" | null` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +// Automatically fetches more pages as needed. +for await (const betaManagedAgentsSessionEvent of client.beta.sessions.events.list( + 'sesn_011CZkZAtmR3yMPDzynEDxu7', +)) { + console.log(betaManagedAgentsSessionEvent); +} +``` + +## Send + +`client.beta.sessions.events.send(stringsessionID, EventSendParamsparams, RequestOptionsoptions?): BetaManagedAgentsSendSessionEvents` + +**post** `/v1/sessions/{session_id}/events` + +Send Events + +### Parameters + +- `sessionID: string` + +- `params: EventSendParams` + + - `events: Array` + + Body param: Events to send to the `session`. + + - `BetaManagedAgentsUserMessageEventParams` + + Parameters for sending a user message to the session. + + - `content: Array` + + Array of content blocks for the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `BetaManagedAgentsUserInterruptEventParams` + + Parameters for sending an interrupt to pause the agent. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `BetaManagedAgentsUserToolConfirmationEventParams` + + Parameters for confirming or denying a tool execution request. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `BetaManagedAgentsUserCustomToolResultEventParams` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSendSessionEvents` + + Events that were successfully sent to the session. + + - `data?: Array` + + Sent events + + - `BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsSendSessionEvents = await client.beta.sessions.events.send( + 'sesn_011CZkZAtmR3yMPDzynEDxu7', + { + events: [ + { content: [{ text: 'Where is my order #1234?', type: 'text' }], type: 'user.message' }, + ], + }, +); + +console.log(betaManagedAgentsSendSessionEvents.data); +``` + +## Stream + +`client.beta.sessions.events.stream(stringsessionID, EventStreamParamsparams?, RequestOptionsoptions?): BetaManagedAgentsStreamSessionEvents | Stream` + +**get** `/v1/sessions/{session_id}/events/stream` + +Stream Events + +### Parameters + +- `sessionID: string` + +- `params: EventStreamParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsStreamSessionEvents = BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | 17 more` + + Server-sent event in the session stream. + + - `BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean | null` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed?: "standard" | "fast" | null` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsStreamSessionEvents = await client.beta.sessions.events.stream( + 'sesn_011CZkZAtmR3yMPDzynEDxu7', +); + +console.log(betaManagedAgentsStreamSessionEvents); +``` + +## Domain Types + +### Beta Managed Agents Agent Custom Tool Use Event + +- `BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + +### Beta Managed Agents Agent MCP Tool Result Event + +- `BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent MCP Tool Use Event + +- `BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + +### Beta Managed Agents Agent Message Event + +- `BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + +### Beta Managed Agents Agent Thinking Event + +- `BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + +### Beta Managed Agents Agent Thread Context Compacted Event + +- `BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + +### Beta Managed Agents Agent Tool Result Event + +- `BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent Tool Use Event + +- `BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + +### Beta Managed Agents Base64 Document Source + +- `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + +### Beta Managed Agents Base64 Image Source + +- `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + +### Beta Managed Agents Billing Error + +- `BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + +### Beta Managed Agents Document Block + +- `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + +### Beta Managed Agents Event Params + +- `BetaManagedAgentsEventParams = BetaManagedAgentsUserMessageEventParams | BetaManagedAgentsUserInterruptEventParams | BetaManagedAgentsUserToolConfirmationEventParams | BetaManagedAgentsUserCustomToolResultEventParams` + + Union type for event parameters that can be sent to a session. + + - `BetaManagedAgentsUserMessageEventParams` + + Parameters for sending a user message to the session. + + - `content: Array` + + Array of content blocks for the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `BetaManagedAgentsUserInterruptEventParams` + + Parameters for sending an interrupt to pause the agent. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `BetaManagedAgentsUserToolConfirmationEventParams` + + Parameters for confirming or denying a tool execution request. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `BetaManagedAgentsUserCustomToolResultEventParams` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents File Document Source + +- `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + +### Beta Managed Agents File Image Source + +- `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + +### Beta Managed Agents Image Block + +- `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + +### Beta Managed Agents MCP Authentication Failed Error + +- `BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + +### Beta Managed Agents MCP Connection Failed Error + +- `BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + +### Beta Managed Agents Model Overloaded Error + +- `BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + +### Beta Managed Agents Model Rate Limited Error + +- `BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + +### Beta Managed Agents Model Request Failed Error + +- `BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + +### Beta Managed Agents Plain Text Document Source + +- `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + +### Beta Managed Agents Retry Status Exhausted + +- `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + +### Beta Managed Agents Retry Status Retrying + +- `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + +### Beta Managed Agents Retry Status Terminal + +- `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + +### Beta Managed Agents Send Session Events + +- `BetaManagedAgentsSendSessionEvents` + + Events that were successfully sent to the session. + + - `data?: Array` + + Sent events + + - `BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + +### Beta Managed Agents Session Deleted Event + +- `BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Beta Managed Agents Session End Turn + +- `BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + +### Beta Managed Agents Session Error Event + +- `BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + +### Beta Managed Agents Session Event + +- `BetaManagedAgentsSessionEvent = BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | 17 more` + + Union type for all event types in a session. + + - `BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean | null` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed?: "standard" | "fast" | null` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Beta Managed Agents Session Requires Action + +- `BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + +### Beta Managed Agents Session Retries Exhausted + +- `BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + +### Beta Managed Agents Session Status Idle Event + +- `BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + +### Beta Managed Agents Session Status Rescheduled Event + +- `BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + +### Beta Managed Agents Session Status Running Event + +- `BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + +### Beta Managed Agents Session Status Terminated Event + +- `BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + +### Beta Managed Agents Span Model Request End Event + +- `BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean | null` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed?: "standard" | "fast" | null` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + +### Beta Managed Agents Span Model Request Start Event + +- `BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + +### Beta Managed Agents Span Model Usage + +- `BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed?: "standard" | "fast" | null` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +### Beta Managed Agents Stream Session Events + +- `BetaManagedAgentsStreamSessionEvents = BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | 17 more` + + Server-sent event in the session stream. + + - `BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean | null` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed?: "standard" | "fast" | null` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Beta Managed Agents Text Block + +- `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + +### Beta Managed Agents Unknown Error + +- `BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + +### Beta Managed Agents URL Document Source + +- `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + +### Beta Managed Agents URL Image Source + +- `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + +### Beta Managed Agents User Custom Tool Result Event + +- `BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Custom Tool Result Event Params + +- `BetaManagedAgentsUserCustomToolResultEventParams` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents User Interrupt Event + +- `BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Interrupt Event Params + +- `BetaManagedAgentsUserInterruptEventParams` + + Parameters for sending an interrupt to pause the agent. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + +### Beta Managed Agents User Message Event + +- `BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Message Event Params + +- `BetaManagedAgentsUserMessageEventParams` + + Parameters for sending a user message to the session. + + - `content: Array` + + Array of content blocks for the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + +### Beta Managed Agents User Tool Confirmation Event + +- `BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Tool Confirmation Event Params + +- `BetaManagedAgentsUserToolConfirmationEventParams` + + Parameters for confirming or denying a tool execution request. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + +# Resources + +## Add + +`client.beta.sessions.resources.add(stringsessionID, ResourceAddParamsparams, RequestOptionsoptions?): BetaManagedAgentsFileResource` + +**post** `/v1/sessions/{session_id}/resources` + +Add Session Resource + +### Parameters + +- `sessionID: string` + +- `params: ResourceAddParams` + + - `file_id: string` + + Body param: ID of a previously uploaded file. + + - `type: "file"` + + Body param + + - `"file"` + + - `mount_path?: string | null` + + Body param: Mount path in the container. Defaults to `/mnt/session/uploads/`. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsFileResource = await client.beta.sessions.resources.add( + 'sesn_011CZkZAtmR3yMPDzynEDxu7', + { file_id: 'file_011CNha8iCJcU1wXNR6q4V8w', type: 'file' }, +); + +console.log(betaManagedAgentsFileResource.id); +``` + +## List + +`client.beta.sessions.resources.list(stringsessionID, ResourceListParamsparams?, RequestOptionsoptions?): PageCursor` + +**get** `/v1/sessions/{session_id}/resources` + +List Session Resources + +### Parameters + +- `sessionID: string` + +- `params: ResourceListParams` + + - `limit?: number` + + Query param: Maximum number of resources to return per page (max 1000). If omitted, returns all resources. + + - `page?: string` + + Query param: Opaque cursor from a previous response's next_page field. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSessionResource = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +// Automatically fetches more pages as needed. +for await (const betaManagedAgentsSessionResource of client.beta.sessions.resources.list( + 'sesn_011CZkZAtmR3yMPDzynEDxu7', +)) { + console.log(betaManagedAgentsSessionResource); +} +``` + +## Retrieve + +`client.beta.sessions.resources.retrieve(stringresourceID, ResourceRetrieveParamsparams, RequestOptionsoptions?): ResourceRetrieveResponse` + +**get** `/v1/sessions/{session_id}/resources/{resource_id}` + +Get Session Resource + +### Parameters + +- `resourceID: string` + +- `params: ResourceRetrieveParams` + + - `session_id: string` + + Path param: Path parameter session_id + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `ResourceRetrieveResponse = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + The requested session resource. + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const resource = await client.beta.sessions.resources.retrieve('sesrsc_011CZkZBJq5dWxk9fVLNcPht', { + session_id: 'sesn_011CZkZAtmR3yMPDzynEDxu7', +}); + +console.log(resource); +``` + +## Update + +`client.beta.sessions.resources.update(stringresourceID, ResourceUpdateParamsparams, RequestOptionsoptions?): ResourceUpdateResponse` + +**post** `/v1/sessions/{session_id}/resources/{resource_id}` + +Update Session Resource + +### Parameters + +- `resourceID: string` + +- `params: ResourceUpdateParams` + + - `session_id: string` + + Path param: Path parameter session_id + + - `authorization_token: string` + + Body param: New authorization token for the resource. Currently only `github_repository` resources support token rotation. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `ResourceUpdateResponse = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + The updated session resource. + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const resource = await client.beta.sessions.resources.update('sesrsc_011CZkZBJq5dWxk9fVLNcPht', { + session_id: 'sesn_011CZkZAtmR3yMPDzynEDxu7', + authorization_token: 'ghp_exampletoken', +}); + +console.log(resource); +``` + +## Delete + +`client.beta.sessions.resources.delete(stringresourceID, ResourceDeleteParamsparams, RequestOptionsoptions?): BetaManagedAgentsDeleteSessionResource` + +**delete** `/v1/sessions/{session_id}/resources/{resource_id}` + +Delete Session Resource + +### Parameters + +- `resourceID: string` + +- `params: ResourceDeleteParams` + + - `session_id: string` + + Path param: Path parameter session_id + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsDeleteSessionResource` + + Confirmation of resource deletion. + + - `id: string` + + - `type: "session_resource_deleted"` + + - `"session_resource_deleted"` + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsDeleteSessionResource = await client.beta.sessions.resources.delete( + 'sesrsc_011CZkZBJq5dWxk9fVLNcPht', + { session_id: 'sesn_011CZkZAtmR3yMPDzynEDxu7' }, +); + +console.log(betaManagedAgentsDeleteSessionResource.id); +``` + +## Domain Types + +### Beta Managed Agents Delete Session Resource + +- `BetaManagedAgentsDeleteSessionResource` + + Confirmation of resource deletion. + + - `id: string` + + - `type: "session_resource_deleted"` + + - `"session_resource_deleted"` + +### Beta Managed Agents File Resource + +- `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents GitHub Repository Resource + +- `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + +### Beta Managed Agents Session Resource + +- `BetaManagedAgentsSessionResource = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Resource Retrieve Response + +- `ResourceRetrieveResponse = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + The requested session resource. + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Resource Update Response + +- `ResourceUpdateResponse = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + The updated session resource. + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +# Vaults + +## Create + +`client.beta.vaults.create(VaultCreateParamsparams, RequestOptionsoptions?): BetaManagedAgentsVault` + +**post** `/v1/vaults` + +Create Vault + +### Parameters + +- `params: VaultCreateParams` + + - `display_name: string` + + Body param: Human-readable name for the vault. 1-255 characters. + + - `metadata?: Record` + + Body param: Arbitrary key-value metadata to attach to the vault. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: Record` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsVault = await client.beta.vaults.create({ display_name: 'Example vault' }); + +console.log(betaManagedAgentsVault.id); +``` + +## List + +`client.beta.vaults.list(VaultListParamsparams?, RequestOptionsoptions?): PageCursor` + +**get** `/v1/vaults` + +List Vaults + +### Parameters + +- `params: VaultListParams` + + - `include_archived?: boolean` + + Query param: Whether to include archived vaults in the results. + + - `limit?: number` + + Query param: Maximum number of vaults to return per page. Defaults to 20, maximum 100. + + - `page?: string` + + Query param: Opaque pagination token from a previous `list_vaults` response. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: Record` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +// Automatically fetches more pages as needed. +for await (const betaManagedAgentsVault of client.beta.vaults.list()) { + console.log(betaManagedAgentsVault.id); +} +``` + +## Retrieve + +`client.beta.vaults.retrieve(stringvaultID, VaultRetrieveParamsparams?, RequestOptionsoptions?): BetaManagedAgentsVault` + +**get** `/v1/vaults/{vault_id}` + +Get Vault + +### Parameters + +- `vaultID: string` + +- `params: VaultRetrieveParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: Record` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsVault = await client.beta.vaults.retrieve('vlt_011CZkZDLs7fYzm1hXNPeRjv'); + +console.log(betaManagedAgentsVault.id); +``` + +## Update + +`client.beta.vaults.update(stringvaultID, VaultUpdateParamsparams, RequestOptionsoptions?): BetaManagedAgentsVault` + +**post** `/v1/vaults/{vault_id}` + +Update Vault + +### Parameters + +- `vaultID: string` + +- `params: VaultUpdateParams` + + - `display_name?: string | null` + + Body param: Updated human-readable name for the vault. 1-255 characters. + + - `metadata?: Record | null` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: Record` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsVault = await client.beta.vaults.update('vlt_011CZkZDLs7fYzm1hXNPeRjv'); + +console.log(betaManagedAgentsVault.id); +``` + +## Delete + +`client.beta.vaults.delete(stringvaultID, VaultDeleteParamsparams?, RequestOptionsoptions?): BetaManagedAgentsDeletedVault` + +**delete** `/v1/vaults/{vault_id}` + +Delete Vault + +### Parameters + +- `vaultID: string` + +- `params: VaultDeleteParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsDeletedVault` + + Confirmation of a deleted vault. + + - `id: string` + + Unique identifier of the deleted vault. + + - `type: "vault_deleted"` + + - `"vault_deleted"` + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsDeletedVault = await client.beta.vaults.delete( + 'vlt_011CZkZDLs7fYzm1hXNPeRjv', +); + +console.log(betaManagedAgentsDeletedVault.id); +``` + +## Archive + +`client.beta.vaults.archive(stringvaultID, VaultArchiveParamsparams?, RequestOptionsoptions?): BetaManagedAgentsVault` + +**post** `/v1/vaults/{vault_id}/archive` + +Archive Vault + +### Parameters + +- `vaultID: string` + +- `params: VaultArchiveParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: Record` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsVault = await client.beta.vaults.archive('vlt_011CZkZDLs7fYzm1hXNPeRjv'); + +console.log(betaManagedAgentsVault.id); +``` + +## Domain Types + +### Beta Managed Agents Deleted Vault + +- `BetaManagedAgentsDeletedVault` + + Confirmation of a deleted vault. + + - `id: string` + + Unique identifier of the deleted vault. + + - `type: "vault_deleted"` + + - `"vault_deleted"` + +### Beta Managed Agents Vault + +- `BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: Record` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +# Credentials + +## Create + +`client.beta.vaults.credentials.create(stringvaultID, CredentialCreateParamsparams, RequestOptionsoptions?): BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials` + +Create Credential + +### Parameters + +- `vaultID: string` + +- `params: CredentialCreateParams` + + - `auth: BetaManagedAgentsMCPOAuthCreateParams | BetaManagedAgentsStaticBearerCreateParams` + + Body param: Authentication details for creating a credential. + + - `BetaManagedAgentsMCPOAuthCreateParams` + + Parameters for creating an MCP OAuth credential. + + - `access_token: string` + + OAuth access token. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshParams | null` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: string` + + OAuth client ID. + + - `refresh_token: string` + + OAuth refresh token. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam | BetaManagedAgentsTokenEndpointAuthBasicParam | BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneParam` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicParam` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerCreateParams` + + Parameters for creating a static bearer token credential. + + - `token: string` + + Static bearer token value. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `display_name?: string | null` + + Body param: Human-readable name for the credential. Up to 255 characters. + + - `metadata?: Record` + + Body param: Arbitrary key-value metadata to attach to the credential. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshResponse | null` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: Record` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name?: string | null` + + Human-readable name for the credential. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsCredential = await client.beta.vaults.credentials.create( + 'vlt_011CZkZDLs7fYzm1hXNPeRjv', + { + auth: { + token: 'bearer_exampletoken', + mcp_server_url: 'https://example-server.modelcontextprotocol.io/sse', + type: 'static_bearer', + }, + }, +); + +console.log(betaManagedAgentsCredential.id); +``` + +## List + +`client.beta.vaults.credentials.list(stringvaultID, CredentialListParamsparams?, RequestOptionsoptions?): PageCursor` + +**get** `/v1/vaults/{vault_id}/credentials` + +List Credentials + +### Parameters + +- `vaultID: string` + +- `params: CredentialListParams` + + - `include_archived?: boolean` + + Query param: Whether to include archived credentials in the results. + + - `limit?: number` + + Query param: Maximum number of credentials to return per page. Defaults to 20, maximum 100. + + - `page?: string` + + Query param: Opaque pagination token from a previous `list_credentials` response. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshResponse | null` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: Record` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name?: string | null` + + Human-readable name for the credential. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +// Automatically fetches more pages as needed. +for await (const betaManagedAgentsCredential of client.beta.vaults.credentials.list( + 'vlt_011CZkZDLs7fYzm1hXNPeRjv', +)) { + console.log(betaManagedAgentsCredential.id); +} +``` + +## Retrieve + +`client.beta.vaults.credentials.retrieve(stringcredentialID, CredentialRetrieveParamsparams, RequestOptionsoptions?): BetaManagedAgentsCredential` + +**get** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Get Credential + +### Parameters + +- `credentialID: string` + +- `params: CredentialRetrieveParams` + + - `vault_id: string` + + Path param: Path parameter vault_id + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshResponse | null` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: Record` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name?: string | null` + + Human-readable name for the credential. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsCredential = await client.beta.vaults.credentials.retrieve( + 'vcrd_011CZkZEMt8gZan2iYOQfSkw', + { vault_id: 'vlt_011CZkZDLs7fYzm1hXNPeRjv' }, +); + +console.log(betaManagedAgentsCredential.id); +``` + +## Update + +`client.beta.vaults.credentials.update(stringcredentialID, CredentialUpdateParamsparams, RequestOptionsoptions?): BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Update Credential + +### Parameters + +- `credentialID: string` + +- `params: CredentialUpdateParams` + + - `vault_id: string` + + Path param: Path parameter vault_id + + - `auth?: BetaManagedAgentsMCPOAuthUpdateParams | BetaManagedAgentsStaticBearerUpdateParams` + + Body param: Updated authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthUpdateParams` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `access_token?: string | null` + + Updated OAuth access token. + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshUpdateParams | null` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token?: string | null` + + Updated OAuth refresh token. + + - `scope?: string | null` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth?: BetaManagedAgentsTokenEndpointAuthBasicUpdateParam | BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `BetaManagedAgentsTokenEndpointAuthBasicUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret?: string | null` + + Updated OAuth client secret. + + - `BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret?: string | null` + + Updated OAuth client secret. + + - `BetaManagedAgentsStaticBearerUpdateParams` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `token?: string | null` + + Updated static bearer token value. + + - `display_name?: string | null` + + Body param: Updated human-readable name for the credential. 1-255 characters. + + - `metadata?: Record | null` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshResponse | null` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: Record` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name?: string | null` + + Human-readable name for the credential. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsCredential = await client.beta.vaults.credentials.update( + 'vcrd_011CZkZEMt8gZan2iYOQfSkw', + { vault_id: 'vlt_011CZkZDLs7fYzm1hXNPeRjv' }, +); + +console.log(betaManagedAgentsCredential.id); +``` + +## Delete + +`client.beta.vaults.credentials.delete(stringcredentialID, CredentialDeleteParamsparams, RequestOptionsoptions?): BetaManagedAgentsDeletedCredential` + +**delete** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Delete Credential + +### Parameters + +- `credentialID: string` + +- `params: CredentialDeleteParams` + + - `vault_id: string` + + Path param: Path parameter vault_id + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsDeletedCredential` + + Confirmation of a deleted credential. + + - `id: string` + + Unique identifier of the deleted credential. + + - `type: "vault_credential_deleted"` + + - `"vault_credential_deleted"` + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsDeletedCredential = await client.beta.vaults.credentials.delete( + 'vcrd_011CZkZEMt8gZan2iYOQfSkw', + { vault_id: 'vlt_011CZkZDLs7fYzm1hXNPeRjv' }, +); + +console.log(betaManagedAgentsDeletedCredential.id); +``` + +## Archive + +`client.beta.vaults.credentials.archive(stringcredentialID, CredentialArchiveParamsparams, RequestOptionsoptions?): BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}/archive` + +Archive Credential + +### Parameters + +- `credentialID: string` + +- `params: CredentialArchiveParams` + + - `vault_id: string` + + Path param: Path parameter vault_id + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshResponse | null` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: Record` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name?: string | null` + + Human-readable name for the credential. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsCredential = await client.beta.vaults.credentials.archive( + 'vcrd_011CZkZEMt8gZan2iYOQfSkw', + { vault_id: 'vlt_011CZkZDLs7fYzm1hXNPeRjv' }, +); + +console.log(betaManagedAgentsCredential.id); +``` + +## Domain Types + +### Beta Managed Agents Credential + +- `BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshResponse | null` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: Record` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name?: string | null` + + Human-readable name for the credential. + +### Beta Managed Agents Deleted Credential + +- `BetaManagedAgentsDeletedCredential` + + Confirmation of a deleted credential. + + - `id: string` + + Unique identifier of the deleted credential. + + - `type: "vault_credential_deleted"` + + - `"vault_credential_deleted"` + +### Beta Managed Agents MCP OAuth Auth Response + +- `BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshResponse | null` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Create Params + +- `BetaManagedAgentsMCPOAuthCreateParams` + + Parameters for creating an MCP OAuth credential. + + - `access_token: string` + + OAuth access token. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshParams | null` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: string` + + OAuth client ID. + + - `refresh_token: string` + + OAuth refresh token. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam | BetaManagedAgentsTokenEndpointAuthBasicParam | BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneParam` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicParam` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Params + +- `BetaManagedAgentsMCPOAuthRefreshParams` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: string` + + OAuth client ID. + + - `refresh_token: string` + + OAuth refresh token. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam | BetaManagedAgentsTokenEndpointAuthBasicParam | BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneParam` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicParam` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Response + +- `BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Update Params + +- `BetaManagedAgentsMCPOAuthRefreshUpdateParams` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token?: string | null` + + Updated OAuth refresh token. + + - `scope?: string | null` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth?: BetaManagedAgentsTokenEndpointAuthBasicUpdateParam | BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `BetaManagedAgentsTokenEndpointAuthBasicUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret?: string | null` + + Updated OAuth client secret. + + - `BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret?: string | null` + + Updated OAuth client secret. + +### Beta Managed Agents MCP OAuth Update Params + +- `BetaManagedAgentsMCPOAuthUpdateParams` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `access_token?: string | null` + + Updated OAuth access token. + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshUpdateParams | null` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token?: string | null` + + Updated OAuth refresh token. + + - `scope?: string | null` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth?: BetaManagedAgentsTokenEndpointAuthBasicUpdateParam | BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `BetaManagedAgentsTokenEndpointAuthBasicUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret?: string | null` + + Updated OAuth client secret. + + - `BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret?: string | null` + + Updated OAuth client secret. + +### Beta Managed Agents Static Bearer Auth Response + +- `BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + +### Beta Managed Agents Static Bearer Create Params + +- `BetaManagedAgentsStaticBearerCreateParams` + + Parameters for creating a static bearer token credential. + + - `token: string` + + Static bearer token value. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + +### Beta Managed Agents Static Bearer Update Params + +- `BetaManagedAgentsStaticBearerUpdateParams` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `token?: string | null` + + Updated static bearer token value. + +### Beta Managed Agents Token Endpoint Auth Basic Param + +- `BetaManagedAgentsTokenEndpointAuthBasicParam` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + +### Beta Managed Agents Token Endpoint Auth Basic Response + +- `BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + +### Beta Managed Agents Token Endpoint Auth Basic Update Param + +- `BetaManagedAgentsTokenEndpointAuthBasicUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret?: string | null` + + Updated OAuth client secret. + +### Beta Managed Agents Token Endpoint Auth None Param + +- `BetaManagedAgentsTokenEndpointAuthNoneParam` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + +### Beta Managed Agents Token Endpoint Auth None Response + +- `BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + +### Beta Managed Agents Token Endpoint Auth Post Param + +- `BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + +### Beta Managed Agents Token Endpoint Auth Post Response + +- `BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + +### Beta Managed Agents Token Endpoint Auth Post Update Param + +- `BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret?: string | null` + + Updated OAuth client secret. + +# Files + +## Upload + +`client.beta.files.upload(FileUploadParamsparams, RequestOptionsoptions?): FileMetadata` + +**post** `/v1/files` + +Upload File + +### Parameters + +- `params: FileUploadParams` + + - `file: Uploadable` + + Body param: The file to upload + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` ### Returns @@ -45468,6 +68446,20 @@ Upload File Whether the file can be downloaded. + - `scope?: BetaFileScope | null` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + + - `"session"` + ### Example ```typescript @@ -45508,13 +68500,17 @@ List Files Defaults to `20`. Ranges from `1` to `1000`. + - `scope_id?: string` + + Query param: Filter by scope ID. Only returns files associated with the specified scope (e.g., a session ID). + - `betas?: Array` Header param: Optional header to specify the beta version(s) you want to use. - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -45558,8 +68554,6 @@ List Files - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `FileMetadata` @@ -45598,6 +68592,20 @@ List Files Whether the file can be downloaded. + - `scope?: BetaFileScope | null` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + + - `"session"` + ### Example ```typescript @@ -45635,7 +68643,7 @@ Download File - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -45679,8 +68687,6 @@ Download File - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `unnamed_schema_1 = Response` @@ -45724,7 +68730,7 @@ Get File Metadata - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -45768,8 +68774,6 @@ Get File Metadata - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `FileMetadata` @@ -45808,6 +68812,20 @@ Get File Metadata Whether the file can be downloaded. + - `scope?: BetaFileScope | null` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + + - `"session"` + ### Example ```typescript @@ -45844,7 +68862,7 @@ Delete File - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -45888,8 +68906,6 @@ Delete File - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `DeletedFile` @@ -45922,6 +68938,20 @@ console.log(deletedFile.id); ## Domain Types +### Beta File Scope + +- `BetaFileScope` + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + + - `"session"` + ### Deleted File - `DeletedFile` @@ -45976,6 +69006,20 @@ console.log(deletedFile.id); Whether the file can be downloaded. + - `scope?: BetaFileScope | null` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + + - `"session"` + # Skills ## Create @@ -46008,7 +69052,7 @@ Create Skill - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -46052,8 +69096,6 @@ Create Skill - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `SkillCreateResponse` @@ -46152,7 +69194,7 @@ List Skills - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -46196,8 +69238,6 @@ List Skills - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `SkillListResponse` @@ -46282,7 +69322,7 @@ Get Skill - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -46326,8 +69366,6 @@ Get Skill - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `SkillRetrieveResponse` @@ -46411,7 +69449,7 @@ Delete Skill - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -46455,8 +69493,6 @@ Delete Skill - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `SkillDeleteResponse` @@ -46672,7 +69708,7 @@ Create Skill Version - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -46716,8 +69752,6 @@ Create Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `VersionCreateResponse` @@ -46814,7 +69848,7 @@ List Skill Versions - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -46858,8 +69892,6 @@ List Skill Versions - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `VersionListResponse` @@ -46953,7 +69985,7 @@ Get Skill Version - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -46997,8 +70029,6 @@ Get Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `VersionRetrieveResponse` @@ -47091,7 +70121,7 @@ Delete Skill Version - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -47135,8 +70165,6 @@ Delete Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `VersionDeleteResponse` @@ -47328,586 +70356,3 @@ console.log(version.id); Deleted object type. For Skill Versions, this is always `"skill_version_deleted"`. - -# User Profiles - -## Create - -`client.beta.userProfiles.create(UserProfileCreateParamsparams, RequestOptionsoptions?): BetaUserProfile` - -**post** `/v1/user_profiles` - -Create User Profile - -### Parameters - -- `params: UserProfileCreateParams` - - - `external_id?: string | null` - - Body param - - - `metadata?: Record` - - Body param: Free-form key-value data to attach to this user profile. Maximum 16 keys, with keys up to 64 characters and values up to 512 characters. Values must be non-empty strings. - - - `betas?: Array` - - Header param: Optional header to specify the beta version(s) you want to use. - - - `(string & {})` - - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` - - - `"message-batches-2024-09-24"` - - - `"prompt-caching-2024-07-31"` - - - `"computer-use-2024-10-22"` - - - `"computer-use-2025-01-24"` - - - `"pdfs-2024-09-25"` - - - `"token-counting-2024-11-01"` - - - `"token-efficient-tools-2025-02-19"` - - - `"output-128k-2025-02-19"` - - - `"files-api-2025-04-14"` - - - `"mcp-client-2025-04-04"` - - - `"mcp-client-2025-11-20"` - - - `"dev-full-thinking-2025-05-14"` - - - `"interleaved-thinking-2025-05-14"` - - - `"code-execution-2025-05-22"` - - - `"extended-cache-ttl-2025-04-11"` - - - `"context-1m-2025-08-07"` - - - `"context-management-2025-06-27"` - - - `"model-context-window-exceeded-2025-08-26"` - - - `"skills-2025-10-02"` - - - `"fast-mode-2026-02-01"` - - - `"output-300k-2026-03-24"` - - - `"user-profiles-2026-03-24"` - -### Returns - -- `BetaUserProfile` - - - `id: string` - - - `created_at: string` - - A timestamp in RFC 3339 format - - - `metadata: Record` - - - `trust_grants: Record` - - - `status: string` - - - `type: string` - - - `updated_at: string` - - A timestamp in RFC 3339 format - - - `external_id?: string | null` - -### Example - -```typescript -import Anthropic from '@anthropic-ai/sdk'; - -const client = new Anthropic({ - apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted -}); - -const betaUserProfile = await client.beta.userProfiles.create(); - -console.log(betaUserProfile.id); -``` - -## List - -`client.beta.userProfiles.list(UserProfileListParamsparams?, RequestOptionsoptions?): PageCursorV2` - -**get** `/v1/user_profiles` - -List User Profiles - -### Parameters - -- `params: UserProfileListParams` - - - `limit?: number` - - Query param: Query parameter for limit - - - `order?: "asc" | "desc"` - - Query param: Query parameter for order - - - `"asc"` - - - `"desc"` - - - `page?: string` - - Query param: Query parameter for page - - - `betas?: Array` - - Header param: Optional header to specify the beta version(s) you want to use. - - - `(string & {})` - - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` - - - `"message-batches-2024-09-24"` - - - `"prompt-caching-2024-07-31"` - - - `"computer-use-2024-10-22"` - - - `"computer-use-2025-01-24"` - - - `"pdfs-2024-09-25"` - - - `"token-counting-2024-11-01"` - - - `"token-efficient-tools-2025-02-19"` - - - `"output-128k-2025-02-19"` - - - `"files-api-2025-04-14"` - - - `"mcp-client-2025-04-04"` - - - `"mcp-client-2025-11-20"` - - - `"dev-full-thinking-2025-05-14"` - - - `"interleaved-thinking-2025-05-14"` - - - `"code-execution-2025-05-22"` - - - `"extended-cache-ttl-2025-04-11"` - - - `"context-1m-2025-08-07"` - - - `"context-management-2025-06-27"` - - - `"model-context-window-exceeded-2025-08-26"` - - - `"skills-2025-10-02"` - - - `"fast-mode-2026-02-01"` - - - `"output-300k-2026-03-24"` - - - `"user-profiles-2026-03-24"` - -### Returns - -- `BetaUserProfile` - - - `id: string` - - - `created_at: string` - - A timestamp in RFC 3339 format - - - `metadata: Record` - - - `trust_grants: Record` - - - `status: string` - - - `type: string` - - - `updated_at: string` - - A timestamp in RFC 3339 format - - - `external_id?: string | null` - -### Example - -```typescript -import Anthropic from '@anthropic-ai/sdk'; - -const client = new Anthropic({ - apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted -}); - -// Automatically fetches more pages as needed. -for await (const betaUserProfile of client.beta.userProfiles.list()) { - console.log(betaUserProfile.id); -} -``` - -## Retrieve - -`client.beta.userProfiles.retrieve(stringid, UserProfileRetrieveParamsparams?, RequestOptionsoptions?): BetaUserProfile` - -**get** `/v1/user_profiles/{id}` - -Get User Profile - -### Parameters - -- `id: string` - -- `params: UserProfileRetrieveParams` - - - `betas?: Array` - - Optional header to specify the beta version(s) you want to use. - - - `(string & {})` - - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` - - - `"message-batches-2024-09-24"` - - - `"prompt-caching-2024-07-31"` - - - `"computer-use-2024-10-22"` - - - `"computer-use-2025-01-24"` - - - `"pdfs-2024-09-25"` - - - `"token-counting-2024-11-01"` - - - `"token-efficient-tools-2025-02-19"` - - - `"output-128k-2025-02-19"` - - - `"files-api-2025-04-14"` - - - `"mcp-client-2025-04-04"` - - - `"mcp-client-2025-11-20"` - - - `"dev-full-thinking-2025-05-14"` - - - `"interleaved-thinking-2025-05-14"` - - - `"code-execution-2025-05-22"` - - - `"extended-cache-ttl-2025-04-11"` - - - `"context-1m-2025-08-07"` - - - `"context-management-2025-06-27"` - - - `"model-context-window-exceeded-2025-08-26"` - - - `"skills-2025-10-02"` - - - `"fast-mode-2026-02-01"` - - - `"output-300k-2026-03-24"` - - - `"user-profiles-2026-03-24"` - -### Returns - -- `BetaUserProfile` - - - `id: string` - - - `created_at: string` - - A timestamp in RFC 3339 format - - - `metadata: Record` - - - `trust_grants: Record` - - - `status: string` - - - `type: string` - - - `updated_at: string` - - A timestamp in RFC 3339 format - - - `external_id?: string | null` - -### Example - -```typescript -import Anthropic from '@anthropic-ai/sdk'; - -const client = new Anthropic({ - apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted -}); - -const betaUserProfile = await client.beta.userProfiles.retrieve('id'); - -console.log(betaUserProfile.id); -``` - -## Update - -`client.beta.userProfiles.update(stringid, UserProfileUpdateParamsparams, RequestOptionsoptions?): BetaUserProfile` - -**post** `/v1/user_profiles/{id}` - -Update User Profile - -### Parameters - -- `id: string` - -- `params: UserProfileUpdateParams` - - - `external_id?: string | null` - - Body param - - - `metadata?: Record` - - Body param: Key-value pairs to merge into the stored metadata. Keys provided overwrite existing values. To remove a key, set its value to an empty string. Keys not provided are left unchanged. Maximum 16 keys, with keys up to 64 characters and values up to 512 characters. - - - `betas?: Array` - - Header param: Optional header to specify the beta version(s) you want to use. - - - `(string & {})` - - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` - - - `"message-batches-2024-09-24"` - - - `"prompt-caching-2024-07-31"` - - - `"computer-use-2024-10-22"` - - - `"computer-use-2025-01-24"` - - - `"pdfs-2024-09-25"` - - - `"token-counting-2024-11-01"` - - - `"token-efficient-tools-2025-02-19"` - - - `"output-128k-2025-02-19"` - - - `"files-api-2025-04-14"` - - - `"mcp-client-2025-04-04"` - - - `"mcp-client-2025-11-20"` - - - `"dev-full-thinking-2025-05-14"` - - - `"interleaved-thinking-2025-05-14"` - - - `"code-execution-2025-05-22"` - - - `"extended-cache-ttl-2025-04-11"` - - - `"context-1m-2025-08-07"` - - - `"context-management-2025-06-27"` - - - `"model-context-window-exceeded-2025-08-26"` - - - `"skills-2025-10-02"` - - - `"fast-mode-2026-02-01"` - - - `"output-300k-2026-03-24"` - - - `"user-profiles-2026-03-24"` - -### Returns - -- `BetaUserProfile` - - - `id: string` - - - `created_at: string` - - A timestamp in RFC 3339 format - - - `metadata: Record` - - - `trust_grants: Record` - - - `status: string` - - - `type: string` - - - `updated_at: string` - - A timestamp in RFC 3339 format - - - `external_id?: string | null` - -### Example - -```typescript -import Anthropic from '@anthropic-ai/sdk'; - -const client = new Anthropic({ - apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted -}); - -const betaUserProfile = await client.beta.userProfiles.update('id'); - -console.log(betaUserProfile.id); -``` - -## Create Enrollment URL - -`client.beta.userProfiles.createEnrollmentURL(stringid, UserProfileCreateEnrollmentURLParamsparams?, RequestOptionsoptions?): BetaUserProfileEnrollmentURL` - -**post** `/v1/user_profiles/{id}/enrollment_url` - -Create Enrollment URL - -### Parameters - -- `id: string` - -- `params: UserProfileCreateEnrollmentURLParams` - - - `betas?: Array` - - Optional header to specify the beta version(s) you want to use. - - - `(string & {})` - - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` - - - `"message-batches-2024-09-24"` - - - `"prompt-caching-2024-07-31"` - - - `"computer-use-2024-10-22"` - - - `"computer-use-2025-01-24"` - - - `"pdfs-2024-09-25"` - - - `"token-counting-2024-11-01"` - - - `"token-efficient-tools-2025-02-19"` - - - `"output-128k-2025-02-19"` - - - `"files-api-2025-04-14"` - - - `"mcp-client-2025-04-04"` - - - `"mcp-client-2025-11-20"` - - - `"dev-full-thinking-2025-05-14"` - - - `"interleaved-thinking-2025-05-14"` - - - `"code-execution-2025-05-22"` - - - `"extended-cache-ttl-2025-04-11"` - - - `"context-1m-2025-08-07"` - - - `"context-management-2025-06-27"` - - - `"model-context-window-exceeded-2025-08-26"` - - - `"skills-2025-10-02"` - - - `"fast-mode-2026-02-01"` - - - `"output-300k-2026-03-24"` - - - `"user-profiles-2026-03-24"` - -### Returns - -- `BetaUserProfileEnrollmentURL` - - - `expires_at: string` - - A timestamp in RFC 3339 format - - - `type: string` - - - `url: string` - -### Example - -```typescript -import Anthropic from '@anthropic-ai/sdk'; - -const client = new Anthropic({ - apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted -}); - -const betaUserProfileEnrollmentURL = await client.beta.userProfiles.createEnrollmentURL('id'); - -console.log(betaUserProfileEnrollmentURL.expires_at); -``` - -## Domain Types - -### Beta User Profile - -- `BetaUserProfile` - - - `id: string` - - - `created_at: string` - - A timestamp in RFC 3339 format - - - `metadata: Record` - - - `trust_grants: Record` - - - `status: string` - - - `type: string` - - - `updated_at: string` - - A timestamp in RFC 3339 format - - - `external_id?: string | null` - -### Beta User Profile Enrollment URL - -- `BetaUserProfileEnrollmentURL` - - - `expires_at: string` - - A timestamp in RFC 3339 format - - - `type: string` - - - `url: string` - -### Beta User Profile Trust Grant - -- `BetaUserProfileTrustGrant` - - - `status: string` diff --git a/content/en/api/typescript/beta/agents.md b/content/en/api/typescript/beta/agents.md new file mode 100644 index 000000000..a66f2ba7e --- /dev/null +++ b/content/en/api/typescript/beta/agents.md @@ -0,0 +1,4272 @@ +# Agents + +## Create + +`client.beta.agents.create(AgentCreateParamsparams, RequestOptionsoptions?): BetaManagedAgentsAgent` + +**post** `/v1/agents` + +Create Agent + +### Parameters + +- `params: AgentCreateParams` + + - `model: BetaManagedAgentsModel | BetaManagedAgentsModelConfigParams` + + Body param: Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control + + - `BetaManagedAgentsModel = "claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more | (string & {})` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `BetaManagedAgentsModelConfigParams` + + An object that defines additional configuration control over model use + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast" | null` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + Body param: Human-readable name for the agent. 1-256 characters. + + - `description?: string | null` + + Body param: Description of what the agent does. Up to 2048 characters. + + - `mcp_servers?: Array` + + Body param: MCP servers this agent connects to. Maximum 20. Names must be unique within the array. + + - `name: string` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `type: "url"` + + - `"url"` + + - `url: string` + + Endpoint URL for the MCP server. + + - `metadata?: Record` + + Body param: Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars. + + - `skills?: Array` + + Body param: Skills available to the agent. Maximum 20. + + - `BetaManagedAgentsAnthropicSkillParams` + + An Anthropic-managed skill. + + - `skill_id: string` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: "anthropic"` + + - `"anthropic"` + + - `version?: string | null` + + Version to pin. Defaults to latest if omitted. + + - `BetaManagedAgentsCustomSkillParams` + + A user-created custom skill. + + - `skill_id: string` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: "custom"` + + - `"custom"` + + - `version?: string | null` + + Version to pin. Defaults to latest if omitted. + + - `system?: string | null` + + Body param: System prompt for the agent. Up to 100,000 characters. + + - `tools?: Array` + + Body param: Tool configurations available to the agent. Maximum of 128 tools across all toolsets allowed. + + - `BetaManagedAgentsAgentToolset20260401Params` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `configs?: Array` + + Per-tool configuration overrides. + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled?: boolean | null` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config?: BetaManagedAgentsAgentToolsetDefaultConfigParams | null` + + Default configuration for all tools in a toolset. + + - `enabled?: boolean | null` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `BetaManagedAgentsMCPToolsetParams` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `mcp_server_name: string` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `configs?: Array` + + Per-tool configuration overrides. + + - `name: string` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled?: boolean | null` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config?: BetaManagedAgentsMCPToolsetDefaultConfigParams | null` + + Default configuration for all tools from an MCP server. + + - `enabled?: boolean | null` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `BetaManagedAgentsCustomToolParams` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: string` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: "custom"` + + - `"custom"` + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: Record` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsAgent = await client.beta.agents.create({ + model: 'claude-sonnet-4-6', + name: 'My First Agent', +}); + +console.log(betaManagedAgentsAgent.id); +``` + +## List + +`client.beta.agents.list(AgentListParamsparams?, RequestOptionsoptions?): PageCursor` + +**get** `/v1/agents` + +List Agents + +### Parameters + +- `params: AgentListParams` + + - `createdAtGte?: string` + + Query param: Return agents created at or after this time (inclusive). + + - `createdAtLte?: string` + + Query param: Return agents created at or before this time (inclusive). + + - `include_archived?: boolean` + + Query param: Include archived agents in results. Defaults to false. + + - `limit?: number` + + Query param: Maximum results per page. Default 20, maximum 100. + + - `page?: string` + + Query param: Opaque pagination cursor from a previous response. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: Record` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +// Automatically fetches more pages as needed. +for await (const betaManagedAgentsAgent of client.beta.agents.list()) { + console.log(betaManagedAgentsAgent.id); +} +``` + +## Retrieve + +`client.beta.agents.retrieve(stringagentID, AgentRetrieveParamsparams?, RequestOptionsoptions?): BetaManagedAgentsAgent` + +**get** `/v1/agents/{agent_id}` + +Get Agent + +### Parameters + +- `agentID: string` + +- `params: AgentRetrieveParams` + + - `version?: number` + + Query param: Agent version. Omit for the most recent version. Must be at least 1 if specified. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: Record` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsAgent = await client.beta.agents.retrieve('agent_011CZkYpogX7uDKUyvBTophP'); + +console.log(betaManagedAgentsAgent.id); +``` + +## Update + +`client.beta.agents.update(stringagentID, AgentUpdateParamsparams, RequestOptionsoptions?): BetaManagedAgentsAgent` + +**post** `/v1/agents/{agent_id}` + +Update Agent + +### Parameters + +- `agentID: string` + +- `params: AgentUpdateParams` + + - `version: number` + + Body param: The agent's current version, used to prevent concurrent overwrites. Obtain this value from a create or retrieve response. The request fails if this does not match the server's current version. + + - `description?: string | null` + + Body param: Description. Up to 2048 characters. Omit to preserve; send empty string or null to clear. + + - `mcp_servers?: Array | null` + + Body param: MCP servers. Full replacement. Omit to preserve; send empty array or null to clear. Names must be unique. Maximum 20. + + - `name: string` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `type: "url"` + + - `"url"` + + - `url: string` + + Endpoint URL for the MCP server. + + - `metadata?: Record | null` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. The stored bag is limited to 16 keys (up to 64 chars each) with values up to 512 chars. + + - `model?: BetaManagedAgentsModel | BetaManagedAgentsModelConfigParams` + + Body param: Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control. Omit to preserve. Cannot be cleared. + + - `BetaManagedAgentsModel = "claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more | (string & {})` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `BetaManagedAgentsModelConfigParams` + + An object that defines additional configuration control over model use + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast" | null` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name?: string` + + Body param: Human-readable name. 1-256 characters. Omit to preserve. Cannot be cleared. + + - `skills?: Array | null` + + Body param: Skills. Full replacement. Omit to preserve; send empty array or null to clear. Maximum 20. + + - `BetaManagedAgentsAnthropicSkillParams` + + An Anthropic-managed skill. + + - `skill_id: string` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: "anthropic"` + + - `"anthropic"` + + - `version?: string | null` + + Version to pin. Defaults to latest if omitted. + + - `BetaManagedAgentsCustomSkillParams` + + A user-created custom skill. + + - `skill_id: string` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: "custom"` + + - `"custom"` + + - `version?: string | null` + + Version to pin. Defaults to latest if omitted. + + - `system?: string | null` + + Body param: System prompt. Up to 100,000 characters. Omit to preserve; send empty string or null to clear. + + - `tools?: Array | null` + + Body param: Tool configurations available to the agent. Full replacement. Omit to preserve; send empty array or null to clear. Maximum of 128 tools across all toolsets allowed. + + - `BetaManagedAgentsAgentToolset20260401Params` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `configs?: Array` + + Per-tool configuration overrides. + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled?: boolean | null` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config?: BetaManagedAgentsAgentToolsetDefaultConfigParams | null` + + Default configuration for all tools in a toolset. + + - `enabled?: boolean | null` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `BetaManagedAgentsMCPToolsetParams` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `mcp_server_name: string` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `configs?: Array` + + Per-tool configuration overrides. + + - `name: string` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled?: boolean | null` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config?: BetaManagedAgentsMCPToolsetDefaultConfigParams | null` + + Default configuration for all tools from an MCP server. + + - `enabled?: boolean | null` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `BetaManagedAgentsCustomToolParams` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: string` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: "custom"` + + - `"custom"` + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: Record` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsAgent = await client.beta.agents.update('agent_011CZkYpogX7uDKUyvBTophP', { + version: 1, +}); + +console.log(betaManagedAgentsAgent.id); +``` + +## Archive + +`client.beta.agents.archive(stringagentID, AgentArchiveParamsparams?, RequestOptionsoptions?): BetaManagedAgentsAgent` + +**post** `/v1/agents/{agent_id}/archive` + +Archive Agent + +### Parameters + +- `agentID: string` + +- `params: AgentArchiveParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: Record` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsAgent = await client.beta.agents.archive('agent_011CZkYpogX7uDKUyvBTophP'); + +console.log(betaManagedAgentsAgent.id); +``` + +## Domain Types + +### Beta Managed Agents Agent + +- `BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: Record` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Beta Managed Agents Agent Tool Config + +- `BetaManagedAgentsAgentToolConfig` + + Configuration for a specific agent tool. + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Agent Tool Config Params + +- `BetaManagedAgentsAgentToolConfigParams` + + Configuration override for a specific tool within a toolset. + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled?: boolean | null` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Agent Toolset Default Config + +- `BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Agent Toolset Default Config Params + +- `BetaManagedAgentsAgentToolsetDefaultConfigParams` + + Default configuration for all tools in a toolset. + + - `enabled?: boolean | null` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Agent Toolset20260401 + +- `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + +### Beta Managed Agents Agent Toolset20260401 Params + +- `BetaManagedAgentsAgentToolset20260401Params` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `configs?: Array` + + Per-tool configuration overrides. + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled?: boolean | null` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config?: BetaManagedAgentsAgentToolsetDefaultConfigParams | null` + + Default configuration for all tools in a toolset. + + - `enabled?: boolean | null` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Always Allow Policy + +- `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + +### Beta Managed Agents Always Ask Policy + +- `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Anthropic Skill + +- `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + +### Beta Managed Agents Anthropic Skill Params + +- `BetaManagedAgentsAnthropicSkillParams` + + An Anthropic-managed skill. + + - `skill_id: string` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: "anthropic"` + + - `"anthropic"` + + - `version?: string | null` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents Custom Skill + +- `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + +### Beta Managed Agents Custom Skill Params + +- `BetaManagedAgentsCustomSkillParams` + + A user-created custom skill. + + - `skill_id: string` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: "custom"` + + - `"custom"` + + - `version?: string | null` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents Custom Tool + +- `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + +### Beta Managed Agents Custom Tool Input Schema + +- `BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + +### Beta Managed Agents Custom Tool Params + +- `BetaManagedAgentsCustomToolParams` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: string` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: "custom"` + + - `"custom"` + +### Beta Managed Agents MCP Server URL Definition + +- `BetaManagedAgentsMCPServerURLDefinition` + + URL-based MCP server connection as returned in API responses. + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + +### Beta Managed Agents MCP Tool Config + +- `BetaManagedAgentsMCPToolConfig` + + Resolved configuration for a specific MCP tool. + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents MCP Tool Config Params + +- `BetaManagedAgentsMCPToolConfigParams` + + Configuration override for a specific MCP tool. + + - `name: string` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled?: boolean | null` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents MCP Toolset + +- `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + +### Beta Managed Agents MCP Toolset Default Config + +- `BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents MCP Toolset Default Config Params + +- `BetaManagedAgentsMCPToolsetDefaultConfigParams` + + Default configuration for all tools from an MCP server. + + - `enabled?: boolean | null` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents MCP Toolset Params + +- `BetaManagedAgentsMCPToolsetParams` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `mcp_server_name: string` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `configs?: Array` + + Per-tool configuration overrides. + + - `name: string` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled?: boolean | null` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config?: BetaManagedAgentsMCPToolsetDefaultConfigParams | null` + + Default configuration for all tools from an MCP server. + + - `enabled?: boolean | null` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + +### Beta Managed Agents Model + +- `BetaManagedAgentsModel = "claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more | (string & {})` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + +### Beta Managed Agents Model Config + +- `BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +### Beta Managed Agents Model Config Params + +- `BetaManagedAgentsModelConfigParams` + + An object that defines additional configuration control over model use + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast" | null` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +### Beta Managed Agents Skill Params + +- `BetaManagedAgentsSkillParams = BetaManagedAgentsAnthropicSkillParams | BetaManagedAgentsCustomSkillParams` + + Skill to load in the session container. + + - `BetaManagedAgentsAnthropicSkillParams` + + An Anthropic-managed skill. + + - `skill_id: string` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: "anthropic"` + + - `"anthropic"` + + - `version?: string | null` + + Version to pin. Defaults to latest if omitted. + + - `BetaManagedAgentsCustomSkillParams` + + A user-created custom skill. + + - `skill_id: string` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: "custom"` + + - `"custom"` + + - `version?: string | null` + + Version to pin. Defaults to latest if omitted. + +### Beta Managed Agents URL MCP Server Params + +- `BetaManagedAgentsURLMCPServerParams` + + URL-based MCP server connection. + + - `name: string` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `type: "url"` + + - `"url"` + + - `url: string` + + Endpoint URL for the MCP server. + +# Versions + +## List + +`client.beta.agents.versions.list(stringagentID, VersionListParamsparams?, RequestOptionsoptions?): PageCursor` + +**get** `/v1/agents/{agent_id}/versions` + +List Agent Versions + +### Parameters + +- `agentID: string` + +- `params: VersionListParams` + + - `limit?: number` + + Query param: Maximum results per page. Default 20, maximum 100. + + - `page?: string` + + Query param: Opaque pagination cursor. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: Record` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +// Automatically fetches more pages as needed. +for await (const betaManagedAgentsAgent of client.beta.agents.versions.list( + 'agent_011CZkYpogX7uDKUyvBTophP', +)) { + console.log(betaManagedAgentsAgent.id); +} +``` diff --git a/content/en/api/typescript/beta/agents/archive.md b/content/en/api/typescript/beta/agents/archive.md new file mode 100644 index 000000000..1d808da53 --- /dev/null +++ b/content/en/api/typescript/beta/agents/archive.md @@ -0,0 +1,371 @@ +## Archive + +`client.beta.agents.archive(stringagentID, AgentArchiveParamsparams?, RequestOptionsoptions?): BetaManagedAgentsAgent` + +**post** `/v1/agents/{agent_id}/archive` + +Archive Agent + +### Parameters + +- `agentID: string` + +- `params: AgentArchiveParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: Record` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsAgent = await client.beta.agents.archive('agent_011CZkYpogX7uDKUyvBTophP'); + +console.log(betaManagedAgentsAgent.id); +``` diff --git a/content/en/api/typescript/beta/agents/create.md b/content/en/api/typescript/beta/agents/create.md new file mode 100644 index 000000000..21761ac23 --- /dev/null +++ b/content/en/api/typescript/beta/agents/create.md @@ -0,0 +1,734 @@ +## Create + +`client.beta.agents.create(AgentCreateParamsparams, RequestOptionsoptions?): BetaManagedAgentsAgent` + +**post** `/v1/agents` + +Create Agent + +### Parameters + +- `params: AgentCreateParams` + + - `model: BetaManagedAgentsModel | BetaManagedAgentsModelConfigParams` + + Body param: Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control + + - `BetaManagedAgentsModel = "claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more | (string & {})` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `BetaManagedAgentsModelConfigParams` + + An object that defines additional configuration control over model use + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast" | null` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + Body param: Human-readable name for the agent. 1-256 characters. + + - `description?: string | null` + + Body param: Description of what the agent does. Up to 2048 characters. + + - `mcp_servers?: Array` + + Body param: MCP servers this agent connects to. Maximum 20. Names must be unique within the array. + + - `name: string` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `type: "url"` + + - `"url"` + + - `url: string` + + Endpoint URL for the MCP server. + + - `metadata?: Record` + + Body param: Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars. + + - `skills?: Array` + + Body param: Skills available to the agent. Maximum 20. + + - `BetaManagedAgentsAnthropicSkillParams` + + An Anthropic-managed skill. + + - `skill_id: string` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: "anthropic"` + + - `"anthropic"` + + - `version?: string | null` + + Version to pin. Defaults to latest if omitted. + + - `BetaManagedAgentsCustomSkillParams` + + A user-created custom skill. + + - `skill_id: string` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: "custom"` + + - `"custom"` + + - `version?: string | null` + + Version to pin. Defaults to latest if omitted. + + - `system?: string | null` + + Body param: System prompt for the agent. Up to 100,000 characters. + + - `tools?: Array` + + Body param: Tool configurations available to the agent. Maximum of 128 tools across all toolsets allowed. + + - `BetaManagedAgentsAgentToolset20260401Params` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `configs?: Array` + + Per-tool configuration overrides. + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled?: boolean | null` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config?: BetaManagedAgentsAgentToolsetDefaultConfigParams | null` + + Default configuration for all tools in a toolset. + + - `enabled?: boolean | null` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `BetaManagedAgentsMCPToolsetParams` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `mcp_server_name: string` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `configs?: Array` + + Per-tool configuration overrides. + + - `name: string` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled?: boolean | null` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config?: BetaManagedAgentsMCPToolsetDefaultConfigParams | null` + + Default configuration for all tools from an MCP server. + + - `enabled?: boolean | null` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `BetaManagedAgentsCustomToolParams` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: string` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: "custom"` + + - `"custom"` + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: Record` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsAgent = await client.beta.agents.create({ + model: 'claude-sonnet-4-6', + name: 'My First Agent', +}); + +console.log(betaManagedAgentsAgent.id); +``` diff --git a/content/en/api/typescript/beta/agents/list.md b/content/en/api/typescript/beta/agents/list.md new file mode 100644 index 000000000..3557fa886 --- /dev/null +++ b/content/en/api/typescript/beta/agents/list.md @@ -0,0 +1,390 @@ +## List + +`client.beta.agents.list(AgentListParamsparams?, RequestOptionsoptions?): PageCursor` + +**get** `/v1/agents` + +List Agents + +### Parameters + +- `params: AgentListParams` + + - `createdAtGte?: string` + + Query param: Return agents created at or after this time (inclusive). + + - `createdAtLte?: string` + + Query param: Return agents created at or before this time (inclusive). + + - `include_archived?: boolean` + + Query param: Include archived agents in results. Defaults to false. + + - `limit?: number` + + Query param: Maximum results per page. Default 20, maximum 100. + + - `page?: string` + + Query param: Opaque pagination cursor from a previous response. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: Record` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +// Automatically fetches more pages as needed. +for await (const betaManagedAgentsAgent of client.beta.agents.list()) { + console.log(betaManagedAgentsAgent.id); +} +``` diff --git a/content/en/api/typescript/beta/agents/retrieve.md b/content/en/api/typescript/beta/agents/retrieve.md new file mode 100644 index 000000000..b498d6611 --- /dev/null +++ b/content/en/api/typescript/beta/agents/retrieve.md @@ -0,0 +1,375 @@ +## Retrieve + +`client.beta.agents.retrieve(stringagentID, AgentRetrieveParamsparams?, RequestOptionsoptions?): BetaManagedAgentsAgent` + +**get** `/v1/agents/{agent_id}` + +Get Agent + +### Parameters + +- `agentID: string` + +- `params: AgentRetrieveParams` + + - `version?: number` + + Query param: Agent version. Omit for the most recent version. Must be at least 1 if specified. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: Record` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsAgent = await client.beta.agents.retrieve('agent_011CZkYpogX7uDKUyvBTophP'); + +console.log(betaManagedAgentsAgent.id); +``` diff --git a/content/en/api/typescript/beta/agents/update.md b/content/en/api/typescript/beta/agents/update.md new file mode 100644 index 000000000..0843a3bdc --- /dev/null +++ b/content/en/api/typescript/beta/agents/update.md @@ -0,0 +1,739 @@ +## Update + +`client.beta.agents.update(stringagentID, AgentUpdateParamsparams, RequestOptionsoptions?): BetaManagedAgentsAgent` + +**post** `/v1/agents/{agent_id}` + +Update Agent + +### Parameters + +- `agentID: string` + +- `params: AgentUpdateParams` + + - `version: number` + + Body param: The agent's current version, used to prevent concurrent overwrites. Obtain this value from a create or retrieve response. The request fails if this does not match the server's current version. + + - `description?: string | null` + + Body param: Description. Up to 2048 characters. Omit to preserve; send empty string or null to clear. + + - `mcp_servers?: Array | null` + + Body param: MCP servers. Full replacement. Omit to preserve; send empty array or null to clear. Names must be unique. Maximum 20. + + - `name: string` + + Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters. + + - `type: "url"` + + - `"url"` + + - `url: string` + + Endpoint URL for the MCP server. + + - `metadata?: Record | null` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. The stored bag is limited to 16 keys (up to 64 chars each) with values up to 512 chars. + + - `model?: BetaManagedAgentsModel | BetaManagedAgentsModelConfigParams` + + Body param: Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control. Omit to preserve. Cannot be cleared. + + - `BetaManagedAgentsModel = "claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more | (string & {})` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `BetaManagedAgentsModelConfigParams` + + An object that defines additional configuration control over model use + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast" | null` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name?: string` + + Body param: Human-readable name. 1-256 characters. Omit to preserve. Cannot be cleared. + + - `skills?: Array | null` + + Body param: Skills. Full replacement. Omit to preserve; send empty array or null to clear. Maximum 20. + + - `BetaManagedAgentsAnthropicSkillParams` + + An Anthropic-managed skill. + + - `skill_id: string` + + Identifier of the Anthropic skill (e.g., "xlsx"). + + - `type: "anthropic"` + + - `"anthropic"` + + - `version?: string | null` + + Version to pin. Defaults to latest if omitted. + + - `BetaManagedAgentsCustomSkillParams` + + A user-created custom skill. + + - `skill_id: string` + + Tagged ID of the custom skill (e.g., "skill_01XJ5..."). + + - `type: "custom"` + + - `"custom"` + + - `version?: string | null` + + Version to pin. Defaults to latest if omitted. + + - `system?: string | null` + + Body param: System prompt. Up to 100,000 characters. Omit to preserve; send empty string or null to clear. + + - `tools?: Array | null` + + Body param: Tool configurations available to the agent. Full replacement. Omit to preserve; send empty array or null to clear. Maximum of 128 tools across all toolsets allowed. + + - `BetaManagedAgentsAgentToolset20260401Params` + + Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent. + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `configs?: Array` + + Per-tool configuration overrides. + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `enabled?: boolean | null` + + Whether this tool is enabled and available to Claude. Overrides the default_config setting. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config?: BetaManagedAgentsAgentToolsetDefaultConfigParams | null` + + Default configuration for all tools in a toolset. + + - `enabled?: boolean | null` + + Whether tools are enabled and available to Claude by default. Defaults to true if not specified. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `BetaManagedAgentsMCPToolsetParams` + + Configuration for tools from an MCP server defined in `mcp_servers`. + + - `mcp_server_name: string` + + Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters. + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `configs?: Array` + + Per-tool configuration overrides. + + - `name: string` + + Name of the MCP tool to configure. 1-128 characters. + + - `enabled?: boolean | null` + + Whether this tool is enabled. Overrides the `default_config` setting. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config?: BetaManagedAgentsMCPToolsetDefaultConfigParams | null` + + Default configuration for all tools from an MCP server. + + - `enabled?: boolean | null` + + Whether tools are enabled by default. Defaults to true if not specified. + + - `permission_policy?: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy | null` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `BetaManagedAgentsCustomToolParams` + + A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event. + + - `description: string` + + Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters. + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens. + + - `type: "custom"` + + - `"custom"` + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: Record` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsAgent = await client.beta.agents.update('agent_011CZkYpogX7uDKUyvBTophP', { + version: 1, +}); + +console.log(betaManagedAgentsAgent.id); +``` diff --git a/content/en/api/typescript/beta/agents/versions.md b/content/en/api/typescript/beta/agents/versions.md new file mode 100644 index 000000000..120af2762 --- /dev/null +++ b/content/en/api/typescript/beta/agents/versions.md @@ -0,0 +1,384 @@ +# Versions + +## List + +`client.beta.agents.versions.list(stringagentID, VersionListParamsparams?, RequestOptionsoptions?): PageCursor` + +**get** `/v1/agents/{agent_id}/versions` + +List Agent Versions + +### Parameters + +- `agentID: string` + +- `params: VersionListParams` + + - `limit?: number` + + Query param: Maximum results per page. Default 20, maximum 100. + + - `page?: string` + + Query param: Opaque pagination cursor. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: Record` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +// Automatically fetches more pages as needed. +for await (const betaManagedAgentsAgent of client.beta.agents.versions.list( + 'agent_011CZkYpogX7uDKUyvBTophP', +)) { + console.log(betaManagedAgentsAgent.id); +} +``` diff --git a/content/en/api/typescript/beta/agents/versions/list.md b/content/en/api/typescript/beta/agents/versions/list.md new file mode 100644 index 000000000..0a9694ede --- /dev/null +++ b/content/en/api/typescript/beta/agents/versions/list.md @@ -0,0 +1,382 @@ +## List + +`client.beta.agents.versions.list(stringagentID, VersionListParamsparams?, RequestOptionsoptions?): PageCursor` + +**get** `/v1/agents/{agent_id}/versions` + +List Agent Versions + +### Parameters + +- `agentID: string` + +- `params: VersionListParams` + + - `limit?: number` + + Query param: Maximum results per page. Default 20, maximum 100. + + - `page?: string` + + Query param: Opaque pagination cursor. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsAgent` + + A Managed Agents `agent`. + + - `id: string` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `metadata: Record` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `version: number` + + The agent's current version. Starts at 1 and increments when the agent is modified. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +// Automatically fetches more pages as needed. +for await (const betaManagedAgentsAgent of client.beta.agents.versions.list( + 'agent_011CZkYpogX7uDKUyvBTophP', +)) { + console.log(betaManagedAgentsAgent.id); +} +``` diff --git a/content/en/api/typescript/beta/environments.md b/content/en/api/typescript/beta/environments.md new file mode 100644 index 000000000..fcc7f803f --- /dev/null +++ b/content/en/api/typescript/beta/environments.md @@ -0,0 +1,1743 @@ +# Environments + +## Create + +`client.beta.environments.create(EnvironmentCreateParamsparams, RequestOptionsoptions?): BetaEnvironment` + +**post** `/v1/environments` + +Create a new environment with the specified configuration. + +### Parameters + +- `params: EnvironmentCreateParams` + + - `name: string` + + Body param: Human-readable name for the environment + + - `config?: BetaCloudConfigParams | null` + + Body param: Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `networking?: BetaUnrestrictedNetwork | BetaLimitedNetworkParams | null` + + Network configuration policy. Omit on update to preserve the existing value. + + - `BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetworkParams` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `allow_mcp_servers?: boolean | null` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers?: boolean | null` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts?: Array | null` + + Specifies domains the container can reach. + + - `packages?: BetaPackagesParams | null` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt?: Array | null` + + Ubuntu/Debian packages to install + + - `cargo?: Array | null` + + Rust packages to install + + - `gem?: Array | null` + + Ruby packages to install + + - `go?: Array | null` + + Go packages to install + + - `npm?: Array | null` + + Node.js packages to install + + - `pip?: Array | null` + + Python packages to install + + - `type?: "packages"` + + Package configuration type + + - `"packages"` + + - `description?: string | null` + + Body param: Optional description of the environment + + - `metadata?: Record` + + Body param: User-provided metadata key-value pairs + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string | null` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array` + + Ubuntu/Debian packages to install + + - `cargo: Array` + + Rust packages to install + + - `gem: Array` + + Ruby packages to install + + - `go: Array` + + Go packages to install + + - `npm: Array` + + Node.js packages to install + + - `pip: Array` + + Python packages to install + + - `type?: "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: Record` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaEnvironment = await client.beta.environments.create({ name: 'python-data-analysis' }); + +console.log(betaEnvironment.id); +``` + +## List + +`client.beta.environments.list(EnvironmentListParamsparams?, RequestOptionsoptions?): PageCursor` + +**get** `/v1/environments` + +List environments with pagination support. + +### Parameters + +- `params: EnvironmentListParams` + + - `include_archived?: boolean` + + Query param: Include archived environments in the response + + - `limit?: number` + + Query param: Maximum number of environments to return + + - `page?: string | null` + + Query param: Opaque cursor from previous response for pagination. Pass the `next_page` value from the previous response. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string | null` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array` + + Ubuntu/Debian packages to install + + - `cargo: Array` + + Rust packages to install + + - `gem: Array` + + Ruby packages to install + + - `go: Array` + + Go packages to install + + - `npm: Array` + + Node.js packages to install + + - `pip: Array` + + Python packages to install + + - `type?: "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: Record` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +// Automatically fetches more pages as needed. +for await (const betaEnvironment of client.beta.environments.list()) { + console.log(betaEnvironment.id); +} +``` + +## Retrieve + +`client.beta.environments.retrieve(stringenvironmentID, EnvironmentRetrieveParamsparams?, RequestOptionsoptions?): BetaEnvironment` + +**get** `/v1/environments/{environment_id}` + +Retrieve a specific environment by ID. + +### Parameters + +- `environmentID: string` + +- `params: EnvironmentRetrieveParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string | null` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array` + + Ubuntu/Debian packages to install + + - `cargo: Array` + + Rust packages to install + + - `gem: Array` + + Ruby packages to install + + - `go: Array` + + Go packages to install + + - `npm: Array` + + Node.js packages to install + + - `pip: Array` + + Python packages to install + + - `type?: "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: Record` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaEnvironment = await client.beta.environments.retrieve('env_011CZkZ9X2dpNyB7HsEFoRfW'); + +console.log(betaEnvironment.id); +``` + +## Update + +`client.beta.environments.update(stringenvironmentID, EnvironmentUpdateParamsparams, RequestOptionsoptions?): BetaEnvironment` + +**post** `/v1/environments/{environment_id}` + +Update an existing environment's configuration. + +### Parameters + +- `environmentID: string` + +- `params: EnvironmentUpdateParams` + + - `config?: BetaCloudConfigParams | null` + + Body param: Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `networking?: BetaUnrestrictedNetwork | BetaLimitedNetworkParams | null` + + Network configuration policy. Omit on update to preserve the existing value. + + - `BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetworkParams` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `allow_mcp_servers?: boolean | null` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers?: boolean | null` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts?: Array | null` + + Specifies domains the container can reach. + + - `packages?: BetaPackagesParams | null` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt?: Array | null` + + Ubuntu/Debian packages to install + + - `cargo?: Array | null` + + Rust packages to install + + - `gem?: Array | null` + + Ruby packages to install + + - `go?: Array | null` + + Go packages to install + + - `npm?: Array | null` + + Node.js packages to install + + - `pip?: Array | null` + + Python packages to install + + - `type?: "packages"` + + Package configuration type + + - `"packages"` + + - `description?: string | null` + + Body param: Updated description of the environment + + - `metadata?: Record` + + Body param: User-provided metadata key-value pairs. Set a value to null or empty string to delete the key. + + - `name?: string | null` + + Body param: Updated name for the environment + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string | null` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array` + + Ubuntu/Debian packages to install + + - `cargo: Array` + + Rust packages to install + + - `gem: Array` + + Ruby packages to install + + - `go: Array` + + Go packages to install + + - `npm: Array` + + Node.js packages to install + + - `pip: Array` + + Python packages to install + + - `type?: "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: Record` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaEnvironment = await client.beta.environments.update('env_011CZkZ9X2dpNyB7HsEFoRfW'); + +console.log(betaEnvironment.id); +``` + +## Delete + +`client.beta.environments.delete(stringenvironmentID, EnvironmentDeleteParamsparams?, RequestOptionsoptions?): BetaEnvironmentDeleteResponse` + +**delete** `/v1/environments/{environment_id}` + +Delete an environment by ID. Returns a confirmation of the deletion. + +### Parameters + +- `environmentID: string` + +- `params: EnvironmentDeleteParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaEnvironmentDeleteResponse` + + Response after deleting an environment. + + - `id: string` + + Environment identifier + + - `type: "environment_deleted"` + + The type of response + + - `"environment_deleted"` + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaEnvironmentDeleteResponse = await client.beta.environments.delete( + 'env_011CZkZ9X2dpNyB7HsEFoRfW', +); + +console.log(betaEnvironmentDeleteResponse.id); +``` + +## Archive + +`client.beta.environments.archive(stringenvironmentID, EnvironmentArchiveParamsparams?, RequestOptionsoptions?): BetaEnvironment` + +**post** `/v1/environments/{environment_id}/archive` + +Archive an environment by ID. Archived environments cannot be used to create new sessions. + +### Parameters + +- `environmentID: string` + +- `params: EnvironmentArchiveParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string | null` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array` + + Ubuntu/Debian packages to install + + - `cargo: Array` + + Rust packages to install + + - `gem: Array` + + Ruby packages to install + + - `go: Array` + + Go packages to install + + - `npm: Array` + + Node.js packages to install + + - `pip: Array` + + Python packages to install + + - `type?: "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: Record` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaEnvironment = await client.beta.environments.archive('env_011CZkZ9X2dpNyB7HsEFoRfW'); + +console.log(betaEnvironment.id); +``` + +## Domain Types + +### Beta Cloud Config + +- `BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array` + + Ubuntu/Debian packages to install + + - `cargo: Array` + + Rust packages to install + + - `gem: Array` + + Ruby packages to install + + - `go: Array` + + Go packages to install + + - `npm: Array` + + Node.js packages to install + + - `pip: Array` + + Python packages to install + + - `type?: "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + +### Beta Cloud Config Params + +- `BetaCloudConfigParams` + + Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `networking?: BetaUnrestrictedNetwork | BetaLimitedNetworkParams | null` + + Network configuration policy. Omit on update to preserve the existing value. + + - `BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetworkParams` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `allow_mcp_servers?: boolean | null` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers?: boolean | null` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts?: Array | null` + + Specifies domains the container can reach. + + - `packages?: BetaPackagesParams | null` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt?: Array | null` + + Ubuntu/Debian packages to install + + - `cargo?: Array | null` + + Rust packages to install + + - `gem?: Array | null` + + Ruby packages to install + + - `go?: Array | null` + + Go packages to install + + - `npm?: Array | null` + + Node.js packages to install + + - `pip?: Array | null` + + Python packages to install + + - `type?: "packages"` + + Package configuration type + + - `"packages"` + +### Beta Environment + +- `BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string | null` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array` + + Ubuntu/Debian packages to install + + - `cargo: Array` + + Rust packages to install + + - `gem: Array` + + Ruby packages to install + + - `go: Array` + + Go packages to install + + - `npm: Array` + + Node.js packages to install + + - `pip: Array` + + Python packages to install + + - `type?: "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: Record` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Beta Environment Delete Response + +- `BetaEnvironmentDeleteResponse` + + Response after deleting an environment. + + - `id: string` + + Environment identifier + + - `type: "environment_deleted"` + + The type of response + + - `"environment_deleted"` + +### Beta Limited Network + +- `BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + +### Beta Limited Network Params + +- `BetaLimitedNetworkParams` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `allow_mcp_servers?: boolean | null` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers?: boolean | null` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts?: Array | null` + + Specifies domains the container can reach. + +### Beta Packages + +- `BetaPackages` + + Packages (and their versions) available in this environment. + + - `apt: Array` + + Ubuntu/Debian packages to install + + - `cargo: Array` + + Rust packages to install + + - `gem: Array` + + Ruby packages to install + + - `go: Array` + + Go packages to install + + - `npm: Array` + + Node.js packages to install + + - `pip: Array` + + Python packages to install + + - `type?: "packages"` + + Package configuration type + + - `"packages"` + +### Beta Packages Params + +- `BetaPackagesParams` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt?: Array | null` + + Ubuntu/Debian packages to install + + - `cargo?: Array | null` + + Rust packages to install + + - `gem?: Array | null` + + Ruby packages to install + + - `go?: Array | null` + + Go packages to install + + - `npm?: Array | null` + + Node.js packages to install + + - `pip?: Array | null` + + Python packages to install + + - `type?: "packages"` + + Package configuration type + + - `"packages"` + +### Beta Unrestricted Network + +- `BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` diff --git a/content/en/api/typescript/beta/environments/archive.md b/content/en/api/typescript/beta/environments/archive.md new file mode 100644 index 000000000..8e6fe64f2 --- /dev/null +++ b/content/en/api/typescript/beta/environments/archive.md @@ -0,0 +1,197 @@ +## Archive + +`client.beta.environments.archive(stringenvironmentID, EnvironmentArchiveParamsparams?, RequestOptionsoptions?): BetaEnvironment` + +**post** `/v1/environments/{environment_id}/archive` + +Archive an environment by ID. Archived environments cannot be used to create new sessions. + +### Parameters + +- `environmentID: string` + +- `params: EnvironmentArchiveParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string | null` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array` + + Ubuntu/Debian packages to install + + - `cargo: Array` + + Rust packages to install + + - `gem: Array` + + Ruby packages to install + + - `go: Array` + + Go packages to install + + - `npm: Array` + + Node.js packages to install + + - `pip: Array` + + Python packages to install + + - `type?: "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: Record` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaEnvironment = await client.beta.environments.archive('env_011CZkZ9X2dpNyB7HsEFoRfW'); + +console.log(betaEnvironment.id); +``` diff --git a/content/en/api/typescript/beta/environments/create.md b/content/en/api/typescript/beta/environments/create.md new file mode 100644 index 000000000..ae62c69ff --- /dev/null +++ b/content/en/api/typescript/beta/environments/create.md @@ -0,0 +1,295 @@ +## Create + +`client.beta.environments.create(EnvironmentCreateParamsparams, RequestOptionsoptions?): BetaEnvironment` + +**post** `/v1/environments` + +Create a new environment with the specified configuration. + +### Parameters + +- `params: EnvironmentCreateParams` + + - `name: string` + + Body param: Human-readable name for the environment + + - `config?: BetaCloudConfigParams | null` + + Body param: Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `networking?: BetaUnrestrictedNetwork | BetaLimitedNetworkParams | null` + + Network configuration policy. Omit on update to preserve the existing value. + + - `BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetworkParams` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `allow_mcp_servers?: boolean | null` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers?: boolean | null` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts?: Array | null` + + Specifies domains the container can reach. + + - `packages?: BetaPackagesParams | null` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt?: Array | null` + + Ubuntu/Debian packages to install + + - `cargo?: Array | null` + + Rust packages to install + + - `gem?: Array | null` + + Ruby packages to install + + - `go?: Array | null` + + Go packages to install + + - `npm?: Array | null` + + Node.js packages to install + + - `pip?: Array | null` + + Python packages to install + + - `type?: "packages"` + + Package configuration type + + - `"packages"` + + - `description?: string | null` + + Body param: Optional description of the environment + + - `metadata?: Record` + + Body param: User-provided metadata key-value pairs + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string | null` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array` + + Ubuntu/Debian packages to install + + - `cargo: Array` + + Rust packages to install + + - `gem: Array` + + Ruby packages to install + + - `go: Array` + + Go packages to install + + - `npm: Array` + + Node.js packages to install + + - `pip: Array` + + Python packages to install + + - `type?: "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: Record` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaEnvironment = await client.beta.environments.create({ name: 'python-data-analysis' }); + +console.log(betaEnvironment.id); +``` diff --git a/content/en/api/typescript/beta/environments/delete.md b/content/en/api/typescript/beta/environments/delete.md new file mode 100644 index 000000000..63c7ac870 --- /dev/null +++ b/content/en/api/typescript/beta/environments/delete.md @@ -0,0 +1,95 @@ +## Delete + +`client.beta.environments.delete(stringenvironmentID, EnvironmentDeleteParamsparams?, RequestOptionsoptions?): BetaEnvironmentDeleteResponse` + +**delete** `/v1/environments/{environment_id}` + +Delete an environment by ID. Returns a confirmation of the deletion. + +### Parameters + +- `environmentID: string` + +- `params: EnvironmentDeleteParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaEnvironmentDeleteResponse` + + Response after deleting an environment. + + - `id: string` + + Environment identifier + + - `type: "environment_deleted"` + + The type of response + + - `"environment_deleted"` + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaEnvironmentDeleteResponse = await client.beta.environments.delete( + 'env_011CZkZ9X2dpNyB7HsEFoRfW', +); + +console.log(betaEnvironmentDeleteResponse.id); +``` diff --git a/content/en/api/typescript/beta/environments/list.md b/content/en/api/typescript/beta/environments/list.md new file mode 100644 index 000000000..86f6cad09 --- /dev/null +++ b/content/en/api/typescript/beta/environments/list.md @@ -0,0 +1,208 @@ +## List + +`client.beta.environments.list(EnvironmentListParamsparams?, RequestOptionsoptions?): PageCursor` + +**get** `/v1/environments` + +List environments with pagination support. + +### Parameters + +- `params: EnvironmentListParams` + + - `include_archived?: boolean` + + Query param: Include archived environments in the response + + - `limit?: number` + + Query param: Maximum number of environments to return + + - `page?: string | null` + + Query param: Opaque cursor from previous response for pagination. Pass the `next_page` value from the previous response. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string | null` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array` + + Ubuntu/Debian packages to install + + - `cargo: Array` + + Rust packages to install + + - `gem: Array` + + Ruby packages to install + + - `go: Array` + + Go packages to install + + - `npm: Array` + + Node.js packages to install + + - `pip: Array` + + Python packages to install + + - `type?: "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: Record` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +// Automatically fetches more pages as needed. +for await (const betaEnvironment of client.beta.environments.list()) { + console.log(betaEnvironment.id); +} +``` diff --git a/content/en/api/typescript/beta/environments/retrieve.md b/content/en/api/typescript/beta/environments/retrieve.md new file mode 100644 index 000000000..f9e550e6c --- /dev/null +++ b/content/en/api/typescript/beta/environments/retrieve.md @@ -0,0 +1,197 @@ +## Retrieve + +`client.beta.environments.retrieve(stringenvironmentID, EnvironmentRetrieveParamsparams?, RequestOptionsoptions?): BetaEnvironment` + +**get** `/v1/environments/{environment_id}` + +Retrieve a specific environment by ID. + +### Parameters + +- `environmentID: string` + +- `params: EnvironmentRetrieveParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string | null` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array` + + Ubuntu/Debian packages to install + + - `cargo: Array` + + Rust packages to install + + - `gem: Array` + + Ruby packages to install + + - `go: Array` + + Go packages to install + + - `npm: Array` + + Node.js packages to install + + - `pip: Array` + + Python packages to install + + - `type?: "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: Record` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaEnvironment = await client.beta.environments.retrieve('env_011CZkZ9X2dpNyB7HsEFoRfW'); + +console.log(betaEnvironment.id); +``` diff --git a/content/en/api/typescript/beta/environments/update.md b/content/en/api/typescript/beta/environments/update.md new file mode 100644 index 000000000..54db476d2 --- /dev/null +++ b/content/en/api/typescript/beta/environments/update.md @@ -0,0 +1,297 @@ +## Update + +`client.beta.environments.update(stringenvironmentID, EnvironmentUpdateParamsparams, RequestOptionsoptions?): BetaEnvironment` + +**post** `/v1/environments/{environment_id}` + +Update an existing environment's configuration. + +### Parameters + +- `environmentID: string` + +- `params: EnvironmentUpdateParams` + + - `config?: BetaCloudConfigParams | null` + + Body param: Request params for `cloud` environment configuration. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `networking?: BetaUnrestrictedNetwork | BetaLimitedNetworkParams | null` + + Network configuration policy. Omit on update to preserve the existing value. + + - `BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetworkParams` + + Limited network request params. + + Fields default to null; on update, omitted fields preserve the + existing value. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `allow_mcp_servers?: boolean | null` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allow_package_managers?: boolean | null` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + + - `allowed_hosts?: Array | null` + + Specifies domains the container can reach. + + - `packages?: BetaPackagesParams | null` + + Specify packages (and optionally their versions) available in this environment. + + When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. + + - `apt?: Array | null` + + Ubuntu/Debian packages to install + + - `cargo?: Array | null` + + Rust packages to install + + - `gem?: Array | null` + + Ruby packages to install + + - `go?: Array | null` + + Go packages to install + + - `npm?: Array | null` + + Node.js packages to install + + - `pip?: Array | null` + + Python packages to install + + - `type?: "packages"` + + Package configuration type + + - `"packages"` + + - `description?: string | null` + + Body param: Updated description of the environment + + - `metadata?: Record` + + Body param: User-provided metadata key-value pairs. Set a value to null or empty string to delete the key. + + - `name?: string | null` + + Body param: Updated name for the environment + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaEnvironment` + + Unified Environment resource for both cloud and BYOC environments. + + - `id: string` + + Environment identifier (e.g., 'env_...') + + - `archived_at: string | null` + + RFC 3339 timestamp when environment was archived, or null if not archived + + - `config: BetaCloudConfig` + + `cloud` environment configuration. + + - `networking: BetaUnrestrictedNetwork | BetaLimitedNetwork` + + Network configuration policy. + + - `BetaUnrestrictedNetwork` + + Unrestricted network access. + + - `type: "unrestricted"` + + Network policy type + + - `"unrestricted"` + + - `BetaLimitedNetwork` + + Limited network access. + + - `allow_mcp_servers: boolean` + + Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. + + - `allow_package_managers: boolean` + + Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. + + - `allowed_hosts: Array` + + Specifies domains the container can reach. + + - `type: "limited"` + + Network policy type + + - `"limited"` + + - `packages: BetaPackages` + + Package manager configuration. + + - `apt: Array` + + Ubuntu/Debian packages to install + + - `cargo: Array` + + Rust packages to install + + - `gem: Array` + + Ruby packages to install + + - `go: Array` + + Go packages to install + + - `npm: Array` + + Node.js packages to install + + - `pip: Array` + + Python packages to install + + - `type?: "packages"` + + Package configuration type + + - `"packages"` + + - `type: "cloud"` + + Environment type + + - `"cloud"` + + - `created_at: string` + + RFC 3339 timestamp when environment was created + + - `description: string` + + User-provided description for the environment + + - `metadata: Record` + + User-provided metadata key-value pairs + + - `name: string` + + Human-readable name for the environment + + - `type: "environment"` + + The type of object (always 'environment') + + - `"environment"` + + - `updated_at: string` + + RFC 3339 timestamp when environment was last updated + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaEnvironment = await client.beta.environments.update('env_011CZkZ9X2dpNyB7HsEFoRfW'); + +console.log(betaEnvironment.id); +``` diff --git a/content/en/api/typescript/beta/files.md b/content/en/api/typescript/beta/files.md index c097dc2fa..88f45a582 100644 --- a/content/en/api/typescript/beta/files.md +++ b/content/en/api/typescript/beta/files.md @@ -22,7 +22,7 @@ Upload File - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -66,8 +66,6 @@ Upload File - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `FileMetadata` @@ -106,6 +104,20 @@ Upload File Whether the file can be downloaded. + - `scope?: BetaFileScope | null` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + + - `"session"` + ### Example ```typescript @@ -146,13 +158,17 @@ List Files Defaults to `20`. Ranges from `1` to `1000`. + - `scope_id?: string` + + Query param: Filter by scope ID. Only returns files associated with the specified scope (e.g., a session ID). + - `betas?: Array` Header param: Optional header to specify the beta version(s) you want to use. - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -196,8 +212,6 @@ List Files - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `FileMetadata` @@ -236,6 +250,20 @@ List Files Whether the file can be downloaded. + - `scope?: BetaFileScope | null` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + + - `"session"` + ### Example ```typescript @@ -273,7 +301,7 @@ Download File - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -317,8 +345,6 @@ Download File - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `unnamed_schema_1 = Response` @@ -362,7 +388,7 @@ Get File Metadata - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -406,8 +432,6 @@ Get File Metadata - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `FileMetadata` @@ -446,6 +470,20 @@ Get File Metadata Whether the file can be downloaded. + - `scope?: BetaFileScope | null` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + + - `"session"` + ### Example ```typescript @@ -482,7 +520,7 @@ Delete File - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -526,8 +564,6 @@ Delete File - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `DeletedFile` @@ -560,6 +596,20 @@ console.log(deletedFile.id); ## Domain Types +### Beta File Scope + +- `BetaFileScope` + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + + - `"session"` + ### Deleted File - `DeletedFile` @@ -613,3 +663,17 @@ console.log(deletedFile.id); - `downloadable?: boolean` Whether the file can be downloaded. + + - `scope?: BetaFileScope | null` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + + - `"session"` diff --git a/content/en/api/typescript/beta/files/delete.md b/content/en/api/typescript/beta/files/delete.md index 1bb06b909..a73219021 100644 --- a/content/en/api/typescript/beta/files/delete.md +++ b/content/en/api/typescript/beta/files/delete.md @@ -20,7 +20,7 @@ Delete File - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -64,8 +64,6 @@ Delete File - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `DeletedFile` diff --git a/content/en/api/typescript/beta/files/download.md b/content/en/api/typescript/beta/files/download.md index 11b4a663c..1e324c3ea 100644 --- a/content/en/api/typescript/beta/files/download.md +++ b/content/en/api/typescript/beta/files/download.md @@ -20,7 +20,7 @@ Download File - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -64,8 +64,6 @@ Download File - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `unnamed_schema_1 = Response` diff --git a/content/en/api/typescript/beta/files/list.md b/content/en/api/typescript/beta/files/list.md index 1c91938d9..f2876b9ef 100644 --- a/content/en/api/typescript/beta/files/list.md +++ b/content/en/api/typescript/beta/files/list.md @@ -24,13 +24,17 @@ List Files Defaults to `20`. Ranges from `1` to `1000`. + - `scope_id?: string` + + Query param: Filter by scope ID. Only returns files associated with the specified scope (e.g., a session ID). + - `betas?: Array` Header param: Optional header to specify the beta version(s) you want to use. - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -74,8 +78,6 @@ List Files - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `FileMetadata` @@ -114,6 +116,20 @@ List Files Whether the file can be downloaded. + - `scope?: BetaFileScope | null` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + + - `"session"` + ### Example ```typescript diff --git a/content/en/api/typescript/beta/files/retrieve_metadata.md b/content/en/api/typescript/beta/files/retrieve_metadata.md index 143221aa3..3d6226478 100644 --- a/content/en/api/typescript/beta/files/retrieve_metadata.md +++ b/content/en/api/typescript/beta/files/retrieve_metadata.md @@ -20,7 +20,7 @@ Get File Metadata - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -64,8 +64,6 @@ Get File Metadata - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `FileMetadata` @@ -104,6 +102,20 @@ Get File Metadata Whether the file can be downloaded. + - `scope?: BetaFileScope | null` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + + - `"session"` + ### Example ```typescript diff --git a/content/en/api/typescript/beta/files/upload.md b/content/en/api/typescript/beta/files/upload.md index 2aa08c9d4..7ab5e3200 100644 --- a/content/en/api/typescript/beta/files/upload.md +++ b/content/en/api/typescript/beta/files/upload.md @@ -20,7 +20,7 @@ Upload File - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -64,8 +64,6 @@ Upload File - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `FileMetadata` @@ -104,6 +102,20 @@ Upload File Whether the file can be downloaded. + - `scope?: BetaFileScope | null` + + The scope of this file, indicating the context in which it was created (e.g., a session). + + - `id: string` + + The ID of the scoping resource (e.g., the session ID). + + - `type: "session"` + + The type of scope (e.g., `"session"`). + + - `"session"` + ### Example ```typescript diff --git a/content/en/api/typescript/beta/messages.md b/content/en/api/typescript/beta/messages.md index 2bd345bec..30a19b5bc 100644 --- a/content/en/api/typescript/beta/messages.md +++ b/content/en/api/typescript/beta/messages.md @@ -2603,11 +2603,15 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -4678,17 +4682,13 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en Recommended for advanced use cases only. You usually only need to use `temperature`. - - `user_profile_id?: string | null` - - Body param: The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `betas?: Array` Header param: Optional header to specify the beta version(s) you want to use. - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -4732,8 +4732,6 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - - `MessageCreateParamsNonStreaming extends MessageCreateParamsBase` - `stream?: false` @@ -5677,11 +5675,15 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -8589,11 +8591,15 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -10572,7 +10578,7 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -10616,8 +10622,6 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaMessageTokensCount` @@ -10645,7 +10649,7 @@ const client = new Anthropic({ const betaMessageTokensCount = await client.beta.messages.countTokens({ messages: [{ content: 'string', role: 'user' }], - model: 'claude-opus-4-6', + model: 'claude-mythos-preview', }); console.log(betaMessageTokensCount.context_management); @@ -17836,11 +17840,15 @@ console.log(betaMessageTokensCount.context_management); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -23176,11 +23184,15 @@ console.log(betaMessageTokensCount.context_management); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -24416,11 +24428,15 @@ console.log(betaMessageTokensCount.context_management); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -35554,11 +35570,15 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -37627,17 +37647,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Recommended for advanced use cases only. You usually only need to use `temperature`. - - `user_profile_id?: string | null` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `betas?: Array` Header param: Optional header to specify the beta version(s) you want to use. - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -37681,8 +37697,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaMessageBatch` @@ -37822,7 +37836,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -37866,8 +37880,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaMessageBatch` @@ -38006,7 +38018,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -38050,8 +38062,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaMessageBatch` @@ -38183,7 +38193,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -38227,8 +38237,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaMessageBatch` @@ -38359,7 +38367,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -38403,8 +38411,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaDeletedMessageBatch` @@ -38461,7 +38467,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -38505,8 +38511,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaMessageBatchIndividualResponse` @@ -39448,11 +39452,15 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -41024,11 +41032,15 @@ console.log(betaMessageBatchIndividualResponse.custom_id); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -42392,11 +42404,15 @@ console.log(betaMessageBatchIndividualResponse.custom_id); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -43722,11 +43738,15 @@ console.log(betaMessageBatchIndividualResponse.custom_id); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` diff --git a/content/en/api/typescript/beta/messages/batches.md b/content/en/api/typescript/beta/messages/batches.md index e0da020fe..3058e1aa3 100644 --- a/content/en/api/typescript/beta/messages/batches.md +++ b/content/en/api/typescript/beta/messages/batches.md @@ -2617,11 +2617,15 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -4690,17 +4694,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Recommended for advanced use cases only. You usually only need to use `temperature`. - - `user_profile_id?: string | null` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `betas?: Array` Header param: Optional header to specify the beta version(s) you want to use. - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -4744,8 +4744,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaMessageBatch` @@ -4885,7 +4883,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -4929,8 +4927,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaMessageBatch` @@ -5069,7 +5065,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -5113,8 +5109,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaMessageBatch` @@ -5246,7 +5240,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -5290,8 +5284,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaMessageBatch` @@ -5422,7 +5414,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -5466,8 +5458,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaDeletedMessageBatch` @@ -5524,7 +5514,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -5568,8 +5558,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaMessageBatchIndividualResponse` @@ -6511,11 +6499,15 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -8087,11 +8079,15 @@ console.log(betaMessageBatchIndividualResponse.custom_id); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -9455,11 +9451,15 @@ console.log(betaMessageBatchIndividualResponse.custom_id); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -10785,11 +10785,15 @@ console.log(betaMessageBatchIndividualResponse.custom_id); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` diff --git a/content/en/api/typescript/beta/messages/batches/cancel.md b/content/en/api/typescript/beta/messages/batches/cancel.md index 6c502136d..08b2846fb 100644 --- a/content/en/api/typescript/beta/messages/batches/cancel.md +++ b/content/en/api/typescript/beta/messages/batches/cancel.md @@ -24,7 +24,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -68,8 +68,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaMessageBatch` diff --git a/content/en/api/typescript/beta/messages/batches/create.md b/content/en/api/typescript/beta/messages/batches/create.md index 1001517bb..56edba284 100644 --- a/content/en/api/typescript/beta/messages/batches/create.md +++ b/content/en/api/typescript/beta/messages/batches/create.md @@ -2615,11 +2615,15 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -4688,17 +4692,13 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude Recommended for advanced use cases only. You usually only need to use `temperature`. - - `user_profile_id?: string | null` - - The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `betas?: Array` Header param: Optional header to specify the beta version(s) you want to use. - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -4742,8 +4742,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaMessageBatch` diff --git a/content/en/api/typescript/beta/messages/batches/delete.md b/content/en/api/typescript/beta/messages/batches/delete.md index 637b50a6e..1224b51d2 100644 --- a/content/en/api/typescript/beta/messages/batches/delete.md +++ b/content/en/api/typescript/beta/messages/batches/delete.md @@ -24,7 +24,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -68,8 +68,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaDeletedMessageBatch` diff --git a/content/en/api/typescript/beta/messages/batches/list.md b/content/en/api/typescript/beta/messages/batches/list.md index 0be19f368..53855b4cf 100644 --- a/content/en/api/typescript/beta/messages/batches/list.md +++ b/content/en/api/typescript/beta/messages/batches/list.md @@ -32,7 +32,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -76,8 +76,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaMessageBatch` diff --git a/content/en/api/typescript/beta/messages/batches/results.md b/content/en/api/typescript/beta/messages/batches/results.md index 0d9c73e7e..3fbdb2bc6 100644 --- a/content/en/api/typescript/beta/messages/batches/results.md +++ b/content/en/api/typescript/beta/messages/batches/results.md @@ -24,7 +24,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -68,8 +68,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaMessageBatchIndividualResponse` @@ -1011,11 +1009,15 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` diff --git a/content/en/api/typescript/beta/messages/batches/retrieve.md b/content/en/api/typescript/beta/messages/batches/retrieve.md index 15b8ade12..86ce10568 100644 --- a/content/en/api/typescript/beta/messages/batches/retrieve.md +++ b/content/en/api/typescript/beta/messages/batches/retrieve.md @@ -22,7 +22,7 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -66,8 +66,6 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaMessageBatch` diff --git a/content/en/api/typescript/beta/messages/count_tokens.md b/content/en/api/typescript/beta/messages/count_tokens.md index 4e13c4d0b..ad2e2aa98 100644 --- a/content/en/api/typescript/beta/messages/count_tokens.md +++ b/content/en/api/typescript/beta/messages/count_tokens.md @@ -2591,11 +2591,15 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -4574,7 +4578,7 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -4618,8 +4622,6 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaMessageTokensCount` @@ -4647,7 +4649,7 @@ const client = new Anthropic({ const betaMessageTokensCount = await client.beta.messages.countTokens({ messages: [{ content: 'string', role: 'user' }], - model: 'claude-opus-4-6', + model: 'claude-mythos-preview', }); console.log(betaMessageTokensCount.context_management); diff --git a/content/en/api/typescript/beta/messages/create.md b/content/en/api/typescript/beta/messages/create.md index 04e68e15b..7e369a659 100644 --- a/content/en/api/typescript/beta/messages/create.md +++ b/content/en/api/typescript/beta/messages/create.md @@ -2601,11 +2601,15 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -4676,17 +4680,13 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en Recommended for advanced use cases only. You usually only need to use `temperature`. - - `user_profile_id?: string | null` - - Body param: The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. - - `betas?: Array` Header param: Optional header to specify the beta version(s) you want to use. - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -4730,8 +4730,6 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - - `MessageCreateParamsNonStreaming extends MessageCreateParamsBase` - `stream?: false` @@ -5675,11 +5673,15 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` diff --git a/content/en/api/typescript/beta/models.md b/content/en/api/typescript/beta/models.md index 9c57c027f..aad1de53c 100644 --- a/content/en/api/typescript/beta/models.md +++ b/content/en/api/typescript/beta/models.md @@ -34,7 +34,7 @@ The Models API response can be used to determine which models are available for - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -78,8 +78,6 @@ The Models API response can be used to determine which models are available for - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaModelInfo` @@ -303,7 +301,7 @@ The Models API response can be used to determine information about a specific mo - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -347,8 +345,6 @@ The Models API response can be used to determine information about a specific mo - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaModelInfo` diff --git a/content/en/api/typescript/beta/models/list.md b/content/en/api/typescript/beta/models/list.md index 9d859b0c8..619bac825 100644 --- a/content/en/api/typescript/beta/models/list.md +++ b/content/en/api/typescript/beta/models/list.md @@ -32,7 +32,7 @@ The Models API response can be used to determine which models are available for - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -76,8 +76,6 @@ The Models API response can be used to determine which models are available for - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaModelInfo` diff --git a/content/en/api/typescript/beta/models/retrieve.md b/content/en/api/typescript/beta/models/retrieve.md index 7456fda4f..1386fe8fc 100644 --- a/content/en/api/typescript/beta/models/retrieve.md +++ b/content/en/api/typescript/beta/models/retrieve.md @@ -22,7 +22,7 @@ The Models API response can be used to determine information about a specific mo - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -66,8 +66,6 @@ The Models API response can be used to determine information about a specific mo - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `BetaModelInfo` diff --git a/content/en/api/typescript/beta/sessions.md b/content/en/api/typescript/beta/sessions.md new file mode 100644 index 000000000..6e79686f4 --- /dev/null +++ b/content/en/api/typescript/beta/sessions.md @@ -0,0 +1,14267 @@ +# Sessions + +## Create + +`client.beta.sessions.create(SessionCreateParamsparams, RequestOptionsoptions?): BetaManagedAgentsSession` + +**post** `/v1/sessions` + +Create Session + +### Parameters + +- `params: SessionCreateParams` + + - `agent: string | BetaManagedAgentsAgentParams` + + Body param: Agent identifier. Accepts the `agent` ID string, which pins the latest version for the session, or an `agent` object with both id and version specified. + + - `string` + + - `BetaManagedAgentsAgentParams` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `id: string` + + The `agent` ID. + + - `type: "agent"` + + - `"agent"` + + - `version?: number` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + + - `environment_id: string` + + Body param: ID of the `environment` defining the container configuration for this session. + + - `metadata?: Record` + + Body param: Arbitrary key-value metadata attached to the session. + + - `resources?: Array` + + Body param: Resources (e.g. repositories, files) to mount into the session's container. + + - `BetaManagedAgentsGitHubRepositoryResourceParams` + + Mount a GitHub repository into the session's container. + + - `authorization_token: string` + + GitHub authorization token used to clone the repository. + + - `type: "github_repository"` + + - `"github_repository"` + + - `url: string` + + Github URL of the repository + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `mount_path?: string | null` + + Mount path in the container. Defaults to `/workspace/`. + + - `BetaManagedAgentsFileResourceParams` + + Mount a file uploaded via the Files API into the session. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `mount_path?: string | null` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + + - `title?: string | null` + + Body param: Human-readable session title. + + - `vault_ids?: Array` + + Body param: Vault IDs for stored credentials the agent can use during the session. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: Record` + + - `resources: Array` + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds?: number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds?: number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" | "running" | "idle" | "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string | null` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation?: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens?: number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens?: number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens?: number` + + Total tokens read from prompt cache. + + - `input_tokens?: number` + + Total input tokens consumed across all turns. + + - `output_tokens?: number` + + Total output tokens generated across all turns. + + - `vault_ids: Array` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsSession = await client.beta.sessions.create({ + agent: 'agent_011CZkYpogX7uDKUyvBTophP', + environment_id: 'env_011CZkZ9X2dpNyB7HsEFoRfW', +}); + +console.log(betaManagedAgentsSession.id); +``` + +## List + +`client.beta.sessions.list(SessionListParamsparams?, RequestOptionsoptions?): PageCursor` + +**get** `/v1/sessions` + +List Sessions + +### Parameters + +- `params: SessionListParams` + + - `agent_id?: string` + + Query param: Filter sessions created with this agent ID. + + - `agent_version?: number` + + Query param: Filter by agent version. Only applies when agent_id is also set. + + - `createdAtGt?: string` + + Query param: Return sessions created after this time (exclusive). + + - `createdAtGte?: string` + + Query param: Return sessions created at or after this time (inclusive). + + - `createdAtLt?: string` + + Query param: Return sessions created before this time (exclusive). + + - `createdAtLte?: string` + + Query param: Return sessions created at or before this time (inclusive). + + - `include_archived?: boolean` + + Query param: When true, includes archived sessions. Default: false (exclude archived). + + - `limit?: number` + + Query param: Maximum number of results to return. + + - `order?: "asc" | "desc"` + + Query param: Sort direction for results, ordered by created_at. Defaults to desc (newest first). + + - `"asc"` + + - `"desc"` + + - `page?: string` + + Query param: Opaque pagination cursor from a previous response's next_page. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: Record` + + - `resources: Array` + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds?: number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds?: number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" | "running" | "idle" | "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string | null` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation?: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens?: number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens?: number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens?: number` + + Total tokens read from prompt cache. + + - `input_tokens?: number` + + Total input tokens consumed across all turns. + + - `output_tokens?: number` + + Total output tokens generated across all turns. + + - `vault_ids: Array` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +// Automatically fetches more pages as needed. +for await (const betaManagedAgentsSession of client.beta.sessions.list()) { + console.log(betaManagedAgentsSession.id); +} +``` + +## Retrieve + +`client.beta.sessions.retrieve(stringsessionID, SessionRetrieveParamsparams?, RequestOptionsoptions?): BetaManagedAgentsSession` + +**get** `/v1/sessions/{session_id}` + +Get Session + +### Parameters + +- `sessionID: string` + +- `params: SessionRetrieveParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: Record` + + - `resources: Array` + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds?: number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds?: number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" | "running" | "idle" | "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string | null` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation?: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens?: number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens?: number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens?: number` + + Total tokens read from prompt cache. + + - `input_tokens?: number` + + Total input tokens consumed across all turns. + + - `output_tokens?: number` + + Total output tokens generated across all turns. + + - `vault_ids: Array` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsSession = await client.beta.sessions.retrieve( + 'sesn_011CZkZAtmR3yMPDzynEDxu7', +); + +console.log(betaManagedAgentsSession.id); +``` + +## Update + +`client.beta.sessions.update(stringsessionID, SessionUpdateParamsparams, RequestOptionsoptions?): BetaManagedAgentsSession` + +**post** `/v1/sessions/{session_id}` + +Update Session + +### Parameters + +- `sessionID: string` + +- `params: SessionUpdateParams` + + - `metadata?: Record | null` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. + + - `title?: string | null` + + Body param: Human-readable session title. + + - `vault_ids?: Array` + + Body param: Vault IDs (`vlt_*`) to attach to the session. Not yet supported; requests setting this field are rejected. Reserved for future use. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: Record` + + - `resources: Array` + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds?: number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds?: number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" | "running" | "idle" | "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string | null` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation?: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens?: number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens?: number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens?: number` + + Total tokens read from prompt cache. + + - `input_tokens?: number` + + Total input tokens consumed across all turns. + + - `output_tokens?: number` + + Total output tokens generated across all turns. + + - `vault_ids: Array` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsSession = await client.beta.sessions.update('sesn_011CZkZAtmR3yMPDzynEDxu7'); + +console.log(betaManagedAgentsSession.id); +``` + +## Delete + +`client.beta.sessions.delete(stringsessionID, SessionDeleteParamsparams?, RequestOptionsoptions?): BetaManagedAgentsDeletedSession` + +**delete** `/v1/sessions/{session_id}` + +Delete Session + +### Parameters + +- `sessionID: string` + +- `params: SessionDeleteParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsDeletedSession` + + Confirmation that a `session` has been permanently deleted. + + - `id: string` + + - `type: "session_deleted"` + + - `"session_deleted"` + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsDeletedSession = await client.beta.sessions.delete( + 'sesn_011CZkZAtmR3yMPDzynEDxu7', +); + +console.log(betaManagedAgentsDeletedSession.id); +``` + +## Archive + +`client.beta.sessions.archive(stringsessionID, SessionArchiveParamsparams?, RequestOptionsoptions?): BetaManagedAgentsSession` + +**post** `/v1/sessions/{session_id}/archive` + +Archive Session + +### Parameters + +- `sessionID: string` + +- `params: SessionArchiveParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: Record` + + - `resources: Array` + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds?: number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds?: number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" | "running" | "idle" | "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string | null` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation?: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens?: number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens?: number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens?: number` + + Total tokens read from prompt cache. + + - `input_tokens?: number` + + Total input tokens consumed across all turns. + + - `output_tokens?: number` + + Total output tokens generated across all turns. + + - `vault_ids: Array` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsSession = await client.beta.sessions.archive( + 'sesn_011CZkZAtmR3yMPDzynEDxu7', +); + +console.log(betaManagedAgentsSession.id); +``` + +## Domain Types + +### Beta Managed Agents Agent Params + +- `BetaManagedAgentsAgentParams` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `id: string` + + The `agent` ID. + + - `type: "agent"` + + - `"agent"` + + - `version?: number` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + +### Beta Managed Agents Branch Checkout + +- `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + +### Beta Managed Agents Cache Creation Usage + +- `BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens?: number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens?: number` + + Tokens used to create 5-minute ephemeral cache entries. + +### Beta Managed Agents Commit Checkout + +- `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + +### Beta Managed Agents Deleted Session + +- `BetaManagedAgentsDeletedSession` + + Confirmation that a `session` has been permanently deleted. + + - `id: string` + + - `type: "session_deleted"` + + - `"session_deleted"` + +### Beta Managed Agents File Resource Params + +- `BetaManagedAgentsFileResourceParams` + + Mount a file uploaded via the Files API into the session. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `mount_path?: string | null` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + +### Beta Managed Agents GitHub Repository Resource Params + +- `BetaManagedAgentsGitHubRepositoryResourceParams` + + Mount a GitHub repository into the session's container. + + - `authorization_token: string` + + GitHub authorization token used to clone the repository. + + - `type: "github_repository"` + + - `"github_repository"` + + - `url: string` + + Github URL of the repository + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `mount_path?: string | null` + + Mount path in the container. Defaults to `/workspace/`. + +### Beta Managed Agents Session + +- `BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: Record` + + - `resources: Array` + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds?: number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds?: number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" | "running" | "idle" | "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string | null` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation?: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens?: number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens?: number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens?: number` + + Total tokens read from prompt cache. + + - `input_tokens?: number` + + Total input tokens consumed across all turns. + + - `output_tokens?: number` + + Total output tokens generated across all turns. + + - `vault_ids: Array` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Beta Managed Agents Session Agent + +- `BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + +### Beta Managed Agents Session Stats + +- `BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds?: number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds?: number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + +### Beta Managed Agents Session Usage + +- `BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation?: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens?: number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens?: number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens?: number` + + Total tokens read from prompt cache. + + - `input_tokens?: number` + + Total input tokens consumed across all turns. + + - `output_tokens?: number` + + Total output tokens generated across all turns. + +# Events + +## List + +`client.beta.sessions.events.list(stringsessionID, EventListParamsparams?, RequestOptionsoptions?): PageCursor` + +**get** `/v1/sessions/{session_id}/events` + +List Events + +### Parameters + +- `sessionID: string` + +- `params: EventListParams` + + - `limit?: number` + + Query param: Query parameter for limit + + - `order?: "asc" | "desc"` + + Query param: Sort direction for results, ordered by created_at. Defaults to asc (chronological). + + - `"asc"` + + - `"desc"` + + - `page?: string` + + Query param: Opaque pagination cursor from a previous response's next_page. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSessionEvent = BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | 17 more` + + Union type for all event types in a session. + + - `BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean | null` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed?: "standard" | "fast" | null` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +// Automatically fetches more pages as needed. +for await (const betaManagedAgentsSessionEvent of client.beta.sessions.events.list( + 'sesn_011CZkZAtmR3yMPDzynEDxu7', +)) { + console.log(betaManagedAgentsSessionEvent); +} +``` + +## Send + +`client.beta.sessions.events.send(stringsessionID, EventSendParamsparams, RequestOptionsoptions?): BetaManagedAgentsSendSessionEvents` + +**post** `/v1/sessions/{session_id}/events` + +Send Events + +### Parameters + +- `sessionID: string` + +- `params: EventSendParams` + + - `events: Array` + + Body param: Events to send to the `session`. + + - `BetaManagedAgentsUserMessageEventParams` + + Parameters for sending a user message to the session. + + - `content: Array` + + Array of content blocks for the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `BetaManagedAgentsUserInterruptEventParams` + + Parameters for sending an interrupt to pause the agent. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `BetaManagedAgentsUserToolConfirmationEventParams` + + Parameters for confirming or denying a tool execution request. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `BetaManagedAgentsUserCustomToolResultEventParams` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSendSessionEvents` + + Events that were successfully sent to the session. + + - `data?: Array` + + Sent events + + - `BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsSendSessionEvents = await client.beta.sessions.events.send( + 'sesn_011CZkZAtmR3yMPDzynEDxu7', + { + events: [ + { content: [{ text: 'Where is my order #1234?', type: 'text' }], type: 'user.message' }, + ], + }, +); + +console.log(betaManagedAgentsSendSessionEvents.data); +``` + +## Stream + +`client.beta.sessions.events.stream(stringsessionID, EventStreamParamsparams?, RequestOptionsoptions?): BetaManagedAgentsStreamSessionEvents | Stream` + +**get** `/v1/sessions/{session_id}/events/stream` + +Stream Events + +### Parameters + +- `sessionID: string` + +- `params: EventStreamParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsStreamSessionEvents = BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | 17 more` + + Server-sent event in the session stream. + + - `BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean | null` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed?: "standard" | "fast" | null` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsStreamSessionEvents = await client.beta.sessions.events.stream( + 'sesn_011CZkZAtmR3yMPDzynEDxu7', +); + +console.log(betaManagedAgentsStreamSessionEvents); +``` + +## Domain Types + +### Beta Managed Agents Agent Custom Tool Use Event + +- `BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + +### Beta Managed Agents Agent MCP Tool Result Event + +- `BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent MCP Tool Use Event + +- `BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + +### Beta Managed Agents Agent Message Event + +- `BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + +### Beta Managed Agents Agent Thinking Event + +- `BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + +### Beta Managed Agents Agent Thread Context Compacted Event + +- `BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + +### Beta Managed Agents Agent Tool Result Event + +- `BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent Tool Use Event + +- `BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + +### Beta Managed Agents Base64 Document Source + +- `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + +### Beta Managed Agents Base64 Image Source + +- `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + +### Beta Managed Agents Billing Error + +- `BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + +### Beta Managed Agents Document Block + +- `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + +### Beta Managed Agents Event Params + +- `BetaManagedAgentsEventParams = BetaManagedAgentsUserMessageEventParams | BetaManagedAgentsUserInterruptEventParams | BetaManagedAgentsUserToolConfirmationEventParams | BetaManagedAgentsUserCustomToolResultEventParams` + + Union type for event parameters that can be sent to a session. + + - `BetaManagedAgentsUserMessageEventParams` + + Parameters for sending a user message to the session. + + - `content: Array` + + Array of content blocks for the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `BetaManagedAgentsUserInterruptEventParams` + + Parameters for sending an interrupt to pause the agent. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `BetaManagedAgentsUserToolConfirmationEventParams` + + Parameters for confirming or denying a tool execution request. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `BetaManagedAgentsUserCustomToolResultEventParams` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents File Document Source + +- `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + +### Beta Managed Agents File Image Source + +- `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + +### Beta Managed Agents Image Block + +- `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + +### Beta Managed Agents MCP Authentication Failed Error + +- `BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + +### Beta Managed Agents MCP Connection Failed Error + +- `BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + +### Beta Managed Agents Model Overloaded Error + +- `BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + +### Beta Managed Agents Model Rate Limited Error + +- `BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + +### Beta Managed Agents Model Request Failed Error + +- `BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + +### Beta Managed Agents Plain Text Document Source + +- `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + +### Beta Managed Agents Retry Status Exhausted + +- `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + +### Beta Managed Agents Retry Status Retrying + +- `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + +### Beta Managed Agents Retry Status Terminal + +- `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + +### Beta Managed Agents Send Session Events + +- `BetaManagedAgentsSendSessionEvents` + + Events that were successfully sent to the session. + + - `data?: Array` + + Sent events + + - `BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + +### Beta Managed Agents Session Deleted Event + +- `BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Beta Managed Agents Session End Turn + +- `BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + +### Beta Managed Agents Session Error Event + +- `BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + +### Beta Managed Agents Session Event + +- `BetaManagedAgentsSessionEvent = BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | 17 more` + + Union type for all event types in a session. + + - `BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean | null` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed?: "standard" | "fast" | null` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Beta Managed Agents Session Requires Action + +- `BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + +### Beta Managed Agents Session Retries Exhausted + +- `BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + +### Beta Managed Agents Session Status Idle Event + +- `BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + +### Beta Managed Agents Session Status Rescheduled Event + +- `BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + +### Beta Managed Agents Session Status Running Event + +- `BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + +### Beta Managed Agents Session Status Terminated Event + +- `BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + +### Beta Managed Agents Span Model Request End Event + +- `BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean | null` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed?: "standard" | "fast" | null` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + +### Beta Managed Agents Span Model Request Start Event + +- `BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + +### Beta Managed Agents Span Model Usage + +- `BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed?: "standard" | "fast" | null` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +### Beta Managed Agents Stream Session Events + +- `BetaManagedAgentsStreamSessionEvents = BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | 17 more` + + Server-sent event in the session stream. + + - `BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean | null` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed?: "standard" | "fast" | null` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Beta Managed Agents Text Block + +- `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + +### Beta Managed Agents Unknown Error + +- `BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + +### Beta Managed Agents URL Document Source + +- `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + +### Beta Managed Agents URL Image Source + +- `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + +### Beta Managed Agents User Custom Tool Result Event + +- `BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Custom Tool Result Event Params + +- `BetaManagedAgentsUserCustomToolResultEventParams` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents User Interrupt Event + +- `BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Interrupt Event Params + +- `BetaManagedAgentsUserInterruptEventParams` + + Parameters for sending an interrupt to pause the agent. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + +### Beta Managed Agents User Message Event + +- `BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Message Event Params + +- `BetaManagedAgentsUserMessageEventParams` + + Parameters for sending a user message to the session. + + - `content: Array` + + Array of content blocks for the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + +### Beta Managed Agents User Tool Confirmation Event + +- `BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Tool Confirmation Event Params + +- `BetaManagedAgentsUserToolConfirmationEventParams` + + Parameters for confirming or denying a tool execution request. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + +# Resources + +## Add + +`client.beta.sessions.resources.add(stringsessionID, ResourceAddParamsparams, RequestOptionsoptions?): BetaManagedAgentsFileResource` + +**post** `/v1/sessions/{session_id}/resources` + +Add Session Resource + +### Parameters + +- `sessionID: string` + +- `params: ResourceAddParams` + + - `file_id: string` + + Body param: ID of a previously uploaded file. + + - `type: "file"` + + Body param + + - `"file"` + + - `mount_path?: string | null` + + Body param: Mount path in the container. Defaults to `/mnt/session/uploads/`. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsFileResource = await client.beta.sessions.resources.add( + 'sesn_011CZkZAtmR3yMPDzynEDxu7', + { file_id: 'file_011CNha8iCJcU1wXNR6q4V8w', type: 'file' }, +); + +console.log(betaManagedAgentsFileResource.id); +``` + +## List + +`client.beta.sessions.resources.list(stringsessionID, ResourceListParamsparams?, RequestOptionsoptions?): PageCursor` + +**get** `/v1/sessions/{session_id}/resources` + +List Session Resources + +### Parameters + +- `sessionID: string` + +- `params: ResourceListParams` + + - `limit?: number` + + Query param: Maximum number of resources to return per page (max 1000). If omitted, returns all resources. + + - `page?: string` + + Query param: Opaque cursor from a previous response's next_page field. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSessionResource = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +// Automatically fetches more pages as needed. +for await (const betaManagedAgentsSessionResource of client.beta.sessions.resources.list( + 'sesn_011CZkZAtmR3yMPDzynEDxu7', +)) { + console.log(betaManagedAgentsSessionResource); +} +``` + +## Retrieve + +`client.beta.sessions.resources.retrieve(stringresourceID, ResourceRetrieveParamsparams, RequestOptionsoptions?): ResourceRetrieveResponse` + +**get** `/v1/sessions/{session_id}/resources/{resource_id}` + +Get Session Resource + +### Parameters + +- `resourceID: string` + +- `params: ResourceRetrieveParams` + + - `session_id: string` + + Path param: Path parameter session_id + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `ResourceRetrieveResponse = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + The requested session resource. + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const resource = await client.beta.sessions.resources.retrieve('sesrsc_011CZkZBJq5dWxk9fVLNcPht', { + session_id: 'sesn_011CZkZAtmR3yMPDzynEDxu7', +}); + +console.log(resource); +``` + +## Update + +`client.beta.sessions.resources.update(stringresourceID, ResourceUpdateParamsparams, RequestOptionsoptions?): ResourceUpdateResponse` + +**post** `/v1/sessions/{session_id}/resources/{resource_id}` + +Update Session Resource + +### Parameters + +- `resourceID: string` + +- `params: ResourceUpdateParams` + + - `session_id: string` + + Path param: Path parameter session_id + + - `authorization_token: string` + + Body param: New authorization token for the resource. Currently only `github_repository` resources support token rotation. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `ResourceUpdateResponse = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + The updated session resource. + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const resource = await client.beta.sessions.resources.update('sesrsc_011CZkZBJq5dWxk9fVLNcPht', { + session_id: 'sesn_011CZkZAtmR3yMPDzynEDxu7', + authorization_token: 'ghp_exampletoken', +}); + +console.log(resource); +``` + +## Delete + +`client.beta.sessions.resources.delete(stringresourceID, ResourceDeleteParamsparams, RequestOptionsoptions?): BetaManagedAgentsDeleteSessionResource` + +**delete** `/v1/sessions/{session_id}/resources/{resource_id}` + +Delete Session Resource + +### Parameters + +- `resourceID: string` + +- `params: ResourceDeleteParams` + + - `session_id: string` + + Path param: Path parameter session_id + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsDeleteSessionResource` + + Confirmation of resource deletion. + + - `id: string` + + - `type: "session_resource_deleted"` + + - `"session_resource_deleted"` + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsDeleteSessionResource = await client.beta.sessions.resources.delete( + 'sesrsc_011CZkZBJq5dWxk9fVLNcPht', + { session_id: 'sesn_011CZkZAtmR3yMPDzynEDxu7' }, +); + +console.log(betaManagedAgentsDeleteSessionResource.id); +``` + +## Domain Types + +### Beta Managed Agents Delete Session Resource + +- `BetaManagedAgentsDeleteSessionResource` + + Confirmation of resource deletion. + + - `id: string` + + - `type: "session_resource_deleted"` + + - `"session_resource_deleted"` + +### Beta Managed Agents File Resource + +- `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents GitHub Repository Resource + +- `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + +### Beta Managed Agents Session Resource + +- `BetaManagedAgentsSessionResource = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Resource Retrieve Response + +- `ResourceRetrieveResponse = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + The requested session resource. + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Resource Update Response + +- `ResourceUpdateResponse = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + The updated session resource. + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format diff --git a/content/en/api/typescript/beta/sessions/archive.md b/content/en/api/typescript/beta/sessions/archive.md new file mode 100644 index 000000000..c03911437 --- /dev/null +++ b/content/en/api/typescript/beta/sessions/archive.md @@ -0,0 +1,505 @@ +## Archive + +`client.beta.sessions.archive(stringsessionID, SessionArchiveParamsparams?, RequestOptionsoptions?): BetaManagedAgentsSession` + +**post** `/v1/sessions/{session_id}/archive` + +Archive Session + +### Parameters + +- `sessionID: string` + +- `params: SessionArchiveParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: Record` + + - `resources: Array` + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds?: number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds?: number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" | "running" | "idle" | "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string | null` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation?: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens?: number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens?: number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens?: number` + + Total tokens read from prompt cache. + + - `input_tokens?: number` + + Total input tokens consumed across all turns. + + - `output_tokens?: number` + + Total output tokens generated across all turns. + + - `vault_ids: Array` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsSession = await client.beta.sessions.archive( + 'sesn_011CZkZAtmR3yMPDzynEDxu7', +); + +console.log(betaManagedAgentsSession.id); +``` diff --git a/content/en/api/typescript/beta/sessions/create.md b/content/en/api/typescript/beta/sessions/create.md new file mode 100644 index 000000000..f7b05d9d2 --- /dev/null +++ b/content/en/api/typescript/beta/sessions/create.md @@ -0,0 +1,606 @@ +## Create + +`client.beta.sessions.create(SessionCreateParamsparams, RequestOptionsoptions?): BetaManagedAgentsSession` + +**post** `/v1/sessions` + +Create Session + +### Parameters + +- `params: SessionCreateParams` + + - `agent: string | BetaManagedAgentsAgentParams` + + Body param: Agent identifier. Accepts the `agent` ID string, which pins the latest version for the session, or an `agent` object with both id and version specified. + + - `string` + + - `BetaManagedAgentsAgentParams` + + Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version + + - `id: string` + + The `agent` ID. + + - `type: "agent"` + + - `"agent"` + + - `version?: number` + + The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified. + + - `environment_id: string` + + Body param: ID of the `environment` defining the container configuration for this session. + + - `metadata?: Record` + + Body param: Arbitrary key-value metadata attached to the session. + + - `resources?: Array` + + Body param: Resources (e.g. repositories, files) to mount into the session's container. + + - `BetaManagedAgentsGitHubRepositoryResourceParams` + + Mount a GitHub repository into the session's container. + + - `authorization_token: string` + + GitHub authorization token used to clone the repository. + + - `type: "github_repository"` + + - `"github_repository"` + + - `url: string` + + Github URL of the repository + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + Branch or commit to check out. Defaults to the repository's default branch. + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `mount_path?: string | null` + + Mount path in the container. Defaults to `/workspace/`. + + - `BetaManagedAgentsFileResourceParams` + + Mount a file uploaded via the Files API into the session. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `mount_path?: string | null` + + Mount path in the container. Defaults to `/mnt/session/uploads/`. + + - `title?: string | null` + + Body param: Human-readable session title. + + - `vault_ids?: Array` + + Body param: Vault IDs for stored credentials the agent can use during the session. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: Record` + + - `resources: Array` + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds?: number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds?: number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" | "running" | "idle" | "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string | null` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation?: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens?: number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens?: number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens?: number` + + Total tokens read from prompt cache. + + - `input_tokens?: number` + + Total input tokens consumed across all turns. + + - `output_tokens?: number` + + Total output tokens generated across all turns. + + - `vault_ids: Array` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsSession = await client.beta.sessions.create({ + agent: 'agent_011CZkYpogX7uDKUyvBTophP', + environment_id: 'env_011CZkZ9X2dpNyB7HsEFoRfW', +}); + +console.log(betaManagedAgentsSession.id); +``` diff --git a/content/en/api/typescript/beta/sessions/delete.md b/content/en/api/typescript/beta/sessions/delete.md new file mode 100644 index 000000000..7e143d09d --- /dev/null +++ b/content/en/api/typescript/beta/sessions/delete.md @@ -0,0 +1,91 @@ +## Delete + +`client.beta.sessions.delete(stringsessionID, SessionDeleteParamsparams?, RequestOptionsoptions?): BetaManagedAgentsDeletedSession` + +**delete** `/v1/sessions/{session_id}` + +Delete Session + +### Parameters + +- `sessionID: string` + +- `params: SessionDeleteParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsDeletedSession` + + Confirmation that a `session` has been permanently deleted. + + - `id: string` + + - `type: "session_deleted"` + + - `"session_deleted"` + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsDeletedSession = await client.beta.sessions.delete( + 'sesn_011CZkZAtmR3yMPDzynEDxu7', +); + +console.log(betaManagedAgentsDeletedSession.id); +``` diff --git a/content/en/api/typescript/beta/sessions/events.md b/content/en/api/typescript/beta/sessions/events.md new file mode 100644 index 000000000..06d21e531 --- /dev/null +++ b/content/en/api/typescript/beta/sessions/events.md @@ -0,0 +1,9647 @@ +# Events + +## List + +`client.beta.sessions.events.list(stringsessionID, EventListParamsparams?, RequestOptionsoptions?): PageCursor` + +**get** `/v1/sessions/{session_id}/events` + +List Events + +### Parameters + +- `sessionID: string` + +- `params: EventListParams` + + - `limit?: number` + + Query param: Query parameter for limit + + - `order?: "asc" | "desc"` + + Query param: Sort direction for results, ordered by created_at. Defaults to asc (chronological). + + - `"asc"` + + - `"desc"` + + - `page?: string` + + Query param: Opaque pagination cursor from a previous response's next_page. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSessionEvent = BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | 17 more` + + Union type for all event types in a session. + + - `BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean | null` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed?: "standard" | "fast" | null` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +// Automatically fetches more pages as needed. +for await (const betaManagedAgentsSessionEvent of client.beta.sessions.events.list( + 'sesn_011CZkZAtmR3yMPDzynEDxu7', +)) { + console.log(betaManagedAgentsSessionEvent); +} +``` + +## Send + +`client.beta.sessions.events.send(stringsessionID, EventSendParamsparams, RequestOptionsoptions?): BetaManagedAgentsSendSessionEvents` + +**post** `/v1/sessions/{session_id}/events` + +Send Events + +### Parameters + +- `sessionID: string` + +- `params: EventSendParams` + + - `events: Array` + + Body param: Events to send to the `session`. + + - `BetaManagedAgentsUserMessageEventParams` + + Parameters for sending a user message to the session. + + - `content: Array` + + Array of content blocks for the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `BetaManagedAgentsUserInterruptEventParams` + + Parameters for sending an interrupt to pause the agent. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `BetaManagedAgentsUserToolConfirmationEventParams` + + Parameters for confirming or denying a tool execution request. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `BetaManagedAgentsUserCustomToolResultEventParams` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSendSessionEvents` + + Events that were successfully sent to the session. + + - `data?: Array` + + Sent events + + - `BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsSendSessionEvents = await client.beta.sessions.events.send( + 'sesn_011CZkZAtmR3yMPDzynEDxu7', + { + events: [ + { content: [{ text: 'Where is my order #1234?', type: 'text' }], type: 'user.message' }, + ], + }, +); + +console.log(betaManagedAgentsSendSessionEvents.data); +``` + +## Stream + +`client.beta.sessions.events.stream(stringsessionID, EventStreamParamsparams?, RequestOptionsoptions?): BetaManagedAgentsStreamSessionEvents | Stream` + +**get** `/v1/sessions/{session_id}/events/stream` + +Stream Events + +### Parameters + +- `sessionID: string` + +- `params: EventStreamParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsStreamSessionEvents = BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | 17 more` + + Server-sent event in the session stream. + + - `BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean | null` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed?: "standard" | "fast" | null` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsStreamSessionEvents = await client.beta.sessions.events.stream( + 'sesn_011CZkZAtmR3yMPDzynEDxu7', +); + +console.log(betaManagedAgentsStreamSessionEvents); +``` + +## Domain Types + +### Beta Managed Agents Agent Custom Tool Use Event + +- `BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + +### Beta Managed Agents Agent MCP Tool Result Event + +- `BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent MCP Tool Use Event + +- `BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + +### Beta Managed Agents Agent Message Event + +- `BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + +### Beta Managed Agents Agent Thinking Event + +- `BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + +### Beta Managed Agents Agent Thread Context Compacted Event + +- `BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + +### Beta Managed Agents Agent Tool Result Event + +- `BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents Agent Tool Use Event + +- `BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + +### Beta Managed Agents Base64 Document Source + +- `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + +### Beta Managed Agents Base64 Image Source + +- `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + +### Beta Managed Agents Billing Error + +- `BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + +### Beta Managed Agents Document Block + +- `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + +### Beta Managed Agents Event Params + +- `BetaManagedAgentsEventParams = BetaManagedAgentsUserMessageEventParams | BetaManagedAgentsUserInterruptEventParams | BetaManagedAgentsUserToolConfirmationEventParams | BetaManagedAgentsUserCustomToolResultEventParams` + + Union type for event parameters that can be sent to a session. + + - `BetaManagedAgentsUserMessageEventParams` + + Parameters for sending a user message to the session. + + - `content: Array` + + Array of content blocks for the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `BetaManagedAgentsUserInterruptEventParams` + + Parameters for sending an interrupt to pause the agent. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `BetaManagedAgentsUserToolConfirmationEventParams` + + Parameters for confirming or denying a tool execution request. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `BetaManagedAgentsUserCustomToolResultEventParams` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents File Document Source + +- `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + +### Beta Managed Agents File Image Source + +- `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + +### Beta Managed Agents Image Block + +- `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + +### Beta Managed Agents MCP Authentication Failed Error + +- `BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + +### Beta Managed Agents MCP Connection Failed Error + +- `BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + +### Beta Managed Agents Model Overloaded Error + +- `BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + +### Beta Managed Agents Model Rate Limited Error + +- `BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + +### Beta Managed Agents Model Request Failed Error + +- `BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + +### Beta Managed Agents Plain Text Document Source + +- `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + +### Beta Managed Agents Retry Status Exhausted + +- `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + +### Beta Managed Agents Retry Status Retrying + +- `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + +### Beta Managed Agents Retry Status Terminal + +- `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + +### Beta Managed Agents Send Session Events + +- `BetaManagedAgentsSendSessionEvents` + + Events that were successfully sent to the session. + + - `data?: Array` + + Sent events + + - `BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + +### Beta Managed Agents Session Deleted Event + +- `BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Beta Managed Agents Session End Turn + +- `BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + +### Beta Managed Agents Session Error Event + +- `BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + +### Beta Managed Agents Session Event + +- `BetaManagedAgentsSessionEvent = BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | 17 more` + + Union type for all event types in a session. + + - `BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean | null` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed?: "standard" | "fast" | null` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Beta Managed Agents Session Requires Action + +- `BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + +### Beta Managed Agents Session Retries Exhausted + +- `BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + +### Beta Managed Agents Session Status Idle Event + +- `BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + +### Beta Managed Agents Session Status Rescheduled Event + +- `BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + +### Beta Managed Agents Session Status Running Event + +- `BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + +### Beta Managed Agents Session Status Terminated Event + +- `BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + +### Beta Managed Agents Span Model Request End Event + +- `BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean | null` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed?: "standard" | "fast" | null` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + +### Beta Managed Agents Span Model Request Start Event + +- `BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + +### Beta Managed Agents Span Model Usage + +- `BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed?: "standard" | "fast" | null` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + +### Beta Managed Agents Stream Session Events + +- `BetaManagedAgentsStreamSessionEvents = BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | 17 more` + + Server-sent event in the session stream. + + - `BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean | null` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed?: "standard" | "fast" | null` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Beta Managed Agents Text Block + +- `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + +### Beta Managed Agents Unknown Error + +- `BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + +### Beta Managed Agents URL Document Source + +- `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + +### Beta Managed Agents URL Image Source + +- `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + +### Beta Managed Agents User Custom Tool Result Event + +- `BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Custom Tool Result Event Params + +- `BetaManagedAgentsUserCustomToolResultEventParams` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + +### Beta Managed Agents User Interrupt Event + +- `BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Interrupt Event Params + +- `BetaManagedAgentsUserInterruptEventParams` + + Parameters for sending an interrupt to pause the agent. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + +### Beta Managed Agents User Message Event + +- `BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Message Event Params + +- `BetaManagedAgentsUserMessageEventParams` + + Parameters for sending a user message to the session. + + - `content: Array` + + Array of content blocks for the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + +### Beta Managed Agents User Tool Confirmation Event + +- `BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + +### Beta Managed Agents User Tool Confirmation Event Params + +- `BetaManagedAgentsUserToolConfirmationEventParams` + + Parameters for confirming or denying a tool execution request. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. diff --git a/content/en/api/typescript/beta/sessions/events/list.md b/content/en/api/typescript/beta/sessions/events/list.md new file mode 100644 index 000000000..6a2d4721d --- /dev/null +++ b/content/en/api/typescript/beta/sessions/events/list.md @@ -0,0 +1,1466 @@ +## List + +`client.beta.sessions.events.list(stringsessionID, EventListParamsparams?, RequestOptionsoptions?): PageCursor` + +**get** `/v1/sessions/{session_id}/events` + +List Events + +### Parameters + +- `sessionID: string` + +- `params: EventListParams` + + - `limit?: number` + + Query param: Query parameter for limit + + - `order?: "asc" | "desc"` + + Query param: Sort direction for results, ordered by created_at. Defaults to asc (chronological). + + - `"asc"` + + - `"desc"` + + - `page?: string` + + Query param: Opaque pagination cursor from a previous response's next_page. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSessionEvent = BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | 17 more` + + Union type for all event types in a session. + + - `BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean | null` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed?: "standard" | "fast" | null` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +// Automatically fetches more pages as needed. +for await (const betaManagedAgentsSessionEvent of client.beta.sessions.events.list( + 'sesn_011CZkZAtmR3yMPDzynEDxu7', +)) { + console.log(betaManagedAgentsSessionEvent); +} +``` diff --git a/content/en/api/typescript/beta/sessions/events/send.md b/content/en/api/typescript/beta/sessions/events/send.md new file mode 100644 index 000000000..bc55bfdb1 --- /dev/null +++ b/content/en/api/typescript/beta/sessions/events/send.md @@ -0,0 +1,826 @@ +## Send + +`client.beta.sessions.events.send(stringsessionID, EventSendParamsparams, RequestOptionsoptions?): BetaManagedAgentsSendSessionEvents` + +**post** `/v1/sessions/{session_id}/events` + +Send Events + +### Parameters + +- `sessionID: string` + +- `params: EventSendParams` + + - `events: Array` + + Body param: Events to send to the `session`. + + - `BetaManagedAgentsUserMessageEventParams` + + Parameters for sending a user message to the session. + + - `content: Array` + + Array of content blocks for the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `BetaManagedAgentsUserInterruptEventParams` + + Parameters for sending an interrupt to pause the agent. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `BetaManagedAgentsUserToolConfirmationEventParams` + + Parameters for confirming or denying a tool execution request. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `BetaManagedAgentsUserCustomToolResultEventParams` + + Parameters for providing the result of a custom tool execution. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSendSessionEvents` + + Events that were successfully sent to the session. + + - `data?: Array` + + Sent events + + - `BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsSendSessionEvents = await client.beta.sessions.events.send( + 'sesn_011CZkZAtmR3yMPDzynEDxu7', + { + events: [ + { content: [{ text: 'Where is my order #1234?', type: 'text' }], type: 'user.message' }, + ], + }, +); + +console.log(betaManagedAgentsSendSessionEvents.data); +``` diff --git a/content/en/api/typescript/beta/sessions/events/stream.md b/content/en/api/typescript/beta/sessions/events/stream.md new file mode 100644 index 000000000..d772ba967 --- /dev/null +++ b/content/en/api/typescript/beta/sessions/events/stream.md @@ -0,0 +1,1449 @@ +## Stream + +`client.beta.sessions.events.stream(stringsessionID, EventStreamParamsparams?, RequestOptionsoptions?): BetaManagedAgentsStreamSessionEvents | Stream` + +**get** `/v1/sessions/{session_id}/events/stream` + +Stream Events + +### Parameters + +- `sessionID: string` + +- `params: EventStreamParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsStreamSessionEvents = BetaManagedAgentsUserMessageEvent | BetaManagedAgentsUserInterruptEvent | BetaManagedAgentsUserToolConfirmationEvent | 17 more` + + Server-sent event in the session stream. + + - `BetaManagedAgentsUserMessageEvent` + + A user message event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of content blocks comprising the user message. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `type: "user.message"` + + - `"user.message"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserInterruptEvent` + + An interrupt event that pauses agent execution and returns control to the user. + + - `id: string` + + Unique identifier for this event. + + - `type: "user.interrupt"` + + - `"user.interrupt"` + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserToolConfirmationEvent` + + A tool confirmation event that approves or denies a pending tool execution. + + - `id: string` + + Unique identifier for this event. + + - `result: "allow" | "deny"` + + UserToolConfirmationResult enum + + - `"allow"` + + - `"deny"` + + - `tool_use_id: string` + + The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.tool_confirmation"` + + - `"user.tool_confirmation"` + + - `deny_message?: string | null` + + Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsUserCustomToolResultEvent` + + Event sent by the client providing the result of a custom tool execution. + + - `id: string` + + Unique identifier for this event. + + - `custom_tool_use_id: string` + + The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field. + + - `type: "user.custom_tool_result"` + + - `"user.custom_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `processed_at?: string | null` + + A timestamp in RFC 3339 format + + - `BetaManagedAgentsAgentCustomToolUseEvent` + + Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the custom tool being called. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.custom_tool_use"` + + - `"agent.custom_tool_use"` + + - `BetaManagedAgentsAgentMessageEvent` + + An agent response event in the session conversation. + + - `id: string` + + Unique identifier for this event. + + - `content: Array` + + Array of text blocks comprising the agent response. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.message"` + + - `"agent.message"` + + - `BetaManagedAgentsAgentThinkingEvent` + + Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thinking"` + + - `"agent.thinking"` + + - `BetaManagedAgentsAgentMCPToolUseEvent` + + Event emitted when the agent invokes a tool provided by an MCP server. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `mcp_server_name: string` + + Name of the MCP server providing the tool. + + - `name: string` + + Name of the MCP tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_use"` + + - `"agent.mcp_tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentMCPToolResultEvent` + + Event representing the result of an MCP tool execution. + + - `id: string` + + Unique identifier for this event. + + - `mcp_tool_use_id: string` + + The id of the `agent.mcp_tool_use` event this result corresponds to. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.mcp_tool_result"` + + - `"agent.mcp_tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentToolUseEvent` + + Event emitted when the agent invokes a built-in agent tool. + + - `id: string` + + Unique identifier for this event. + + - `input: Record` + + Input parameters for the tool call. + + - `name: string` + + Name of the agent tool being used. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.tool_use"` + + - `"agent.tool_use"` + + - `evaluated_permission?: "allow" | "ask" | "deny"` + + AgentEvaluatedPermission enum + + - `"allow"` + + - `"ask"` + + - `"deny"` + + - `BetaManagedAgentsAgentToolResultEvent` + + Event representing the result of an agent tool execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `tool_use_id: string` + + The id of the `agent.tool_use` event this result corresponds to. + + - `type: "agent.tool_result"` + + - `"agent.tool_result"` + + - `content?: Array` + + The result content returned by the tool. + + - `BetaManagedAgentsTextBlock` + + Regular text content. + + - `text: string` + + The text content. + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsImageBlock` + + Image content specified directly as base64 data or as a reference via a URL. + + - `source: BetaManagedAgentsBase64ImageSource | BetaManagedAgentsURLImageSource | BetaManagedAgentsFileImageSource` + + Union type for image source variants. + + - `BetaManagedAgentsBase64ImageSource` + + Base64-encoded image data. + + - `data: string` + + Base64-encoded image data. + + - `media_type: string` + + MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsURLImageSource` + + Image referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the image to fetch. + + - `BetaManagedAgentsFileImageSource` + + Image referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "image"` + + - `"image"` + + - `BetaManagedAgentsDocumentBlock` + + Document content, either specified directly as base64 data, as text, or as a reference via a URL. + + - `source: BetaManagedAgentsBase64DocumentSource | BetaManagedAgentsPlainTextDocumentSource | BetaManagedAgentsURLDocumentSource | BetaManagedAgentsFileDocumentSource` + + Union type for document source variants. + + - `BetaManagedAgentsBase64DocumentSource` + + Base64-encoded document data. + + - `data: string` + + Base64-encoded document data. + + - `media_type: string` + + MIME type of the document (e.g., "application/pdf"). + + - `type: "base64"` + + - `"base64"` + + - `BetaManagedAgentsPlainTextDocumentSource` + + Plain text document content. + + - `data: string` + + The plain text content. + + - `media_type: "text/plain"` + + MIME type of the text content. Must be "text/plain". + + - `"text/plain"` + + - `type: "text"` + + - `"text"` + + - `BetaManagedAgentsURLDocumentSource` + + Document referenced by URL. + + - `type: "url"` + + - `"url"` + + - `url: string` + + URL of the document to fetch. + + - `BetaManagedAgentsFileDocumentSource` + + Document referenced by file ID. + + - `file_id: string` + + ID of a previously uploaded file. + + - `type: "file"` + + - `"file"` + + - `type: "document"` + + - `"document"` + + - `context?: string | null` + + Additional context about the document for the model. + + - `title?: string | null` + + The title of the document. + + - `is_error?: boolean | null` + + Whether the tool execution resulted in an error. + + - `BetaManagedAgentsAgentThreadContextCompactedEvent` + + Indicates that context compaction (summarization) occurred during the session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "agent.thread_context_compacted"` + + - `"agent.thread_context_compacted"` + + - `BetaManagedAgentsSessionErrorEvent` + + An error event indicating a problem occurred during session execution. + + - `id: string` + + Unique identifier for this event. + + - `error: BetaManagedAgentsUnknownError | BetaManagedAgentsModelOverloadedError | BetaManagedAgentsModelRateLimitedError | 4 more` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `BetaManagedAgentsUnknownError` + + An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "unknown_error"` + + - `"unknown_error"` + + - `BetaManagedAgentsModelOverloadedError` + + The model is currently overloaded. Emitted after automatic retries are exhausted. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_overloaded_error"` + + - `"model_overloaded_error"` + + - `BetaManagedAgentsModelRateLimitedError` + + The model request was rate-limited. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_rate_limited_error"` + + - `"model_rate_limited_error"` + + - `BetaManagedAgentsModelRequestFailedError` + + A model request failed for a reason other than overload or rate-limiting. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "model_request_failed_error"` + + - `"model_request_failed_error"` + + - `BetaManagedAgentsMCPConnectionFailedError` + + Failed to connect to an MCP server. + + - `mcp_server_name: string` + + Name of the MCP server that failed to connect. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_connection_failed_error"` + + - `"mcp_connection_failed_error"` + + - `BetaManagedAgentsMCPAuthenticationFailedError` + + Authentication to an MCP server failed. + + - `mcp_server_name: string` + + Name of the MCP server that failed authentication. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "mcp_authentication_failed_error"` + + - `"mcp_authentication_failed_error"` + + - `BetaManagedAgentsBillingError` + + The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state. + + - `message: string` + + Human-readable error description. + + - `retry_status: BetaManagedAgentsRetryStatusRetrying | BetaManagedAgentsRetryStatusExhausted | BetaManagedAgentsRetryStatusTerminal` + + What the client should do next in response to this error. + + - `BetaManagedAgentsRetryStatusRetrying` + + The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out. + + - `type: "retrying"` + + - `"retrying"` + + - `BetaManagedAgentsRetryStatusExhausted` + + This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt. + + - `type: "exhausted"` + + - `"exhausted"` + + - `BetaManagedAgentsRetryStatusTerminal` + + The session encountered a terminal error and will transition to `terminated` state. + + - `type: "terminal"` + + - `"terminal"` + + - `type: "billing_error"` + + - `"billing_error"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.error"` + + - `"session.error"` + + - `BetaManagedAgentsSessionStatusRescheduledEvent` + + Indicates the session is recovering from an error state and is rescheduled for execution. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_rescheduled"` + + - `"session.status_rescheduled"` + + - `BetaManagedAgentsSessionStatusRunningEvent` + + Indicates the session is actively running and the agent is working. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_running"` + + - `"session.status_running"` + + - `BetaManagedAgentsSessionStatusIdleEvent` + + Indicates the agent has paused and is awaiting user input. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `stop_reason: BetaManagedAgentsSessionEndTurn | BetaManagedAgentsSessionRequiresAction | BetaManagedAgentsSessionRetriesExhausted` + + The agent completed its turn naturally and is ready for the next user message. + + - `BetaManagedAgentsSessionEndTurn` + + The agent completed its turn naturally and is ready for the next user message. + + - `type: "end_turn"` + + - `"end_turn"` + + - `BetaManagedAgentsSessionRequiresAction` + + The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running. + + - `event_ids: Array` + + The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder. + + - `type: "requires_action"` + + - `"requires_action"` + + - `BetaManagedAgentsSessionRetriesExhausted` + + The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`). + + - `type: "retries_exhausted"` + + - `"retries_exhausted"` + + - `type: "session.status_idle"` + + - `"session.status_idle"` + + - `BetaManagedAgentsSessionStatusTerminatedEvent` + + Indicates the session has terminated, either due to an error or completion. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.status_terminated"` + + - `"session.status_terminated"` + + - `BetaManagedAgentsSpanModelRequestStartEvent` + + Emitted when a model request is initiated by the agent. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_start"` + + - `"span.model_request_start"` + + - `BetaManagedAgentsSpanModelRequestEndEvent` + + Emitted when a model request completes. + + - `id: string` + + Unique identifier for this event. + + - `is_error: boolean | null` + + Whether the model request resulted in an error. + + - `model_request_start_id: string` + + The id of the corresponding `span.model_request_start` event. + + - `model_usage: BetaManagedAgentsSpanModelUsage` + + Token usage for a single model request. + + - `cache_creation_input_tokens: number` + + Tokens used to create prompt cache in this request. + + - `cache_read_input_tokens: number` + + Tokens read from prompt cache in this request. + + - `input_tokens: number` + + Input tokens consumed by this request. + + - `output_tokens: number` + + Output tokens generated by this request. + + - `speed?: "standard" | "fast" | null` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "span.model_request_end"` + + - `"span.model_request_end"` + + - `BetaManagedAgentsSessionDeletedEvent` + + Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session. + + - `id: string` + + Unique identifier for this event. + + - `processed_at: string` + + A timestamp in RFC 3339 format + + - `type: "session.deleted"` + + - `"session.deleted"` + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsStreamSessionEvents = await client.beta.sessions.events.stream( + 'sesn_011CZkZAtmR3yMPDzynEDxu7', +); + +console.log(betaManagedAgentsStreamSessionEvents); +``` diff --git a/content/en/api/typescript/beta/sessions/list.md b/content/en/api/typescript/beta/sessions/list.md new file mode 100644 index 000000000..5bd2ee341 --- /dev/null +++ b/content/en/api/typescript/beta/sessions/list.md @@ -0,0 +1,546 @@ +## List + +`client.beta.sessions.list(SessionListParamsparams?, RequestOptionsoptions?): PageCursor` + +**get** `/v1/sessions` + +List Sessions + +### Parameters + +- `params: SessionListParams` + + - `agent_id?: string` + + Query param: Filter sessions created with this agent ID. + + - `agent_version?: number` + + Query param: Filter by agent version. Only applies when agent_id is also set. + + - `createdAtGt?: string` + + Query param: Return sessions created after this time (exclusive). + + - `createdAtGte?: string` + + Query param: Return sessions created at or after this time (inclusive). + + - `createdAtLt?: string` + + Query param: Return sessions created before this time (exclusive). + + - `createdAtLte?: string` + + Query param: Return sessions created at or before this time (inclusive). + + - `include_archived?: boolean` + + Query param: When true, includes archived sessions. Default: false (exclude archived). + + - `limit?: number` + + Query param: Maximum number of results to return. + + - `order?: "asc" | "desc"` + + Query param: Sort direction for results, ordered by created_at. Defaults to desc (newest first). + + - `"asc"` + + - `"desc"` + + - `page?: string` + + Query param: Opaque pagination cursor from a previous response's next_page. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: Record` + + - `resources: Array` + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds?: number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds?: number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" | "running" | "idle" | "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string | null` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation?: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens?: number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens?: number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens?: number` + + Total tokens read from prompt cache. + + - `input_tokens?: number` + + Total input tokens consumed across all turns. + + - `output_tokens?: number` + + Total output tokens generated across all turns. + + - `vault_ids: Array` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +// Automatically fetches more pages as needed. +for await (const betaManagedAgentsSession of client.beta.sessions.list()) { + console.log(betaManagedAgentsSession.id); +} +``` diff --git a/content/en/api/typescript/beta/sessions/resources.md b/content/en/api/typescript/beta/sessions/resources.md new file mode 100644 index 000000000..9faabe149 --- /dev/null +++ b/content/en/api/typescript/beta/sessions/resources.md @@ -0,0 +1,961 @@ +# Resources + +## Add + +`client.beta.sessions.resources.add(stringsessionID, ResourceAddParamsparams, RequestOptionsoptions?): BetaManagedAgentsFileResource` + +**post** `/v1/sessions/{session_id}/resources` + +Add Session Resource + +### Parameters + +- `sessionID: string` + +- `params: ResourceAddParams` + + - `file_id: string` + + Body param: ID of a previously uploaded file. + + - `type: "file"` + + Body param + + - `"file"` + + - `mount_path?: string | null` + + Body param: Mount path in the container. Defaults to `/mnt/session/uploads/`. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsFileResource = await client.beta.sessions.resources.add( + 'sesn_011CZkZAtmR3yMPDzynEDxu7', + { file_id: 'file_011CNha8iCJcU1wXNR6q4V8w', type: 'file' }, +); + +console.log(betaManagedAgentsFileResource.id); +``` + +## List + +`client.beta.sessions.resources.list(stringsessionID, ResourceListParamsparams?, RequestOptionsoptions?): PageCursor` + +**get** `/v1/sessions/{session_id}/resources` + +List Session Resources + +### Parameters + +- `sessionID: string` + +- `params: ResourceListParams` + + - `limit?: number` + + Query param: Maximum number of resources to return per page (max 1000). If omitted, returns all resources. + + - `page?: string` + + Query param: Opaque cursor from a previous response's next_page field. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSessionResource = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +// Automatically fetches more pages as needed. +for await (const betaManagedAgentsSessionResource of client.beta.sessions.resources.list( + 'sesn_011CZkZAtmR3yMPDzynEDxu7', +)) { + console.log(betaManagedAgentsSessionResource); +} +``` + +## Retrieve + +`client.beta.sessions.resources.retrieve(stringresourceID, ResourceRetrieveParamsparams, RequestOptionsoptions?): ResourceRetrieveResponse` + +**get** `/v1/sessions/{session_id}/resources/{resource_id}` + +Get Session Resource + +### Parameters + +- `resourceID: string` + +- `params: ResourceRetrieveParams` + + - `session_id: string` + + Path param: Path parameter session_id + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `ResourceRetrieveResponse = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + The requested session resource. + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const resource = await client.beta.sessions.resources.retrieve('sesrsc_011CZkZBJq5dWxk9fVLNcPht', { + session_id: 'sesn_011CZkZAtmR3yMPDzynEDxu7', +}); + +console.log(resource); +``` + +## Update + +`client.beta.sessions.resources.update(stringresourceID, ResourceUpdateParamsparams, RequestOptionsoptions?): ResourceUpdateResponse` + +**post** `/v1/sessions/{session_id}/resources/{resource_id}` + +Update Session Resource + +### Parameters + +- `resourceID: string` + +- `params: ResourceUpdateParams` + + - `session_id: string` + + Path param: Path parameter session_id + + - `authorization_token: string` + + Body param: New authorization token for the resource. Currently only `github_repository` resources support token rotation. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `ResourceUpdateResponse = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + The updated session resource. + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const resource = await client.beta.sessions.resources.update('sesrsc_011CZkZBJq5dWxk9fVLNcPht', { + session_id: 'sesn_011CZkZAtmR3yMPDzynEDxu7', + authorization_token: 'ghp_exampletoken', +}); + +console.log(resource); +``` + +## Delete + +`client.beta.sessions.resources.delete(stringresourceID, ResourceDeleteParamsparams, RequestOptionsoptions?): BetaManagedAgentsDeleteSessionResource` + +**delete** `/v1/sessions/{session_id}/resources/{resource_id}` + +Delete Session Resource + +### Parameters + +- `resourceID: string` + +- `params: ResourceDeleteParams` + + - `session_id: string` + + Path param: Path parameter session_id + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsDeleteSessionResource` + + Confirmation of resource deletion. + + - `id: string` + + - `type: "session_resource_deleted"` + + - `"session_resource_deleted"` + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsDeleteSessionResource = await client.beta.sessions.resources.delete( + 'sesrsc_011CZkZBJq5dWxk9fVLNcPht', + { session_id: 'sesn_011CZkZAtmR3yMPDzynEDxu7' }, +); + +console.log(betaManagedAgentsDeleteSessionResource.id); +``` + +## Domain Types + +### Beta Managed Agents Delete Session Resource + +- `BetaManagedAgentsDeleteSessionResource` + + Confirmation of resource deletion. + + - `id: string` + + - `type: "session_resource_deleted"` + + - `"session_resource_deleted"` + +### Beta Managed Agents File Resource + +- `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Beta Managed Agents GitHub Repository Resource + +- `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + +### Beta Managed Agents Session Resource + +- `BetaManagedAgentsSessionResource = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Resource Retrieve Response + +- `ResourceRetrieveResponse = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + The requested session resource. + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Resource Update Response + +- `ResourceUpdateResponse = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + The updated session resource. + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format diff --git a/content/en/api/typescript/beta/sessions/resources/add.md b/content/en/api/typescript/beta/sessions/resources/add.md new file mode 100644 index 000000000..d1027d6b4 --- /dev/null +++ b/content/en/api/typescript/beta/sessions/resources/add.md @@ -0,0 +1,116 @@ +## Add + +`client.beta.sessions.resources.add(stringsessionID, ResourceAddParamsparams, RequestOptionsoptions?): BetaManagedAgentsFileResource` + +**post** `/v1/sessions/{session_id}/resources` + +Add Session Resource + +### Parameters + +- `sessionID: string` + +- `params: ResourceAddParams` + + - `file_id: string` + + Body param: ID of a previously uploaded file. + + - `type: "file"` + + Body param + + - `"file"` + + - `mount_path?: string | null` + + Body param: Mount path in the container. Defaults to `/mnt/session/uploads/`. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsFileResource = await client.beta.sessions.resources.add( + 'sesn_011CZkZAtmR3yMPDzynEDxu7', + { file_id: 'file_011CNha8iCJcU1wXNR6q4V8w', type: 'file' }, +); + +console.log(betaManagedAgentsFileResource.id); +``` diff --git a/content/en/api/typescript/beta/sessions/resources/delete.md b/content/en/api/typescript/beta/sessions/resources/delete.md new file mode 100644 index 000000000..262526aab --- /dev/null +++ b/content/en/api/typescript/beta/sessions/resources/delete.md @@ -0,0 +1,96 @@ +## Delete + +`client.beta.sessions.resources.delete(stringresourceID, ResourceDeleteParamsparams, RequestOptionsoptions?): BetaManagedAgentsDeleteSessionResource` + +**delete** `/v1/sessions/{session_id}/resources/{resource_id}` + +Delete Session Resource + +### Parameters + +- `resourceID: string` + +- `params: ResourceDeleteParams` + + - `session_id: string` + + Path param: Path parameter session_id + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsDeleteSessionResource` + + Confirmation of resource deletion. + + - `id: string` + + - `type: "session_resource_deleted"` + + - `"session_resource_deleted"` + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsDeleteSessionResource = await client.beta.sessions.resources.delete( + 'sesrsc_011CZkZBJq5dWxk9fVLNcPht', + { session_id: 'sesn_011CZkZAtmR3yMPDzynEDxu7' }, +); + +console.log(betaManagedAgentsDeleteSessionResource.id); +``` diff --git a/content/en/api/typescript/beta/sessions/resources/list.md b/content/en/api/typescript/beta/sessions/resources/list.md new file mode 100644 index 000000000..e01b5605f --- /dev/null +++ b/content/en/api/typescript/beta/sessions/resources/list.md @@ -0,0 +1,154 @@ +## List + +`client.beta.sessions.resources.list(stringsessionID, ResourceListParamsparams?, RequestOptionsoptions?): PageCursor` + +**get** `/v1/sessions/{session_id}/resources` + +List Session Resources + +### Parameters + +- `sessionID: string` + +- `params: ResourceListParams` + + - `limit?: number` + + Query param: Maximum number of resources to return per page (max 1000). If omitted, returns all resources. + + - `page?: string` + + Query param: Opaque cursor from a previous response's next_page field. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSessionResource = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +// Automatically fetches more pages as needed. +for await (const betaManagedAgentsSessionResource of client.beta.sessions.resources.list( + 'sesn_011CZkZAtmR3yMPDzynEDxu7', +)) { + console.log(betaManagedAgentsSessionResource); +} +``` diff --git a/content/en/api/typescript/beta/sessions/resources/retrieve.md b/content/en/api/typescript/beta/sessions/resources/retrieve.md new file mode 100644 index 000000000..d4d81a99b --- /dev/null +++ b/content/en/api/typescript/beta/sessions/resources/retrieve.md @@ -0,0 +1,151 @@ +## Retrieve + +`client.beta.sessions.resources.retrieve(stringresourceID, ResourceRetrieveParamsparams, RequestOptionsoptions?): ResourceRetrieveResponse` + +**get** `/v1/sessions/{session_id}/resources/{resource_id}` + +Get Session Resource + +### Parameters + +- `resourceID: string` + +- `params: ResourceRetrieveParams` + + - `session_id: string` + + Path param: Path parameter session_id + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `ResourceRetrieveResponse = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + The requested session resource. + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const resource = await client.beta.sessions.resources.retrieve('sesrsc_011CZkZBJq5dWxk9fVLNcPht', { + session_id: 'sesn_011CZkZAtmR3yMPDzynEDxu7', +}); + +console.log(resource); +``` diff --git a/content/en/api/typescript/beta/sessions/resources/update.md b/content/en/api/typescript/beta/sessions/resources/update.md new file mode 100644 index 000000000..3d81bb8be --- /dev/null +++ b/content/en/api/typescript/beta/sessions/resources/update.md @@ -0,0 +1,156 @@ +## Update + +`client.beta.sessions.resources.update(stringresourceID, ResourceUpdateParamsparams, RequestOptionsoptions?): ResourceUpdateResponse` + +**post** `/v1/sessions/{session_id}/resources/{resource_id}` + +Update Session Resource + +### Parameters + +- `resourceID: string` + +- `params: ResourceUpdateParams` + + - `session_id: string` + + Path param: Path parameter session_id + + - `authorization_token: string` + + Body param: New authorization token for the resource. Currently only `github_repository` resources support token rotation. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `ResourceUpdateResponse = BetaManagedAgentsGitHubRepositoryResource | BetaManagedAgentsFileResource` + + The updated session resource. + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const resource = await client.beta.sessions.resources.update('sesrsc_011CZkZBJq5dWxk9fVLNcPht', { + session_id: 'sesn_011CZkZAtmR3yMPDzynEDxu7', + authorization_token: 'ghp_exampletoken', +}); + +console.log(resource); +``` diff --git a/content/en/api/typescript/beta/sessions/retrieve.md b/content/en/api/typescript/beta/sessions/retrieve.md new file mode 100644 index 000000000..44a5bbdac --- /dev/null +++ b/content/en/api/typescript/beta/sessions/retrieve.md @@ -0,0 +1,505 @@ +## Retrieve + +`client.beta.sessions.retrieve(stringsessionID, SessionRetrieveParamsparams?, RequestOptionsoptions?): BetaManagedAgentsSession` + +**get** `/v1/sessions/{session_id}` + +Get Session + +### Parameters + +- `sessionID: string` + +- `params: SessionRetrieveParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: Record` + + - `resources: Array` + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds?: number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds?: number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" | "running" | "idle" | "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string | null` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation?: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens?: number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens?: number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens?: number` + + Total tokens read from prompt cache. + + - `input_tokens?: number` + + Total input tokens consumed across all turns. + + - `output_tokens?: number` + + Total output tokens generated across all turns. + + - `vault_ids: Array` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsSession = await client.beta.sessions.retrieve( + 'sesn_011CZkZAtmR3yMPDzynEDxu7', +); + +console.log(betaManagedAgentsSession.id); +``` diff --git a/content/en/api/typescript/beta/sessions/update.md b/content/en/api/typescript/beta/sessions/update.md new file mode 100644 index 000000000..134dd8064 --- /dev/null +++ b/content/en/api/typescript/beta/sessions/update.md @@ -0,0 +1,515 @@ +## Update + +`client.beta.sessions.update(stringsessionID, SessionUpdateParamsparams, RequestOptionsoptions?): BetaManagedAgentsSession` + +**post** `/v1/sessions/{session_id}` + +Update Session + +### Parameters + +- `sessionID: string` + +- `params: SessionUpdateParams` + + - `metadata?: Record | null` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. + + - `title?: string | null` + + Body param: Human-readable session title. + + - `vault_ids?: Array` + + Body param: Vault IDs (`vlt_*`) to attach to the session. Not yet supported; requests setting this field are rejected. Reserved for future use. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsSession` + + A Managed Agents `session`. + + - `id: string` + + - `agent: BetaManagedAgentsSessionAgent` + + Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. + + - `id: string` + + - `description: string | null` + + - `mcp_servers: Array` + + - `name: string` + + - `type: "url"` + + - `"url"` + + - `url: string` + + - `model: BetaManagedAgentsModelConfig` + + Model identifier and configuration. + + - `id: BetaManagedAgentsModel` + + The model that will power your agent. + + See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. + + - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 5 more` + + - `"claude-opus-4-6"` + + Most intelligent model for building agents and coding + + - `"claude-sonnet-4-6"` + + Best combination of speed and intelligence + + - `"claude-haiku-4-5"` + + Fastest model with near-frontier intelligence + + - `"claude-haiku-4-5-20251001"` + + Fastest model with near-frontier intelligence + + - `"claude-opus-4-5"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-opus-4-5-20251101"` + + Premium model combining maximum intelligence with practical performance + + - `"claude-sonnet-4-5"` + + High-performance model for agents and coding + + - `"claude-sonnet-4-5-20250929"` + + High-performance model for agents and coding + + - `(string & {})` + + - `speed?: "standard" | "fast"` + + Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. + + - `"standard"` + + - `"fast"` + + - `name: string` + + - `skills: Array` + + - `BetaManagedAgentsAnthropicSkill` + + A resolved Anthropic-managed skill. + + - `skill_id: string` + + - `type: "anthropic"` + + - `"anthropic"` + + - `version: string` + + - `BetaManagedAgentsCustomSkill` + + A resolved user-created custom skill. + + - `skill_id: string` + + - `type: "custom"` + + - `"custom"` + + - `version: string` + + - `system: string | null` + + - `tools: Array` + + - `BetaManagedAgentsAgentToolset20260401` + + - `configs: Array` + + - `enabled: boolean` + + - `name: "bash" | "edit" | "read" | 5 more` + + Built-in agent tool identifier. + + - `"bash"` + + - `"edit"` + + - `"read"` + + - `"write"` + + - `"glob"` + + - `"grep"` + + - `"web_fetch"` + + - `"web_search"` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig` + + Resolved default configuration for agent tools. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `type: "agent_toolset_20260401"` + + - `"agent_toolset_20260401"` + + - `BetaManagedAgentsMCPToolset` + + - `configs: Array` + + - `enabled: boolean` + + - `name: string` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig` + + Resolved default configuration for all tools from an MCP server. + + - `enabled: boolean` + + - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy | BetaManagedAgentsAlwaysAskPolicy` + + Permission policy for tool execution. + + - `BetaManagedAgentsAlwaysAllowPolicy` + + Tool calls are automatically approved without user confirmation. + + - `type: "always_allow"` + + - `"always_allow"` + + - `BetaManagedAgentsAlwaysAskPolicy` + + Tool calls require user confirmation before execution. + + - `type: "always_ask"` + + - `"always_ask"` + + - `mcp_server_name: string` + + - `type: "mcp_toolset"` + + - `"mcp_toolset"` + + - `BetaManagedAgentsCustomTool` + + A custom tool as returned in API responses. + + - `description: string` + + - `input_schema: BetaManagedAgentsCustomToolInputSchema` + + JSON Schema for custom tool input parameters. + + - `properties?: Record | null` + + JSON Schema properties defining the tool's input parameters. + + - `required?: Array` + + List of required property names. + + - `type?: "object"` + + Must be 'object' for tool input schemas. + + - `"object"` + + - `name: string` + + - `type: "custom"` + + - `"custom"` + + - `type: "agent"` + + - `"agent"` + + - `version: number` + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `environment_id: string` + + - `metadata: Record` + + - `resources: Array` + + - `BetaManagedAgentsGitHubRepositoryResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `mount_path: string` + + - `type: "github_repository"` + + - `"github_repository"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `url: string` + + - `checkout?: BetaManagedAgentsBranchCheckout | BetaManagedAgentsCommitCheckout | null` + + - `BetaManagedAgentsBranchCheckout` + + - `name: string` + + Branch name to check out. + + - `type: "branch"` + + - `"branch"` + + - `BetaManagedAgentsCommitCheckout` + + - `sha: string` + + Full commit SHA to check out. + + - `type: "commit"` + + - `"commit"` + + - `BetaManagedAgentsFileResource` + + - `id: string` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `file_id: string` + + - `mount_path: string` + + - `type: "file"` + + - `"file"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `stats: BetaManagedAgentsSessionStats` + + Timing statistics for a session. + + - `active_seconds?: number` + + Cumulative time in seconds the session spent in running status. Excludes idle time. + + - `duration_seconds?: number` + + Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. + + - `status: "rescheduling" | "running" | "idle" | "terminated"` + + SessionStatus enum + + - `"rescheduling"` + + - `"running"` + + - `"idle"` + + - `"terminated"` + + - `title: string | null` + + - `type: "session"` + + - `"session"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `usage: BetaManagedAgentsSessionUsage` + + Cumulative token usage for a session across all turns. + + - `cache_creation?: BetaManagedAgentsCacheCreationUsage` + + Prompt-cache creation token usage broken down by cache lifetime. + + - `ephemeral_1h_input_tokens?: number` + + Tokens used to create 1-hour ephemeral cache entries. + + - `ephemeral_5m_input_tokens?: number` + + Tokens used to create 5-minute ephemeral cache entries. + + - `cache_read_input_tokens?: number` + + Total tokens read from prompt cache. + + - `input_tokens?: number` + + Total input tokens consumed across all turns. + + - `output_tokens?: number` + + Total output tokens generated across all turns. + + - `vault_ids: Array` + + Vault IDs attached to the session at creation. Empty when no vaults were supplied. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsSession = await client.beta.sessions.update('sesn_011CZkZAtmR3yMPDzynEDxu7'); + +console.log(betaManagedAgentsSession.id); +``` diff --git a/content/en/api/typescript/beta/skills.md b/content/en/api/typescript/beta/skills.md index 35c86039b..06ab8cf42 100644 --- a/content/en/api/typescript/beta/skills.md +++ b/content/en/api/typescript/beta/skills.md @@ -30,7 +30,7 @@ Create Skill - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -74,8 +74,6 @@ Create Skill - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `SkillCreateResponse` @@ -174,7 +172,7 @@ List Skills - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -218,8 +216,6 @@ List Skills - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `SkillListResponse` @@ -304,7 +300,7 @@ Get Skill - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -348,8 +344,6 @@ Get Skill - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `SkillRetrieveResponse` @@ -433,7 +427,7 @@ Delete Skill - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -477,8 +471,6 @@ Delete Skill - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `SkillDeleteResponse` @@ -694,7 +686,7 @@ Create Skill Version - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -738,8 +730,6 @@ Create Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `VersionCreateResponse` @@ -836,7 +826,7 @@ List Skill Versions - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -880,8 +870,6 @@ List Skill Versions - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `VersionListResponse` @@ -975,7 +963,7 @@ Get Skill Version - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -1019,8 +1007,6 @@ Get Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `VersionRetrieveResponse` @@ -1113,7 +1099,7 @@ Delete Skill Version - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -1157,8 +1143,6 @@ Delete Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `VersionDeleteResponse` diff --git a/content/en/api/typescript/beta/skills/create.md b/content/en/api/typescript/beta/skills/create.md index 8b3cb9784..e19e7e4d7 100644 --- a/content/en/api/typescript/beta/skills/create.md +++ b/content/en/api/typescript/beta/skills/create.md @@ -28,7 +28,7 @@ Create Skill - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -72,8 +72,6 @@ Create Skill - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `SkillCreateResponse` diff --git a/content/en/api/typescript/beta/skills/delete.md b/content/en/api/typescript/beta/skills/delete.md index 6224fd18c..d8f78b051 100644 --- a/content/en/api/typescript/beta/skills/delete.md +++ b/content/en/api/typescript/beta/skills/delete.md @@ -22,7 +22,7 @@ Delete Skill - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -66,8 +66,6 @@ Delete Skill - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `SkillDeleteResponse` diff --git a/content/en/api/typescript/beta/skills/list.md b/content/en/api/typescript/beta/skills/list.md index c20bf7698..eff888ba7 100644 --- a/content/en/api/typescript/beta/skills/list.md +++ b/content/en/api/typescript/beta/skills/list.md @@ -37,7 +37,7 @@ List Skills - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -81,8 +81,6 @@ List Skills - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `SkillListResponse` diff --git a/content/en/api/typescript/beta/skills/retrieve.md b/content/en/api/typescript/beta/skills/retrieve.md index 77a323a1e..94f0dd5a0 100644 --- a/content/en/api/typescript/beta/skills/retrieve.md +++ b/content/en/api/typescript/beta/skills/retrieve.md @@ -22,7 +22,7 @@ Get Skill - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -66,8 +66,6 @@ Get Skill - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `SkillRetrieveResponse` diff --git a/content/en/api/typescript/beta/skills/versions.md b/content/en/api/typescript/beta/skills/versions.md index 51d41beed..3f59d8b63 100644 --- a/content/en/api/typescript/beta/skills/versions.md +++ b/content/en/api/typescript/beta/skills/versions.md @@ -30,7 +30,7 @@ Create Skill Version - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -74,8 +74,6 @@ Create Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `VersionCreateResponse` @@ -172,7 +170,7 @@ List Skill Versions - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -216,8 +214,6 @@ List Skill Versions - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `VersionListResponse` @@ -311,7 +307,7 @@ Get Skill Version - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -355,8 +351,6 @@ Get Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `VersionRetrieveResponse` @@ -449,7 +443,7 @@ Delete Skill Version - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -493,8 +487,6 @@ Delete Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `VersionDeleteResponse` diff --git a/content/en/api/typescript/beta/skills/versions/create.md b/content/en/api/typescript/beta/skills/versions/create.md index 0c67a795f..989884ac6 100644 --- a/content/en/api/typescript/beta/skills/versions/create.md +++ b/content/en/api/typescript/beta/skills/versions/create.md @@ -28,7 +28,7 @@ Create Skill Version - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -72,8 +72,6 @@ Create Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `VersionCreateResponse` diff --git a/content/en/api/typescript/beta/skills/versions/delete.md b/content/en/api/typescript/beta/skills/versions/delete.md index 5e5d517af..935dade25 100644 --- a/content/en/api/typescript/beta/skills/versions/delete.md +++ b/content/en/api/typescript/beta/skills/versions/delete.md @@ -28,7 +28,7 @@ Delete Skill Version - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -72,8 +72,6 @@ Delete Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `VersionDeleteResponse` diff --git a/content/en/api/typescript/beta/skills/versions/list.md b/content/en/api/typescript/beta/skills/versions/list.md index ae5d1fae6..cf531f20b 100644 --- a/content/en/api/typescript/beta/skills/versions/list.md +++ b/content/en/api/typescript/beta/skills/versions/list.md @@ -32,7 +32,7 @@ List Skill Versions - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -76,8 +76,6 @@ List Skill Versions - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `VersionListResponse` diff --git a/content/en/api/typescript/beta/skills/versions/retrieve.md b/content/en/api/typescript/beta/skills/versions/retrieve.md index 8abc41308..344a5d07c 100644 --- a/content/en/api/typescript/beta/skills/versions/retrieve.md +++ b/content/en/api/typescript/beta/skills/versions/retrieve.md @@ -28,7 +28,7 @@ Get Skill Version - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -72,8 +72,6 @@ Get Skill Version - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `VersionRetrieveResponse` diff --git a/content/en/api/typescript/beta/vaults.md b/content/en/api/typescript/beta/vaults.md new file mode 100644 index 000000000..3e84c3b8e --- /dev/null +++ b/content/en/api/typescript/beta/vaults.md @@ -0,0 +1,2680 @@ +# Vaults + +## Create + +`client.beta.vaults.create(VaultCreateParamsparams, RequestOptionsoptions?): BetaManagedAgentsVault` + +**post** `/v1/vaults` + +Create Vault + +### Parameters + +- `params: VaultCreateParams` + + - `display_name: string` + + Body param: Human-readable name for the vault. 1-255 characters. + + - `metadata?: Record` + + Body param: Arbitrary key-value metadata to attach to the vault. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: Record` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsVault = await client.beta.vaults.create({ display_name: 'Example vault' }); + +console.log(betaManagedAgentsVault.id); +``` + +## List + +`client.beta.vaults.list(VaultListParamsparams?, RequestOptionsoptions?): PageCursor` + +**get** `/v1/vaults` + +List Vaults + +### Parameters + +- `params: VaultListParams` + + - `include_archived?: boolean` + + Query param: Whether to include archived vaults in the results. + + - `limit?: number` + + Query param: Maximum number of vaults to return per page. Defaults to 20, maximum 100. + + - `page?: string` + + Query param: Opaque pagination token from a previous `list_vaults` response. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: Record` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +// Automatically fetches more pages as needed. +for await (const betaManagedAgentsVault of client.beta.vaults.list()) { + console.log(betaManagedAgentsVault.id); +} +``` + +## Retrieve + +`client.beta.vaults.retrieve(stringvaultID, VaultRetrieveParamsparams?, RequestOptionsoptions?): BetaManagedAgentsVault` + +**get** `/v1/vaults/{vault_id}` + +Get Vault + +### Parameters + +- `vaultID: string` + +- `params: VaultRetrieveParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: Record` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsVault = await client.beta.vaults.retrieve('vlt_011CZkZDLs7fYzm1hXNPeRjv'); + +console.log(betaManagedAgentsVault.id); +``` + +## Update + +`client.beta.vaults.update(stringvaultID, VaultUpdateParamsparams, RequestOptionsoptions?): BetaManagedAgentsVault` + +**post** `/v1/vaults/{vault_id}` + +Update Vault + +### Parameters + +- `vaultID: string` + +- `params: VaultUpdateParams` + + - `display_name?: string | null` + + Body param: Updated human-readable name for the vault. 1-255 characters. + + - `metadata?: Record | null` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: Record` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsVault = await client.beta.vaults.update('vlt_011CZkZDLs7fYzm1hXNPeRjv'); + +console.log(betaManagedAgentsVault.id); +``` + +## Delete + +`client.beta.vaults.delete(stringvaultID, VaultDeleteParamsparams?, RequestOptionsoptions?): BetaManagedAgentsDeletedVault` + +**delete** `/v1/vaults/{vault_id}` + +Delete Vault + +### Parameters + +- `vaultID: string` + +- `params: VaultDeleteParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsDeletedVault` + + Confirmation of a deleted vault. + + - `id: string` + + Unique identifier of the deleted vault. + + - `type: "vault_deleted"` + + - `"vault_deleted"` + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsDeletedVault = await client.beta.vaults.delete( + 'vlt_011CZkZDLs7fYzm1hXNPeRjv', +); + +console.log(betaManagedAgentsDeletedVault.id); +``` + +## Archive + +`client.beta.vaults.archive(stringvaultID, VaultArchiveParamsparams?, RequestOptionsoptions?): BetaManagedAgentsVault` + +**post** `/v1/vaults/{vault_id}/archive` + +Archive Vault + +### Parameters + +- `vaultID: string` + +- `params: VaultArchiveParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: Record` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsVault = await client.beta.vaults.archive('vlt_011CZkZDLs7fYzm1hXNPeRjv'); + +console.log(betaManagedAgentsVault.id); +``` + +## Domain Types + +### Beta Managed Agents Deleted Vault + +- `BetaManagedAgentsDeletedVault` + + Confirmation of a deleted vault. + + - `id: string` + + Unique identifier of the deleted vault. + + - `type: "vault_deleted"` + + - `"vault_deleted"` + +### Beta Managed Agents Vault + +- `BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: Record` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +# Credentials + +## Create + +`client.beta.vaults.credentials.create(stringvaultID, CredentialCreateParamsparams, RequestOptionsoptions?): BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials` + +Create Credential + +### Parameters + +- `vaultID: string` + +- `params: CredentialCreateParams` + + - `auth: BetaManagedAgentsMCPOAuthCreateParams | BetaManagedAgentsStaticBearerCreateParams` + + Body param: Authentication details for creating a credential. + + - `BetaManagedAgentsMCPOAuthCreateParams` + + Parameters for creating an MCP OAuth credential. + + - `access_token: string` + + OAuth access token. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshParams | null` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: string` + + OAuth client ID. + + - `refresh_token: string` + + OAuth refresh token. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam | BetaManagedAgentsTokenEndpointAuthBasicParam | BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneParam` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicParam` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerCreateParams` + + Parameters for creating a static bearer token credential. + + - `token: string` + + Static bearer token value. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `display_name?: string | null` + + Body param: Human-readable name for the credential. Up to 255 characters. + + - `metadata?: Record` + + Body param: Arbitrary key-value metadata to attach to the credential. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshResponse | null` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: Record` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name?: string | null` + + Human-readable name for the credential. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsCredential = await client.beta.vaults.credentials.create( + 'vlt_011CZkZDLs7fYzm1hXNPeRjv', + { + auth: { + token: 'bearer_exampletoken', + mcp_server_url: 'https://example-server.modelcontextprotocol.io/sse', + type: 'static_bearer', + }, + }, +); + +console.log(betaManagedAgentsCredential.id); +``` + +## List + +`client.beta.vaults.credentials.list(stringvaultID, CredentialListParamsparams?, RequestOptionsoptions?): PageCursor` + +**get** `/v1/vaults/{vault_id}/credentials` + +List Credentials + +### Parameters + +- `vaultID: string` + +- `params: CredentialListParams` + + - `include_archived?: boolean` + + Query param: Whether to include archived credentials in the results. + + - `limit?: number` + + Query param: Maximum number of credentials to return per page. Defaults to 20, maximum 100. + + - `page?: string` + + Query param: Opaque pagination token from a previous `list_credentials` response. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshResponse | null` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: Record` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name?: string | null` + + Human-readable name for the credential. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +// Automatically fetches more pages as needed. +for await (const betaManagedAgentsCredential of client.beta.vaults.credentials.list( + 'vlt_011CZkZDLs7fYzm1hXNPeRjv', +)) { + console.log(betaManagedAgentsCredential.id); +} +``` + +## Retrieve + +`client.beta.vaults.credentials.retrieve(stringcredentialID, CredentialRetrieveParamsparams, RequestOptionsoptions?): BetaManagedAgentsCredential` + +**get** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Get Credential + +### Parameters + +- `credentialID: string` + +- `params: CredentialRetrieveParams` + + - `vault_id: string` + + Path param: Path parameter vault_id + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshResponse | null` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: Record` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name?: string | null` + + Human-readable name for the credential. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsCredential = await client.beta.vaults.credentials.retrieve( + 'vcrd_011CZkZEMt8gZan2iYOQfSkw', + { vault_id: 'vlt_011CZkZDLs7fYzm1hXNPeRjv' }, +); + +console.log(betaManagedAgentsCredential.id); +``` + +## Update + +`client.beta.vaults.credentials.update(stringcredentialID, CredentialUpdateParamsparams, RequestOptionsoptions?): BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Update Credential + +### Parameters + +- `credentialID: string` + +- `params: CredentialUpdateParams` + + - `vault_id: string` + + Path param: Path parameter vault_id + + - `auth?: BetaManagedAgentsMCPOAuthUpdateParams | BetaManagedAgentsStaticBearerUpdateParams` + + Body param: Updated authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthUpdateParams` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `access_token?: string | null` + + Updated OAuth access token. + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshUpdateParams | null` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token?: string | null` + + Updated OAuth refresh token. + + - `scope?: string | null` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth?: BetaManagedAgentsTokenEndpointAuthBasicUpdateParam | BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `BetaManagedAgentsTokenEndpointAuthBasicUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret?: string | null` + + Updated OAuth client secret. + + - `BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret?: string | null` + + Updated OAuth client secret. + + - `BetaManagedAgentsStaticBearerUpdateParams` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `token?: string | null` + + Updated static bearer token value. + + - `display_name?: string | null` + + Body param: Updated human-readable name for the credential. 1-255 characters. + + - `metadata?: Record | null` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshResponse | null` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: Record` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name?: string | null` + + Human-readable name for the credential. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsCredential = await client.beta.vaults.credentials.update( + 'vcrd_011CZkZEMt8gZan2iYOQfSkw', + { vault_id: 'vlt_011CZkZDLs7fYzm1hXNPeRjv' }, +); + +console.log(betaManagedAgentsCredential.id); +``` + +## Delete + +`client.beta.vaults.credentials.delete(stringcredentialID, CredentialDeleteParamsparams, RequestOptionsoptions?): BetaManagedAgentsDeletedCredential` + +**delete** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Delete Credential + +### Parameters + +- `credentialID: string` + +- `params: CredentialDeleteParams` + + - `vault_id: string` + + Path param: Path parameter vault_id + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsDeletedCredential` + + Confirmation of a deleted credential. + + - `id: string` + + Unique identifier of the deleted credential. + + - `type: "vault_credential_deleted"` + + - `"vault_credential_deleted"` + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsDeletedCredential = await client.beta.vaults.credentials.delete( + 'vcrd_011CZkZEMt8gZan2iYOQfSkw', + { vault_id: 'vlt_011CZkZDLs7fYzm1hXNPeRjv' }, +); + +console.log(betaManagedAgentsDeletedCredential.id); +``` + +## Archive + +`client.beta.vaults.credentials.archive(stringcredentialID, CredentialArchiveParamsparams, RequestOptionsoptions?): BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}/archive` + +Archive Credential + +### Parameters + +- `credentialID: string` + +- `params: CredentialArchiveParams` + + - `vault_id: string` + + Path param: Path parameter vault_id + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshResponse | null` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: Record` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name?: string | null` + + Human-readable name for the credential. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsCredential = await client.beta.vaults.credentials.archive( + 'vcrd_011CZkZEMt8gZan2iYOQfSkw', + { vault_id: 'vlt_011CZkZDLs7fYzm1hXNPeRjv' }, +); + +console.log(betaManagedAgentsCredential.id); +``` + +## Domain Types + +### Beta Managed Agents Credential + +- `BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshResponse | null` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: Record` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name?: string | null` + + Human-readable name for the credential. + +### Beta Managed Agents Deleted Credential + +- `BetaManagedAgentsDeletedCredential` + + Confirmation of a deleted credential. + + - `id: string` + + Unique identifier of the deleted credential. + + - `type: "vault_credential_deleted"` + + - `"vault_credential_deleted"` + +### Beta Managed Agents MCP OAuth Auth Response + +- `BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshResponse | null` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Create Params + +- `BetaManagedAgentsMCPOAuthCreateParams` + + Parameters for creating an MCP OAuth credential. + + - `access_token: string` + + OAuth access token. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshParams | null` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: string` + + OAuth client ID. + + - `refresh_token: string` + + OAuth refresh token. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam | BetaManagedAgentsTokenEndpointAuthBasicParam | BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneParam` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicParam` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Params + +- `BetaManagedAgentsMCPOAuthRefreshParams` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: string` + + OAuth client ID. + + - `refresh_token: string` + + OAuth refresh token. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam | BetaManagedAgentsTokenEndpointAuthBasicParam | BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneParam` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicParam` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Response + +- `BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Update Params + +- `BetaManagedAgentsMCPOAuthRefreshUpdateParams` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token?: string | null` + + Updated OAuth refresh token. + + - `scope?: string | null` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth?: BetaManagedAgentsTokenEndpointAuthBasicUpdateParam | BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `BetaManagedAgentsTokenEndpointAuthBasicUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret?: string | null` + + Updated OAuth client secret. + + - `BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret?: string | null` + + Updated OAuth client secret. + +### Beta Managed Agents MCP OAuth Update Params + +- `BetaManagedAgentsMCPOAuthUpdateParams` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `access_token?: string | null` + + Updated OAuth access token. + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshUpdateParams | null` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token?: string | null` + + Updated OAuth refresh token. + + - `scope?: string | null` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth?: BetaManagedAgentsTokenEndpointAuthBasicUpdateParam | BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `BetaManagedAgentsTokenEndpointAuthBasicUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret?: string | null` + + Updated OAuth client secret. + + - `BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret?: string | null` + + Updated OAuth client secret. + +### Beta Managed Agents Static Bearer Auth Response + +- `BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + +### Beta Managed Agents Static Bearer Create Params + +- `BetaManagedAgentsStaticBearerCreateParams` + + Parameters for creating a static bearer token credential. + + - `token: string` + + Static bearer token value. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + +### Beta Managed Agents Static Bearer Update Params + +- `BetaManagedAgentsStaticBearerUpdateParams` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `token?: string | null` + + Updated static bearer token value. + +### Beta Managed Agents Token Endpoint Auth Basic Param + +- `BetaManagedAgentsTokenEndpointAuthBasicParam` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + +### Beta Managed Agents Token Endpoint Auth Basic Response + +- `BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + +### Beta Managed Agents Token Endpoint Auth Basic Update Param + +- `BetaManagedAgentsTokenEndpointAuthBasicUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret?: string | null` + + Updated OAuth client secret. + +### Beta Managed Agents Token Endpoint Auth None Param + +- `BetaManagedAgentsTokenEndpointAuthNoneParam` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + +### Beta Managed Agents Token Endpoint Auth None Response + +- `BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + +### Beta Managed Agents Token Endpoint Auth Post Param + +- `BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + +### Beta Managed Agents Token Endpoint Auth Post Response + +- `BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + +### Beta Managed Agents Token Endpoint Auth Post Update Param + +- `BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret?: string | null` + + Updated OAuth client secret. diff --git a/content/en/api/typescript/beta/vaults/archive.md b/content/en/api/typescript/beta/vaults/archive.md new file mode 100644 index 000000000..72ff1b423 --- /dev/null +++ b/content/en/api/typescript/beta/vaults/archive.md @@ -0,0 +1,111 @@ +## Archive + +`client.beta.vaults.archive(stringvaultID, VaultArchiveParamsparams?, RequestOptionsoptions?): BetaManagedAgentsVault` + +**post** `/v1/vaults/{vault_id}/archive` + +Archive Vault + +### Parameters + +- `vaultID: string` + +- `params: VaultArchiveParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: Record` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsVault = await client.beta.vaults.archive('vlt_011CZkZDLs7fYzm1hXNPeRjv'); + +console.log(betaManagedAgentsVault.id); +``` diff --git a/content/en/api/typescript/beta/vaults/create.md b/content/en/api/typescript/beta/vaults/create.md new file mode 100644 index 000000000..81b91395e --- /dev/null +++ b/content/en/api/typescript/beta/vaults/create.md @@ -0,0 +1,117 @@ +## Create + +`client.beta.vaults.create(VaultCreateParamsparams, RequestOptionsoptions?): BetaManagedAgentsVault` + +**post** `/v1/vaults` + +Create Vault + +### Parameters + +- `params: VaultCreateParams` + + - `display_name: string` + + Body param: Human-readable name for the vault. 1-255 characters. + + - `metadata?: Record` + + Body param: Arbitrary key-value metadata to attach to the vault. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: Record` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsVault = await client.beta.vaults.create({ display_name: 'Example vault' }); + +console.log(betaManagedAgentsVault.id); +``` diff --git a/content/en/api/typescript/beta/vaults/credentials.md b/content/en/api/typescript/beta/vaults/credentials.md new file mode 100644 index 000000000..7efd42e4c --- /dev/null +++ b/content/en/api/typescript/beta/vaults/credentials.md @@ -0,0 +1,1949 @@ +# Credentials + +## Create + +`client.beta.vaults.credentials.create(stringvaultID, CredentialCreateParamsparams, RequestOptionsoptions?): BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials` + +Create Credential + +### Parameters + +- `vaultID: string` + +- `params: CredentialCreateParams` + + - `auth: BetaManagedAgentsMCPOAuthCreateParams | BetaManagedAgentsStaticBearerCreateParams` + + Body param: Authentication details for creating a credential. + + - `BetaManagedAgentsMCPOAuthCreateParams` + + Parameters for creating an MCP OAuth credential. + + - `access_token: string` + + OAuth access token. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshParams | null` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: string` + + OAuth client ID. + + - `refresh_token: string` + + OAuth refresh token. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam | BetaManagedAgentsTokenEndpointAuthBasicParam | BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneParam` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicParam` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerCreateParams` + + Parameters for creating a static bearer token credential. + + - `token: string` + + Static bearer token value. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `display_name?: string | null` + + Body param: Human-readable name for the credential. Up to 255 characters. + + - `metadata?: Record` + + Body param: Arbitrary key-value metadata to attach to the credential. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshResponse | null` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: Record` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name?: string | null` + + Human-readable name for the credential. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsCredential = await client.beta.vaults.credentials.create( + 'vlt_011CZkZDLs7fYzm1hXNPeRjv', + { + auth: { + token: 'bearer_exampletoken', + mcp_server_url: 'https://example-server.modelcontextprotocol.io/sse', + type: 'static_bearer', + }, + }, +); + +console.log(betaManagedAgentsCredential.id); +``` + +## List + +`client.beta.vaults.credentials.list(stringvaultID, CredentialListParamsparams?, RequestOptionsoptions?): PageCursor` + +**get** `/v1/vaults/{vault_id}/credentials` + +List Credentials + +### Parameters + +- `vaultID: string` + +- `params: CredentialListParams` + + - `include_archived?: boolean` + + Query param: Whether to include archived credentials in the results. + + - `limit?: number` + + Query param: Maximum number of credentials to return per page. Defaults to 20, maximum 100. + + - `page?: string` + + Query param: Opaque pagination token from a previous `list_credentials` response. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshResponse | null` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: Record` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name?: string | null` + + Human-readable name for the credential. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +// Automatically fetches more pages as needed. +for await (const betaManagedAgentsCredential of client.beta.vaults.credentials.list( + 'vlt_011CZkZDLs7fYzm1hXNPeRjv', +)) { + console.log(betaManagedAgentsCredential.id); +} +``` + +## Retrieve + +`client.beta.vaults.credentials.retrieve(stringcredentialID, CredentialRetrieveParamsparams, RequestOptionsoptions?): BetaManagedAgentsCredential` + +**get** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Get Credential + +### Parameters + +- `credentialID: string` + +- `params: CredentialRetrieveParams` + + - `vault_id: string` + + Path param: Path parameter vault_id + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshResponse | null` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: Record` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name?: string | null` + + Human-readable name for the credential. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsCredential = await client.beta.vaults.credentials.retrieve( + 'vcrd_011CZkZEMt8gZan2iYOQfSkw', + { vault_id: 'vlt_011CZkZDLs7fYzm1hXNPeRjv' }, +); + +console.log(betaManagedAgentsCredential.id); +``` + +## Update + +`client.beta.vaults.credentials.update(stringcredentialID, CredentialUpdateParamsparams, RequestOptionsoptions?): BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Update Credential + +### Parameters + +- `credentialID: string` + +- `params: CredentialUpdateParams` + + - `vault_id: string` + + Path param: Path parameter vault_id + + - `auth?: BetaManagedAgentsMCPOAuthUpdateParams | BetaManagedAgentsStaticBearerUpdateParams` + + Body param: Updated authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthUpdateParams` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `access_token?: string | null` + + Updated OAuth access token. + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshUpdateParams | null` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token?: string | null` + + Updated OAuth refresh token. + + - `scope?: string | null` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth?: BetaManagedAgentsTokenEndpointAuthBasicUpdateParam | BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `BetaManagedAgentsTokenEndpointAuthBasicUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret?: string | null` + + Updated OAuth client secret. + + - `BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret?: string | null` + + Updated OAuth client secret. + + - `BetaManagedAgentsStaticBearerUpdateParams` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `token?: string | null` + + Updated static bearer token value. + + - `display_name?: string | null` + + Body param: Updated human-readable name for the credential. 1-255 characters. + + - `metadata?: Record | null` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshResponse | null` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: Record` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name?: string | null` + + Human-readable name for the credential. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsCredential = await client.beta.vaults.credentials.update( + 'vcrd_011CZkZEMt8gZan2iYOQfSkw', + { vault_id: 'vlt_011CZkZDLs7fYzm1hXNPeRjv' }, +); + +console.log(betaManagedAgentsCredential.id); +``` + +## Delete + +`client.beta.vaults.credentials.delete(stringcredentialID, CredentialDeleteParamsparams, RequestOptionsoptions?): BetaManagedAgentsDeletedCredential` + +**delete** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Delete Credential + +### Parameters + +- `credentialID: string` + +- `params: CredentialDeleteParams` + + - `vault_id: string` + + Path param: Path parameter vault_id + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsDeletedCredential` + + Confirmation of a deleted credential. + + - `id: string` + + Unique identifier of the deleted credential. + + - `type: "vault_credential_deleted"` + + - `"vault_credential_deleted"` + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsDeletedCredential = await client.beta.vaults.credentials.delete( + 'vcrd_011CZkZEMt8gZan2iYOQfSkw', + { vault_id: 'vlt_011CZkZDLs7fYzm1hXNPeRjv' }, +); + +console.log(betaManagedAgentsDeletedCredential.id); +``` + +## Archive + +`client.beta.vaults.credentials.archive(stringcredentialID, CredentialArchiveParamsparams, RequestOptionsoptions?): BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}/archive` + +Archive Credential + +### Parameters + +- `credentialID: string` + +- `params: CredentialArchiveParams` + + - `vault_id: string` + + Path param: Path parameter vault_id + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshResponse | null` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: Record` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name?: string | null` + + Human-readable name for the credential. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsCredential = await client.beta.vaults.credentials.archive( + 'vcrd_011CZkZEMt8gZan2iYOQfSkw', + { vault_id: 'vlt_011CZkZDLs7fYzm1hXNPeRjv' }, +); + +console.log(betaManagedAgentsCredential.id); +``` + +## Domain Types + +### Beta Managed Agents Credential + +- `BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshResponse | null` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: Record` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name?: string | null` + + Human-readable name for the credential. + +### Beta Managed Agents Deleted Credential + +- `BetaManagedAgentsDeletedCredential` + + Confirmation of a deleted credential. + + - `id: string` + + Unique identifier of the deleted credential. + + - `type: "vault_credential_deleted"` + + - `"vault_credential_deleted"` + +### Beta Managed Agents MCP OAuth Auth Response + +- `BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshResponse | null` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Create Params + +- `BetaManagedAgentsMCPOAuthCreateParams` + + Parameters for creating an MCP OAuth credential. + + - `access_token: string` + + OAuth access token. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshParams | null` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: string` + + OAuth client ID. + + - `refresh_token: string` + + OAuth refresh token. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam | BetaManagedAgentsTokenEndpointAuthBasicParam | BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneParam` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicParam` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Params + +- `BetaManagedAgentsMCPOAuthRefreshParams` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: string` + + OAuth client ID. + + - `refresh_token: string` + + OAuth refresh token. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam | BetaManagedAgentsTokenEndpointAuthBasicParam | BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneParam` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicParam` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Response + +- `BetaManagedAgentsMCPOAuthRefreshResponse` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + +### Beta Managed Agents MCP OAuth Refresh Update Params + +- `BetaManagedAgentsMCPOAuthRefreshUpdateParams` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token?: string | null` + + Updated OAuth refresh token. + + - `scope?: string | null` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth?: BetaManagedAgentsTokenEndpointAuthBasicUpdateParam | BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `BetaManagedAgentsTokenEndpointAuthBasicUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret?: string | null` + + Updated OAuth client secret. + + - `BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret?: string | null` + + Updated OAuth client secret. + +### Beta Managed Agents MCP OAuth Update Params + +- `BetaManagedAgentsMCPOAuthUpdateParams` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `access_token?: string | null` + + Updated OAuth access token. + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshUpdateParams | null` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token?: string | null` + + Updated OAuth refresh token. + + - `scope?: string | null` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth?: BetaManagedAgentsTokenEndpointAuthBasicUpdateParam | BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `BetaManagedAgentsTokenEndpointAuthBasicUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret?: string | null` + + Updated OAuth client secret. + + - `BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret?: string | null` + + Updated OAuth client secret. + +### Beta Managed Agents Static Bearer Auth Response + +- `BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + +### Beta Managed Agents Static Bearer Create Params + +- `BetaManagedAgentsStaticBearerCreateParams` + + Parameters for creating a static bearer token credential. + + - `token: string` + + Static bearer token value. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + +### Beta Managed Agents Static Bearer Update Params + +- `BetaManagedAgentsStaticBearerUpdateParams` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `token?: string | null` + + Updated static bearer token value. + +### Beta Managed Agents Token Endpoint Auth Basic Param + +- `BetaManagedAgentsTokenEndpointAuthBasicParam` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + +### Beta Managed Agents Token Endpoint Auth Basic Response + +- `BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + +### Beta Managed Agents Token Endpoint Auth Basic Update Param + +- `BetaManagedAgentsTokenEndpointAuthBasicUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret?: string | null` + + Updated OAuth client secret. + +### Beta Managed Agents Token Endpoint Auth None Param + +- `BetaManagedAgentsTokenEndpointAuthNoneParam` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + +### Beta Managed Agents Token Endpoint Auth None Response + +- `BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + +### Beta Managed Agents Token Endpoint Auth Post Param + +- `BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + +### Beta Managed Agents Token Endpoint Auth Post Response + +- `BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + +### Beta Managed Agents Token Endpoint Auth Post Update Param + +- `BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret?: string | null` + + Updated OAuth client secret. diff --git a/content/en/api/typescript/beta/vaults/credentials/archive.md b/content/en/api/typescript/beta/vaults/credentials/archive.md new file mode 100644 index 000000000..27702fde4 --- /dev/null +++ b/content/en/api/typescript/beta/vaults/credentials/archive.md @@ -0,0 +1,202 @@ +## Archive + +`client.beta.vaults.credentials.archive(stringcredentialID, CredentialArchiveParamsparams, RequestOptionsoptions?): BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}/archive` + +Archive Credential + +### Parameters + +- `credentialID: string` + +- `params: CredentialArchiveParams` + + - `vault_id: string` + + Path param: Path parameter vault_id + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshResponse | null` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: Record` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name?: string | null` + + Human-readable name for the credential. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsCredential = await client.beta.vaults.credentials.archive( + 'vcrd_011CZkZEMt8gZan2iYOQfSkw', + { vault_id: 'vlt_011CZkZDLs7fYzm1hXNPeRjv' }, +); + +console.log(betaManagedAgentsCredential.id); +``` diff --git a/content/en/api/typescript/beta/vaults/credentials/create.md b/content/en/api/typescript/beta/vaults/credentials/create.md new file mode 100644 index 000000000..bede279e2 --- /dev/null +++ b/content/en/api/typescript/beta/vaults/credentials/create.md @@ -0,0 +1,312 @@ +## Create + +`client.beta.vaults.credentials.create(stringvaultID, CredentialCreateParamsparams, RequestOptionsoptions?): BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials` + +Create Credential + +### Parameters + +- `vaultID: string` + +- `params: CredentialCreateParams` + + - `auth: BetaManagedAgentsMCPOAuthCreateParams | BetaManagedAgentsStaticBearerCreateParams` + + Body param: Authentication details for creating a credential. + + - `BetaManagedAgentsMCPOAuthCreateParams` + + Parameters for creating an MCP OAuth credential. + + - `access_token: string` + + OAuth access token. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshParams | null` + + OAuth refresh token parameters for creating a credential with refresh support. + + - `client_id: string` + + OAuth client ID. + + - `refresh_token: string` + + OAuth refresh token. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam | BetaManagedAgentsTokenEndpointAuthBasicParam | BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneParam` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicParam` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostParam` + + Token endpoint uses POST body authentication with client credentials. + + - `client_secret: string` + + OAuth client secret. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerCreateParams` + + Parameters for creating a static bearer token credential. + + - `token: string` + + Static bearer token value. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `display_name?: string | null` + + Body param: Human-readable name for the credential. Up to 255 characters. + + - `metadata?: Record` + + Body param: Arbitrary key-value metadata to attach to the credential. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshResponse | null` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: Record` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name?: string | null` + + Human-readable name for the credential. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsCredential = await client.beta.vaults.credentials.create( + 'vlt_011CZkZDLs7fYzm1hXNPeRjv', + { + auth: { + token: 'bearer_exampletoken', + mcp_server_url: 'https://example-server.modelcontextprotocol.io/sse', + type: 'static_bearer', + }, + }, +); + +console.log(betaManagedAgentsCredential.id); +``` diff --git a/content/en/api/typescript/beta/vaults/credentials/delete.md b/content/en/api/typescript/beta/vaults/credentials/delete.md new file mode 100644 index 000000000..4b56412da --- /dev/null +++ b/content/en/api/typescript/beta/vaults/credentials/delete.md @@ -0,0 +1,98 @@ +## Delete + +`client.beta.vaults.credentials.delete(stringcredentialID, CredentialDeleteParamsparams, RequestOptionsoptions?): BetaManagedAgentsDeletedCredential` + +**delete** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Delete Credential + +### Parameters + +- `credentialID: string` + +- `params: CredentialDeleteParams` + + - `vault_id: string` + + Path param: Path parameter vault_id + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsDeletedCredential` + + Confirmation of a deleted credential. + + - `id: string` + + Unique identifier of the deleted credential. + + - `type: "vault_credential_deleted"` + + - `"vault_credential_deleted"` + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsDeletedCredential = await client.beta.vaults.credentials.delete( + 'vcrd_011CZkZEMt8gZan2iYOQfSkw', + { vault_id: 'vlt_011CZkZDLs7fYzm1hXNPeRjv' }, +); + +console.log(betaManagedAgentsDeletedCredential.id); +``` diff --git a/content/en/api/typescript/beta/vaults/credentials/list.md b/content/en/api/typescript/beta/vaults/credentials/list.md new file mode 100644 index 000000000..72d472521 --- /dev/null +++ b/content/en/api/typescript/beta/vaults/credentials/list.md @@ -0,0 +1,210 @@ +## List + +`client.beta.vaults.credentials.list(stringvaultID, CredentialListParamsparams?, RequestOptionsoptions?): PageCursor` + +**get** `/v1/vaults/{vault_id}/credentials` + +List Credentials + +### Parameters + +- `vaultID: string` + +- `params: CredentialListParams` + + - `include_archived?: boolean` + + Query param: Whether to include archived credentials in the results. + + - `limit?: number` + + Query param: Maximum number of credentials to return per page. Defaults to 20, maximum 100. + + - `page?: string` + + Query param: Opaque pagination token from a previous `list_credentials` response. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshResponse | null` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: Record` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name?: string | null` + + Human-readable name for the credential. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +// Automatically fetches more pages as needed. +for await (const betaManagedAgentsCredential of client.beta.vaults.credentials.list( + 'vlt_011CZkZDLs7fYzm1hXNPeRjv', +)) { + console.log(betaManagedAgentsCredential.id); +} +``` diff --git a/content/en/api/typescript/beta/vaults/credentials/retrieve.md b/content/en/api/typescript/beta/vaults/credentials/retrieve.md new file mode 100644 index 000000000..4407cef24 --- /dev/null +++ b/content/en/api/typescript/beta/vaults/credentials/retrieve.md @@ -0,0 +1,202 @@ +## Retrieve + +`client.beta.vaults.credentials.retrieve(stringcredentialID, CredentialRetrieveParamsparams, RequestOptionsoptions?): BetaManagedAgentsCredential` + +**get** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Get Credential + +### Parameters + +- `credentialID: string` + +- `params: CredentialRetrieveParams` + + - `vault_id: string` + + Path param: Path parameter vault_id + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshResponse | null` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: Record` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name?: string | null` + + Human-readable name for the credential. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsCredential = await client.beta.vaults.credentials.retrieve( + 'vcrd_011CZkZEMt8gZan2iYOQfSkw', + { vault_id: 'vlt_011CZkZDLs7fYzm1hXNPeRjv' }, +); + +console.log(betaManagedAgentsCredential.id); +``` diff --git a/content/en/api/typescript/beta/vaults/credentials/update.md b/content/en/api/typescript/beta/vaults/credentials/update.md new file mode 100644 index 000000000..459b6be71 --- /dev/null +++ b/content/en/api/typescript/beta/vaults/credentials/update.md @@ -0,0 +1,282 @@ +## Update + +`client.beta.vaults.credentials.update(stringcredentialID, CredentialUpdateParamsparams, RequestOptionsoptions?): BetaManagedAgentsCredential` + +**post** `/v1/vaults/{vault_id}/credentials/{credential_id}` + +Update Credential + +### Parameters + +- `credentialID: string` + +- `params: CredentialUpdateParams` + + - `vault_id: string` + + Path param: Path parameter vault_id + + - `auth?: BetaManagedAgentsMCPOAuthUpdateParams | BetaManagedAgentsStaticBearerUpdateParams` + + Body param: Updated authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthUpdateParams` + + Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `access_token?: string | null` + + Updated OAuth access token. + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshUpdateParams | null` + + Parameters for updating OAuth refresh token configuration. + + - `refresh_token?: string | null` + + Updated OAuth refresh token. + + - `scope?: string | null` + + Updated OAuth scope for the refresh request. + + - `token_endpoint_auth?: BetaManagedAgentsTokenEndpointAuthBasicUpdateParam | BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `BetaManagedAgentsTokenEndpointAuthBasicUpdateParam` + + Updated HTTP Basic authentication parameters for the token endpoint. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `client_secret?: string | null` + + Updated OAuth client secret. + + - `BetaManagedAgentsTokenEndpointAuthPostUpdateParam` + + Updated POST body authentication parameters for the token endpoint. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `client_secret?: string | null` + + Updated OAuth client secret. + + - `BetaManagedAgentsStaticBearerUpdateParams` + + Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `token?: string | null` + + Updated static bearer token value. + + - `display_name?: string | null` + + Body param: Updated human-readable name for the credential. 1-255 characters. + + - `metadata?: Record | null` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsCredential` + + A credential stored in a vault. Sensitive fields are never returned in responses. + + - `id: string` + + Unique identifier for the credential. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `auth: BetaManagedAgentsMCPOAuthAuthResponse | BetaManagedAgentsStaticBearerAuthResponse` + + Authentication details for a credential. + + - `BetaManagedAgentsMCPOAuthAuthResponse` + + OAuth credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "mcp_oauth"` + + - `"mcp_oauth"` + + - `expires_at?: string | null` + + A timestamp in RFC 3339 format + + - `refresh?: BetaManagedAgentsMCPOAuthRefreshResponse | null` + + OAuth refresh token configuration returned in credential responses. + + - `client_id: string` + + OAuth client ID. + + - `token_endpoint: string` + + Token endpoint URL used to refresh the access token. + + - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneResponse | BetaManagedAgentsTokenEndpointAuthBasicResponse | BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint requires no client authentication. + + - `BetaManagedAgentsTokenEndpointAuthNoneResponse` + + Token endpoint requires no client authentication. + + - `type: "none"` + + - `"none"` + + - `BetaManagedAgentsTokenEndpointAuthBasicResponse` + + Token endpoint uses HTTP Basic authentication with client credentials. + + - `type: "client_secret_basic"` + + - `"client_secret_basic"` + + - `BetaManagedAgentsTokenEndpointAuthPostResponse` + + Token endpoint uses POST body authentication with client credentials. + + - `type: "client_secret_post"` + + - `"client_secret_post"` + + - `resource?: string | null` + + OAuth resource indicator. + + - `scope?: string | null` + + OAuth scope for the refresh request. + + - `BetaManagedAgentsStaticBearerAuthResponse` + + Static bearer token credential details for an MCP server. + + - `mcp_server_url: string` + + URL of the MCP server this credential authenticates against. + + - `type: "static_bearer"` + + - `"static_bearer"` + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `metadata: Record` + + Arbitrary key-value metadata attached to the credential. + + - `type: "vault_credential"` + + - `"vault_credential"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + + - `vault_id: string` + + Identifier of the vault this credential belongs to. + + - `display_name?: string | null` + + Human-readable name for the credential. + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsCredential = await client.beta.vaults.credentials.update( + 'vcrd_011CZkZEMt8gZan2iYOQfSkw', + { vault_id: 'vlt_011CZkZDLs7fYzm1hXNPeRjv' }, +); + +console.log(betaManagedAgentsCredential.id); +``` diff --git a/content/en/api/typescript/beta/vaults/delete.md b/content/en/api/typescript/beta/vaults/delete.md new file mode 100644 index 000000000..fcf9d5cf7 --- /dev/null +++ b/content/en/api/typescript/beta/vaults/delete.md @@ -0,0 +1,93 @@ +## Delete + +`client.beta.vaults.delete(stringvaultID, VaultDeleteParamsparams?, RequestOptionsoptions?): BetaManagedAgentsDeletedVault` + +**delete** `/v1/vaults/{vault_id}` + +Delete Vault + +### Parameters + +- `vaultID: string` + +- `params: VaultDeleteParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsDeletedVault` + + Confirmation of a deleted vault. + + - `id: string` + + Unique identifier of the deleted vault. + + - `type: "vault_deleted"` + + - `"vault_deleted"` + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsDeletedVault = await client.beta.vaults.delete( + 'vlt_011CZkZDLs7fYzm1hXNPeRjv', +); + +console.log(betaManagedAgentsDeletedVault.id); +``` diff --git a/content/en/api/typescript/beta/vaults/list.md b/content/en/api/typescript/beta/vaults/list.md new file mode 100644 index 000000000..cef9557ce --- /dev/null +++ b/content/en/api/typescript/beta/vaults/list.md @@ -0,0 +1,122 @@ +## List + +`client.beta.vaults.list(VaultListParamsparams?, RequestOptionsoptions?): PageCursor` + +**get** `/v1/vaults` + +List Vaults + +### Parameters + +- `params: VaultListParams` + + - `include_archived?: boolean` + + Query param: Whether to include archived vaults in the results. + + - `limit?: number` + + Query param: Maximum number of vaults to return per page. Defaults to 20, maximum 100. + + - `page?: string` + + Query param: Opaque pagination token from a previous `list_vaults` response. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: Record` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +// Automatically fetches more pages as needed. +for await (const betaManagedAgentsVault of client.beta.vaults.list()) { + console.log(betaManagedAgentsVault.id); +} +``` diff --git a/content/en/api/typescript/beta/vaults/retrieve.md b/content/en/api/typescript/beta/vaults/retrieve.md new file mode 100644 index 000000000..d990bc218 --- /dev/null +++ b/content/en/api/typescript/beta/vaults/retrieve.md @@ -0,0 +1,111 @@ +## Retrieve + +`client.beta.vaults.retrieve(stringvaultID, VaultRetrieveParamsparams?, RequestOptionsoptions?): BetaManagedAgentsVault` + +**get** `/v1/vaults/{vault_id}` + +Get Vault + +### Parameters + +- `vaultID: string` + +- `params: VaultRetrieveParams` + + - `betas?: Array` + + Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: Record` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsVault = await client.beta.vaults.retrieve('vlt_011CZkZDLs7fYzm1hXNPeRjv'); + +console.log(betaManagedAgentsVault.id); +``` diff --git a/content/en/api/typescript/beta/vaults/update.md b/content/en/api/typescript/beta/vaults/update.md new file mode 100644 index 000000000..f0657f43a --- /dev/null +++ b/content/en/api/typescript/beta/vaults/update.md @@ -0,0 +1,119 @@ +## Update + +`client.beta.vaults.update(stringvaultID, VaultUpdateParamsparams, RequestOptionsoptions?): BetaManagedAgentsVault` + +**post** `/v1/vaults/{vault_id}` + +Update Vault + +### Parameters + +- `vaultID: string` + +- `params: VaultUpdateParams` + + - `display_name?: string | null` + + Body param: Updated human-readable name for the vault. 1-255 characters. + + - `metadata?: Record | null` + + Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved. + + - `betas?: Array` + + Header param: Optional header to specify the beta version(s) you want to use. + + - `(string & {})` + + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` + + - `"message-batches-2024-09-24"` + + - `"prompt-caching-2024-07-31"` + + - `"computer-use-2024-10-22"` + + - `"computer-use-2025-01-24"` + + - `"pdfs-2024-09-25"` + + - `"token-counting-2024-11-01"` + + - `"token-efficient-tools-2025-02-19"` + + - `"output-128k-2025-02-19"` + + - `"files-api-2025-04-14"` + + - `"mcp-client-2025-04-04"` + + - `"mcp-client-2025-11-20"` + + - `"dev-full-thinking-2025-05-14"` + + - `"interleaved-thinking-2025-05-14"` + + - `"code-execution-2025-05-22"` + + - `"extended-cache-ttl-2025-04-11"` + + - `"context-1m-2025-08-07"` + + - `"context-management-2025-06-27"` + + - `"model-context-window-exceeded-2025-08-26"` + + - `"skills-2025-10-02"` + + - `"fast-mode-2026-02-01"` + + - `"output-300k-2026-03-24"` + +### Returns + +- `BetaManagedAgentsVault` + + A vault that stores credentials for use by agents during sessions. + + - `id: string` + + Unique identifier for the vault. + + - `archived_at: string | null` + + A timestamp in RFC 3339 format + + - `created_at: string` + + A timestamp in RFC 3339 format + + - `display_name: string` + + Human-readable name for the vault. + + - `metadata: Record` + + Arbitrary key-value metadata attached to the vault. + + - `type: "vault"` + + - `"vault"` + + - `updated_at: string` + + A timestamp in RFC 3339 format + +### Example + +```typescript +import Anthropic from '@anthropic-ai/sdk'; + +const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted +}); + +const betaManagedAgentsVault = await client.beta.vaults.update('vlt_011CZkZDLs7fYzm1hXNPeRjv'); + +console.log(betaManagedAgentsVault.id); +``` diff --git a/content/en/api/typescript/completions.md b/content/en/api/typescript/completions.md index c93142d1d..7edb20c9b 100644 --- a/content/en/api/typescript/completions.md +++ b/content/en/api/typescript/completions.md @@ -30,11 +30,15 @@ Future models and features will not be compatible with Text Completions. See our See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -170,7 +174,7 @@ Future models and features will not be compatible with Text Completions. See our - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -214,8 +218,6 @@ Future models and features will not be compatible with Text Completions. See our - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - - `CompletionCreateParamsNonStreaming extends CompletionCreateParamsBase` - `stream?: false` @@ -256,11 +258,15 @@ Future models and features will not be compatible with Text Completions. See our See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -348,7 +354,7 @@ const client = new Anthropic({ const completion = await client.completions.create({ max_tokens_to_sample: 256, - model: 'claude-opus-4-6', + model: 'claude-mythos-preview', prompt: '\n\nHuman: Hello, world!\n\nAssistant:', }); @@ -377,11 +383,15 @@ console.log(completion.id); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` diff --git a/content/en/api/typescript/completions/create.md b/content/en/api/typescript/completions/create.md index 79ec54874..2bd1c248e 100644 --- a/content/en/api/typescript/completions/create.md +++ b/content/en/api/typescript/completions/create.md @@ -28,11 +28,15 @@ Future models and features will not be compatible with Text Completions. See our See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -168,7 +172,7 @@ Future models and features will not be compatible with Text Completions. See our - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -212,8 +216,6 @@ Future models and features will not be compatible with Text Completions. See our - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - - `CompletionCreateParamsNonStreaming extends CompletionCreateParamsBase` - `stream?: false` @@ -254,11 +256,15 @@ Future models and features will not be compatible with Text Completions. See our See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -346,7 +352,7 @@ const client = new Anthropic({ const completion = await client.completions.create({ max_tokens_to_sample: 256, - model: 'claude-opus-4-6', + model: 'claude-mythos-preview', prompt: '\n\nHuman: Hello, world!\n\nAssistant:', }); diff --git a/content/en/api/typescript/messages.md b/content/en/api/typescript/messages.md index 2d733d205..68f94e9eb 100644 --- a/content/en/api/typescript/messages.md +++ b/content/en/api/typescript/messages.md @@ -2309,11 +2309,15 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -4554,11 +4558,15 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -7074,11 +7082,15 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -8537,7 +8549,7 @@ const client = new Anthropic({ const messageTokensCount = await client.messages.countTokens({ messages: [{ content: 'string', role: 'user' }], - model: 'claude-opus-4-6', + model: 'claude-mythos-preview', }); console.log(messageTokensCount.input_tokens); @@ -14233,11 +14245,15 @@ console.log(messageTokensCount.input_tokens); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -17760,17 +17776,21 @@ console.log(messageTokensCount.input_tokens); ### Model -- `Model = "claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more | (string & {})` +- `Model = "claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more | (string & {})` The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -19637,11 +19657,15 @@ console.log(messageTokensCount.input_tokens); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -20569,11 +20593,15 @@ console.log(messageTokensCount.input_tokens); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -29662,11 +29690,15 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -32459,11 +32491,15 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -33725,11 +33761,15 @@ console.log(messageBatchIndividualResponse.custom_id); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -34785,11 +34825,15 @@ console.log(messageBatchIndividualResponse.custom_id); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -35807,11 +35851,15 @@ console.log(messageBatchIndividualResponse.custom_id); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` diff --git a/content/en/api/typescript/messages/batches.md b/content/en/api/typescript/messages/batches.md index 2b8ac9e1f..f4cbf7bad 100644 --- a/content/en/api/typescript/messages/batches.md +++ b/content/en/api/typescript/messages/batches.md @@ -2323,11 +2323,15 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -5120,11 +5124,15 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -6386,11 +6394,15 @@ console.log(messageBatchIndividualResponse.custom_id); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -7446,11 +7458,15 @@ console.log(messageBatchIndividualResponse.custom_id); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -8468,11 +8484,15 @@ console.log(messageBatchIndividualResponse.custom_id); See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` diff --git a/content/en/api/typescript/messages/batches/create.md b/content/en/api/typescript/messages/batches/create.md index 0798727d8..cea66b870 100644 --- a/content/en/api/typescript/messages/batches/create.md +++ b/content/en/api/typescript/messages/batches/create.md @@ -2321,11 +2321,15 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` diff --git a/content/en/api/typescript/messages/batches/results.md b/content/en/api/typescript/messages/batches/results.md index 191117e46..ece7b2978 100644 --- a/content/en/api/typescript/messages/batches/results.md +++ b/content/en/api/typescript/messages/batches/results.md @@ -747,11 +747,15 @@ Learn more about the Message Batches API in our [user guide](https://docs.claude See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` diff --git a/content/en/api/typescript/messages/count_tokens.md b/content/en/api/typescript/messages/count_tokens.md index dd426d2f6..ede119508 100644 --- a/content/en/api/typescript/messages/count_tokens.md +++ b/content/en/api/typescript/messages/count_tokens.md @@ -2297,11 +2297,15 @@ Learn more about token counting in our [user guide](https://docs.claude.com/en/d See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -3760,7 +3764,7 @@ const client = new Anthropic({ const messageTokensCount = await client.messages.countTokens({ messages: [{ content: 'string', role: 'user' }], - model: 'claude-opus-4-6', + model: 'claude-mythos-preview', }); console.log(messageTokensCount.input_tokens); diff --git a/content/en/api/typescript/messages/create.md b/content/en/api/typescript/messages/create.md index 76b1255d7..67ab39cf7 100644 --- a/content/en/api/typescript/messages/create.md +++ b/content/en/api/typescript/messages/create.md @@ -2307,11 +2307,15 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` @@ -4552,11 +4556,15 @@ Learn more about the Messages API in our [user guide](https://docs.claude.com/en See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options. - - `"claude-opus-4-6" | "claude-sonnet-4-6" | "claude-haiku-4-5" | 12 more` + - `"claude-mythos-preview" | "claude-opus-4-6" | "claude-sonnet-4-6" | 13 more` + + - `"claude-mythos-preview"` + + New class of intelligence, strongest in coding and cybersecurity - `"claude-opus-4-6"` - Most intelligent model for building agents and coding + Frontier intelligence for long-running agents and coding - `"claude-sonnet-4-6"` diff --git a/content/en/api/typescript/models.md b/content/en/api/typescript/models.md index 6158278c5..cff7797c6 100644 --- a/content/en/api/typescript/models.md +++ b/content/en/api/typescript/models.md @@ -34,7 +34,7 @@ The Models API response can be used to determine which models are available for - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -78,8 +78,6 @@ The Models API response can be used to determine which models are available for - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `ModelInfo` @@ -303,7 +301,7 @@ The Models API response can be used to determine information about a specific mo - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -347,8 +345,6 @@ The Models API response can be used to determine information about a specific mo - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `ModelInfo` diff --git a/content/en/api/typescript/models/list.md b/content/en/api/typescript/models/list.md index c2a0455fb..d31c9b205 100644 --- a/content/en/api/typescript/models/list.md +++ b/content/en/api/typescript/models/list.md @@ -32,7 +32,7 @@ The Models API response can be used to determine which models are available for - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -76,8 +76,6 @@ The Models API response can be used to determine which models are available for - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `ModelInfo` diff --git a/content/en/api/typescript/models/retrieve.md b/content/en/api/typescript/models/retrieve.md index 505aba597..4ed6a72ec 100644 --- a/content/en/api/typescript/models/retrieve.md +++ b/content/en/api/typescript/models/retrieve.md @@ -22,7 +22,7 @@ The Models API response can be used to determine information about a specific mo - `(string & {})` - - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 19 more` + - `"message-batches-2024-09-24" | "prompt-caching-2024-07-31" | "computer-use-2024-10-22" | 18 more` - `"message-batches-2024-09-24"` @@ -66,8 +66,6 @@ The Models API response can be used to determine information about a specific mo - `"output-300k-2026-03-24"` - - `"user-profiles-2026-03-24"` - ### Returns - `ModelInfo` diff --git a/content/en/api/versioning.md b/content/en/api/versioning.md index 14173ef02..7e328a32f 100644 --- a/content/en/api/versioning.md +++ b/content/en/api/versioning.md @@ -4,7 +4,7 @@ When making API requests, you must send an `anthropic-version` request header. F --- -For any given API version, we will preserve: +For any given version with the Messages API, we will preserve: * Existing input parameters * Existing output parameters diff --git a/content/en/build-with-claude/adaptive-thinking.md b/content/en/build-with-claude/adaptive-thinking.md index cef064344..0b44b78ec 100644 --- a/content/en/build-with-claude/adaptive-thinking.md +++ b/content/en/build-with-claude/adaptive-thinking.md @@ -62,6 +62,19 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant messages create \ + --model claude-opus-4-6 \ + --max-tokens 16000 \ + --thinking '{type: adaptive}' \ + --message '{role: user, content: Explain why the sum of two even numbers is always even.}' \ + --transform content --format jsonl | + jq -r ' + if .type == "thinking" then "\nThinking: \(.thinking)" + elif .type == "text" then "\nResponse: \(.text)" + else empty end' +``` + ```python Python hidelines={1..2} import anthropic @@ -322,6 +335,21 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant messages create \ + --transform 'content.0.text' --format yaml <<'YAML' +model: claude-opus-4-6 +max_tokens: 16000 +thinking: + type: adaptive +output_config: + effort: medium +messages: + - role: user + content: What is the capital of France? +YAML +``` + ```python Python hidelines={1..2} import anthropic @@ -507,6 +535,14 @@ puts message.content.first.text Adaptive thinking works seamlessly with [streaming](/docs/en/build-with-claude/streaming). Thinking blocks are streamed via `thinking_delta` events just like manual thinking mode: +```bash CLI +ant messages create --stream --format jsonl \ + --model claude-opus-4-6 \ + --max-tokens 16000 \ + --thinking '{type: adaptive}' \ + --message '{role: user, content: What is the greatest common divisor of 1071 and 462?}' +``` + ```python Python hidelines={1..2} import anthropic diff --git a/content/en/build-with-claude/api-and-data-retention.md b/content/en/build-with-claude/api-and-data-retention.md index 699f03e06..480ead250 100644 --- a/content/en/build-with-claude/api-and-data-retention.md +++ b/content/en/build-with-claude/api-and-data-retention.md @@ -274,5 +274,4 @@ To request a ZDR arrangement, contact the [Anthropic sales team](https://claude. - [Prompt caching](/docs/en/build-with-claude/prompt-caching) - [Batch processing](/docs/en/build-with-claude/batch-processing) - [Files API](/docs/en/api/files-create) -- [Agent SDK Sessions](/docs/en/agent-sdk/sessions) - [Trust Center](https://trust.anthropic.com/resources) \ No newline at end of file diff --git a/content/en/build-with-claude/batch-processing.md b/content/en/build-with-claude/batch-processing.md index d906066e1..64eff0181 100644 --- a/content/en/build-with-claude/batch-processing.md +++ b/content/en/build-with-claude/batch-processing.md @@ -19,7 +19,7 @@ This feature is **not** eligible for [Zero Data Retention (ZDR)](/docs/en/build- # Message Batches API -The Message Batches API is a powerful, cost-effective way to asynchronously process large volumes of [Messages](/docs/en/api/messages) requests. This approach is well-suited to tasks that do not require immediate responses, with most batches finishing in less than 1 hour while reducing costs by 50% and increasing throughput. +The Message Batches API is a powerful, cost-effective way to asynchronously process large volumes of [Messages](/docs/en/api/messages/create) requests. This approach is well-suited to tasks that do not require immediate responses, with most batches finishing in less than 1 hour while reducing costs by 50% and increasing throughput. You can [explore the API reference directly](/docs/en/api/creating-message-batches), in addition to this guide. @@ -91,7 +91,7 @@ The Batches API offers significant cost savings. All usage is charged at 50% of A Message Batch is composed of a list of requests to create a Message. The shape of an individual request is comprised of: - A unique `custom_id` for identifying the Messages request -- A `params` object with the standard [Messages API](/docs/en/api/messages) parameters +- A `params` object with the standard [Messages API](/docs/en/api/messages/create) parameters You can [create a batch](/docs/en/api/creating-message-batches) by passing this list into the `requests` parameter: @@ -129,6 +129,26 @@ curl https://api.anthropic.com/v1/messages/batches \ }' ``` +```bash CLI +ant messages:batches create <<'YAML' +requests: + - custom_id: my-first-request + params: + model: claude-opus-4-6 + max_tokens: 1024 + messages: + - role: user + content: Hello, world + - custom_id: my-second-request + params: + model: claude-opus-4-6 + max_tokens: 1024 + messages: + - role: user + content: Hi again, friend +YAML +``` + ```python Python hidelines={1} import anthropic from anthropic.types.message_create_params import MessageCreateParamsNonStreaming @@ -411,12 +431,12 @@ In this example, two separate requests are batched together for asynchronous pro **Test your batch requests with the Messages API** -Validation of the `params` object for each message request is performed asynchronously, and validation errors are returned when processing of the entire batch has ended. You can ensure that you are building your input correctly by verifying your request shape with the [Messages API](/docs/en/api/messages) first. +Validation of the `params` object for each message request is performed asynchronously, and validation errors are returned when processing of the entire batch has ended. You can ensure that you are building your input correctly by verifying your request shape with the [Messages API](/docs/en/api/messages/create) first. When a batch is first created, the response will have a processing status of `in_progress`. -```json JSON +```json Output { "id": "msgbatch_01HkcTjaV5uDC8jWR4ZsDV8d", "type": "message_batch", @@ -475,6 +495,32 @@ done echo "Batch $MESSAGE_BATCH_ID has finished processing" ``` +```bash CLI hidelines={2..14,19} +#!/bin/bash +MESSAGE_BATCH_ID=$(ant messages:batches create \ + --transform id --format yaml <<'YAML' +requests: + - custom_id: test-1 + params: + model: claude-opus-4-6 + max_tokens: 100 + messages: + - role: user + content: Hi +YAML +) + +until [[ $(ant messages:batches retrieve \ + --message-batch-id "$MESSAGE_BATCH_ID" \ + --transform processing_status --format yaml) == "ended" ]]; do + echo "Batch $MESSAGE_BATCH_ID is still processing..." + break + sleep 60 +done + +echo "Batch $MESSAGE_BATCH_ID has finished processing" +``` + ```python Python nocheck hidelines={1} import anthropic import time @@ -687,6 +733,11 @@ while [ "$has_more" = true ]; do done ``` +```bash CLI +# Automatically fetches more pages as needed +ant messages:batches list --limit 20 +``` + ```python Python hidelines={1..2} import anthropic @@ -855,7 +906,7 @@ curl "https://api.anthropic.com/v1/messages/batches/msgbatch_01HkcTjaV5uDC8jWR4Z echo "Success! $custom_id" ;; "errored") - if [ "$error_type" = "invalid_request" ]; then + if [ "$error_type" = "invalid_request_error" ]; then # Request body must be fixed before re-sending request echo "Validation error: $custom_id" else @@ -872,6 +923,29 @@ curl "https://api.anthropic.com/v1/messages/batches/msgbatch_01HkcTjaV5uDC8jWR4Z ``` +```bash CLI +ant messages:batches results \ + --message-batch-id msgbatch_01HkcTjaV5uDC8jWR4ZsDV8d \ + --transform '{custom_id,"type":result.type,"error":result.error.error.type}' \ + --format jsonl \ + | while IFS= read -r line; do + custom_id=${line#*'"custom_id":"'}; custom_id=${custom_id%%'"'*} + case "$line" in + *'"type":"succeeded"'*) + printf 'Success! %s\n' "$custom_id" ;; + *'"type":"errored"'*) + case "$line" in + *'"error":"invalid_request_error"'*) + printf 'Validation error %s\n' "$custom_id" ;; + *) + printf 'Server error %s\n' "$custom_id" ;; + esac ;; + *'"type":"expired"'*) + printf 'Request expired %s\n' "$custom_id" ;; + esac + done +``` + ```python Python nocheck hidelines={1..2} import anthropic @@ -885,7 +959,7 @@ for result in client.messages.batches.results( case "succeeded": print(f"Success! {result.custom_id}") case "errored": - if result.result.error.type == "invalid_request": + if result.result.error.error.type == "invalid_request_error": # Request body must be fixed before re-sending request print(f"Validation error {result.custom_id}") else: @@ -1132,6 +1206,23 @@ curl --request POST https://api.anthropic.com/v1/messages/batches/$MESSAGE_BATCH --header "anthropic-version: 2023-06-01" ``` +```bash CLI hidelines={2..13} +#!/bin/bash +MESSAGE_BATCH_ID=$(ant messages:batches create \ + --transform id --format yaml <<'YAML' +requests: + - custom_id: test-1 + params: + model: claude-opus-4-6 + max_tokens: 100 + messages: + - role: user + content: Hi +YAML +) +ant messages:batches cancel --message-batch-id "$MESSAGE_BATCH_ID" +``` + ```python Python nocheck hidelines={1..2} import anthropic @@ -1242,7 +1333,7 @@ puts message_batch The response will show the batch in a `canceling` state: -```json JSON +```json Output { "id": "msgbatch_013Zva2CMHLNnXjNJJKqJ2EF", "type": "message_batch", @@ -1330,6 +1421,46 @@ curl https://api.anthropic.com/v1/messages/batches \ }' ``` +```bash CLI +ant messages:batches create <<'YAML' +requests: + - custom_id: my-first-request + params: + model: claude-opus-4-6 + max_tokens: 1024 + system: + - type: text + text: > + You are an AI assistant tasked with analyzing literary works. Your + goal is to provide insightful commentary on themes, characters, and + writing style. + - type: text + text: "" + cache_control: + type: ephemeral + messages: + - role: user + content: Analyze the major themes in Pride and Prejudice. + - custom_id: my-second-request + params: + model: claude-opus-4-6 + max_tokens: 1024 + system: + - type: text + text: > + You are an AI assistant tasked with analyzing literary works. Your + goal is to provide insightful commentary on themes, characters, and + writing style. + - type: text + text: "" + cache_control: + type: ephemeral + messages: + - role: user + content: Write a summary of Pride and Prejudice. +YAML +``` + ```python Python hidelines={1} import anthropic from anthropic.types.message_create_params import MessageCreateParamsNonStreaming @@ -1802,6 +1933,22 @@ curl https://api.anthropic.com/v1/messages/batches \ }' ``` +```bash CLI +ant beta:messages:batches create --beta output-300k-2026-03-24 <<'YAML' +requests: + - custom_id: long-form-request + params: + model: claude-opus-4-6 + max_tokens: 300000 + messages: + - role: user + content: >- + Write a comprehensive technical guide to building distributed + systems, covering architecture patterns, consistency models, + fault tolerance, and operational best practices. +YAML +``` + ```python Python hidelines={1} import anthropic from anthropic.types.beta.message_create_params import MessageCreateParamsNonStreaming diff --git a/content/en/build-with-claude/citations.md b/content/en/build-with-claude/citations.md index 65f1d9209..5a6143f5b 100644 --- a/content/en/build-with-claude/citations.md +++ b/content/en/build-with-claude/citations.md @@ -51,6 +51,27 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant messages create <<'YAML' +model: claude-opus-4-6 +max_tokens: 1024 +messages: + - role: user + content: + - type: document + source: + type: text + media_type: text/plain + data: The grass is green. The sky is blue. + title: My Document + context: This is a trustworthy document. + citations: + enabled: true + - type: text + text: What color is the grass and sky? +YAML +``` + ```python Python hidelines={1..2} import anthropic @@ -239,6 +260,27 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant messages create \ + --model claude-opus-4-6 \ + --max-tokens 1024 <<'YAML' +messages: + - role: user + content: + - type: document + source: + type: text + media_type: text/plain + data: This is a very long document with thousands of words... + citations: + enabled: true + cache_control: + type: ephemeral + - type: text + text: What does this document say about API features? +YAML +``` + ```python Python hidelines={1..2} import anthropic diff --git a/content/en/build-with-claude/claude-in-microsoft-foundry.md b/content/en/build-with-claude/claude-in-microsoft-foundry.md index 3f27eb143..5137d7b92 100644 --- a/content/en/build-with-claude/claude-in-microsoft-foundry.md +++ b/content/en/build-with-claude/claude-in-microsoft-foundry.md @@ -51,7 +51,7 @@ dotnet add package Anthropic.Foundry ```kotlin -implementation("com.anthropic:anthropic-java-foundry:2.18.0") +implementation("com.anthropic:anthropic-java-foundry:2.20.0") ``` @@ -59,7 +59,7 @@ implementation("com.anthropic:anthropic-java-foundry:2.18.0") com.anthropic anthropic-java-foundry - 2.18.0 + 2.20.0 ``` @@ -149,6 +149,21 @@ curl https://{resource}.services.ai.azure.com/anthropic/v1/messages \ ``` + + +```bash CLI nocheck +# ant reads ANTHROPIC_API_KEY and sends it as x-api-key, which Foundry accepts +export ANTHROPIC_API_KEY="YOUR_AZURE_API_KEY" + +ant messages create \ + --base-url https://example-resource.services.ai.azure.com/anthropic \ + --model claude-opus-4-6 \ + --max-tokens 1024 \ + --message '{role: user, content: "Hello!"}' \ + --transform content +``` + + ```python nocheck @@ -481,7 +496,7 @@ Claude Opus 4.6 and Claude Sonnet 4.6 have a [1M-token context window](/docs/en/ ## API responses -API responses from Claude on Foundry follow the standard [Claude API response format](/docs/en/api/messages). This includes the `usage` object in response bodies, which provides detailed token consumption information for your requests. The `usage` object is consistent across all platforms (first-party API, Foundry, Amazon Bedrock, and Google Vertex AI). +API responses from Claude on Foundry follow the standard [Claude API response format](/docs/en/api/messages/create). This includes the `usage` object in response bodies, which provides detailed token consumption information for your requests. The `usage` object is consistent across all platforms (first-party API, Foundry, Amazon Bedrock, and Google Vertex AI). For details on response headers specific to Foundry, see the [correlation request IDs section](#correlation-request-ids). diff --git a/content/en/build-with-claude/claude-on-amazon-bedrock.md b/content/en/build-with-claude/claude-on-amazon-bedrock.md index 10b14a741..b5bebbe31 100644 --- a/content/en/build-with-claude/claude-on-amazon-bedrock.md +++ b/content/en/build-with-claude/claude-on-amazon-bedrock.md @@ -54,14 +54,14 @@ go get github.com/anthropics/anthropic-sdk-go/bedrock ```groovy Gradle -implementation("com.anthropic:anthropic-java-bedrock:2.18.0") +implementation("com.anthropic:anthropic-java-bedrock:2.20.0") ``` ```xml Maven com.anthropic anthropic-java-bedrock - 2.18.0 + 2.20.0 ``` @@ -310,6 +310,10 @@ The following examples show how to print a list of all the Claude models availab The following examples show how to generate text from Claude on Bedrock: + ```bash CLI + # The ant CLI does not yet support Amazon Bedrock. + ``` + ```python Python nocheck from anthropic import AnthropicBedrock @@ -682,6 +686,9 @@ This applies to Claude Sonnet 4.5 and future models only. Older models (Claude S The model IDs for Claude Sonnet 4.5 and 4 already include the `global.` prefix: +```bash CLI +# The ant CLI does not yet support Amazon Bedrock. +``` ```python Python nocheck from anthropic import AnthropicBedrock @@ -813,6 +820,9 @@ message = client.messages.create( To use regional endpoints, remove the `global.` prefix from the model ID: +```bash CLI +# The ant CLI does not yet support Amazon Bedrock. +``` ```python Python nocheck from anthropic import AnthropicBedrock diff --git a/content/en/build-with-claude/claude-on-vertex-ai.md b/content/en/build-with-claude/claude-on-vertex-ai.md index c50f7d768..c10734a5f 100644 --- a/content/en/build-with-claude/claude-on-vertex-ai.md +++ b/content/en/build-with-claude/claude-on-vertex-ai.md @@ -4,7 +4,7 @@ Anthropic's Claude models are now generally available through [Vertex AI](https: --- -The Vertex API for accessing Claude is nearly-identical to the [Messages API](/docs/en/api/messages) and supports all of the same options, with two key differences: +The Vertex API for accessing Claude is nearly-identical to the [Messages API](/docs/en/api/messages/create) and supports all of the same options, with two key differences: * In Vertex, `model` is not passed in the request body. Instead, it is specified in the Google Cloud endpoint URL. * In Vertex, `anthropic_version` is passed in the request body (rather than as a header), and must be set to the value `vertex-2023-10-16`. @@ -45,14 +45,14 @@ go get github.com/anthropics/anthropic-sdk-go ```groovy Gradle -implementation("com.anthropic:anthropic-java-vertex:2.18.0") +implementation("com.anthropic:anthropic-java-vertex:2.20.0") ``` ```xml Maven com.anthropic anthropic-java-vertex - 2.18.0 + 2.20.0 ``` @@ -151,6 +151,10 @@ The following examples show how to generate text from Claude on Vertex AI: }' ``` + ```bash CLI + # The ant CLI does not yet support Vertex AI. + ``` + ```python Python nocheck from anthropic import AnthropicVertex @@ -397,6 +401,10 @@ Set the `region` parameter to `"global"` when initializing the client: +```bash CLI +# The ant CLI does not yet support Vertex AI. +``` + ```python Python nocheck from anthropic import AnthropicVertex @@ -725,6 +733,10 @@ Specify a specific region like `"us-east1"` or `"europe-west1"`: +```bash CLI +# The ant CLI does not yet support Vertex AI. +``` + ```python Python nocheck from anthropic import AnthropicVertex diff --git a/content/en/build-with-claude/compaction.md b/content/en/build-with-claude/compaction.md index ae17ef859..ec53cf666 100644 --- a/content/en/build-with-claude/compaction.md +++ b/content/en/build-with-claude/compaction.md @@ -80,6 +80,19 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant beta:messages create --beta compact-2026-01-12 <<'YAML' +model: claude-opus-4-6 +max_tokens: 4096 +messages: + - role: user + content: Help me build a website +context_management: + edits: + - type: compact_20260112 +YAML +``` + ```python Python hidelines={1..2} import anthropic @@ -313,6 +326,22 @@ puts response Configure when compaction triggers using the `trigger` parameter: +```bash CLI +ant beta:messages create --beta compact-2026-01-12 <<'YAML' +model: claude-opus-4-6 +max_tokens: 4096 +messages: + - role: user + content: Hello, Claude +context_management: + edits: + - type: compact_20260112 + trigger: + type: input_tokens + value: 150000 +YAML +``` + ```python Python hidelines={1..2} import anthropic @@ -528,6 +557,22 @@ You have written a partial transcript for the initial task above. Please write a You can provide custom instructions via the `instructions` parameter to replace this prompt entirely. Custom instructions don't supplement the default; they completely replace it: +```bash CLI +ant beta:messages create --beta compact-2026-01-12 <<'YAML' +model: claude-opus-4-6 +max_tokens: 4096 +messages: + - role: user + content: Hello, Claude +context_management: + edits: + - type: compact_20260112 + instructions: >- + Focus on preserving code snippets, variable names, and + technical decisions. +YAML +``` + ```python Python hidelines={1..2} import anthropic @@ -743,6 +788,43 @@ Use `pause_after_compaction` to pause the API after generating the compaction su When enabled, the API returns a message with the `compaction` stop reason after generating the compaction block: +```bash CLI +ant beta:messages create --beta compact-2026-01-12 \ + --transform '{stop_reason,content}' --format jsonl <<'YAML' > resp.json +model: claude-opus-4-6 +max_tokens: 4096 +messages: + - role: user + content: "Hello, Claude" +context_management: + edits: + - type: compact_20260112 + pause_after_compaction: true +YAML + +# Check if compaction triggered a pause +if grep -q '"stop_reason":"compaction"' resp.json; then + # Response contains only the compaction block + RESP=$(cat resp.json) + CONTENT="${RESP#*\"content\":}" + printf '%s' "${CONTENT%\}}" > content.json + + # Continue the request + ant beta:messages create --beta compact-2026-01-12 < /dev/null +model: claude-opus-4-6 +max_tokens: 4096 +messages: + - role: user + content: "Hello, Claude" + - role: assistant + content: $(cat content.json) +context_management: + edits: + - type: compact_20260112 +YAML +fi +``` + ```python Python hidelines={1..2} import anthropic @@ -1115,7 +1197,7 @@ When compaction is triggered, the API returns a `compaction` block at the start A long-running conversation may result in multiple compactions. The last compaction block reflects the final state of the prompt, replacing content prior to it with the generated summary. -```json +```json Output { "content": [ { @@ -1135,6 +1217,37 @@ A long-running conversation may result in multiple compactions. The last compact You must pass the `compaction` block back to the API on subsequent requests to continue the conversation with the shortened prompt. The simplest approach is to append the entire response content to your messages: +```bash CLI +ant beta:messages create --beta compact-2026-01-12 \ + --transform content --format jsonl <<'YAML' > content.json +model: claude-opus-4-6 +max_tokens: 4096 +messages: + - role: user + content: Hello, Claude +context_management: + edits: + - type: compact_20260112 +YAML + +# After receiving a response with a compaction block, append it as the +# assistant turn and continue the conversation +ant beta:messages create --beta compact-2026-01-12 < +```bash CLI +ant beta:messages create --stream --format jsonl \ + --beta compact-2026-01-12 <<'YAML' +model: claude-opus-4-6 +max_tokens: 4096 +messages: + - role: user + content: Hello, Claude +context_management: + edits: + - type: compact_20260112 +YAML +``` + ```python Python hidelines={1..2} import anthropic @@ -1765,6 +1892,24 @@ To maximize cache hit rates, add a `cache_control` breakpoint at the end of your - Only the compaction summary needs to be written as a new cache entry +```bash CLI +ant beta:messages create --beta compact-2026-01-12 <<'YAML' +model: claude-opus-4-6 +max_tokens: 4096 +system: + - type: text + text: You are a helpful coding assistant... + cache_control: + type: ephemeral +messages: + - role: user + content: Hello, Claude +context_management: + edits: + - type: compact_20260112 +YAML +``` + ```python Python hidelines={1..2} import anthropic @@ -1988,7 +2133,7 @@ This approach is particularly beneficial for long system prompts, as they remain Compaction requires an additional sampling step, which contributes to rate limits and billing. The API returns detailed usage information in the response: -```json +```json Output { "usage": { "input_tokens": 23000, @@ -2028,6 +2173,30 @@ When using server tools (like web search), the compaction trigger is checked at The token counting endpoint (`/v1/messages/count_tokens`) applies existing `compaction` blocks in your prompt but does not trigger new compactions. Use it to check your effective token count after previous compactions: +```bash CLI +cat > request.yaml <<'YAML' +model: claude-opus-4-6 +messages: + - role: user + content: Hello, Claude +context_management: + edits: + - type: compact_20260112 +YAML + +CURRENT=$(ant beta:messages count-tokens \ + --beta compact-2026-01-12 \ + --transform input_tokens --format yaml < request.yaml) + +ORIGINAL=$(ant beta:messages count-tokens \ + --beta compact-2026-01-12 \ + --transform context_management.original_input_tokens \ + --format yaml < request.yaml) + +printf 'Current tokens: %s\n' "$CURRENT" +printf 'Original tokens: %s\n' "$ORIGINAL" +``` + ```python Python hidelines={1..2} import anthropic @@ -2206,6 +2375,26 @@ puts "Original tokens: #{count_response.context_management.original_input_tokens Here's a complete example of a long-running conversation with compaction: +```bash CLI +# The CLI handles individual turns; maintain the messages array in the +# calling script. See the SDK tabs for the full chat() loop. Single-turn +# request shape: +ant beta:messages create --beta compact-2026-01-12 \ + --transform 'content.#(type=="text").text' --format yaml <<'YAML' +model: claude-opus-4-6 +max_tokens: 4096 +messages: + - role: user + content: Help me build a Python web scraper +context_management: + edits: + - type: compact_20260112 + trigger: + type: input_tokens + value: 100000 +YAML +``` + ```python Python hidelines={1..2} import anthropic @@ -2528,6 +2717,27 @@ puts chat(client, messages, "Now add rate limiting and error handling") Here's an example that uses `pause_after_compaction` to preserve the prior exchange and the current user message (three messages total) verbatim instead of summarizing them: +```bash CLI +# The CLI handles individual turns; maintain the messages array in the +# calling script. See the SDK tabs for the full chat() loop with +# pause-and-preserve handling. Single-turn request shape: +ant beta:messages create --beta compact-2026-01-12 \ + --transform 'content.#(type=="text").text' --format yaml <<'YAML' +model: claude-opus-4-6 +max_tokens: 4096 +messages: + - role: user + content: Help me build a Python web scraper +context_management: + edits: + - type: compact_20260112 + trigger: + type: input_tokens + value: 100000 + pause_after_compaction: true +YAML +``` + ```python Python hidelines={1} import anthropic from typing import Any diff --git a/content/en/build-with-claude/context-editing.md b/content/en/build-with-claude/context-editing.md index d5e94e2ea..cd0d1aa10 100644 --- a/content/en/build-with-claude/context-editing.md +++ b/content/en/build-with-claude/context-editing.md @@ -102,6 +102,22 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant beta:messages create --beta context-management-2025-06-27 <<'YAML' +model: claude-opus-4-6 +max_tokens: 4096 +messages: + - role: user + content: Search for recent developments in AI +tools: + - type: web_search_20250305 + name: web_search +context_management: + edits: + - type: clear_tool_uses_20250919 +YAML +``` + ```python Python response = client.beta.messages.create( model="claude-opus-4-6", @@ -349,6 +365,37 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant beta:messages create --beta context-management-2025-06-27 <<'YAML' +model: claude-opus-4-6 +max_tokens: 4096 +messages: + - role: user + content: Create a simple command line calculator app using Python +tools: + - type: text_editor_20250728 + name: str_replace_based_edit_tool + max_characters: 10000 + - type: web_search_20250305 + name: web_search + max_uses: 3 +context_management: + edits: + - type: clear_tool_uses_20250919 + trigger: + type: input_tokens + value: 30000 + keep: + type: tool_uses + value: 3 + clear_at_least: + type: input_tokens + value: 5000 + exclude_tools: + - web_search +YAML +``` + ```python Python response = client.beta.messages.create( model="claude-opus-4-6", @@ -766,6 +813,25 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant beta:messages create --beta context-management-2025-06-27 <<'YAML' +model: claude-opus-4-6 +max_tokens: 16000 +messages: + - role: user + content: Hello +thinking: + type: enabled + budget_tokens: 10000 +context_management: + edits: + - type: clear_thinking_20251015 + keep: + type: thinking_turns + value: 2 +YAML +``` + ```python Python nocheck response = client.beta.messages.create( model="claude-opus-4-6", @@ -1042,6 +1108,35 @@ When using multiple strategies, the `clear_thinking_20251015` strategy must be l +```bash CLI +ant beta:messages create --beta context-management-2025-06-27 <<'YAML' +model: claude-opus-4-6 +max_tokens: 16000 +thinking: + type: enabled + budget_tokens: 10000 +messages: + - role: user + content: Hello +tools: + - type: web_search_20250305 + name: web_search +context_management: + edits: + - type: clear_thinking_20251015 + keep: + type: thinking_turns + value: 2 + - type: clear_tool_uses_20250919 + trigger: + type: input_tokens + value: 50000 + keep: + type: tool_uses + value: 5 +YAML +``` + ```python Python nocheck response = client.beta.messages.create( model="claude-opus-4-6", @@ -1364,7 +1459,7 @@ puts response You can see which context edits were applied to your request using the `context_management` response field, along with helpful statistics about the content and input tokens cleared. -```json Response +```json Output { "id": "msg_013Zva2CMHLNnXjNJJKqJ2EF", "type": "message", @@ -1453,6 +1548,38 @@ curl https://api.anthropic.com/v1/messages/count_tokens \ }' ``` +```bash CLI +cat > request.yaml <<'YAML' +model: claude-opus-4-6 +messages: + - role: user + content: Continue our conversation... +tools: [] +context_management: + edits: + - type: clear_tool_uses_20250919 + trigger: + type: input_tokens + value: 30000 + keep: + type: tool_uses + value: 5 +YAML + +ORIGINAL=$(ant beta:messages count-tokens \ + --beta context-management-2025-06-27 \ + --transform context_management.original_input_tokens \ + --format yaml < request.yaml) + +INPUT_TOKENS=$(ant beta:messages count-tokens \ + --beta context-management-2025-06-27 \ + --transform input_tokens --format yaml < request.yaml) + +printf 'Original tokens: %s\n' "$ORIGINAL" +printf 'After clearing: %s\n' "$INPUT_TOKENS" +printf 'Savings: %s tokens\n' "$((ORIGINAL - INPUT_TOKENS))" +``` + ```python Python nocheck response = client.beta.messages.count_tokens( model="claude-opus-4-6", @@ -1711,7 +1838,7 @@ puts "Savings: #{response.context_management.original_input_tokens - response.in -```json Response +```json Output { "input_tokens": 25000, "context_management": { @@ -1738,6 +1865,22 @@ To use both features together, enable them in your API request: +```bash CLI +ant beta:messages create --beta context-management-2025-06-27 <<'YAML' +model: claude-opus-4-6 +max_tokens: 4096 +messages: + - role: user + content: Hello +tools: + - type: memory_20250818 + name: memory +context_management: + edits: + - type: clear_tool_uses_20250919 +YAML +``` + ```python Python nocheck response = client.beta.messages.create( model="claude-opus-4-6", @@ -1967,6 +2110,13 @@ When compaction is enabled, the SDK monitors token usage after each model respon Add `compaction_control` to your `tool_runner` call to enable automatic summarization when token usage exceeds the threshold. + + + +The CLI does not include a `tool_runner` helper. Use [server-side compaction](/docs/en/build-with-claude/compaction) instead, which handles compaction on Anthropic's servers without SDK-side integration. + + + ```python Python hidelines={1..10} @@ -2299,7 +2449,7 @@ When using server-side tools, the SDK may incorrectly calculate token usage, cau For example, after a web search operation, the API response might show: -```json +```json Output { "usage": { "input_tokens": 63000, diff --git a/content/en/build-with-claude/data-residency.md b/content/en/build-with-claude/data-residency.md index 11a669312..742464d4a 100644 --- a/content/en/build-with-claude/data-residency.md +++ b/content/en/build-with-claude/data-residency.md @@ -41,6 +41,15 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant messages create \ + --model claude-opus-4-6 \ + --max-tokens 1024 \ + --inference-geo us \ + --message '{role: user, content: "Summarize the key points of this document."}' \ + --transform '{content.0.text,usage.inference_geo}' --format yaml +``` + ```python Python hidelines={1..2} import anthropic @@ -90,7 +99,7 @@ console.log(`Inference geo: ${response.usage.inference_geo}`); The response `usage` object includes an `inference_geo` field indicating where inference ran: -```json +```json Output { "usage": { "input_tokens": 25, diff --git a/content/en/build-with-claude/effort.md b/content/en/build-with-claude/effort.md index 5f8f99562..9d9ae4f3f 100644 --- a/content/en/build-with-claude/effort.md +++ b/content/en/build-with-claude/effort.md @@ -80,6 +80,18 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant messages create --transform 'content.0.text' --format yaml <<'YAML' +model: claude-opus-4-6 +max_tokens: 4096 +messages: + - role: user + content: Analyze the trade-offs between microservices and monolithic architectures +output_config: + effort: medium +YAML +``` + ```python Python hidelines={1..2} import anthropic diff --git a/content/en/build-with-claude/extended-thinking.md b/content/en/build-with-claude/extended-thinking.md index eeca50a20..fa3175c12 100644 --- a/content/en/build-with-claude/extended-thinking.md +++ b/content/en/build-with-claude/extended-thinking.md @@ -50,7 +50,7 @@ Here's an example of the default response format: } ``` -For more information about the response format of extended thinking, see the [Messages API Reference](/docs/en/api/messages). +For more information about the response format of extended thinking, see the [Messages API Reference](/docs/en/api/messages/create). ## How to use extended thinking @@ -79,6 +79,15 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant messages create \ + --transform content --format yaml \ + --model claude-sonnet-4-6 \ + --max-tokens 16000 \ + --thinking '{type: enabled, budget_tokens: 10000}' \ + --message '{role: user, content: Are there an infinite number of prime numbers such that n mod 4 == 3?}' +``` + ```python Python hidelines={1..2} import anthropic @@ -394,6 +403,17 @@ curl https://api.anthropic.com/v1/messages \ ``` + +```bash CLI +ant messages create \ + --model claude-sonnet-4-6 \ + --max-tokens 16000 \ + --transform content --format yaml \ + --thinking '{type: enabled, budget_tokens: 10000, display: omitted}' \ + --message '{role: user, content: "What is 27 * 453?"}' +``` + + ```python Python hidelines={1..2} import anthropic @@ -729,7 +749,7 @@ end When `display: "omitted"` is set, the response contains `thinking` blocks with an empty `thinking` field: -```json +```json Output { "content": [ { @@ -783,6 +803,14 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant messages create --stream --format jsonl \ + --model claude-sonnet-4-6 \ + --max-tokens 16000 \ + --thinking '{type: enabled, budget_tokens: 10000}' \ + --message '{role: user, content: What is the greatest common divisor of 1071 and 462?}' +``` + ```python Python hidelines={1..2} import anthropic @@ -1128,7 +1156,7 @@ end Example streaming output: -```sse +```sse Output event: message_start data: {"type": "message_start", "message": {"id": "msg_01...", "type": "message", "role": "assistant", "content": [], "model": "claude-sonnet-4-6", "stop_reason": null, "stop_sequence": null}} @@ -1169,7 +1197,7 @@ data: {"type": "message_stop"} When `display: "omitted"` is set, the thinking block opens, a single `signature_delta` arrives, and the block closes without any `thinking_delta` events. Text streaming begins immediately after: -```sse +```sse Output event: content_block_start data: {"type":"content_block_start","index":0,"content_block":{"type":"thinking","thinking":"","signature":""}} @@ -1252,6 +1280,29 @@ Toggling thinking modes also invalidates prompt caching for message history. For Here's a practical example showing how to preserve thinking blocks when providing tool results: +```bash CLI +ant messages create --transform content <<'YAML' +model: claude-sonnet-4-6 +max_tokens: 16000 +thinking: + type: enabled + budget_tokens: 10000 +tools: + - name: get_weather + description: Get current weather for a location + input_schema: + type: object + properties: + location: + type: string + required: + - location +messages: + - role: user + content: "What's the weather in Paris?" +YAML +``` + ```python Python weather_tool = { "name": "get_weather", @@ -1491,7 +1542,7 @@ puts message The API response includes thinking, text, and tool_use blocks: -```json +```json Output { "content": [ { @@ -1518,6 +1569,66 @@ The API response includes thinking, text, and tool_use blocks: Now let's continue the conversation and use the tool +```bash CLI +# First turn: capture the assistant content array (thinking + tool_use, +# with signatures intact) as compact JSON. +ASSISTANT_CONTENT=$(ant messages create \ + --transform content <<'YAML' +model: claude-sonnet-4-6 +max_tokens: 16000 +thinking: + type: enabled + budget_tokens: 10000 +tools: + - name: get_weather + description: Get the current weather in a given location + input_schema: + type: object + properties: + location: + type: string + description: The city and state + required: [location] +messages: + - role: user + content: What's the weather in Paris? +YAML +) + +TOOL_USE_ID=$(printf '%s' "$ASSISTANT_CONTENT" \ + | grep -o 'toolu_[A-Za-z0-9]*') + +# Second turn: pass the captured blocks back as the assistant message. +# The thinking block MUST accompany the tool_use block. +ant messages create < +```bash CLI +# Fetch ~10 kB of Pride and Prejudice for the cached system block +curl -s https://www.gutenberg.org/cache/epub/1342/pg1342.txt \ + | head -c 10000 > pride.txt + +# Emit a request body for the given thinking budget. Once CONTENT1 +# is populated (after the first turn), the assistant reply and a +# follow-up user message are appended so the conversation grows. +build_body() { + cat <- + You are an AI assistant that is tasked with literary analysis. + Analyze the following text carefully. + - type: text + text: "@./pride.txt" + cache_control: + type: ephemeral +messages: + - role: user + content: Analyze the tone of this passage. +YAML + if [[ -n "${CONTENT1:-}" ]]; then + printf ' - role: assistant\n content: %s\n' "$CONTENT1" + printf ' - role: user\n' + printf ' content: Analyze the characters in this passage.\n' + fi +} + +# First request (budget 4000): establishes the cache. Capture usage +# and content as two jsonl lines so the reply can be fed forward. +printf 'First request - establishing cache\n' +{ + read -r USAGE1 + read -r CONTENT1 +} < <(build_body 4000 \ + | ant messages create --transform '[usage,content]' --format jsonl) +printf 'First response usage: %s\n' "$USAGE1" + +# Second request: same budget, system-prompt cache hit expected. +printf '\nSecond request - same thinking parameters (cache hit expected)\n' +USAGE2=$(build_body 4000 \ + | ant messages create --transform usage --format jsonl) +printf 'Second response usage: %s\n' "$USAGE2" + +# Third request: budget changed to 8000. The cached system prompt +# still hits; only message-block caching is invalidated. +printf '\nThird request - different thinking parameters (cache miss for messages)\n' +USAGE3=$(build_body 8000 \ + | ant messages create --transform usage --format jsonl) +printf 'Third response usage: %s\n' "$USAGE3" +``` + ```python Python hidelines={1} from anthropic import Anthropic import requests @@ -2770,6 +2940,84 @@ puts "Third response usage: #{response3.usage}"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +```bash CLI +# Fetch the first ~10 kB of Pride and Prejudice for the cached prefix +curl -sL 'https://www.gutenberg.org/cache/epub/1342/pg1342.txt' \ + | head -c 10000 > book.txt + +# Call 1: thinking budget 4000, writes the cache +USAGE=$(ant messages create \ + --model claude-sonnet-4-6 --max-tokens 20000 \ + --transform usage <<'YAML' +thinking: + type: enabled + budget_tokens: 4000 +messages: + - role: user + content: + - type: text + text: "@./book.txt" + cache_control: + type: ephemeral + - type: text + text: "Give a one-sentence summary of this passage." +YAML +) +printf 'Call 1 (budget 4000):\n%s\n\n' "$USAGE" + +# Call 2: same budget, conversation extended; expect cache HIT +USAGE=$(ant messages create \ + --model claude-sonnet-4-6 --max-tokens 20000 \ + --transform usage <<'YAML' +thinking: + type: enabled + budget_tokens: 4000 +messages: + - role: user + content: + - type: text + text: "@./book.txt" + cache_control: + type: ephemeral + - type: text + text: "Give a one-sentence summary of this passage." + - role: assistant + content: "It opens Pride and Prejudice with the Bennet family." + - role: user + content: "Who is the protagonist?" +YAML +) +printf 'Call 2 (budget 4000):\n%s\n\n' "$USAGE" + +# Call 3: budget changed to 8000; cache MISS even though prefix is identical +USAGE=$(ant messages create \ + --model claude-sonnet-4-6 --max-tokens 20000 \ + --transform usage <<'YAML' +thinking: + type: enabled + budget_tokens: 8000 +messages: + - role: user + content: + - type: text + text: "@./book.txt" + cache_control: + type: ephemeral + - type: text + text: "Give a one-sentence summary of this passage." + - role: assistant + content: "It opens Pride and Prejudice with the Bennet family." + - role: user + content: "Who is the protagonist?" + - role: assistant + content: "Elizabeth Bennet is the protagonist." + - role: user + content: "What era is the story set in?" +YAML +) +printf 'Call 3 (budget 8000):\n%s\n' "$USAGE" +``` + ```python Python hidelines={1} from anthropic import Anthropic import requests @@ -3575,7 +3823,7 @@ puts "Third response usage: #{response3.usage}" Here is the output of the script (you may see slightly different numbers) -```text +```text Output First request - establishing cache First response usage: { cache_creation_input_tokens: 1370, cache_read_input_tokens: 0, input_tokens: 17, output_tokens: 700 } diff --git a/content/en/build-with-claude/fast-mode.md b/content/en/build-with-claude/fast-mode.md index ca9d9653a..2a0248a88 100644 --- a/content/en/build-with-claude/fast-mode.md +++ b/content/en/build-with-claude/fast-mode.md @@ -48,6 +48,19 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant beta:messages create \ + --beta fast-mode-2026-02-01 \ + --transform 'content.0.text' --format yaml <<'YAML' +model: claude-opus-4-6 +max_tokens: 4096 +speed: fast +messages: + - role: user + content: Refactor this module to use dependency injection +YAML +``` + ```python Python nocheck hidelines={1..2} import anthropic @@ -255,6 +268,18 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant beta:messages create --beta fast-mode-2026-02-01 \ + --transform usage.speed --format yaml <<'YAML' +model: claude-opus-4-6 +max_tokens: 1024 +speed: fast +messages: + - role: user + content: Hello +YAML +``` + ```python Python nocheck response = client.beta.messages.create( model="claude-opus-4-6", @@ -384,7 +409,7 @@ puts(response.usage.speed) # "fast" or "standard" ``` -```json JSON hidelines={5..8} +```json Output hidelines={5..8} { "id": "msg_01XFDUDYJgAACzvnptvVoYEL", "type": "message", @@ -420,6 +445,44 @@ Falling back from fast to standard speed will result in a [prompt cache](/docs/e Since setting `max_retries` to `0` also disables retries for other transient errors (overloaded, internal server errors), the examples below re-issue the original request with default retries for those cases. +```bash CLI +# `ant` retries 429/5xx automatically and has no per-request max_retries +# override, so on a fast-mode 429 the fallback runs after the built-in +# retries exhaust. --transform-error surfaces error.type for branching. +create_message_with_fast_fallback() { + local speed="$1" max_attempts="${2:-3}" body out + body=${3:-$(cat)} + out=$( + ant beta:messages create --beta fast-mode-2026-02-01 \ + ${speed:+--speed "$speed"} \ + --transform-error error.type --format-error yaml <<<"$body" 2>/dev/null + ) && { printf '%s\n' "$out"; return; } + case "$out" in + rate_limit_error) + if [[ -n "$speed" ]]; then + create_message_with_fast_fallback "" "$max_attempts" "$body" + return + fi ;; + overloaded_error | api_error | "") + if (( max_attempts > 1 )); then + create_message_with_fast_fallback "$speed" $((max_attempts - 1)) "$body" + return + fi ;; + esac + printf '%s\n' "${out:-connection_error}" >&2 + return 1 +} + +MESSAGE=$( + create_message_with_fast_fallback fast <<'YAML' +model: claude-opus-4-6 +max_tokens: 1024 +messages: + - role: user + content: Hello +YAML +) +``` ```python Python nocheck hidelines={1..2} import anthropic diff --git a/content/en/build-with-claude/files.md b/content/en/build-with-claude/files.md index 7c2ea3ebe..44d8a427a 100644 --- a/content/en/build-with-claude/files.md +++ b/content/en/build-with-claude/files.md @@ -24,7 +24,7 @@ The Files API provides a simple create-once, use-many-times approach for working - **Upload files** to Anthropic's secure storage and receive a unique `file_id` - **Download files** that are created from skills or the code execution tool -- **Reference files** in [Messages](/docs/en/api/messages) requests using the `file_id` instead of re-uploading content +- **Reference files** in [Messages](/docs/en/api/messages/create) requests using the `file_id` instead of re-uploading content - **Manage your files** with list, retrieve, and delete operations ## How to use the Files API @@ -47,6 +47,12 @@ curl -X POST https://api.anthropic.com/v1/files \ -F "file=@/path/to/document.pdf" ```` +````bash +FILE_ID=$(ant beta:files upload \ + --file /path/to/document.pdf \ + --transform id --format yaml) +```` + ````python uploaded = client.beta.files.upload( file=("document.pdf", open("/path/to/document.pdf", "rb"), "application/pdf"), @@ -139,7 +145,7 @@ puts file.id The response from uploading a file will include: -```json +```json Output { "id": "file_011CNha8iCJcU1wXNR6q4V8w", "type": "file", @@ -189,6 +195,22 @@ curl -X POST https://api.anthropic.com/v1/messages \ EOF ```` +````bash +ant beta:messages create --beta files-api-2025-04-14 < document.txt +# The "@./path" reference inlines the file contents directly into the field. +ant messages create \ + --model claude-opus-4-6 \ + --max-tokens 1024 \ + --transform 'content.0.text' --format yaml <<'YAML' +messages: + - role: user + content: + - type: text + text: "Here's the document content:" + - type: text + text: "@./document.txt" + - type: text + text: "Please summarize this document." +YAML +``` + ```python Python nocheck hidelines={2..5} import pandas as pd import anthropic @@ -690,6 +731,10 @@ curl https://api.anthropic.com/v1/files \ -H "anthropic-beta: files-api-2025-04-14" ``` +```bash CLI +ant beta:files list +``` + ```python Python hidelines={1..2} import anthropic @@ -804,6 +849,11 @@ curl "https://api.anthropic.com/v1/files/$FILE_ID" \ -H "anthropic-beta: files-api-2025-04-14" ```` +````bash +ant beta:files retrieve-metadata \ + --file-id "$FILE_ID" +```` + ````python file = client.beta.files.retrieve_metadata(file_id) ```` @@ -868,6 +918,11 @@ curl -X DELETE "https://api.anthropic.com/v1/files/$FILE_ID" \ -H "anthropic-beta: files-api-2025-04-14" ```` +````bash +ant beta:files delete \ + --file-id "$FILE_ID" +```` + ````python result = client.beta.files.delete(file_id) ```` @@ -926,6 +981,12 @@ curl -X GET "https://api.anthropic.com/v1/files/$FILE_ID/content" \ --output downloaded_file.txt ```` +````bash +ant beta:files download \ + --file-id "$FILE_ID" \ + --output downloaded_file.txt +```` + ````python file_content = client.beta.files.download(file_id) @@ -1044,7 +1105,7 @@ Common errors when using the Files API include: - **File too large (413):** File exceeds the 500 MB limit - **Storage limit exceeded (403):** Your organization has reached the 500 GB storage limit -```json +```json Output { "type": "error", "error": { diff --git a/content/en/build-with-claude/handling-stop-reasons.md b/content/en/build-with-claude/handling-stop-reasons.md index 725a701f3..1480d61b6 100644 --- a/content/en/build-with-claude/handling-stop-reasons.md +++ b/content/en/build-with-claude/handling-stop-reasons.md @@ -4,7 +4,7 @@ When you make a request to the Messages API, Claude's response includes a `stop_reason` field that indicates why the model stopped generating its response. Understanding these values is crucial for building robust applications that handle different response types appropriately. -For details about `stop_reason` in the API response, see the [Messages API reference](/docs/en/api/messages). +For details about `stop_reason` in the API response, see the [Messages API reference](/docs/en/api/messages/create). ## The stop_reason field @@ -35,7 +35,7 @@ The `stop_reason` field is part of every successful Messages API response. Unlik ### end_turn The most common stop reason. Indicates Claude finished its response naturally. -```python +```python Python from anthropic import Anthropic client = Anthropic() @@ -138,7 +138,7 @@ def handle_empty_response(client, messages): ### max_tokens Claude stopped because it reached the `max_tokens` limit specified in your request. -```python +```python Python # Request with limited tokens response = client.messages.create( model="claude-opus-4-6", @@ -158,6 +158,19 @@ If Claude's response is cut off due to hitting the `max_tokens` limit, and the t +```bash CLI nocheck +RESPONSE=$(ant messages create --max-tokens 1024 \ + --format jsonl < request.yaml) + +# Check if the response was truncated mid tool use +STOP_REASON=$(jq -r '.stop_reason' <<<"$RESPONSE") +LAST_TYPE=$(jq -r '.content[-1].type' <<<"$RESPONSE") +if [ "$STOP_REASON" = "max_tokens" ] && [ "$LAST_TYPE" = "tool_use" ]; then + # Retry with a higher max_tokens + ant messages create --max-tokens 4096 < request.yaml +fi +``` + ```python Python nocheck hidelines={1..8} import anthropic @@ -378,7 +391,7 @@ end ### stop_sequence Claude encountered one of your custom stop sequences. -```python +```python Python response = client.messages.create( model="claude-opus-4-6", max_tokens=1024, @@ -397,7 +410,7 @@ Claude is calling a tool and expects you to execute it. For most tool use implementations, we recommend using the [tool runner](/docs/en/agents-and-tools/tool-use/tool-runner) which automatically handles tool execution, result formatting, and conversation management. -```python nocheck +```python Python nocheck from anthropic import Anthropic client = Anthropic() @@ -439,7 +452,7 @@ Returned when the server-side sampling loop reaches its iteration limit while ex When this happens, the response may contain a `server_tool_use` block without a corresponding `server_tool_result`. To let Claude finish processing, continue the conversation by sending the response back as-is. -```python nocheck +```python Python nocheck response = client.messages.create( model="claude-opus-4-6", max_tokens=1024, @@ -467,7 +480,7 @@ Your application should handle `pause_turn` in any agent loop that uses server t ### refusal Claude refused to generate a response due to safety concerns. -```python +```python Python response = client.messages.create( model="claude-opus-4-6", max_tokens=1024, @@ -491,7 +504,7 @@ To learn more about refusals triggered by API safety filters for Claude Sonnet 4 ### model_context_window_exceeded Claude stopped because it reached the model's context window limit. This allows you to request the maximum possible tokens without knowing the exact input size. -```python nocheck +```python Python nocheck # Request with maximum tokens to get as much as possible response = client.messages.create( model="claude-opus-4-6", @@ -609,7 +622,7 @@ It's important to distinguish between `stop_reason` values and actual errors: - Indicate request processing failures - Response contains error details -```python +```python Python import anthropic from anthropic import Anthropic @@ -641,7 +654,7 @@ When using streaming, `stop_reason` is: - Provided in the `message_delta` event - Not provided in any other events -```python +```python Python from anthropic import Anthropic client = Anthropic() diff --git a/content/en/build-with-claude/pdf-support.md b/content/en/build-with-claude/pdf-support.md index 3de7c8aa3..b9f9ce56d 100644 --- a/content/en/build-with-claude/pdf-support.md +++ b/content/en/build-with-claude/pdf-support.md @@ -119,6 +119,21 @@ The simplest approach is to reference a PDF directly from a URL: }] }' ``` + ```bash CLI + ant messages create --transform content --format yaml <<'YAML' + model: claude-opus-4-6 + max_tokens: 1024 + messages: + - role: user + content: + - type: document + source: + type: url + url: https://assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf + - type: text + text: What are the key findings in this document? + YAML + ``` ```python Python hidelines={1..2} import anthropic @@ -265,6 +280,25 @@ If you need to send PDFs from your local system or when a URL isn't available: -H "anthropic-version: 2023-06-01" \ -d @request.json ``` + ```bash CLI hidelines={1..2} + cd "$(mktemp -d)" + curl -sSo document.pdf https://assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf + ant messages create \ + --model claude-opus-4-6 \ + --max-tokens 1024 \ + --transform content --format yaml <<'YAML' + messages: + - role: user + content: + - type: document + source: + type: base64 + media_type: application/pdf + data: "@./document.pdf" + - type: text + text: What are the key findings in this document? + YAML + ``` ```python Python hidelines={1} import anthropic import base64 @@ -459,6 +493,32 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI hidelines={1..2} +cd "$(mktemp -d)" +curl -sSo document.pdf https://assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf +# First, upload your PDF to the Files API +FILE_ID=$(ant beta:files upload \ + --file ./document.pdf \ + --transform id --format yaml) + +# Then use the returned file_id in your message +ant beta:messages create \ + --beta files-api-2025-04-14 \ + --transform content --format yaml <- + Which model has the highest human preference win rates + across each use-case? + - custom_id: my-second-request + params: + model: claude-opus-4-6 + max_tokens: 1024 + messages: + - role: user + content: + - type: document + source: + type: base64 + media_type: application/pdf + data: "@./document.pdf" + - type: text + text: Extract 5 key insights from this document. +YAML +``` ```python Python nocheck hidelines={1..5,7..13} import anthropic @@ -1066,7 +1183,7 @@ public class MessagesBatchDocumentExample { See complete API documentation for PDF support. diff --git a/content/en/build-with-claude/prompt-caching.md b/content/en/build-with-claude/prompt-caching.md index 3113b8598..332435427 100644 --- a/content/en/build-with-claude/prompt-caching.md +++ b/content/en/build-with-claude/prompt-caching.md @@ -36,6 +36,21 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant messages create --transform usage <<'YAML' +model: claude-opus-4-6 +max_tokens: 1024 +cache_control: + type: ephemeral +system: >- + You are an AI assistant tasked with analyzing literary works. Your goal is + to provide insightful commentary on themes, characters, and writing style. +messages: + - role: user + content: Analyze the major themes in Pride and Prejudice. +YAML +``` + ```python Python hidelines={1..2} import anthropic @@ -306,6 +321,23 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant messages create --transform usage <<'YAML' +model: claude-opus-4-6 +max_tokens: 1024 +cache_control: + type: ephemeral +system: You are a helpful assistant that remembers our conversation. +messages: + - role: user + content: My name is Alex. I work on machine learning. + - role: assistant + content: Nice to meet you, Alex! How can I help with your ML work today? + - role: user + content: What did I say I work on? +YAML +``` + ```python Python hidelines={1..2} import anthropic @@ -818,7 +850,7 @@ To use the extended cache, include `ttl` in the `cache_control` definition like ``` The response will include detailed cache information like the following: -```json +```json Output { "usage": { "input_tokens": 2048, @@ -909,6 +941,25 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant messages create <<'YAML' +model: claude-opus-4-6 +max_tokens: 1024 +system: + - type: text + text: You are an AI assistant tasked with analyzing legal documents. + - type: text + text: >- + Here is the full text of a complex legal agreement: + [Insert full text of a 50-page legal agreement here] + cache_control: + type: ephemeral +messages: + - role: user + content: What are the key terms and conditions in this agreement? +YAML +``` + ```python Python hidelines={1..2} import anthropic @@ -1258,6 +1309,40 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant messages create <<'YAML' +model: claude-opus-4-6 +max_tokens: 1024 +system: + - type: text + text: "...long system prompt" + cache_control: + type: ephemeral +messages: + - role: user + content: + - type: text + text: Hello, can you tell me more about the solar system? + - role: assistant + content: >- + Certainly! The solar system is the collection of celestial bodies that + orbit our Sun. It consists of eight planets, numerous moons, asteroids, + comets, and other objects. The planets, in order from closest to farthest + from the Sun, are: Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, + and Neptune. Each planet has its own unique characteristics and features. + Is there a specific aspect of the solar system you would like to know + more about? + - role: user + content: + - type: text + text: Good to know. + - type: text + text: Tell me more about Mars. + cache_control: + type: ephemeral +YAML +``` + ```python Python hidelines={1..2} import anthropic @@ -1720,6 +1805,94 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant messages create <<'YAML' +model: claude-opus-4-6 +max_tokens: 1024 +tools: + - name: search_documents + description: Search through the knowledge base + input_schema: + type: object + properties: + query: + type: string + description: Search query + required: [query] + - name: get_document + description: Retrieve a specific document by ID + input_schema: + type: object + properties: + doc_id: + type: string + description: Document ID + required: [doc_id] + cache_control: + type: ephemeral +system: + - type: text + text: |- + You are a helpful research assistant with access to a document knowledge base. + + # Instructions + - Always search for relevant documents before answering + - Provide citations for your sources + - Be objective and accurate in your responses + - If multiple documents contain relevant information, synthesize them + - Acknowledge when information is not available in the knowledge base + cache_control: + type: ephemeral + - type: text + text: |- + # Knowledge Base Context + + Here are the relevant documents for this conversation: + + ## Document 1: Solar System Overview + The solar system consists of the Sun and all objects that orbit it... + + ## Document 2: Planetary Characteristics + Each planet has unique features. Mercury is the smallest planet... + + ## Document 3: Mars Exploration + Mars has been a target of exploration for decades... + + [Additional documents...] + cache_control: + type: ephemeral +messages: + - role: user + content: Can you search for information about Mars rovers? + - role: assistant + content: + - type: tool_use + id: tool_1 + name: search_documents + input: + query: Mars rovers + - role: user + content: + - type: tool_result + tool_use_id: tool_1 + content: >- + Found 3 relevant documents: Document 3 (Mars Exploration), + Document 7 (Rover Technology), Document 9 (Mission History) + - role: assistant + content: + - type: text + text: >- + I found 3 relevant documents about Mars rovers. Let me get more + details from the Mars Exploration document. + - role: user + content: + - type: text + text: Yes, please tell me about the Perseverance rover specifically. + cache_control: + type: ephemeral +YAML +``` + ```python Python hidelines={1..2} import anthropic diff --git a/content/en/build-with-claude/prompt-engineering/claude-prompting-best-practices.md b/content/en/build-with-claude/prompt-engineering/claude-prompting-best-practices.md index 18325fd13..3f8031baf 100644 --- a/content/en/build-with-claude/prompt-engineering/claude-prompting-best-practices.md +++ b/content/en/build-with-claude/prompt-engineering/claude-prompting-best-practices.md @@ -80,7 +80,7 @@ Best practices: Setting a role in the system prompt focuses Claude's behavior and tone for your use case. Even a single sentence makes a difference: -```python +```python Python import anthropic client = anthropic.Anthropic() @@ -394,7 +394,9 @@ Extended thinking adds latency and should only be used when it will meaningfully If you are migrating from [extended thinking](/docs/en/build-with-claude/extended-thinking) with `budget_tokens`, replace your thinking configuration and move budget control to `effort`: -```python Before (extended thinking, older models) nocheck +**Before (extended thinking, older models):** + +```python Python nocheck client.messages.create( model="claude-sonnet-4-5-20250929", max_tokens=64000, @@ -403,7 +405,9 @@ client.messages.create( ) ``` -```python After (adaptive thinking) nocheck +**After (adaptive thinking):** + +```python Python nocheck client.messages.create( model="claude-opus-4-6", max_tokens=64000, @@ -680,7 +684,7 @@ Claude Sonnet 4.6 defaults to an effort level of `high`, in contrast to Claude S If you're not using extended thinking on Claude Sonnet 4.5, you can continue without it on Claude Sonnet 4.6. You should explicitly set effort to the level appropriate for your use case. At `low` effort with thinking disabled, you can expect similar or better performance relative to Claude Sonnet 4.5 with no extended thinking. -```python +```python Python client.messages.create( model="claude-sonnet-4-6", max_tokens=8192, @@ -704,7 +708,7 @@ Adaptive thinking is particularly well suited to the following workload patterns When using adaptive thinking, evaluate `medium` and `high` effort on your tasks. The right level depends on your workload's tradeoff between quality, latency, and token usage. -```python nocheck +```python Python nocheck client.messages.create( model="claude-sonnet-4-6", max_tokens=64000, @@ -720,7 +724,7 @@ If you need to keep `budget_tokens` temporarily while migrating, a budget around **For coding use cases** (agentic coding, tool-heavy workflows, code generation), start with `medium` effort: -```python nocheck +```python Python nocheck client.messages.create( model="claude-sonnet-4-6", max_tokens=16384, @@ -732,7 +736,7 @@ client.messages.create( **For chat and non-coding use cases** (chat, content generation, search, classification), start with `low` effort: -```python nocheck +```python Python nocheck client.messages.create( model="claude-sonnet-4-6", max_tokens=8192, diff --git a/content/en/build-with-claude/search-results.md b/content/en/build-with-claude/search-results.md index 1ef11dafd..1c94eca34 100644 --- a/content/en/build-with-claude/search-results.md +++ b/content/en/build-with-claude/search-results.md @@ -839,6 +839,42 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant messages create <<'YAML' +model: claude-opus-4-6 +max_tokens: 1024 +messages: + - role: user + content: + - type: search_result + source: https://docs.company.com/api-reference + title: API Reference - Authentication + content: + - type: text + text: >- + All API requests must include an API key in the Authorization + header. Keys can be generated from the dashboard. Rate limits: + 1000 requests per hour for standard tier, 10000 for premium. + citations: + enabled: true + - type: search_result + source: https://docs.company.com/quickstart + title: Getting Started Guide + content: + - type: text + text: >- + To get started: 1) Sign up for an account, 2) Generate an API + key from the dashboard, 3) Install our SDK using pip install + company-sdk, 4) Initialize the client with your API key. + citations: + enabled: true + - type: text + text: >- + Based on these search results, how do I authenticate API requests + and what are the rate limits? +YAML +``` + ```python Python hidelines={1} from anthropic import Anthropic from anthropic.types import MessageParam, TextBlockParam, SearchResultBlockParam diff --git a/content/en/build-with-claude/skills-guide.md b/content/en/build-with-claude/skills-guide.md index 15d60c1e7..b0b92fdb4 100644 --- a/content/en/build-with-claude/skills-guide.md +++ b/content/en/build-with-claude/skills-guide.md @@ -110,6 +110,26 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant beta:messages create \ + --beta code-execution-2025-08-25 \ + --beta skills-2025-10-02 <<'YAML' +model: claude-opus-4-6 +max_tokens: 4096 +container: + skills: + - type: anthropic + skill_id: pptx + version: latest +messages: + - role: user + content: Create a presentation about renewable energy +tools: + - type: code_execution_20250825 + name: code_execution +YAML +``` + ```python Python nocheck hidelines={1..2} import anthropic @@ -416,6 +436,47 @@ curl "https://api.anthropic.com/v1/files/$FILE_ID/content" \ echo "Downloaded: $FILENAME" ``` + + + +```bash CLI hidelines={1} +cd "$(mktemp -d)" +# Step 1: Use the xlsx Skill to create a file +# Step 2: Extract file_id from the response via --transform (GJSON path) +FILE_ID=$(ant beta:messages create \ + --beta code-execution-2025-08-25 \ + --beta skills-2025-10-02 \ + --transform 'content.#.content.content.#.file_id|@flatten|0' \ + --format yaml <<'YAML' +model: claude-opus-4-6 +max_tokens: 4096 +container: + skills: + - type: anthropic + skill_id: xlsx + version: latest +messages: + - role: user + content: Create an Excel file with a simple budget spreadsheet +tools: + - type: code_execution_20250825 + name: code_execution +YAML +) + +# Step 3: Get the filename from file metadata +FILENAME=$(ant beta:files retrieve-metadata \ + --file-id "$FILE_ID" \ + --transform filename --format yaml) + +# Step 4: Download the file using Files API +ant beta:files download \ + --file-id "$FILE_ID" \ + --output "$FILENAME" > /dev/null + +printf 'Downloaded: %s\n' "$FILENAME" +``` + @@ -960,6 +1021,24 @@ curl -X DELETE "https://api.anthropic.com/v1/files/$FILE_ID" \ -H "anthropic-beta: files-api-2025-04-14" ``` +```bash CLI +# Get file metadata +ant beta:files retrieve-metadata --file-id "$FILE_ID" \ + --transform '{filename,size_bytes}' --format yaml \ + | { read -r _ name; read -r _ size + printf 'Filename: %s, Size: %s bytes\n' "$name" "$size"; } + +# List all files +ant beta:files list \ + --transform '{filename,created_at}' --format yaml \ + | while read -r _ name && read -r _ date; do + printf '%s - %s\n' "$name" "${date//\"/}" + done + +# Delete a file +ant beta:files delete --file-id "$FILE_ID" >/dev/null +``` + ```python Python nocheck hidelines={1..2} import anthropic @@ -1172,6 +1251,45 @@ For complete details on the Files API, see the [Files API documentation](/docs/e Reuse the same container across multiple messages by specifying the container ID: +```bash CLI +# First request creates container +CONTAINER_ID=$(ant beta:messages create \ + --beta code-execution-2025-08-25 --beta skills-2025-10-02 \ + --transform container.id --format yaml <<'YAML' +model: claude-opus-4-6 +max_tokens: 4096 +container: + skills: + - {type: anthropic, skill_id: xlsx, version: latest} +messages: + - role: user + content: Analyze this sales data +tools: + - {type: code_execution_20250825, name: code_execution} +YAML +) + +# Continue conversation with same container +ant beta:messages create \ + --beta code-execution-2025-08-25 --beta skills-2025-10-02 < "$RESP" <<'YAML' +model: claude-opus-4-6 +max_tokens: 4096 +container: + skills: + - type: custom + skill_id: skill_01AbCdEfGhIjKlMnOpQrStUv + version: latest +messages: + - role: user + content: Process this large dataset +tools: + - type: code_execution_20250825 + name: code_execution +YAML + +# Handle pause_turn for long operations (up to 10 iterations) +for _ in {1..10}; do + [[ $(jq -r '.stop_reason' "$RESP") == pause_turn ]] || break + + CONTAINER_ID=$(jq -r '.container.id' "$RESP") + + # Continue in the same container, appending the prior response's + # content array to messages as the assistant turn. + ant beta:messages create \ + --beta code-execution-2025-08-25 \ + --beta skills-2025-10-02 \ + > "$RESP" < + ```bash Shell nocheck curl -X POST "https://api.anthropic.com/v1/skills" \ @@ -2402,6 +2598,21 @@ curl -X POST "https://api.anthropic.com/v1/skills" \ -F "files[]=@financial_skill/analyze.py;filename=financial_skill/analyze.py" ``` +```bash CLI nocheck +# Option 1: Upload individual files (one --file flag per file) +ant beta:skills create \ + --display-title "Financial Analysis" \ + --file financial_skill/SKILL.md \ + --file financial_skill/analyze.py \ + --beta skills-2025-10-02 + +# Option 2: Upload a zip archive +ant beta:skills create \ + --display-title "Financial Analysis" \ + --file financial_analysis_skill.zip \ + --beta skills-2025-10-02 +``` + ```python Python nocheck hidelines={1..2} import anthropic @@ -2693,7 +2904,7 @@ For complete request/response schemas, see the [Create Skill API reference](/doc Retrieve all Skills available to your workspace, including both Anthropic pre-built Skills and your custom Skills. Use the `source` parameter to filter by skill type: - + ```bash Shell # List all Skills curl "https://api.anthropic.com/v1/skills" \ @@ -2708,6 +2919,14 @@ curl "https://api.anthropic.com/v1/skills?source=custom" \ -H "anthropic-beta: skills-2025-10-02" ``` +```bash CLI +# List all Skills +ant beta:skills list + +# List only custom Skills +ant beta:skills list --source custom +``` + ```python Python # List all Skills skills = client.beta.skills.list(betas=["skills-2025-10-02"]) @@ -2891,7 +3110,7 @@ See the [List Skills API reference](/docs/en/api/skills/list-skills) for paginat Get details about a specific Skill: - + ```bash Shell nocheck curl "https://api.anthropic.com/v1/skills/skill_01AbCdEfGhIjKlMnOpQrStUv" \ @@ -2900,6 +3119,11 @@ curl "https://api.anthropic.com/v1/skills/skill_01AbCdEfGhIjKlMnOpQrStUv" \ -H "anthropic-beta: skills-2025-10-02" ``` +```bash CLI nocheck +ant beta:skills retrieve \ + --skill-id skill_01AbCdEfGhIjKlMnOpQrStUv +``` + ```python Python nocheck skill = client.beta.skills.retrieve( skill_id="skill_01AbCdEfGhIjKlMnOpQrStUv", betas=["skills-2025-10-02"] @@ -3036,7 +3260,7 @@ puts "Created: #{skill.created_at}" To delete a Skill, you must first delete all its versions: - + ```bash Shell nocheck # Delete all versions first, then delete the Skill @@ -3046,6 +3270,23 @@ curl -X DELETE "https://api.anthropic.com/v1/skills/skill_01AbCdEfGhIjKlMnOpQrSt -H "anthropic-beta: skills-2025-10-02" ``` +```bash CLI nocheck +# Step 1: Delete all versions +ant beta:skills:versions list \ + --skill-id skill_01AbCdEfGhIjKlMnOpQrStUv \ + --transform version --format yaml \ + | tr -d '"' \ + | while read -r VERSION; do + ant beta:skills:versions delete \ + --skill-id skill_01AbCdEfGhIjKlMnOpQrStUv \ + --version "$VERSION" >/dev/null + done + +# Step 2: Delete the Skill +ant beta:skills delete \ + --skill-id skill_01AbCdEfGhIjKlMnOpQrStUv >/dev/null +``` + ```python Python nocheck # Step 1: Delete all versions versions = client.beta.skills.versions.list( @@ -3285,7 +3526,7 @@ Skills support versioning to manage updates safely: - Use `"latest"` to always get the most recent version - Create new versions when updating Skill files - + ```bash Shell nocheck # Create a new version @@ -3338,6 +3579,52 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI nocheck +# Create a new version +VERSION_NUMBER=$(ant beta:skills:versions create \ + --skill-id skill_01AbCdEfGhIjKlMnOpQrStUv \ + --file updated_skill/SKILL.md \ + --transform version --format yaml) + +# Use specific version +ant beta:messages create \ + --beta code-execution-2025-08-25 \ + --beta skills-2025-10-02 < +```bash CLI nocheck +if ! RESULT=$(ant beta:messages create \ + --beta code-execution-2025-08-25 \ + --beta skills-2025-10-02 \ + --transform-error error.message --format-error yaml 2>&1 <<'YAML' +model: claude-opus-4-6 +max_tokens: 4096 +container: + skills: + - type: custom + skill_id: skill_01AbCdEfGhIjKlMnOpQrStUv + version: latest +messages: + - role: user + content: Process data +tools: + - type: code_execution_20250825 + name: code_execution +YAML +); then + case "$RESULT" in + *skill*) + printf 'Skill error: %s\n' "$RESULT" + # Handle skill-specific errors + ;; + *) + printf '%s\n' "$RESULT" >&2 + exit 1 + ;; + esac +fi +``` + ```python Python nocheck hidelines={1..2} import anthropic diff --git a/content/en/build-with-claude/streaming.md b/content/en/build-with-claude/streaming.md index f613f4f61..1a9a35900 100644 --- a/content/en/build-with-claude/streaming.md +++ b/content/en/build-with-claude/streaming.md @@ -9,6 +9,18 @@ When creating a Message, you can set `"stream": true` to incrementally stream th The [Python](https://github.com/anthropics/anthropic-sdk-python) and [TypeScript](https://github.com/anthropics/anthropic-sdk-typescript) SDKs offer multiple ways of streaming. The [PHP](https://github.com/anthropics/anthropic-sdk-php) SDK provides streaming via `createStream()`. The Python SDK allows both sync and async streams. See the documentation in each SDK for details. + ```bash CLI + ant messages create --stream --format jsonl \ + --model claude-opus-4-6 \ + --max-tokens 1024 \ + --message '{role: user, content: "Hello"}' \ + | while IFS= read -r event; do + [[ $event == *'"text_delta"'* ]] || continue + text=${event#*'"text":"'} + printf '%b' "${text%\"*}" + done + ``` + ```python Python hidelines={1..2} import anthropic @@ -170,6 +182,19 @@ The [Python](https://github.com/anthropics/anthropic-sdk-python) and [TypeScript If you don't need to process text as it arrives, the SDKs provide a way to use streaming under the hood while returning the complete `Message` object, identical to what `.create()` returns. This is especially useful for requests with large `max_tokens` values, where the SDKs require streaming to avoid HTTP timeouts. + ```bash CLI + # The ant CLI's --stream flag emits one event per line and does not + # accumulate into a final Message. For long generations, stream the + # raw events: + ant messages create --stream --format jsonl <<'YAML' + model: claude-opus-4-6 + max_tokens: 128000 + messages: + - role: user + content: Write a detailed analysis... + YAML + ``` + ```python Python hidelines={1..2} import anthropic @@ -451,6 +476,13 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant messages create --stream --format jsonl \ + --model claude-opus-4-6 \ + --max-tokens 256 \ + --message '{role: user, content: Hello}' +``` + ```python Python hidelines={1..2} import anthropic @@ -683,6 +715,29 @@ This request asks Claude to use a tool to report the weather. }' ``` +```bash CLI +ant messages create --stream --format jsonl <<'YAML' +model: claude-opus-4-6 +max_tokens: 1024 +tools: + - name: get_weather + description: Get the current weather in a given location + input_schema: + type: object + properties: + location: + type: string + description: The city and state, e.g. San Francisco, CA + required: + - location +tool_choice: + type: any +messages: + - role: user + content: What is the weather like in San Francisco? +YAML +``` + ```python Python hidelines={1..2} import anthropic @@ -1102,6 +1157,14 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant messages create --stream --format jsonl \ + --model claude-opus-4-6 \ + --max-tokens 20000 \ + --thinking '{type: enabled, budget_tokens: 16000}' \ + --message '{role: user, content: What is the greatest common divisor of 1071 and 462?}' +``` + ```python Python hidelines={1..2} import anthropic @@ -1367,6 +1430,14 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant messages create --stream --format jsonl \ + --model claude-opus-4-6 \ + --max-tokens 1024 \ + --tool '{type: web_search_20250305, name: web_search, max_uses: 5}' \ + --message '{role: user, content: What is the weather like in New York City today?}' +``` + ```python Python hidelines={1..2} import anthropic diff --git a/content/en/build-with-claude/structured-outputs.md b/content/en/build-with-claude/structured-outputs.md index 68109bf6d..451d95339 100644 --- a/content/en/build-with-claude/structured-outputs.md +++ b/content/en/build-with-claude/structured-outputs.md @@ -82,6 +82,33 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant messages create \ + --transform 'content.0.text|@fromstr' \ + --format jsonl <<'YAML' +model: claude-opus-4-6 +max_tokens: 1024 +messages: + - role: user + content: >- + Extract the key information from this email: John Smith + (john@example.com) is interested in our Enterprise plan and wants + to schedule a demo for next Tuesday at 2pm. +output_config: + format: + type: json_schema + schema: + type: object + properties: + name: {type: string} + email: {type: string} + plan_interest: {type: string} + demo_requested: {type: boolean} + required: [name, email, plan_interest, demo_requested] + additionalProperties: false +YAML +``` + ```python Python hidelines={1..2} import anthropic @@ -348,7 +375,7 @@ puts response.content[0].text **Response format:** Valid JSON matching your schema in `response.content[0].text` -```json +```json Output { "name": "John Smith", "email": "john@example.com", @@ -387,10 +414,39 @@ Instead of writing raw JSON schemas, you can use familiar schema definition tool - **TypeScript**: [Zod](https://zod.dev/) schemas with `zodOutputFormat()` - **Java**: Plain Java classes with automatic schema derivation via `outputConfig(Class)` - **Ruby**: `Anthropic::BaseModel` classes with `output_config: {format: Model}` -- **C#**, **Go**, **PHP**: Raw JSON schemas passed via `output_config` +- **CLI**, **C#**, **Go**, **PHP**: Raw JSON schemas passed via `output_config` +```bash CLI +{ read -r _ NAME; read -r _ EMAIL; } < <( + ant messages create \ + --transform 'content.0.text|@fromstr|{name,email}' --format yaml <<'YAML' +model: claude-opus-4-6 +max_tokens: 1024 +messages: + - role: user + content: >- + Extract the key information from this email: John Smith + (john@example.com) is interested in our Enterprise plan and wants + to schedule a demo for next Tuesday at 2pm. +output_config: + format: + type: json_schema + schema: + type: object + properties: + name: {type: string} + email: {type: string} + plan_interest: {type: string} + demo_requested: {type: boolean} + required: [name, email, plan_interest, demo_requested] + additionalProperties: false +YAML +) +printf '%s (%s)\n' "$NAME" "$EMAIL" +``` + ```python Python from pydantic import BaseModel from anthropic import Anthropic @@ -650,6 +706,47 @@ puts "#{contact.name} (#{contact.email})" Each SDK provides helpers that make working with structured outputs easier. See individual SDK pages for full details. + + +**Raw JSON schemas via heredoc body** + +The CLI passes raw JSON schemas as a YAML heredoc body. Use the GJSON `@fromstr` modifier with `--transform` to parse the JSON string returned in `content[0].text` and project specific fields. + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    + +```bash +ant messages create \ + --transform 'content.0.text|@fromstr|{name,email}' \ + --format yaml <<'YAML' +model: claude-opus-4-6 +max_tokens: 1024 +messages: + - role: user + content: >- + Extract contact info: John Smith, john@example.com, + interested in the Pro plan +output_config: + format: + type: json_schema + schema: + type: object + properties: + name: {type: string} + email: {type: string} + plan_interest: {type: string} + required: [name, email, plan_interest] + additionalProperties: false +YAML +``` + +```yaml Output +name: John Smith +email: john@example.com +``` + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    **`client.messages.parse()` (Recommended)** @@ -1214,6 +1311,32 @@ Extract structured data from unstructured text: +```bash CLI +ant messages create \ + --transform 'content.0.text|@fromstr' --format jsonl <<'YAML' +model: claude-opus-4-6 +max_tokens: 4096 +messages: + - role: user + content: "Extract invoice data from: Invoice #12345, Date: 2024-01-15, Total: $500.00" +output_config: + format: + type: json_schema + schema: + type: object + properties: + invoice_number: {type: string} + date: {type: string} + total_amount: {type: number} + line_items: + type: array + items: {type: object, additionalProperties: false} + customer_name: {type: string} + required: [invoice_number, date, total_amount, line_items, customer_name] + additionalProperties: false +YAML +``` + ```python Python nocheck from pydantic import BaseModel from typing import List @@ -1543,6 +1666,39 @@ Classify content with structured categories: +```bash CLI +ant messages create \ + --transform 'content.0.text|@fromstr' --format jsonl <<'YAML' +model: claude-opus-4-6 +max_tokens: 1024 +messages: + - role: user + content: "Classify this feedback: Great product, fast shipping!" +output_config: + format: + type: json_schema + schema: + type: object + properties: + category: + type: string + confidence: + type: number + tags: + type: array + items: + type: string + sentiment: + type: string + required: + - category + - confidence + - tags + - sentiment + additionalProperties: false +YAML +``` + ```python Python hidelines={1} from anthropic import Anthropic from pydantic import BaseModel @@ -1799,6 +1955,41 @@ Generate API-ready responses: +```bash CLI +ant messages create \ + --transform 'content.0.text' --format yaml <<'YAML' +model: claude-opus-4-6 +max_tokens: 1024 +output_config: + format: + type: json_schema + schema: + type: object + properties: + status: + type: string + data: + type: object + additionalProperties: false + errors: + type: array + items: + type: object + additionalProperties: false + metadata: + type: object + additionalProperties: false + required: + - status + - data + - metadata + additionalProperties: false +messages: + - role: user + content: "Process this request: ..." +YAML +``` + ```python Python hidelines={1} from anthropic import Anthropic from pydantic import BaseModel @@ -2104,6 +2295,45 @@ When combined, Claude can call tools with guaranteed-valid parameters AND return +```bash CLI +ant messages create <<'YAML' +model: claude-opus-4-6 +max_tokens: 1024 +messages: + - role: user + content: Help me plan a trip to Paris departing May 15, 2026 +# JSON outputs: structured response format +output_config: + format: + type: json_schema + schema: + type: object + properties: + summary: + type: string + next_steps: + type: array + items: + type: string + required: [summary, next_steps] + additionalProperties: false +# Strict tool use: guaranteed tool parameters +tools: + - name: search_flights + strict: true + input_schema: + type: object + properties: + destination: + type: string + date: + type: string + format: date + required: [destination, date] + additionalProperties: false +YAML +``` + ```python Python response = client.messages.create( model="claude-opus-4-6", diff --git a/content/en/build-with-claude/token-counting.md b/content/en/build-with-claude/token-counting.md index 7aade1a3c..b136d08ec 100644 --- a/content/en/build-with-claude/token-counting.md +++ b/content/en/build-with-claude/token-counting.md @@ -45,6 +45,13 @@ curl https://api.anthropic.com/v1/messages/count_tokens \ }' ``` +```bash CLI +ant messages count-tokens \ + --model claude-opus-4-6 \ + --system "You are a scientist" \ + --message '{role: user, content: "Hello, Claude"}' +``` + ```python Python hidelines={1..2} import anthropic @@ -193,7 +200,7 @@ puts response ``` -```json JSON +```json Output { "input_tokens": 14 } ``` @@ -237,6 +244,26 @@ curl https://api.anthropic.com/v1/messages/count_tokens \ }' ``` +```bash CLI +ant messages count-tokens <<'YAML' +model: claude-opus-4-6 +tools: + - name: get_weather + description: Get the current weather in a given location + input_schema: + type: object + properties: + location: + type: string + description: The city and state, e.g. San Francisco, CA + required: + - location +messages: + - role: user + content: What's the weather like in San Francisco? +YAML +``` + ```python Python hidelines={1..2} import anthropic @@ -499,7 +526,7 @@ puts response ``` -```json JSON +```json Output { "input_tokens": 403 } ``` @@ -534,6 +561,25 @@ curl https://api.anthropic.com/v1/messages/count_tokens \ EOF ``` +```bash CLI nocheck +IMAGE_URL="https://upload.wikimedia.org/wikipedia/commons/a/a7/Camponotus_flavomarginatus_ant.jpg" +curl -s "$IMAGE_URL" -o ./ant.jpg + +ant messages count-tokens <<'YAML' +model: claude-opus-4-6 +messages: + - role: user + content: + - type: image + source: + type: base64 + media_type: image/jpeg + data: "@./ant.jpg" + - type: text + text: Describe this image +YAML +``` + ```python Python nocheck hidelines={1} import anthropic import base64 @@ -834,7 +880,7 @@ puts response ``` -```json JSON +```json Output { "input_tokens": 1551 } ``` @@ -886,6 +932,29 @@ curl https://api.anthropic.com/v1/messages/count_tokens \ }' ``` +```bash CLI nocheck +ant messages count-tokens <<'YAML' +model: claude-sonnet-4-6 +thinking: + type: enabled + budget_tokens: 16000 +messages: + - role: user + content: Are there an infinite number of prime numbers such that n mod 4 == 3? + - role: assistant + content: + - type: thinking + thinking: >- + This is a nice number theory question. Lets think about it step by step... + signature: >- + EuYBCkQYAiJAgCs1le6/Pol5Z4/JMomVOouGrWdhYNsH3ukzUECbB6iWrSQtsQuRHJID6lWV... + - type: text + text: Yes, there are infinitely many prime numbers p such that p mod 4 = 3... + - role: user + content: Can you write a formal proof? +YAML +``` + ```python Python nocheck hidelines={1..2} import anthropic @@ -1187,7 +1256,7 @@ puts response ``` -```json JSON +```json Output { "input_tokens": 88 } ``` @@ -1230,6 +1299,25 @@ curl https://api.anthropic.com/v1/messages/count_tokens \ EOF ``` +```bash CLI hidelines={1..3} +PDF_URL="https://assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf" +curl -s "$PDF_URL" -o document.pdf + +ant messages count-tokens <<'YAML' +model: claude-opus-4-6 +messages: + - role: user + content: + - type: document + source: + type: base64 + media_type: application/pdf + data: "@./document.pdf" + - type: text + text: Please summarize this document. +YAML +``` + ```python Python nocheck import base64 import anthropic @@ -1502,7 +1590,7 @@ puts response ```
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -```json JSON +```json Output { "input_tokens": 2188 } ``` diff --git a/content/en/build-with-claude/vision.md b/content/en/build-with-claude/vision.md index 8128f2683..931699def 100644 --- a/content/en/build-with-claude/vision.md +++ b/content/en/build-with-claude/vision.md @@ -307,6 +307,25 @@ Below are examples of how to include images in a Messages API request using base } EOF ``` + ```bash CLI + curl -sSo ./image.jpg \ + https://upload.wikimedia.org/wikipedia/commons/a/a7/Camponotus_flavomarginatus_ant.jpg + + ant messages create <<'YAML' + model: claude-opus-4-6 + max_tokens: 1024 + messages: + - role: user + content: + - type: image + source: + type: base64 + media_type: image/jpeg + data: "@./image.jpg" + - type: text + text: Describe this image. + YAML + ``` ```python Python hidelines={1..2} import anthropic @@ -578,6 +597,21 @@ Below are examples of how to include images in a Messages API request using base ] }' ``` + ```bash CLI + ant messages create <<'YAML' + model: claude-opus-4-6 + max_tokens: 1024 + messages: + - role: user + content: + - type: image + source: + type: url + url: https://upload.wikimedia.org/wikipedia/commons/a/a7/Camponotus_flavomarginatus_ant.jpg + - type: text + text: Describe this image. + YAML + ``` ```python Python hidelines={1..2} import anthropic @@ -855,6 +889,34 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI hidelines={1} +cd "$(mktemp -d)" +curl -sSo image.jpg \ + https://upload.wikimedia.org/wikipedia/commons/a/a7/Camponotus_flavomarginatus_ant.jpg + +# First, upload your image to the Files API +FILE_ID=$(ant beta:files upload \ + --file ./image.jpg \ + --transform id --format yaml) + +# Then use the returned file_id in your message +ant beta:messages create \ + --beta files-api-2025-04-14 \ + --transform content --format yaml < -See [Messages API examples](/docs/en/api/messages) for more example code and parameter details. +See [Messages API examples](/docs/en/api/messages/create) for more example code and parameter details.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -1392,7 +1454,7 @@ Ask Claude to contrast two images, then ask a follow-up question comparing the f | User | Image 1: \[Image 3\] Image 2: \[Image 4\] Are these images similar to the first two? | | Assistant | \[Claude's response\] | -When using the API, simply insert new images into the array of Messages in the `user` role as part of any standard [multiturn conversation](/docs/en/api/messages) structure. +When using the API, simply insert new images into the array of Messages in the `user` role as part of any standard [multiturn conversation](/docs/en/api/messages/create) structure.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -1520,6 +1582,6 @@ Always carefully review and verify Claude's image interpretations, especially fo Ready to start building with images using Claude? Here are a few helpful resources: - [Multimodal cookbook](https://platform.claude.com/cookbook/multimodal-getting-started-with-vision): This cookbook has tips on [getting started with images](https://platform.claude.com/cookbook/multimodal-getting-started-with-vision) and [best practice techniques](https://platform.claude.com/cookbook/multimodal-best-practices-for-vision) to ensure the highest quality performance with images. See how you can effectively prompt Claude with images to carry out tasks such as [interpreting and analyzing charts](https://platform.claude.com/cookbook/multimodal-reading-charts-graphs-powerpoints) or [extracting content from forms](https://platform.claude.com/cookbook/multimodal-how-to-transcribe-text). -- [API reference](/docs/en/api/messages): Documentation for the Messages API, including example [API calls involving images](/docs/en/build-with-claude/working-with-messages#vision). +- [API reference](/docs/en/api/messages/create): Documentation for the Messages API, including example [API calls involving images](/docs/en/build-with-claude/working-with-messages#vision). If you have any other questions, reach out to the [support team](https://support.claude.com/). You can also join the [developer community](https://www.anthropic.com/discord) to connect with other creators and get help from Anthropic experts. \ No newline at end of file diff --git a/content/en/build-with-claude/working-with-messages.md b/content/en/build-with-claude/working-with-messages.md index 74cef07b3..0cf071271 100644 --- a/content/en/build-with-claude/working-with-messages.md +++ b/content/en/build-with-claude/working-with-messages.md @@ -4,7 +4,15 @@ Practical patterns and examples for using the Messages API effectively --- -This guide covers common patterns for working with the Messages API, including basic requests, multi-turn conversations, prefill techniques, and vision capabilities. For complete API specifications, see the [Messages API reference](/docs/en/api/messages). +Anthropic offers two ways to build with Claude, each suited to different use cases: + +| | Messages API | Claude Managed Agents | +|---|---|---| +| **What it is** | Direct model prompting access | Pre-built, configurable agent harness that runs in managed infrastructure | +| **Best for** | Custom agent loops and fine-grained control | Long-running tasks and asynchronous work | +| **Learn more** | [Messages API docs](/docs/en/build-with-claude/working-with-messages) | [Claude Managed Agents docs](/docs/en/managed-agents/overview) | + +This guide covers common patterns for working with the Messages API, including basic requests, multi-turn conversations, prefill techniques, and vision capabilities. For complete API specifications, see the [Messages API reference](/docs/en/api/messages/create). This feature is eligible for [Zero Data Retention (ZDR)](/docs/en/build-with-claude/api-and-data-retention). When your organization has a ZDR arrangement, data sent through this feature is not stored after the API response is returned. @@ -29,6 +37,13 @@ This feature is eligible for [Zero Data Retention (ZDR)](/docs/en/build-with-cla }' ``` + ```bash CLI + ant messages create \ + --model claude-opus-4-6 \ + --max-tokens 1024 \ + --message '{role: user, content: "Hello, Claude"}' + ``` + ```python Python hidelines={1..2} import anthropic @@ -159,7 +174,7 @@ This feature is eligible for [Zero Data Retention (ZDR)](/docs/en/build-with-cla ```
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -```json JSON +```json Output { "id": "msg_01XFDUDYJgAACzvnptvVoYEL", "type": "message", @@ -204,6 +219,15 @@ curl https://api.anthropic.com/v1/messages \ }' ``` +```bash CLI +ant messages create \ + --model claude-opus-4-6 \ + --max-tokens 1024 \ + --message '{role: user, content: "Hello, Claude"}' \ + --message '{role: assistant, content: "Hello!"}' \ + --message '{role: user, content: "Can you describe LLMs to me?"}' +``` + ```python Python hidelines={1..2} import anthropic @@ -358,7 +382,7 @@ puts message ```
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -```json JSON +```json Output { "id": "msg_018gCsTGsXkYJVqYPxTgDHBU", "type": "message", @@ -400,6 +424,18 @@ You can pre-fill part of Claude's response in the last position of the input mes }' ``` + ```bash CLI + ant messages create <<'YAML' + model: claude-sonnet-4-5 + max_tokens: 1 + messages: + - role: user + content: "What is latin for Ant? (A) Apoidea, (B) Rhopalocera, (C) Formicidae" + - role: assistant + content: "The answer is (" + YAML + ``` + ```python Python hidelines={1..2} import anthropic @@ -555,7 +591,7 @@ You can pre-fill part of Claude's response in the last position of the input mes ```
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -```json JSON +```json Output { "id": "msg_01Q8Faay6S7QPTvEUUQARt7h", "type": "message", @@ -635,6 +671,44 @@ Claude can read both text and images in requests. Images can be supplied using t ``` + ```bash CLI nocheck + IMAGE_URL="https://upload.wikimedia.org/wikipedia/commons/a/a7/Camponotus_flavomarginatus_ant.jpg" + + # Option 1: Base64-encoded image (CLI auto-encodes binary @file refs) + curl -s "$IMAGE_URL" -o ./ant.jpg + + ant messages create <<'YAML' + model: claude-opus-4-6 + max_tokens: 1024 + messages: + - role: user + content: + - type: image + source: + type: base64 + media_type: image/jpeg + data: "@./ant.jpg" + - type: text + text: What is in the above image? + YAML + + # Option 2: URL-referenced image + ant messages create < -```json JSON +```json Output { "id": "msg_01EcyWo6m4hyW8KHs2y2pei5", "type": "message", diff --git a/content/en/build-with-claude/workspaces.md b/content/en/build-with-claude/workspaces.md index acaf1c42a..a6df39616 100644 --- a/content/en/build-with-claude/workspaces.md +++ b/content/en/build-with-claude/workspaces.md @@ -23,6 +23,7 @@ Members can have different roles in each workspace, allowing fine-grained access | Role | Permissions | |------|-------------| | Workspace User | Use the Workbench only | +| Workspace Limited Developer | Create and manage API keys, use the API. Cannot access session tracing views or download files. | | Workspace Developer | Create and manage API keys, use the API | | Workspace Admin | Full control over workspace settings and members | | Workspace Billing | View workspace billing information (inherited from organization billing role) | @@ -287,7 +288,7 @@ Organization admins automatically get the Workspace Admin role in all workspaces
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -Organization users and developers can be assigned Workspace Admin, Workspace Developer, or Workspace User roles. The Workspace Billing role cannot be manually assigned; it's inherited from having the organization `billing` role. +Organization users and developers can be assigned Workspace Admin, Workspace Developer, Workspace Limited Developer, or Workspace User roles. The Workspace Billing role cannot be manually assigned; it's inherited from having the organization `billing` role.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    diff --git a/content/en/docs/claude-code/authentication.md b/content/en/docs/claude-code/authentication.md index 61799a5f8..01c65d961 100644 --- a/content/en/docs/claude-code/authentication.md +++ b/content/en/docs/claude-code/authentication.md @@ -14,6 +14,8 @@ After [installing Claude Code](/en/setup#install-claude-code), run `claude` in y If the browser doesn't open automatically, press `c` to copy the login URL to your clipboard, then paste it into your browser. +If your browser shows a login code instead of redirecting back after you sign in, paste it into the terminal at the `Paste code here if prompted` prompt. + You can authenticate with any of these account types: * **Claude Pro or Max subscription**: log in with your Claude.ai account. Subscribe at [claude.com/pricing](https://claude.com/pricing?utm_source=claude_code\&utm_medium=docs\&utm_content=authentication_pro_max). diff --git a/content/en/docs/claude-code/changelog.md b/content/en/docs/claude-code/changelog.md index c5d85db09..f3caae7ea 100644 --- a/content/en/docs/claude-code/changelog.md +++ b/content/en/docs/claude-code/changelog.md @@ -10,6 +10,10 @@ This page is generated from the [CHANGELOG.md on GitHub](https://github.com/anth Run `claude --version` to check your installed version. + + * Fixed Bedrock requests failing with `403 "Authorization header is missing"` when using `AWS_BEARER_TOKEN_BEDROCK` or `CLAUDE_CODE_SKIP_BEDROCK_AUTH` (regression in 2.1.94) + + * Added support for Amazon Bedrock powered by Mantle, set `CLAUDE_CODE_USE_MANTLE=1` * Changed default effort level from medium to high for API-key, Bedrock/Vertex/Foundry, Team, and Enterprise users (control this with `/effort`) diff --git a/content/en/docs/claude-code/fast-mode.md b/content/en/docs/claude-code/fast-mode.md index 2e41ef532..de78e32f0 100644 --- a/content/en/docs/claude-code/fast-mode.md +++ b/content/en/docs/claude-code/fast-mode.md @@ -124,7 +124,7 @@ This is useful for controlling costs in organizations where users run multiple c ## Handle rate limits -Fast mode has separate rate limits from standard Opus 4.6. When you hit the fast mode rate limit or run out of extra usage credits: +Fast mode has separate rate limits from standard Opus 4.6. When you hit the fast mode rate limit or run out of extra usage: 1. Fast mode automatically falls back to standard Opus 4.6 2. The `↯` icon turns gray to indicate cooldown diff --git a/content/en/docs/claude-code/how-claude-code-works.md b/content/en/docs/claude-code/how-claude-code-works.md index 3cadc310d..2882f157b 100644 --- a/content/en/docs/claude-code/how-claude-code-works.md +++ b/content/en/docs/claude-code/how-claude-code-works.md @@ -134,6 +134,8 @@ Claude Code manages context automatically as you approach the limit. It clears o To control what's preserved during compaction, add a "Compact Instructions" section to CLAUDE.md or run `/compact` with a focus (like `/compact focus on the API changes`). +If a single file or tool output is so large that context refills immediately after each summary, Claude Code stops auto-compacting after a few attempts and shows an error instead of looping. See [Auto-compaction stops with a thrashing error](/en/troubleshooting#auto-compaction-stops-with-a-thrashing-error) for recovery steps. + Run `/context` to see what's using space. MCP tool definitions are deferred by default and loaded on demand via [tool search](/en/mcp#scale-with-mcp-tool-search), so only tool names consume context until Claude uses a specific tool. Run `/mcp` to check per-server costs. #### Manage context with skills and subagents diff --git a/content/en/docs/claude-code/setup.md b/content/en/docs/claude-code/setup.md index 6a5776639..929aada4c 100644 --- a/content/en/docs/claude-code/setup.md +++ b/content/en/docs/claude-code/setup.md @@ -18,7 +18,7 @@ Claude Code runs on the following platforms and configurations: * Ubuntu 20.04+ * Debian 10+ * Alpine Linux 3.19+ -* **Hardware**: 4 GB+ RAM +* **Hardware**: 4 GB+ RAM, x64 or ARM64 processor * **Network**: internet connection required. See [network configuration](/en/network-config#network-access-requirements). * **Shell**: Bash, Zsh, PowerShell, or CMD. On Windows, [Git for Windows](https://git-scm.com/downloads/win) is required. * **Location**: [Anthropic supported countries](https://www.anthropic.com/supported-countries) @@ -41,19 +41,19 @@ To install Claude Code, use one of the following methods: **macOS, Linux, WSL:** - ```bash theme={null} + ```bash theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} curl -fsSL https://claude.ai/install.sh | bash ``` **Windows PowerShell:** - ```powershell theme={null} + ```powershell theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} irm https://claude.ai/install.ps1 | iex ``` **Windows CMD:** - ```batch theme={null} + ```batch theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd ``` @@ -67,7 +67,7 @@ To install Claude Code, use one of the following methods: - ```bash theme={null} + ```bash theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} brew install --cask claude-code ``` @@ -77,7 +77,7 @@ To install Claude Code, use one of the following methods: - ```powershell theme={null} + ```powershell theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} winget install Anthropic.ClaudeCode ``` diff --git a/content/en/docs/claude-code/statusline.md b/content/en/docs/claude-code/statusline.md index 90f97bffd..b5502a90b 100644 --- a/content/en/docs/claude-code/statusline.md +++ b/content/en/docs/claude-code/statusline.md @@ -769,7 +769,7 @@ This field is only present for Claude.ai subscribers (Pro/Max) after the first A Your status line script runs frequently during active sessions. Commands like `git status` or `git diff` can be slow, especially in large repositories. This example caches git information to a temp file and only refreshes it every 5 seconds. -Use a stable, fixed filename for the cache file like `/tmp/statusline-git-cache`. Each status line invocation runs as a new process, so process-based identifiers like `$$`, `os.getpid()`, or `process.pid` produce a different value every time and the cache is never reused. +The cache filename needs to be stable across status line invocations within a session, but unique across sessions so concurrent sessions in different repositories don't read each other's cached git state. Process-based identifiers like `$$`, `os.getpid()`, or `process.pid` change on every invocation and defeat the cache. Use the `session_id` from the JSON input instead: it's stable for the lifetime of a session and unique per session. Each script checks if the cache file is missing or older than 5 seconds before running git commands: @@ -780,8 +780,9 @@ Each script checks if the cache file is missing or older than 5 seconds before r MODEL=$(echo "$input" | jq -r '.model.display_name') DIR=$(echo "$input" | jq -r '.workspace.current_dir') + SESSION_ID=$(echo "$input" | jq -r '.session_id') - CACHE_FILE="/tmp/statusline-git-cache" + CACHE_FILE="/tmp/statusline-git-cache-$SESSION_ID" CACHE_MAX_AGE=5 # seconds cache_is_stale() { @@ -817,8 +818,9 @@ Each script checks if the cache file is missing or older than 5 seconds before r data = json.load(sys.stdin) model = data['model']['display_name'] directory = os.path.basename(data['workspace']['current_dir']) + session_id = data['session_id'] - CACHE_FILE = "/tmp/statusline-git-cache" + CACHE_FILE = f"/tmp/statusline-git-cache-{session_id}" CACHE_MAX_AGE = 5 # seconds def cache_is_stale(): @@ -861,8 +863,9 @@ Each script checks if the cache file is missing or older than 5 seconds before r const data = JSON.parse(input); const model = data.model.display_name; const dir = path.basename(data.workspace.current_dir); + const sessionId = data.session_id; - const CACHE_FILE = '/tmp/statusline-git-cache'; + const CACHE_FILE = `/tmp/statusline-git-cache-${sessionId}`; const CACHE_MAX_AGE = 5; // seconds const cacheIsStale = () => { diff --git a/content/en/docs/claude-code/troubleshooting.md b/content/en/docs/claude-code/troubleshooting.md index fdc5975cd..a1a8b4c56 100644 --- a/content/en/docs/claude-code/troubleshooting.md +++ b/content/en/docs/claude-code/troubleshooting.md @@ -746,6 +746,17 @@ Claude Code is designed to work with most development environments, but may cons 2. Close and restart Claude Code between major tasks 3. Consider adding large build directories to your `.gitignore` file +### Auto-compaction stops with a thrashing error + +If you see `Autocompact is thrashing: the context refilled to the limit...`, automatic compaction succeeded but a file or tool output immediately refilled the context window several times in a row. Claude Code stops retrying to avoid wasting API calls on a loop that isn't making progress. + +To recover: + +1. Ask Claude to read the oversized file in smaller chunks, such as a specific line range or function, instead of the whole file +2. Run `/compact` with a focus that drops the large output, for example `/compact keep only the plan and the diff` +3. Move the large-file work to a [subagent](/en/sub-agents) so it runs in a separate context window +4. Run `/clear` if the earlier conversation is no longer needed + ### Command hangs or freezes If Claude Code seems unresponsive: diff --git a/content/en/get-started.md b/content/en/get-started.md index 69c3d2ecd..17a067de2 100644 --- a/content/en/get-started.md +++ b/content/en/get-started.md @@ -20,6 +20,8 @@ Make your first API call to Claude and build a simple web search assistant. ```bash export ANTHROPIC_API_KEY='your-api-key-here' ``` + + To persist the key across shell sessions, add the line to your shell profile (such as `~/.zshrc` or `~/.bashrc`). @@ -43,7 +45,66 @@ Make your first API call to Claude and build a simple web search assistant. ``` **Example output:** - ```json + ```json Output + { + "id": "msg_01HCDu5LRGeP2o7s2xGmxyx8", + "type": "message", + "role": "assistant", + "content": [ + { + "type": "text", + "text": "Here are some effective search strategies to find the latest renewable energy developments:\n\n## Search Terms to Use:\n- \"renewable energy news 2024\"\n- \"clean energy breakthrough\"\n- \"solar/wind/battery technology advances\"\n- \"green energy innovations\"\n- \"climate tech developments\"\n- \"energy storage solutions\"\n\n## Best Sources to Check:\n\n**News & Industry Sites:**\n- Renewable Energy World\n- GreenTech Media (now Wood Mackenzie)\n- Energy Storage News\n- CleanTechnica\n- PV Magazine (for solar)\n- WindPower Engineering & Development..." + } + ], + "model": "claude-opus-4-6", + "stop_reason": "end_turn", + "usage": { + "input_tokens": 21, + "output_tokens": 305 + } + } + ``` + + + + + + + + Get your API key from the [Claude Console](/settings/keys) and set it as an environment variable: + + ```bash + export ANTHROPIC_API_KEY='your-api-key-here' + ``` + + To persist the key across shell sessions, add the line to your shell profile (such as `~/.zshrc` or `~/.bashrc`). + + + + Install the Anthropic CLI with Homebrew: + + ```bash + brew install anthropics/tap/ant + ``` + + For other installation methods, see [Installation](/docs/en/api/sdks/cli#installation) in the CLI reference. + + + + Run this command to create a simple web search assistant: + + ```bash + ant messages create \ + --model claude-opus-4-6 \ + --max-tokens 1000 \ + --message '{ + role: user, + content: "What should I search for to find the latest developments in renewable energy?" + }' + ``` + + **Example output:** + ```json Output { "id": "msg_01HCDu5LRGeP2o7s2xGmxyx8", "type": "message", @@ -74,6 +135,8 @@ Make your first API call to Claude and build a simple web search assistant. ```bash export ANTHROPIC_API_KEY='your-api-key-here' ``` + + To persist the key across shell sessions, add the line to your shell profile (such as `~/.zshrc` or `~/.bashrc`). @@ -112,7 +175,7 @@ Make your first API call to Claude and build a simple web search assistant. ``` **Example output:** - ```python + ```text Output [ TextBlock( text='Here are some effective search strategies for finding the latest renewable energy developments:\n\n**Search Terms to Use:**\n- "renewable energy news 2024"\n- "clean energy breakthroughs"\n- "solar/wind/battery technology advances"\n- "energy storage innovations"\n- "green hydrogen developments"\n- "renewable energy policy updates"\n\n**Reliable Sources to Check:**\n- **News & Analysis:** Reuters Energy, Bloomberg New Energy Finance, Greentech Media, Energy Storage News\n- **Industry Publications:** Renewable Energy World, PV Magazine, Wind Power Engineering\n- **Research Organizations:** International Energy Agency (IEA), National Renewable Energy Laboratory (NREL)\n- **Government Sources:** Department of Energy websites, EPA clean energy updates\n\n**Specific Topics to Explore:**\n- Perovskite and next-gen solar cells\n- Offshore wind expansion\n- Grid-scale battery storage\n- Green hydrogen production\n- Carbon capture technologies\n- Smart grid innovations\n- Energy policy changes and incentives...', @@ -132,6 +195,8 @@ Make your first API call to Claude and build a simple web search assistant. ```bash export ANTHROPIC_API_KEY='your-api-key-here' ``` + + To persist the key across shell sessions, add the line to your shell profile (such as `~/.zshrc` or `~/.bashrc`). @@ -175,7 +240,7 @@ main().catch(console.error); ``` **Example output:** - ```javascript hidelines={1..2} + ```javascript Output hidelines={1..2} const _ = // output { @@ -224,6 +289,8 @@ main().catch(console.error); ```bash export ANTHROPIC_API_KEY='your-api-key-here' ``` + + To persist the key across shell sessions, add the line to your shell profile (such as `~/.zshrc` or `~/.bashrc`). @@ -231,7 +298,7 @@ main().catch(console.error); **Gradle:** ```groovy - implementation("com.anthropic:anthropic-java:2.18.0") + implementation("com.anthropic:anthropic-java:2.20.0") ``` **Maven:** @@ -239,7 +306,7 @@ main().catch(console.error); com.anthropic anthropic-java - 2.18.0 + 2.20.0 ``` @@ -280,8 +347,7 @@ main().catch(console.error); ``` **Example output:** - - ```java nocheck + ```text Output [ContentBlock{text=TextBlock{text=Here are some effective search strategies to find the latest renewable energy developments: ## Search Terms to Use: diff --git a/content/en/intro.md b/content/en/intro.md index 6cb91b44f..a75d45475 100644 --- a/content/en/intro.md +++ b/content/en/intro.md @@ -20,6 +20,14 @@ The latest generation of Claude models: Looking to chat with Claude? Visit [claude.ai](https://www.claude.ai). +Anthropic offers two ways to build with Claude, each suited to different use cases: + +| | Messages API | Claude Managed Agents | +|---|---|---| +| **What it is** | Direct model prompting access | Pre-built, configurable agent harness that runs in managed infrastructure | +| **Best for** | Custom agent loops and fine-grained control | Long-running tasks and asynchronous work | +| **Learn more** | [Messages API docs](/docs/en/build-with-claude/working-with-messages) | [Claude Managed Agents docs](/docs/en/managed-agents/overview) | + ## Recommended path for new developers Follow these steps to go from zero to a working Claude integration. diff --git a/content/en/managed-agents/agent-setup.md b/content/en/managed-agents/agent-setup.md new file mode 100644 index 000000000..e01d6e5e3 --- /dev/null +++ b/content/en/managed-agents/agent-setup.md @@ -0,0 +1,479 @@ +# Define your agent + +Create a reusable, versioned agent configuration. + +--- + +An agent is a reusable, versioned configuration that defines persona and capabilities. It bundles the model, system prompt, tools, MCP servers, and skills that shape how Claude behaves during a session. + +Create the agent once as a reusable resource and reference it by ID each time you [start a session](/docs/en/managed-agents/sessions). Agents are versioned and easier to manage across many sessions. + + +All Managed Agents API requests require the `managed-agents-2026-04-01` beta header. The SDK sets the beta header automatically. + + +## Agent configuration fields + +| Field | Description | +| --- | --- | +| `name` | Required. A human-readable name for the agent. | +| `model` | Required. The Claude [model](/docs/en/about-claude/models/overview) that powers the agent. All Claude 4.5 and later models are supported. | +| `system` | A [system prompt](/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role) that defines the agent's behavior and persona. The system prompt is distinct from [user messages](/docs/en/managed-agents/events-and-streaming#user-events), which should describe the work to be done. | +| `tools` | The tools available to the agent. Combines [pre-built agent tools](/docs/en/managed-agents/tools), [MCP tools](/docs/en/managed-agents/mcp-connector), and [custom tools](/docs/en/managed-agents/tools#custom-tools). | +| `mcp_servers` | MCP servers that provide standardized third-party capabilities. | +| `skills` | [Skills](/docs/en/managed-agents/skills) that supply domain-specific context with progressive disclosure. | +| `callable_agents` | Other agents this agent can invoke for [multi-agent orchestration](/docs/en/managed-agents/multi-agent). This is a research preview feature; [request access](https://claude.com/form/claude-managed-agents) to try it.| +| `description` | A description of what the agent does. | +| `metadata` | Arbitrary key-value pairs for your own tracking. | + +## Create an agent + +The following example defines a coding agent that uses Claude Sonnet 4.6 with access to the pre-built agent toolset. The toolset lets the agent write code, read files, search the web, and more. See the [agent tools reference](/docs/en/managed-agents/tools) for the full list of supported tools. + + + +````bash +agent=$(curl -fsSL https://api.anthropic.com/v1/agents \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -d '{ + "name": "Coding Assistant", + "model": "claude-sonnet-4-6", + "system": "You are a helpful coding agent.", + "tools": [{"type": "agent_toolset_20260401"}] + }') + +AGENT_ID=$(jq -r '.id' <<< "$agent") +AGENT_VERSION=$(jq -r '.version' <<< "$agent") +```` + + +````bash +ant beta:agents create \ + --name "Coding Assistant" \ + --model claude-sonnet-4-6 \ + --system "You are a helpful coding agent." \ + --tool '{type: agent_toolset_20260401}' +```` + + +````python +agent = client.beta.agents.create( + name="Coding Assistant", + model="claude-sonnet-4-6", + system="You are a helpful coding agent.", + tools=[ + {"type": "agent_toolset_20260401"}, + ], +) +```` + + +````typescript +const agent = await client.beta.agents.create({ + name: "Coding Assistant", + model: "claude-sonnet-4-6", + system: "You are a helpful coding agent.", + tools: [{ type: "agent_toolset_20260401" }], +}); +```` + + +````csharp +var agent = await client.Beta.Agents.Create(new() +{ + Name = "Coding Assistant", + Model = new("claude-sonnet-4-6"), + System = "You are a helpful coding agent.", + Tools = + [ + new BetaManagedAgentsAgentToolset20260401Params + { + Type = "agent_toolset_20260401", + }, + ], +}); +```` + + +````go +agent, err := client.Beta.Agents.New(ctx, anthropic.BetaAgentNewParams{ + Name: "Coding Assistant", + Model: anthropic.BetaManagedAgentsModelConfigParams{ + ID: "claude-sonnet-4-6", + Type: anthropic.BetaManagedAgentsModelConfigParamsTypeModelConfig, + }, + System: anthropic.String("You are a helpful coding agent."), + Tools: []anthropic.BetaAgentNewParamsToolUnion{{ + OfAgentToolset20260401: &anthropic.BetaManagedAgentsAgentToolset20260401Params{ + Type: anthropic.BetaManagedAgentsAgentToolset20260401ParamsTypeAgentToolset20260401, + }, + }}, +}) +if err != nil { + panic(err) +} +```` + + +````java +var agent = client.beta().agents().create( + AgentCreateParams.builder() + .name("Coding Assistant") + .model(BetaManagedAgentsModel.CLAUDE_SONNET_4_6) + .system("You are a helpful coding agent.") + .addTool( + BetaManagedAgentsAgentToolset20260401Params.builder() + .type(BetaManagedAgentsAgentToolset20260401Params.Type.AGENT_TOOLSET_20260401) + .build() + ) + .build() +); +```` + + +````php +$agent = $client->beta->agents->create( + name: 'Coding Assistant', + model: 'claude-sonnet-4-6', + system: 'You are a helpful coding agent.', + tools: [ + BetaManagedAgentsAgentToolset20260401Params::with( + type: 'agent_toolset_20260401', + ), + ], +); +```` + + +````ruby +agent = client.beta.agents.create( + name: "Coding Assistant", + model: "claude-sonnet-4-6", + system_: "You are a helpful coding agent.", + tools: [{type: "agent_toolset_20260401"}] +) +```` + + + + +To use Claude Opus 4.6 with [fast mode](/docs/en/build-with-claude/fast-mode), pass `model` as an object: `{"id": "claude-opus-4-6", "speed": "fast"}`. + + +The response echoes your configuration and adds `id`, `version`, `created_at`, `updated_at`, and `archived_at` fields. The `version` starts at 1 and increments each time you update the agent. + +```json +{ + "id": "agent_01HqR2k7vXbZ9mNpL3wYcT8f", + "type": "agent", + "name": "Coding Assistant", + "model": { + "id": "claude-sonnet-4-6", + "speed": "standard" + }, + "system": "You are a helpful coding agent.", + "description": null, + "tools": [ + { + "type": "agent_toolset_20260401", + "default_config": { + "permission_policy": { "type": "always_allow" } + } + } + ], + "skills": [], + "mcp_servers": [], + "metadata": {}, + "version": 1, + "created_at": "2026-04-03T18:24:10.412Z", + "updated_at": "2026-04-03T18:24:10.412Z", + "archived_at": null +} +``` + +## Update an agent + +Updating an agent generates a new version. Pass the current `version` to ensure you're updating from a known state. + + + +````bash +updated_agent=$(curl -fsSL "https://api.anthropic.com/v1/agents/$AGENT_ID" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -d @- <beta->agents->update( + $agent->id, + version: $agent->version, + system: 'You are a helpful coding agent. Always write tests.', +); + +echo "New version: {$updatedAgent->version}\n"; +```` + + +````ruby +updated_agent = client.beta.agents.update( + agent.id, + version: agent.version, + system_: "You are a helpful coding agent. Always write tests." +) + +puts "New version: #{updated_agent.version}" +```` + + + +### Update semantics + +- **Omitted fields are preserved.** You only need to include the fields you want to change. + +- **Scalar fields** (`model`, `system`, `name`, etc.) are replaced with the new value. `system` and `description` can be cleared by passing `null`. `model` and `name` are mandatory and cannot be cleared. + +- **Array fields** (`tools`, `mcp_servers`, `skills`, `callable_agents`) are fully replaced by the new array. To clear an array field entirely, pass `null` or an empty array. + +- **Metadata** is merged at the key level. Keys you provide are added or updated. Keys you omit are preserved. To delete a specific key, set its value to an empty string. + +- **No-op detection.** If the update produces no change relative to the current version, no new version is created and the existing version is returned. + +## Agent lifecycle + +| Operation | Behavior | +| --- | --- | +| **Update** | Generates a new agent version. | +| **List versions** | Fetch the full version history to track changes over time. | +| **Archive** | The agent becomes read-only. New sessions cannot reference it, but existing sessions continue to run. | + +### List versions + +Fetch the full version history to track how an agent has changed over time. + + + +````bash +curl -fsSL "https://api.anthropic.com/v1/agents/$AGENT_ID/versions" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + | jq -r '.data[] | "Version \(.version): \(.updated_at)"' +```` + + +````bash +ant beta:agents:versions list --agent-id "$AGENT_ID" +```` + + +````python +for version in client.beta.agents.versions.list(agent.id): + print(f"Version {version.version}: {version.updated_at.isoformat()}") +```` + + +````typescript +for await (const version of client.beta.agents.versions.list(agent.id)) { + console.log(`Version ${version.version}: ${version.updated_at}`); +} +```` + + +````csharp +var versions = await client.Beta.Agents.Versions.List(agent.ID); +await foreach (var version in versions.Paginate()) +{ + Console.WriteLine($"Version {version.Version}: {version.UpdatedAt:O}"); +} +```` + + +````go +iter := client.Beta.Agents.Versions.ListAutoPaging(ctx, agent.ID, anthropic.BetaAgentVersionListParams{}) +for iter.Next() { + version := iter.Current() + fmt.Printf("Version %d: %s\n", version.Version, version.UpdatedAt.Format(time.RFC3339)) +} +if err := iter.Err(); err != nil { + panic(err) +} +```` + + +````java +for (var version : client.beta().agents().versions().list(agent.id()).autoPager()) { + IO.println("Version " + version.version() + ": " + version.updatedAt()); +} +```` + + +````php +foreach ($client->beta->agents->versions->list($agent->id)->pagingEachItem() as $version) { + echo "Version {$version->version}: {$version->updatedAt->format(DateTimeInterface::ATOM)}\n"; +} +```` + + +````ruby +client.beta.agents.versions.list(agent.id).auto_paging_each do + puts "Version #{it.version}: #{it.updated_at.iso8601}" +end +```` + + + +### Archive an agent + +Archiving makes the agent read-only. Existing sessions continue to run, but new sessions cannot reference the agent. The response sets `archived_at` to the archive timestamp. + + + +````bash +archived=$(curl -fsSL -X POST "https://api.anthropic.com/v1/agents/$AGENT_ID/archive" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01") + +echo "Archived at: $(jq -r '.archived_at' <<< "$archived")" +```` + + +````bash +ant beta:agents archive --agent-id "$AGENT_ID" +```` + + +````python +archived = client.beta.agents.archive(agent.id) + +print(f"Archived at: {archived.archived_at.isoformat()}") +```` + + +````typescript +const archived = await client.beta.agents.archive(agent.id); +console.log(`Archived at: ${archived.archived_at}`); +```` + + +````csharp +var archived = await client.Beta.Agents.Archive(agent.ID); +Console.WriteLine($"Archived at: {archived.ArchivedAt:O}"); +```` + + +````go +archived, err := client.Beta.Agents.Archive(ctx, agent.ID, anthropic.BetaAgentArchiveParams{}) +if err != nil { + panic(err) +} +fmt.Printf("Archived at: %s\n", archived.ArchivedAt.Format(time.RFC3339)) +```` + + +````java +var archived = client.beta().agents().archive(agent.id()); +IO.println("Archived at: " + archived.archivedAt().orElseThrow()); +```` + + +````php +$archived = $client->beta->agents->archive($agent->id); + +echo "Archived at: {$archived->archivedAt->format(DateTimeInterface::ATOM)}\n"; +```` + + +````ruby +archived = client.beta.agents.archive(agent.id) +puts "Archived at: #{archived.archived_at.iso8601}" +```` + + + +## Next steps + +- [Configure tools](/docs/en/managed-agents/tools) to customize which capabilities the agent can use. +- [Attach skills](/docs/en/managed-agents/skills) for domain-specific expertise. +- [Start a session](/docs/en/managed-agents/sessions) that references your agent. \ No newline at end of file diff --git a/content/en/managed-agents/cloud-containers.md b/content/en/managed-agents/cloud-containers.md new file mode 100644 index 000000000..a8da150ac --- /dev/null +++ b/content/en/managed-agents/cloud-containers.md @@ -0,0 +1,71 @@ +# Container reference + +Pre-installed packages, databases, and utilities available in cloud containers. + +--- + +Cloud containers in Claude Managed Agents come pre-installed with a comprehensive set of programming languages, databases, and utilities. The agent can use these immediately without any installation steps. + + +All Managed Agents API requests require the `managed-agents-2026-04-01` beta header. The SDK sets the beta header automatically. + + +## Programming languages + +| Language | Version | Package manager | +|----------|---------|-----------------| +| Python | 3.12+ | pip, uv | +| Node.js | 20+ | npm, yarn, pnpm | +| Go | 1.22+ | go modules | +| Rust | 1.77+ | cargo | +| Java | 21+ | maven, gradle | +| Ruby | 3.3+ | bundler, gem | +| PHP | 8.3+ | composer | +| C/C++ | GCC 13+ | make, cmake | + +## Databases + +| Database | Description | +|----------|-------------| +| SQLite | Pre-installed, available immediately | +| PostgreSQL client | `psql` client for connecting to external databases | +| Redis client | `redis-cli` for connecting to external instances | + + +Database servers (PostgreSQL, Redis, etc.) are not running in the container by default. The container includes client tools for connecting to external database instances. SQLite is fully available for local use. + + +## Utilities + +### System tools + +- `git` - Version control +- `curl`, `wget` - HTTP clients +- `jq` - JSON processing +- `tar`, `zip`, `unzip` - Archive tools +- `ssh`, `scp` - Remote access (requires network enabled) +- `tmux`, `screen` - Terminal multiplexers + +### Development tools + +- `make`, `cmake` - Build systems +- `docker` - Container management (limited availability) +- `ripgrep` (`rg`) - Fast file search +- `tree` - Directory visualization +- `htop` - Process monitoring + +### Text processing + +- `sed`, `awk`, `grep` - Stream editors +- `vim`, `nano` - Text editors +- `diff`, `patch` - File comparison + +## Container specifications + +| Property | Value | +|----------|-------| +| Operating system | Ubuntu 22.04 LTS | +| Architecture | x86_64 (amd64) | +| Memory | Up to 8 GB | +| Disk space | Up to 10 GB | +| Network | Disabled by default (enable in environment config) | \ No newline at end of file diff --git a/content/en/managed-agents/define-outcomes.md b/content/en/managed-agents/define-outcomes.md new file mode 100644 index 000000000..7462c783b --- /dev/null +++ b/content/en/managed-agents/define-outcomes.md @@ -0,0 +1,563 @@ +# Define outcomes + +Tell the agent what 'done' looks like, and let it iterate until it gets there. + +--- + + +Outcomes is a Research Preview feature. [Request access](https://claude.com/form/claude-managed-agents) to try it. + + +The `outcome` elevates a session from *conversation* to *work*. You define what the end result should look like and how to measure quality. The agent works toward that target, self-evaluating and iterating until the outcome is met. + +When you define an outcome, the harness automatically provisions a *grader* to evaluate the artifact against a rubric. It leverages a separate context window to avoid being influenced by the main agent's implementation choices. + +The grader returns a per-criterion breakdown: either confirmation that the artifact satisfies the rubric, or the specific gaps between the current work and the requirements. That feedback is handed back to the agent for the next iteration. + + +All Managed Agents API requests require the `managed-agents-2026-04-01` beta header. Research preview features additionally require `managed-agents-2026-04-01-research-preview`. The SDK sets these beta headers automatically. + + +## Create a rubric + +A rubric is a markdown document describing per-criterion scoring. The rubric is required. + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    + +Structure the rubric as explicit, gradeable criteria, such as "The CSV contains a price column with numeric values" rather than "The data looks good." The grader scores each criterion independently, so vague criteria produce noisy evaluations. + +If you don't have a rubric on hand, try giving Claude an example of a known-good artifact and asking it to analyze what makes that content good, then turn that analysis into a rubric. This middle-ground approach often produces better results than writing criteria from scratch. + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    + +Example rubric: + +```markdown +# DCF Model Rubric + +## Revenue Projections +- Uses historical revenue data from the last 5 fiscal years +- Projects revenue for at least 5 years forward +- Growth rate assumptions are explicitly stated and reasonable + +## Cost Structure +- COGS and operating expenses are modeled separately +- Margins are consistent with historical trends or deviations are justified + +## Discount Rate +- WACC is calculated with stated assumptions for cost of equity and cost of debt +- Beta, risk-free rate, and equity risk premium are sourced or justified + +## Terminal Value +- Uses either perpetuity growth or exit multiple method (stated which) +- Terminal growth rate does not exceed long-term GDP growth + +## Output Quality +- All figures are in a single .xlsx file with clearly labeled sheets +- Key assumptions are on a separate "Assumptions" sheet +- Sensitivity analysis on WACC and terminal growth rate is included +``` + +Pass the rubric as inline text on `user.define_outcome` (shown in the next section), or upload it via the Files API for reuse across sessions: + +**Requires beta header `files-api-2025-04-14`.** + + + + ```bash curl + rubric=$(curl -fsSL https://api.anthropic.com/v1/files \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01,files-api-2025-04-14" \ + -F file=@/path/to/pr_review_rubric.md) + rubric_id=$(jq -r '.id' <<<"$rubric") + printf 'Uploaded rubric: %s\n' "$rubric_id" + ``` + + ```bash CLI + RUBRIC_ID=$(ant beta:files upload \ + --file /path/to/pr_review_rubric.md \ + --transform id --format yaml) + ``` + ```python Python + from pathlib import Path + + rubric = client.beta.files.upload(file=Path("/path/to/pr_review_rubric.md")) + print(f"Uploaded rubric: {rubric.id}") + ``` + ```typescript TypeScript + import { readFile } from "node:fs/promises"; + import { toFile } from "@anthropic-ai/sdk"; + + const rubric = await client.beta.files.upload({ + file: await toFile(readFile("/path/to/pr_review_rubric.md"), "pr_review_rubric.md") + }); + console.log(`Uploaded rubric: ${rubric.id}`); + ``` + ```csharp C# + var rubric = await client.Beta.Files.Upload(new() + { + File = File.OpenRead("/path/to/pr_review_rubric.md"), + }); + Console.WriteLine($"Uploaded rubric: {rubric.ID}"); + ``` + ```go Go + f, err := os.Open("/path/to/pr_review_rubric.md") + if err != nil { + panic(err) + } + + rubric, err := client.Beta.Files.Upload(ctx, anthropic.BetaFileUploadParams{ + File: anthropic.File(f, "pr_review_rubric.md", "text/markdown"), + }) + if err != nil { + panic(err) + } + fmt.Printf("Uploaded rubric: %s\n", rubric.ID) + ``` + ```java Java + var rubric = client.beta().files().upload( + FileUploadParams.builder() + .file(Path.of("/path/to/pr_review_rubric.md")) + .build() + ); + IO.println("Uploaded rubric: " + rubric.id()); + ``` + ```php PHP + $rubric = $client->beta->files->upload( + file: fopen('/path/to/pr_review_rubric.md', 'r'), + ); + echo "Uploaded rubric: {$rubric->id}\n"; + ``` + ```ruby Ruby + require "pathname" + + rubric = client.beta.files.upload(file: Pathname.new("/path/to/pr_review_rubric.md")) + puts "Uploaded rubric: #{rubric.id}" + ``` + + +## Create a session with an outcome + +After creating a session, send a `user.define_outcome` event. The agent begins work immediately; no additional user message event is required. + + + + ```bash curl + # Create a session + session=$(curl -fsSL https://api.anthropic.com/v1/sessions \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01-research-preview" \ + --json @- </dev/null <beta->sessions->create( + agent: $agent->id, + environmentID: $environment->id, + title: 'Financial analysis on Costco', + ); + + // Define the outcome — agent starts working on receipt + $client->beta->sessions->events->send( + $session->id, + events: [ + [ + 'type' => 'user.define_outcome', + 'description' => 'Build a DCF model for Costco in .xlsx', + 'rubric' => ['type' => 'text', 'content' => $rubric], + // or: 'rubric' => ['type' => 'file', 'file_id' => $rubric->id], + 'max_iterations' => 5, // optional; default 3, max 20 + ], + ], + ); + ``` + ```ruby Ruby + # Create a session + session = client.beta.sessions.create( + agent: agent.id, + environment_id: environment.id, + title: "Financial analysis on Costco" + ) + + # Define the outcome — agent starts working on receipt + client.beta.sessions.events.send_( + session.id, + events: [ + { + type: "user.define_outcome", + description: "Build a DCF model for Costco in .xlsx", + rubric: {type: "text", content: rubric}, + # or: rubric: {type: "file", file_id: rubric.id}, + max_iterations: 5 # optional; default 3, max 20 + } + ] + ) + ``` + + +## Outcome events + +Progress on an outcome-oriented session is surfaced on the events [stream](/docs/en/managed-agents/events-and-streaming). + +- `agent.*` events (messages, tool use, etc.) show progress towards the outcome. +- `span.outcome_evaluation_*` events are only emitted for outcome-oriented sessions and show the number of iteration loops and the grader's feedback process. +- You can also send `user.message` [events](/docs/en/managed-agents/events-and-streaming#user-events) to an outcome-oriented session, to direct the agent's work as it progresses, but these are not as necessary; the agent knows to work until it has exhausted its iterations or achieved the outcome. +- A `user.interrupt` event will pause work on the current outcome and mark the `span.outcome_evaluation_end.result` as `interrupted`, allowing you to kick off a new outcome. +- After the final outcome evaluation, the session can be continued as a conversational session, or a new outcome can be kicked off. The session will retain history of the prior outcome. + +### Define outcome user event + +Only one outcome supported at a time, but you may chain together outcomes in sequence. To do this, send a new `user.define_outcome` event after the terminal event of the previous outcome. + + +This is the event you send to initiate an outcome. It is echoed back on receipt, including a `processed_at` timestamp and `outcome_id`. + +```json +{ + "type": "user.define_outcome", + "description": "Build a DCF model for Costco in .xlsx", + "rubric": { "type": "file", "file_id": "file_01..." }, + "max_iterations": 5 +} +``` + +### Outcome evaluation start + +Emitted once the grader starts an evaluation over one iteration loop. The `iteration` field is a 0-indexed revision counter: `0` is the first evaluation, `1` is the re-evaluation after the first revision, and so on. + +```json +{ + "type": "span.outcome_evaluation_start", + "id": "sevt_01def...", + "outcome_id": "outc_01a...", + "iteration": 0, + "processed_at": "2026-03-25T14:01:45Z" +} +``` + +### Outcome evaluation ongoing + +Heartbeat emitted while the grader runs. The grader's internal reasoning is opaque: you see that it's working, not what it's thinking. + +```json +{ + "type": "span.outcome_evaluation_ongoing", + "id": "sevt_01ghi...", + "outcome_id": "outc_01a...", + "processed_at": "2026-03-25T14:02:10Z" +} +``` + +### Outcome evaluation end + +Emitted after the grader finishes evaluating one iteration. The `result` field indicates what happens next. + +| Result | Next | +| --- | --- | +| `satisfied` | Session transitions to `idle`. | +| `needs_revision` | Agent starts a new iteration cycle. | +| `max_iterations_reached` | No further evaluation cycles. The agent may run one final revision before the session transitions to `idle`. | +| `failed` | Session transitions to `idle`. Returned when the rubric fundamentally does not match the task, for example if the description and rubric contradict each other. | +| `interrupted` | Only emitted if `outcome_evaluation_start` already fired before the interrupt. | + +```json +{ + "type": "span.outcome_evaluation_end", + "id": "sevt_01jkl...", + "outcome_evaluation_start_id": "sevt_01def...", + "outcome_id": "outc_01a...", + "result": "satisfied", + "explanation": "All 12 criteria met: revenue projections use 5 years of historical data, WACC assumptions are stated, sensitivity table is included...", + "iteration": 0, + "usage": { + "input_tokens": 2400, + "output_tokens": 350, + "cache_creation_input_tokens": 0, + "cache_read_input_tokens": 1800 + }, + "processed_at": "2026-03-25T14:03:00Z" +} +``` + +## Checking on outcome status + +You can either listen on the [event stream](/docs/en/managed-agents/events-and-streaming) for `span.outcome_evaluation_end`, or poll `GET /v1/sessions/:id` and read `outcome_evaluations[].result`: + + + + ```bash curl + session=$(curl -fsSL "https://api.anthropic.com/v1/sessions/$session_id" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01-research-preview") + + jq -r '.outcome_evaluations[] | "\(.outcome_id): \(.result)"' <<<"$session" + # outc_01a...: satisfied + ``` + + ```bash CLI + ant beta:sessions retrieve --session-id "$SESSION_ID" + ``` + ```python Python + session = client.beta.sessions.retrieve(session.id) + + for outcome in session.outcome_evaluations: + print(f"{outcome.outcome_id}: {outcome.result}") + # outc_01a...: satisfied + ``` + ```typescript TypeScript + const retrieved = await client.beta.sessions.retrieve(session.id); + + for (const outcome of retrieved.outcome_evaluations) { + console.log(`${outcome.outcome_id}: ${outcome.result}`); + // outc_01a...: satisfied + } + ``` + ```csharp C# + session = await client.Beta.Sessions.Retrieve(session.ID); + + foreach (var outcome in session.OutcomeEvaluations) + { + Console.WriteLine($"{outcome.OutcomeID}: {outcome.Result}"); + // outc_01a...: satisfied + } + ``` + ```go Go + session, err = client.Beta.Sessions.Get(ctx, session.ID, anthropic.BetaSessionGetParams{}) + if err != nil { + panic(err) + } + + for _, outcome := range session.OutcomeEvaluations { + fmt.Printf("%s: %s\n", outcome.OutcomeID, outcome.Result) + // outc_01a...: satisfied + } + ``` + ```java Java + var retrieved = client.beta().sessions().retrieve(session.id()); + + for (var outcome : retrieved.outcomeEvaluations()) { + IO.println(outcome.outcomeId() + ": " + outcome.result()); + // outc_01a...: satisfied + } + ``` + ```php PHP + $session = $client->beta->sessions->retrieve($session->id); + + foreach ($session->outcomeEvaluations as $outcome) { + echo "{$outcome->outcomeID}: {$outcome->result}\n"; + // outc_01a...: satisfied + } + ``` + ```ruby Ruby + session = client.beta.sessions.retrieve(session.id) + + session.outcome_evaluations.each do + puts "#{it.outcome_id}: #{it.result}" + # outc_01a...: satisfied + end + ``` + + +## Retrieving deliverables + +The agent writes output files to `/mnt/session/outputs/` inside the container. Once the session is idle, fetch them via the [Files API](/docs/en/build-with-claude/files) scoped to the session: + + + ```bash curl + # List files produced by this session + curl -fsSL "https://api.anthropic.com/v1/files?scope_id=$session_id" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: files-api-2025-04-14,managed-agents-2026-04-01-research-preview" \ + | jq '.data[] | {id, filename, size_bytes}' + + # Download by file_id + curl -fsSL "https://api.anthropic.com/v1/files/$file_id/content" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: files-api-2025-04-14" \ + -o costco_dcf.xlsx + ``` + ```python Python + files = client.beta.files.list(scope_id=session.id) + for f in files.data: + print(f"{f.id}: {f.filename} ({f.size_bytes} bytes)") + + content = client.beta.files.download(files.data[0].id) + content.write_to_file("costco_dcf.xlsx") + ``` + \ No newline at end of file diff --git a/content/en/managed-agents/environments.md b/content/en/managed-agents/environments.md new file mode 100644 index 000000000..66701ad4c --- /dev/null +++ b/content/en/managed-agents/environments.md @@ -0,0 +1,669 @@ +# Cloud environment setup + +Customize cloud containers for your sessions. + +--- + +Environments define the container configuration where your agent runs. You create an environment once, then reference its ID each time you start a session. Multiple sessions can share the same environment, but each session gets its own isolated container instance. + + +All Managed Agents API requests require the `managed-agents-2026-04-01` beta header. The SDK sets the beta header automatically. + + +## Create an environment + + + +````bash +environment=$(curl -fsS https://api.anthropic.com/v1/environments \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + --data @- <<'EOF' +{ + "name": "python-dev", + "config": { + "type": "cloud", + "networking": {"type": "unrestricted"} + } +} +EOF +) +environment_id=$(jq -r '.id' <<< "$environment") + +echo "Environment ID: $environment_id" +```` + + +````bash +ant beta:environments create \ + --name "python-dev" \ + --config '{type: cloud, networking: {type: unrestricted}}' +```` + + +````python +environment = client.beta.environments.create( + name="python-dev", + config={ + "type": "cloud", + "networking": {"type": "unrestricted"}, + }, +) + +print(f"Environment ID: {environment.id}") +```` + + +````typescript +const environment = await client.beta.environments.create({ + name: "python-dev", + config: { + type: "cloud", + networking: { type: "unrestricted" }, + }, +}); + +console.log(`Environment ID: ${environment.id}`); +```` + + +````csharp +var environment = await client.Beta.Environments.Create(new() +{ + Name = "python-dev", + Config = new() + { + Networking = new UnrestrictedNetwork(), + }, +}); + +Console.WriteLine($"Environment ID: {environment.ID}"); +```` + + +````go +environment, err := client.Beta.Environments.New(ctx, anthropic.BetaEnvironmentNewParams{ + Name: "python-dev", + Config: anthropic.BetaCloudConfigParams{ + Networking: anthropic.BetaCloudConfigParamsNetworkingUnion{ + OfUnrestricted: &anthropic.UnrestrictedNetworkParam{}, + }, + }, +}) +if err != nil { + panic(err) +} + +fmt.Printf("Environment ID: %s\n", environment.ID) +```` + + +````java +var environment = client.beta().environments().create(EnvironmentCreateParams.builder() + .name("python-dev") + .config(BetaCloudConfigParams.builder() + .networking(UnrestrictedNetwork.builder().build()) + .build()) + .build()); +IO.println("Environment ID: " + environment.id()); +```` + + +````php +$environment = $client->beta->environments->create( + name: 'python-dev', + config: ['type' => 'cloud', 'networking' => ['type' => 'unrestricted']], +); +echo "Environment ID: {$environment->id}\n"; +```` + + +````ruby +environment = client.beta.environments.create( + name: "python-dev", + config: { + type: "cloud", + networking: {type: "unrestricted"} + } +) + +puts "Environment ID: #{environment.id}" +```` + + + +The `name` must be unique within your organization and workspace. + +## Use the environment in a session + +Pass the environment ID as a string when creating a session. + + + +````bash +session=$(curl -fsS https://api.anthropic.com/v1/sessions \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + --data @- <beta->sessions->create( + agent: $agent->id, + environmentID: $environment->id, +); +```` + + +````ruby +session = client.beta.sessions.create( + agent: agent.id, + environment_id: environment.id +) +```` + + + +## Configuration options + +### Packages + +The `packages` field pre-installs packages into the container before the agent starts. Packages are installed by their respective package managers and cached across sessions that share the same environment. When multiple package managers are specified, they run in alphabetical order (apt, cargo, gem, go, npm, pip). You can optionally pin specific versions; the default is latest. + + +```bash curl +environment=$(curl -fsS https://api.anthropic.com/v1/environments \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + --data @- <<'EOF' +{ + "name": "data-analysis", + "config": { + "type": "cloud", + "packages": { + "pip": ["pandas", "numpy", "scikit-learn"], + "npm": ["express"] + }, + "networking": {"type": "unrestricted"} + } +} +EOF +) +``` + +```bash CLI +ant beta:environments create <<'YAML' +name: data-analysis +config: + type: cloud + packages: + pip: + - pandas + - numpy + - scikit-learn + npm: + - express + networking: + type: unrestricted +YAML +``` + +```python Python +environment = client.beta.environments.create( + name="data-analysis", + config={ + "type": "cloud", + "packages": { + "pip": ["pandas", "numpy", "scikit-learn"], + "npm": ["express"], + }, + "networking": {"type": "unrestricted"}, + }, +) +``` + +```typescript TypeScript +const environment = await client.beta.environments.create({ + name: "data-analysis", + config: { + type: "cloud", + packages: { + pip: ["pandas", "numpy", "scikit-learn"], + npm: ["express"] + }, + networking: { type: "unrestricted" } + } +}); +``` + +```csharp C# +var environment = await client.Beta.Environments.Create(new() +{ + Name = "data-analysis", + Config = new() + { + Packages = new() + { + Pip = ["pandas", "numpy", "scikit-learn"], + Npm = ["express"], + }, + Networking = new UnrestrictedNetwork(), + }, +}); +``` + +```go Go +environment, err := client.Beta.Environments.New(ctx, anthropic.BetaEnvironmentNewParams{ + Name: "data-analysis", + Config: anthropic.BetaCloudConfigParams{ + Packages: anthropic.BetaPackagesParams{ + Pip: []string{"pandas", "numpy", "scikit-learn"}, + Npm: []string{"express"}, + }, + Networking: anthropic.BetaCloudConfigParamsNetworkingUnion{ + OfUnrestricted: &anthropic.UnrestrictedNetworkParam{}, + }, + }, +}) +if err != nil { + panic(err) +} +``` + +```java Java +var environment = client.beta().environments().create(EnvironmentCreateParams.builder() + .name("data-analysis") + .config(BetaCloudConfigParams.builder() + .packages(BetaPackagesParams.builder() + .pip(List.of("pandas", "numpy", "scikit-learn")) + .npm(List.of("express")) + .build()) + .networking(UnrestrictedNetwork.builder().build()) + .build()) + .build()); +``` + +```php PHP +$environment = $client->beta->environments->create( + name: 'data-analysis', + config: [ + 'type' => 'cloud', + 'packages' => [ + 'pip' => ['pandas', 'numpy', 'scikit-learn'], + 'npm' => ['express'], + ], + 'networking' => ['type' => 'unrestricted'], + ], +); +``` + +```ruby Ruby +environment = client.beta.environments.create( + name: "data-analysis", + config: { + type: "cloud", + packages: { + pip: %w[pandas numpy scikit-learn], + npm: %w[express] + }, + networking: {type: "unrestricted"} + } +) +``` + + +Supported package managers: + +| Field | Package manager | Example | +| --- | --- | --- | +| `apt` | System packages (apt-get) | `"ffmpeg"` | +| `cargo` | Rust (cargo) | `"ripgrep@14.0.0"` | +| `gem` | Ruby (gem) | `"rails:7.1.0"` | +| `go` | Go modules | `"golang.org/x/tools/cmd/goimports@latest"` | +| `npm` | Node.js (npm) | `"express@4.18.0"` | +| `pip` | Python (pip) | `"pandas==2.2.0"` | + +### Networking + +The `networking` field controls the container's outbound network access. It does not impact the `web_search` or `web_fetch` tools' allowed domains. + +| Mode | Description | +| --- | --- | +| `unrestricted` | Full outbound network access, except for a general safety blocklist. This is the default. | +| `limited` | Restricts container network access to the `allowed_hosts` list. Further access is enabled via the `allow_package_managers` and `allow_mcp_servers` bool.| + + +```bash curl +config=$(cat <<'EOF' +{ + "type": "cloud", + "networking": { + "type": "limited", + "allowed_hosts": ["api.example.com"], + "allow_mcp_servers": true, + "allow_package_managers": true + } +} +EOF +) +``` + +```python Python +config = { + "type": "cloud", + "networking": { + "type": "limited", + "allowed_hosts": ["api.example.com"], + "allow_mcp_servers": True, + "allow_package_managers": True, + }, +} +``` + +```typescript TypeScript +const config = { + type: "cloud", + networking: { + type: "limited", + allowed_hosts: ["api.example.com"], + allow_mcp_servers: true, + allow_package_managers: true + } +}; +``` + +```csharp C# +var config = new BetaCloudConfigParams +{ + Networking = new BetaLimitedNetworkParams + { + AllowedHosts = ["api.example.com"], + AllowMcpServers = true, + AllowPackageManagers = true, + }, +}; +``` + +```go Go +config := anthropic.BetaCloudConfigParams{ + Networking: anthropic.BetaCloudConfigParamsNetworkingUnion{ + OfLimited: &anthropic.BetaLimitedNetworkParams{ + AllowedHosts: []string{"api.example.com"}, + AllowMCPServers: anthropic.Bool(true), + AllowPackageManagers: anthropic.Bool(true), + }, + }, +} +``` + +```java Java +var config = BetaCloudConfigParams.builder() + .networking(BetaLimitedNetworkParams.builder() + .allowedHosts(List.of("api.example.com")) + .allowMcpServers(true) + .allowPackageManagers(true) + .build()) + .build(); +``` + +```php PHP +$config = [ + 'type' => 'cloud', + 'networking' => [ + 'type' => 'limited', + 'allowed_hosts' => ['api.example.com'], + 'allow_mcp_servers' => true, + 'allow_package_managers' => true, + ], +]; +``` + +```ruby Ruby +config = { + type: "cloud", + networking: { + type: "limited", + allowed_hosts: %w[api.example.com], + allow_mcp_servers: true, + allow_package_managers: true + } +} +``` + + + +For production deployments, use `limited` networking with an explicit `allowed_hosts` list. Follow the principle of least privilege by granting only the minimum network access your agent requires, and regularly audit your allowed domains. + + +When using `limited` networking: +- `allowed_hosts` specifies domains the container can reach. These must be HTTPS-prefixed. +- `allow_mcp_servers` permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`. +- `allow_package_managers` permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`. + +## Environment lifecycle + +- Environments persist until explicitly archived or deleted. +- Multiple sessions can reference the same environment. +- Each session gets its own container instance. Sessions do not share file system state. +- Environments are not versioned. If you frequently update your environments, you may want to log these updates on your side, to map environment state with sessions. + +## Manage environments + + + +````bash +# List environments +environments=$(curl -fsS https://api.anthropic.com/v1/environments \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01") + +# Retrieve a specific environment +env=$(curl -fsS "https://api.anthropic.com/v1/environments/$environment_id" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01") + +# Archive an environment (read-only, existing sessions continue) +curl -fsS -X POST "https://api.anthropic.com/v1/environments/$environment_id/archive" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" + +# Delete an environment (only if no sessions reference it) +curl -fsS -X DELETE "https://api.anthropic.com/v1/environments/$environment_id" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" +```` + + +````bash +# List environments +ant beta:environments list + +# Retrieve a specific environment +ant beta:environments retrieve --environment-id "$ENVIRONMENT_ID" + +# Archive an environment (read-only, existing sessions continue) +ant beta:environments archive --environment-id "$ENVIRONMENT_ID" + +# Delete an environment (only if no sessions reference it) +ant beta:environments delete --environment-id "$ENVIRONMENT_ID" +```` + + +````python +# List environments +environments = client.beta.environments.list() + +# Retrieve a specific environment +env = client.beta.environments.retrieve(environment.id) + +# Archive an environment (read-only, existing sessions continue) +client.beta.environments.archive(environment.id) + +# Delete an environment (only if no sessions reference it) +client.beta.environments.delete(environment.id) +```` + + +````typescript +// List environments +const environments = await client.beta.environments.list(); + +// Retrieve a specific environment +const env = await client.beta.environments.retrieve(environment.id); + +// Archive an environment (read-only, existing sessions continue) +await client.beta.environments.archive(environment.id); + +// Delete an environment (only if no sessions reference it) +await client.beta.environments.delete(environment.id); +```` + + +````csharp +// List environments +var environments = await client.Beta.Environments.List(); + +// Retrieve a specific environment +var env = await client.Beta.Environments.Retrieve(environment.ID); + +// Archive an environment (read-only, existing sessions continue) +await client.Beta.Environments.Archive(environment.ID); + +// Delete an environment (only if no sessions reference it) +await client.Beta.Environments.Delete(environment.ID); +```` + + +````go +// List environments +environments, err := client.Beta.Environments.List(ctx, anthropic.BetaEnvironmentListParams{}) +if err != nil { + panic(err) +} + +// Retrieve a specific environment +env, err := client.Beta.Environments.Get(ctx, environment.ID, anthropic.BetaEnvironmentGetParams{}) +if err != nil { + panic(err) +} + +// Archive an environment (read-only, existing sessions continue) +_, err = client.Beta.Environments.Archive(ctx, environment.ID, anthropic.BetaEnvironmentArchiveParams{}) +if err != nil { + panic(err) +} + +// Delete an environment (only if no sessions reference it) +_, err = client.Beta.Environments.Delete(ctx, environment.ID, anthropic.BetaEnvironmentDeleteParams{}) +if err != nil { + panic(err) +} +```` + + +````java +// List environments +var environments = client.beta().environments().list(); +// Retrieve a specific environment +var env = client.beta().environments().retrieve(environment.id()); +// Archive an environment (read-only, existing sessions continue) +client.beta().environments().archive(environment.id()); +// Delete an environment (only if no sessions reference it) +client.beta().environments().delete(environment.id()); +```` + + +````php +// List environments +$environments = $client->beta->environments->list(); +// Retrieve a specific environment +$env = $client->beta->environments->retrieve($environment->id); +// Archive an environment (read-only, existing sessions continue) +$client->beta->environments->archive($environment->id); +// Delete an environment (only if no sessions reference it) +$client->beta->environments->delete($environment->id); +```` + + +````ruby +# List environments +environments = client.beta.environments.list + +# Retrieve a specific environment +env = client.beta.environments.retrieve(environment.id) + +# Archive an environment (read-only, existing sessions continue) +client.beta.environments.archive(environment.id) + +# Delete an environment (only if no sessions reference it) +client.beta.environments.delete(environment.id) +```` + + + +## Pre-installed runtimes + +Cloud containers include common runtimes out of the box. See [Container reference](/docs/en/managed-agents/cloud-containers) for the full list of pre-installed languages, databases, and utilities. \ No newline at end of file diff --git a/content/en/managed-agents/events-and-streaming.md b/content/en/managed-agents/events-and-streaming.md new file mode 100644 index 000000000..176e5c4f7 --- /dev/null +++ b/content/en/managed-agents/events-and-streaming.md @@ -0,0 +1,1622 @@ +# Session event stream + +Send events, stream responses, and interrupt or redirect your session mid-execution. + +--- + +Communication with Claude Managed Agents is event-based. You send user events to the agent, and receive agent and session events back to track status. + + +All Managed Agents API requests require the `managed-agents-2026-04-01` beta header. The SDK sets the beta header automatically. + + +## Event types + +Events flow in two directions. +- **User events** are what you send to the agent to kick off a session and steer it as it progresses. +- **Session events**, **span events**, and **agent events** are sent to you for observability into your session state and agent progress. + +Event type strings follow a `{domain}.{action}` naming convention. + + + + +| Type | Description | +| --- | --- | +| `user.message` | A user message with text content. | +| `user.interrupt` | Stop the agent mid-execution. | +| `user.custom_tool_result` | Response to a custom tool call from the agent. | +| `user.tool_confirmation` | Approve or deny an agent or MCP tool call when a permission policy requires confirmation. | +| `user.define_outcome` | Define an [outcome](/docs/en/managed-agents/define-outcomes) for the agent to work toward. | + + + + +| Type | Description | +| --- | --- | +| `agent.message` | Agent response containing text content blocks. | +| `agent.thinking` | Agent thinking content, emitted separately from messages. | +| `agent.tool_use` | Agent invoked a pre-built agent tool (bash, file operations, and so on). | +| `agent.tool_result` | Result of a pre-built agent tool execution. | +| `agent.mcp_tool_use` | Agent invoked an MCP server tool. | +| `agent.mcp_tool_result` | Result of an MCP tool execution. | +| `agent.custom_tool_use` | Agent invoked one of your custom tools. Respond with a `user.custom_tool_result` event. | +| `agent.thread_context_compacted` | Conversation history was compacted to fit the context window. | +| `agent.thread_message_sent` | Agent sent a message to another [multiagent](/docs/en/managed-agents/multi-agent) thread. | +| `agent.thread_message_received` | Agent received a message from another [multiagent](/docs/en/managed-agents/multi-agent) thread. | + + + + +| Type | Description | +| --- | --- | +| `session.status_running` | Agent is actively processing. | +| `session.status_idle` | Agent finished its current task and is waiting for input. Includes a `stop_reason` indicating why the agent stopped. | +| `session.status_rescheduled` | A transient error occurred and the session is retrying automatically. | +| `session.status_terminated` | Session ended due to an unrecoverable error. | +| `session.error` | An error occurred during processing. Includes a typed `error` object with a `retry_status`. | +| `session.outcome_evaluated` | An [outcome](/docs/en/managed-agents/define-outcomes) evaluation has reached a terminal status. | +| `session.thread_created` | The coordinator spawned a new [multiagent](/docs/en/managed-agents/multi-agent) thread. | +| `session.thread_idle` | A [multiagent](/docs/en/managed-agents/multi-agent) thread finished its current work. | + + + + +Span events are observability markers that wrap activity for timing and usage tracking. + +| Type | Description | +| --- | --- | +| `span.model_request_start` | A model inference call has started. | +| `span.model_request_end` | A model inference call has completed. Includes `model_usage` with token counts. | +| `span.outcome_evaluation_start` | [Outcome](/docs/en/managed-agents/define-outcomes) evaluation has started. | +| `span.outcome_evaluation_ongoing` | Heartbeat during an ongoing [outcome](/docs/en/managed-agents/define-outcomes) evaluation. | +| `span.outcome_evaluation_end` | [Outcome](/docs/en/managed-agents/define-outcomes) evaluation has completed. | + + + + +Every event includes a `processed_at` timestamp indicating when the event was recorded server-side. If `processed_at` is null, it means the event has been queued by the harness and will be handled after preceding events finish processing. + +See the [session events API reference](/docs/en/api/beta/sessions/events/stream) for the full schema of each event type. + +## Integrating events + + + + +Send a `user.message` event to start or continue the agent's work: + + +```bash curl +curl -sS --fail-with-body "https://api.anthropic.com/v1/sessions/$SESSION_ID/events?beta=true" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -d @- <<'EOF' +{ + "events": [ + { + "type": "user.message", + "content": [ + {"type": "text", "text": "Analyze the performance of the sort function in utils.py"} + ] + } + ] +} +EOF +``` + +```python Python +client.beta.sessions.events.send( + session.id, + events=[ + { + "type": "user.message", + "content": [ + { + "type": "text", + "text": "Analyze the performance of the sort function in utils.py", + }, + ], + }, + ], +) +``` + +```typescript TypeScript +await client.beta.sessions.events.send(session.id, { + events: [ + { + type: "user.message", + content: [ + { + type: "text", + text: "Analyze the performance of the sort function in utils.py" + } + ] + } + ] +}); +``` + +```csharp C# +await client.Beta.Sessions.Events.Send(session.ID, new() +{ + Events = + [ + new BetaManagedAgentsUserMessageEventParams + { + Type = BetaManagedAgentsUserMessageEventParamsType.UserMessage, + Content = + [ + new BetaManagedAgentsTextBlock + { + Type = BetaManagedAgentsTextBlockType.Text, + Text = "Analyze the performance of the sort function in utils.py", + }, + ], + }, + ], +}); +``` + +```go Go +if _, err := client.Beta.Sessions.Events.Send(ctx, session.ID, anthropic.BetaSessionEventSendParams{ + Events: []anthropic.SendEventsParamsUnion{{ + OfUserMessage: &anthropic.BetaManagedAgentsUserMessageEventParams{ + Type: anthropic.BetaManagedAgentsUserMessageEventParamsTypeUserMessage, + Content: []anthropic.BetaManagedAgentsUserMessageEventParamsContentUnion{{ + OfText: &anthropic.BetaManagedAgentsTextBlockParam{ + Type: anthropic.BetaManagedAgentsTextBlockTypeText, + Text: "Analyze the performance of the sort function in utils.py", + }, + }}, + }, + }}, +}); err != nil { + panic(err) +} +``` + +```java Java +client.beta().sessions().events().send( + session.id(), + EventSendParams.builder() + .addEvent(BetaManagedAgentsUserMessageEventParams.builder() + .type(BetaManagedAgentsUserMessageEventParams.Type.USER_MESSAGE) + .addTextContent("Analyze the performance of the sort function in utils.py") + .build()) + .build()); +``` + +```php PHP +$client->beta->sessions->events->send( + $session->id, + events: [ + [ + 'type' => 'user.message', + 'content' => [ + [ + 'type' => 'text', + 'text' => 'Analyze the performance of the sort function in utils.py', + ], + ], + ], + ], +); +``` + +```ruby Ruby +client.beta.sessions.events.send_( + session.id, + events: [ + { + type: "user.message", + content: [ + {type: "text", text: "Analyze the performance of the sort function in utils.py"} + ] + } + ] +) +``` + + +Send a `user.interrupt` event to stop the agent mid-execution, then follow up with a `user.message` event to redirect it: + + +```bash curl +# Agent is currently analyzing a file... +# Interrupt with a new direction: +curl -sS --fail-with-body "https://api.anthropic.com/v1/sessions/$SESSION_ID/events?beta=true" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -d @- <<'EOF' +{ + "events": [ + {"type": "user.interrupt"}, + { + "type": "user.message", + "content": [ + {"type": "text", "text": "Instead, focus on fixing the bug in line 42."} + ] + } + ] +} +EOF +``` + +```python Python +# Agent is currently analyzing a file... +# Interrupt with a new direction: +client.beta.sessions.events.send( + session.id, + events=[ + {"type": "user.interrupt"}, + { + "type": "user.message", + "content": [ + { + "type": "text", + "text": "Instead, focus on fixing the bug in line 42.", + }, + ], + }, + ], +) +``` + +```typescript TypeScript +// Agent is currently analyzing a file... +// Interrupt with a new direction: +await client.beta.sessions.events.send(session.id, { + events: [ + { type: "user.interrupt" }, + { + type: "user.message", + content: [ + { + type: "text", + text: "Instead, focus on fixing the bug in line 42." + } + ] + } + ] +}); +``` + +```csharp C# +// Agent is currently analyzing a file... +// Interrupt with a new direction: +await client.Beta.Sessions.Events.Send(session.ID, new() +{ + Events = + [ + new BetaManagedAgentsUserInterruptEventParams + { + Type = BetaManagedAgentsUserInterruptEventParamsType.UserInterrupt, + }, + new BetaManagedAgentsUserMessageEventParams + { + Type = BetaManagedAgentsUserMessageEventParamsType.UserMessage, + Content = + [ + new BetaManagedAgentsTextBlock + { + Type = BetaManagedAgentsTextBlockType.Text, + Text = "Instead, focus on fixing the bug in line 42.", + }, + ], + }, + ], +}); +``` + +```go Go +// Agent is currently analyzing a file... +// Interrupt with a new direction: +if _, err := client.Beta.Sessions.Events.Send(ctx, session.ID, anthropic.BetaSessionEventSendParams{ + Events: []anthropic.SendEventsParamsUnion{ + { + OfUserInterrupt: &anthropic.BetaManagedAgentsUserInterruptEventParams{ + Type: anthropic.BetaManagedAgentsUserInterruptEventParamsTypeUserInterrupt, + }, + }, + { + OfUserMessage: &anthropic.BetaManagedAgentsUserMessageEventParams{ + Type: anthropic.BetaManagedAgentsUserMessageEventParamsTypeUserMessage, + Content: []anthropic.BetaManagedAgentsUserMessageEventParamsContentUnion{{ + OfText: &anthropic.BetaManagedAgentsTextBlockParam{ + Type: anthropic.BetaManagedAgentsTextBlockTypeText, + Text: "Instead, focus on fixing the bug in line 42.", + }, + }}, + }, + }, + }, +}); err != nil { + panic(err) +} +``` + +```java Java +// Agent is currently analyzing a file... +// Interrupt with a new direction: +client.beta().sessions().events().send( + session.id(), + EventSendParams.builder() + .addEvent(BetaManagedAgentsUserInterruptEventParams.builder() + .type(BetaManagedAgentsUserInterruptEventParams.Type.USER_INTERRUPT) + .build()) + .addEvent(BetaManagedAgentsUserMessageEventParams.builder() + .type(BetaManagedAgentsUserMessageEventParams.Type.USER_MESSAGE) + .addTextContent("Instead, focus on fixing the bug in line 42.") + .build()) + .build()); +``` + +```php PHP +// Agent is currently analyzing a file... +// Interrupt with a new direction: +$client->beta->sessions->events->send( + $session->id, + events: [ + ['type' => 'user.interrupt'], + [ + 'type' => 'user.message', + 'content' => [ + [ + 'type' => 'text', + 'text' => 'Instead, focus on fixing the bug in line 42.', + ], + ], + ], + ], +); +``` + +```ruby Ruby +# Agent is currently analyzing a file... +# Interrupt with a new direction: +client.beta.sessions.events.send_( + session.id, + events: [ + {type: "user.interrupt"}, + { + type: "user.message", + content: [ + {type: "text", text: "Instead, focus on fixing the bug in line 42."} + ] + } + ] +) +``` + + +The agent will acknowledge the interruption and switch to the new task. + + + + +Stream events from the session to receive real-time updates as the agent works. Only events emitted after the stream is opened are delivered, so open the stream before sending events to avoid a race condition. + + + +````bash +# Open the stream first, then send the user message +exec {stream}< <( + curl -sS -N --fail-with-body \ + "https://api.anthropic.com/v1/sessions/$SESSION_ID/stream?beta=true" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -H "Accept: text/event-stream" +) + +curl -sS --fail-with-body \ + "https://api.anthropic.com/v1/sessions/$SESSION_ID/events?beta=true" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -d @- >/dev/null <<'EOF' +{ + "events": [ + { + "type": "user.message", + "content": [{"type": "text", "text": "Summarize the repo README"}] + } + ] +} +EOF + +while IFS= read -r -u "$stream" line; do + [[ $line == data:* ]] || continue + json=${line#data: } + case $(jq -r '.type' <<<"$json") in + agent.message) + jq -j '.content[] | select(.type == "text") | .text' <<<"$json" + ;; + session.status_idle) + break + ;; + session.error) + printf '\n[Error: %s]\n' "$(jq -r '.error.message // "unknown"' <<<"$json")" + break + ;; + esac +done +exec {stream}<&- +```` + + +````bash +# Open the stream first, then send the user message +exec {stream}< <(ant beta:sessions stream \ + --session-id "$SESSION_ID" \ + --transform '{type,text:content.#(type=="text").text,err:error.message}' \ + --format yaml) + +ant beta:sessions:events send \ + --session-id "$SESSION_ID" \ + > /dev/null <<'YAML' +events: + - type: user.message + content: + - type: text + text: Summarize the repo README +YAML + +type= +while IFS= read -r -u "$stream" line; do + case "$line" in + type:\ session.status_idle) break ;; + type:\ session.error) + IFS= read -r -u "$stream" next || next= + case "$next" in err:\ *) msg=${next#err: } ;; *) msg=unknown ;; esac + printf '\n[Error: %s]\n' "$msg"; break ;; + type:\ *) type=${line#type: } ;; + text:*) + [[ $type == agent.message ]] || continue + val=${line#text: } + case "$val" in '|-'|'|') ;; *) printf '%s' "$val" ;; esac ;; + \ \ *) + if [[ $type == agent.message ]]; then printf '%s\n' "${line# }"; fi ;; + esac +done +exec {stream}<&- +```` + + +````python +# Open the stream first, then send the user message +with client.beta.sessions.events.stream(session.id) as stream: + client.beta.sessions.events.send( + session.id, + events=[ + { + "type": "user.message", + "content": [{"type": "text", "text": "Summarize the repo README"}], + }, + ], + ) + + for event in stream: + match event.type: + case "agent.message": + for block in event.content: + if block.type == "text": + print(block.text, end="") + case "session.status_idle": + break + case "session.error": + msg = event.error.message if event.error else "unknown" + print(f"\n[Error: {msg}]") + break +```` + + +````typescript +// Open the stream first, then send the user message +const stream = await client.beta.sessions.events.stream(session.id); +await client.beta.sessions.events.send(session.id, { + events: [ + { + type: "user.message", + content: [{ type: "text", text: "Summarize the repo README" }] + } + ] +}); + +for await (const event of stream) { + if (event.type === "agent.message") { + for (const block of event.content) { + if (block.type === "text") { + process.stdout.write(block.text); + } + } + } else if (event.type === "session.status_idle") { + break; + } else if (event.type === "session.error") { + console.log(`\n[Error: ${event.error?.message ?? "unknown"}]`); + break; + } +} +```` + + +````csharp +// Open the stream first, then send the user message +using var stream = await client.Beta.Sessions.Events.WithRawResponse.StreamStreaming(session.ID); +await client.Beta.Sessions.Events.Send(session.ID, new() +{ + Events = + [ + new BetaManagedAgentsUserMessageEventParams + { + Type = BetaManagedAgentsUserMessageEventParamsType.UserMessage, + Content = + [ + new BetaManagedAgentsTextBlock + { + Type = BetaManagedAgentsTextBlockType.Text, + Text = "Summarize the repo README", + }, + ], + }, + ], +}); + +await foreach (var streamEvent in stream.Enumerate()) +{ + if (streamEvent.Value is BetaManagedAgentsAgentMessageEvent message) + { + foreach (var block in message.Content) + { + Console.Write(block.Text); + } + } + else if (streamEvent.Value is BetaManagedAgentsSessionStatusIdleEvent) + { + break; + } + else if (streamEvent.Value is BetaManagedAgentsSessionErrorEvent error) + { + Console.WriteLine($"\n[Error: {error.Error?.Message ?? "unknown"}]"); + break; + } +} +```` + + +````go + // Open the stream first, then send the user message + stream := client.Beta.Sessions.Events.StreamEvents(ctx, session.ID, anthropic.BetaSessionEventStreamParams{}) + defer stream.Close() + + if _, err := client.Beta.Sessions.Events.Send(ctx, session.ID, anthropic.BetaSessionEventSendParams{ + Events: []anthropic.SendEventsParamsUnion{{ + OfUserMessage: &anthropic.BetaManagedAgentsUserMessageEventParams{ + Type: anthropic.BetaManagedAgentsUserMessageEventParamsTypeUserMessage, + Content: []anthropic.BetaManagedAgentsUserMessageEventParamsContentUnion{{ + OfText: &anthropic.BetaManagedAgentsTextBlockParam{ + Type: anthropic.BetaManagedAgentsTextBlockTypeText, + Text: "Summarize the repo README", + }, + }}, + }, + }}, + }); err != nil { + panic(err) + } + +events: + for stream.Next() { + switch event := stream.Current().AsAny().(type) { + case anthropic.BetaManagedAgentsAgentMessageEvent: + for _, block := range event.Content { + fmt.Print(block.Text) + } + case anthropic.BetaManagedAgentsSessionStatusIdleEvent: + break events + case anthropic.BetaManagedAgentsSessionErrorEvent: + fmt.Printf("\n[Error: %s]\n", cmp.Or(event.Error.Message, "unknown")) + break events + } + } + if err := stream.Err(); err != nil { + panic(err) + } +```` + + +````java +// Open the stream first, then send the user message +try (var stream = client.beta().sessions().events().streamStreaming(session.id())) { + client.beta().sessions().events().send( + session.id(), + EventSendParams.builder() + .addEvent(BetaManagedAgentsUserMessageEventParams.builder() + .type(BetaManagedAgentsUserMessageEventParams.Type.USER_MESSAGE) + .addTextContent("Summarize the repo README") + .build()) + .build() + ); + + for (var event : (Iterable) stream.stream()::iterator) { + if (event.isAgentMessage()) { + event.asAgentMessage().content().forEach(block -> IO.print(block.text())); + } else if (event.isSessionStatusIdle()) { + break; + } else if (event.isSessionError()) { + var msg = event.asSessionError().error() + .flatMap(err -> err._json()) + .map(json -> { + Optional> obj = json.asObject(); + return obj.orElseThrow().get("message").asStringOrThrow(); + }) + .orElse("unknown"); + IO.println("\n[Error: " + msg + "]"); + break; + } + } +} +```` + + +````php +// Open the stream first, then send the user message +$stream = $client->beta->sessions->events->streamStream( + $session->id, + requestOptions: ['transporter' => $streamingClient], +); +$client->beta->sessions->events->send( + $session->id, + events: [ + [ + 'type' => 'user.message', + 'content' => [['type' => 'text', 'text' => 'Summarize the repo README']], + ], + ], +); + +foreach ($stream as $event) { + match ($event->type) { + 'agent.message' => array_walk( + $event->content, + static fn($block) => $block->type === 'text' ? print($block->text) : null, + ), + 'session.error' => printf("\n[Error: %s]", $event->error?->message ?? 'unknown'), + default => null, + }; + if ($event->type === 'session.status_idle' || $event->type === 'session.error') { + break; + } +} +$stream->close(); +```` + + +````ruby +# Open the stream first, then send the user message +stream = client.beta.sessions.events.stream_events(session.id) + +client.beta.sessions.events.send_( + session.id, + events: [{ + type: "user.message", + content: [{type: "text", text: "Summarize the repo README"}] + }] +) + +stream.each do |event| + case event.type + in :"agent.message" + event.content.each { print it.text } + in :"session.status_idle" + break + in :"session.error" + puts "\n[Error: #{event.error&.message || "unknown"}]" + break + else + # ignore other event types + end +end +```` + + + +To reconnect to an existing session without missing events, open a new stream and then list the full history to seed a set of seen event IDs. Tail the live stream while skipping any events already returned by the history list. + + + +````bash +exec {stream}< <( + curl -sS -N --fail-with-body \ + "https://api.anthropic.com/v1/sessions/$SESSION_ID/stream?beta=true" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -H "Accept: text/event-stream" +) + +# Stream is open and buffering. List history before tailing live. +declare -A seen_event_ids +while IFS= read -r id; do + seen_event_ids[$id]=1 +done < <( + curl -sS --fail-with-body \ + "https://api.anthropic.com/v1/sessions/$SESSION_ID/events?beta=true" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" | jq -r '.data[].id' +) + +# Tail live events, skipping anything already seen +while IFS= read -r -u "$stream" line; do + [[ $line == data:* ]] || continue + json=${line#data: } + id=$(jq -r '.id' <<<"$json") + [[ -n ${seen_event_ids[$id]+seen} ]] && continue + seen_event_ids[$id]=1 + case $(jq -r '.type' <<<"$json") in + agent.message) + jq -j '.content[] | select(.type == "text") | .text' <<<"$json" + ;; + session.status_idle) + break + ;; + esac +done +exec {stream}<&- +```` + + +````bash +exec {stream}< <(ant beta:sessions stream \ + --session-id "$SESSION_ID" \ + --transform '{id,type,text:content.#(type=="text").text}' \ + --format yaml) +stream_pid=$! + +# Stream is open and buffering. List history before tailing live. +declare -A seen_event_ids +while IFS= read -r id; do + seen_event_ids[$id]=1 +done < <(ant beta:sessions:events list \ + --session-id "$SESSION_ID" \ + --transform id --format yaml) + +# Tail live events, skipping anything already seen +id= type= skip= +while IFS= read -r -u "$stream" line; do + case "$line" in + id:\ *) + id=${line#id: } + if [[ -n ${seen_event_ids[$id]+seen} ]]; then skip=1; continue; fi + skip=; seen_event_ids[$id]=1 ;; + type:\ *) + [[ -n $skip ]] && continue + type=${line#type: } + [[ $type == session.status_idle ]] && break ;; + text:*) + [[ -z $skip && $type == agent.message ]] || continue + val=${line#text: } + case "$val" in '|-'|'|') ;; *) printf '%s' "$val" ;; esac ;; + \ \ *) + [[ -z $skip && $type == agent.message ]] && printf '%s\n' "${line# }" ;; + esac +done +exec {stream}<&- +```` + + +````python +with client.beta.sessions.events.stream(session.id) as stream: + # Stream is open and buffering. List history before tailing live. + seen_event_ids = {event.id for event in client.beta.sessions.events.list(session.id)} + + # Tail live events, skipping anything already seen + for event in stream: + if event.id in seen_event_ids: + continue + seen_event_ids.add(event.id) + match event.type: + case "agent.message": + for block in event.content: + if block.type == "text": + print(block.text, end="") + case "session.status_idle": + break +```` + + +````typescript +const seenEventIds = new Set(); +const stream = await client.beta.sessions.events.stream(session.id); + +// Stream is open and buffering. List history before tailing live. +for await (const event of client.beta.sessions.events.list(session.id)) { + seenEventIds.add(event.id); +} + +// Tail live events, skipping anything already seen +for await (const event of stream) { + if (seenEventIds.has(event.id)) continue; + seenEventIds.add(event.id); + if (event.type === "agent.message") { + for (const block of event.content) { + if (block.type === "text") { + process.stdout.write(block.text); + } + } + } else if (event.type === "session.status_idle") { + break; + } +} +```` + + +````csharp +using var stream = await client.Beta.Sessions.Events.WithRawResponse.StreamStreaming(session.ID); + +// Stream is open and buffering. List history before tailing live. +HashSet seenEventIds = []; +var history = await client.Beta.Sessions.Events.List(session.ID); +await foreach (var pastEvent in history.Paginate()) +{ + seenEventIds.Add(pastEvent.ID); +} + +// Tail live events, skipping anything already seen +await foreach (var streamEvent in stream.Enumerate()) +{ + if (!seenEventIds.Add(streamEvent.ID)) + { + continue; + } + if (streamEvent.Value is BetaManagedAgentsAgentMessageEvent message) + { + foreach (var block in message.Content) + { + Console.Write(block.Text); + } + } + else if (streamEvent.Value is BetaManagedAgentsSessionStatusIdleEvent) + { + break; + } +} +```` + + +````go + stream := client.Beta.Sessions.Events.StreamEvents(ctx, session.ID, anthropic.BetaSessionEventStreamParams{}) + defer stream.Close() + + // Stream is open and buffering. List history before tailing live. + seenEventIDs := map[string]struct{}{} + history := client.Beta.Sessions.Events.ListAutoPaging(ctx, session.ID, anthropic.BetaSessionEventListParams{}) + for history.Next() { + seenEventIDs[history.Current().ID] = struct{}{} + } + if err := history.Err(); err != nil { + panic(err) + } + + // Tail live events, skipping anything already seen +tail: + for stream.Next() { + event := stream.Current() + if _, seen := seenEventIDs[event.ID]; seen { + continue + } + seenEventIDs[event.ID] = struct{}{} + switch event := event.AsAny().(type) { + case anthropic.BetaManagedAgentsAgentMessageEvent: + for _, block := range event.Content { + fmt.Print(block.Text) + } + case anthropic.BetaManagedAgentsSessionStatusIdleEvent: + break tail + } + } + if err := stream.Err(); err != nil { + panic(err) + } +```` + + +````java +try (var stream = client.beta().sessions().events().streamStreaming(session.id())) { + // Stream is open and buffering. List history before tailing live. + // _json() exposes the raw event so we can read the cross-variant `id` field. + var seenEventIds = new HashSet(); + for (var past : client.beta().sessions().events().list(session.id()).autoPager()) { + Optional> obj = past._json().orElseThrow().asObject(); + seenEventIds.add(obj.orElseThrow().get("id").asStringOrThrow()); + } + + // Tail live events, skipping anything already seen + for (var event : (Iterable) stream.stream()::iterator) { + Optional> obj = event._json().orElseThrow().asObject(); + if (!seenEventIds.add(obj.orElseThrow().get("id").asStringOrThrow())) continue; + if (event.isAgentMessage()) { + event.asAgentMessage().content().forEach(block -> IO.print(block.text())); + } else if (event.isSessionStatusIdle()) { + break; + } + } +} +```` + + +````php +$stream = $client->beta->sessions->events->streamStream( + $session->id, + requestOptions: ['transporter' => $streamingClient], +); + +// Stream is open and buffering. List history before tailing live. +$seenEventIds = []; +foreach ($client->beta->sessions->events->list($session->id)->pagingEachItem() as $event) { + $seenEventIds[$event->id] = true; +} + +// Tail live events, skipping anything already seen +foreach ($stream as $event) { + if (isset($seenEventIds[$event->id])) { + continue; + } + $seenEventIds[$event->id] = true; + match ($event->type) { + 'agent.message' => array_walk( + $event->content, + static fn($block) => $block->type === 'text' ? print($block->text) : null, + ), + default => null, + }; + if ($event->type === 'session.status_idle') { + break; + } +} +$stream->close(); +```` + + +````ruby +stream = client.beta.sessions.events.stream_events(session.id) + +# Stream is open and buffering. List history before tailing live. +seen_event_ids = Set.new +client.beta.sessions.events.list(session.id).auto_paging_each { seen_event_ids << it.id } + +# Tail live events, skipping anything already seen +stream.each do |event| + next if seen_event_ids.include?(event.id) + seen_event_ids << event.id + case event.type + in :"agent.message" + event.content.each { print it.text } + in :"session.status_idle" + break + else + # ignore other event types + end +end +```` + + + + + + +Retrieve the full event history for a session: + + +```bash curl +curl -sS --fail-with-body "https://api.anthropic.com/v1/sessions/$SESSION_ID/events?beta=true" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + | jq -r '.data[] | "[\(.type)] \(.processed_at)"' +``` + +```python Python +events = client.beta.sessions.events.list(session.id) +for event in events.data: + print(f"[{event.type}] {event.processed_at}") +``` + +```typescript TypeScript +const events = await client.beta.sessions.events.list(session.id); +for (const event of events.data) { + console.log(`[${event.type}] ${event.processed_at}`); +} +``` + +```csharp C# +var events = await client.Beta.Sessions.Events.List(session.ID); +foreach (var evt in events.Items) +{ + Console.WriteLine($"[{evt.Json.GetProperty("type").GetString()}] {evt.ProcessedAt}"); +} +``` + +```go Go +events, err := client.Beta.Sessions.Events.List(ctx, session.ID, anthropic.BetaSessionEventListParams{}) +if err != nil { + panic(err) +} +for _, event := range events.Data { + fmt.Printf("[%s] %s\n", event.Type, event.ProcessedAt) +} +``` + +```java Java +var events = client.beta().sessions().events().list(session.id()); +for (var event : events.data()) { + var json = (Map) event._json().orElseThrow().asObject().orElseThrow(); + var type = json.get("type").asStringOrThrow(); + var processedAt = json.containsKey("processed_at") + ? json.get("processed_at").asStringOrThrow() + : "pending"; + IO.println("[" + type + "] " + processedAt); +} +``` + +```php PHP +$events = $client->beta->sessions->events->list($session->id); +foreach ($events->data as $event) { + $processedAt = ($event->processedAt ?? null)?->format(DATE_RFC3339) ?? 'pending'; + echo "[{$event->type}] {$processedAt}\n"; +} +``` + +```ruby Ruby +events = client.beta.sessions.events.list(session.id) +events.data.each { puts "[#{it.type}] #{it.processed_at}" } +``` + + + + + +## Additional scenarios + +### Handling custom tool calls + +When the agent invokes a [custom tool](/docs/en/managed-agents/tools#custom-tools): + +1. The session emits an `agent.custom_tool_use` event containing the tool name and input. +2. The session pauses with a `session.status_idle` event containing `stop_reason: requires_action`. The blocking event IDs are in the `stop_reason.requires_action.event_ids` array. +3. Execute the tool in your system and send a `user.custom_tool_result` event for each, passing the event ID in the `custom_tool_use_id` param along with the result content. +4. Once all blocking events are resolved, the session transitions back to `running`. + + +```bash curl +exec {fd}< <(curl -sS -N --fail-with-body \ + "https://api.anthropic.com/v1/sessions/$SESSION_ID/stream?beta=true" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -H "Accept: text/event-stream") + +while IFS= read -r -u "$fd" line; do + [[ $line == data:* ]] || continue + data="${line#data: }" + [[ $(jq -r '.type' <<<"$data") == "session.status_idle" ]] || continue + case $(jq -r '.stop_reason.type // empty' <<<"$data") in + requires_action) + while IFS= read -r event_id; do + # Look up the custom tool use event and execute it + result=$(call_tool "$event_id") + # Send the result back + jq -n --arg id "$event_id" --arg result "$result" \ + '{events: [{type: "user.custom_tool_result", custom_tool_use_id: $id, content: [{type: "text", text: $result}]}]}' | + curl -sS --fail-with-body \ + "https://api.anthropic.com/v1/sessions/$SESSION_ID/events?beta=true" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -d @- + done < <(jq -r '.stop_reason.event_ids[]' <<<"$data") + ;; + end_turn) + break + ;; + esac +done +exec {fd}<&- +``` + +```python Python +with client.beta.sessions.events.stream(session.id) as stream: + for event in stream: + if event.type == "session.status_idle" and (stop := event.stop_reason): + match stop.type: + case "requires_action": + for event_id in stop.event_ids: + # Look up the custom tool use event and execute it + tool_event = events_by_id[event_id] + result = call_tool(tool_event.name, tool_event.input) + + # Send the result back + client.beta.sessions.events.send( + session.id, + events=[ + { + "type": "user.custom_tool_result", + "custom_tool_use_id": event_id, + "content": [{"type": "text", "text": result}], + }, + ], + ) + case "end_turn": + break +``` + +```typescript TypeScript +const stream = await client.beta.sessions.events.stream(session.id); + +for await (const event of stream) { + if (event.type === "session.status_idle") { + if (event.stop_reason?.type === "requires_action") { + for (const eventId of event.stop_reason.event_ids) { + // Look up the custom tool use event and execute it + const toolEvent = eventsById[eventId]; + const result = await callTool(toolEvent.name, toolEvent.input); + + // Send the result back + await client.beta.sessions.events.send(session.id, { + events: [ + { + type: "user.custom_tool_result", + custom_tool_use_id: eventId, + content: [{ type: "text", text: result }] + } + ] + }); + } + } else if (event.stop_reason?.type === "end_turn") { + break; + } + } +} +``` + +```csharp C# +await foreach (var streamEvent in client.Beta.Sessions.Events.StreamStreaming(session.ID)) +{ + if (streamEvent.Value is BetaManagedAgentsSessionStatusIdleEvent idle) + { + if (idle.StopReason?.Value is BetaManagedAgentsSessionRequiresAction requiresAction) + { + foreach (var eventId in requiresAction.EventIds) + { + // Look up the custom tool use event and execute it + var toolEvent = eventsById[eventId]; + var result = await CallTool(toolEvent.Name, toolEvent.Input); + // Send the result back + await client.Beta.Sessions.Events.Send(session.ID, new() + { + Events = + [ + new BetaManagedAgentsUserCustomToolResultEventParams + { + Type = BetaManagedAgentsUserCustomToolResultEventParamsType.UserCustomToolResult, + CustomToolUseID = eventId, + Content = + [ + new BetaManagedAgentsTextBlock + { + Type = BetaManagedAgentsTextBlockType.Text, + Text = result, + }, + ], + }, + ], + }); + } + } + else if (idle.StopReason?.Value is BetaManagedAgentsSessionEndTurn) + { + break; + } + } +} +``` + +```go Go +stream := client.Beta.Sessions.Events.StreamEvents(ctx, session.ID, anthropic.BetaSessionEventStreamParams{}) +defer stream.Close() + +loop: +for stream.Next() { + event, ok := stream.Current().AsAny().(anthropic.BetaManagedAgentsSessionStatusIdleEvent) + if !ok { + continue + } + switch stopReason := event.StopReason.AsAny().(type) { + case anthropic.BetaManagedAgentsSessionRequiresAction: + for _, eventID := range stopReason.EventIDs { + // Look up the custom tool use event and execute it + toolEvent := eventsByID[eventID] + result := callTool(toolEvent.Name, toolEvent.Input) + // Send the result back + if _, err := client.Beta.Sessions.Events.Send(ctx, session.ID, anthropic.BetaSessionEventSendParams{ + Events: []anthropic.SendEventsParamsUnion{{ + OfUserCustomToolResult: &anthropic.BetaManagedAgentsUserCustomToolResultEventParams{ + Type: anthropic.BetaManagedAgentsUserCustomToolResultEventParamsTypeUserCustomToolResult, + CustomToolUseID: eventID, + Content: []anthropic.BetaManagedAgentsUserCustomToolResultEventParamsContentUnion{{ + OfText: &anthropic.BetaManagedAgentsTextBlockParam{ + Type: anthropic.BetaManagedAgentsTextBlockTypeText, + Text: result, + }, + }}, + }, + }}, + }); err != nil { + panic(err) + } + } + case anthropic.BetaManagedAgentsSessionEndTurn: + break loop + } +} +if err := stream.Err(); err != nil { + panic(err) +} +``` + +```java Java +try (var stream = client.beta().sessions().events().streamStreaming(session.id())) { + for (var event : (Iterable) stream.stream()::iterator) { + if (!event.isSessionStatusIdle()) continue; + var stopReason = event.asSessionStatusIdle().stopReason().orElseThrow(); + if (stopReason.isRequiresAction()) { + for (var eventId : stopReason.asRequiresAction().eventIds()) { + // Look up the custom tool use event and execute it + var toolEvent = eventsById.get(eventId); + var result = callTool(toolEvent.name(), toolEvent.input()); + // Send the result back + client.beta().sessions().events().send( + session.id(), + EventSendParams.builder() + .addEvent(BetaManagedAgentsUserCustomToolResultEventParams.builder() + .type(BetaManagedAgentsUserCustomToolResultEventParams.Type.USER_CUSTOM_TOOL_RESULT) + .customToolUseId(eventId) + .addTextContent(result) + .build()) + .build()); + } + } else if (stopReason.isEndTurn()) { + break; + } + } +} +``` + +```php PHP +$stream = $client->beta->sessions->events->streamStream( + $session->id, + requestOptions: ['transporter' => $streamingClient], +); + +foreach ($stream as $event) { + if ($event->type === 'session.status_idle' && $event->stopReason) { + if ($event->stopReason->type === 'requires_action') { + foreach ($event->stopReason->eventIDs as $eventId) { + // Look up the custom tool use event and execute it + $toolEvent = $eventsById[$eventId]; + $result = callTool($toolEvent->name, $toolEvent->input); + + // Send the result back + $client->beta->sessions->events->send( + $session->id, + events: [ + [ + 'type' => 'user.custom_tool_result', + 'custom_tool_use_id' => $eventId, + 'content' => [['type' => 'text', 'text' => $result]], + ], + ], + ); + } + } elseif ($event->stopReason->type === 'end_turn') { + break; + } + } +} +``` + +```ruby Ruby +client.beta.sessions.events.stream_events(session.id).each do |event| + case event + in {type: :"session.status_idle", stop_reason: {type: :requires_action, event_ids:}} + event_ids.each do |event_id| + # Look up the custom tool use event and execute it + tool_event = events_by_id[event_id] + result = call_tool(tool_event.name, tool_event.input) + # Send the result back + client.beta.sessions.events.send_( + session.id, + events: [ + { + type: "user.custom_tool_result", + custom_tool_use_id: event_id, + content: [{type: "text", text: result}] + } + ] + ) + end + in {type: :"session.status_idle", stop_reason: {type: :end_turn}} + break + else + end +end +``` + + +### Tool confirmation + +When a [permission policy](/docs/en/managed-agents/permission-policies) requires confirmation before a tool executes: + +1. The session emits an `agent.tool_use` or `agent.mcp_tool_use` event. +2. The session pauses with a `session.status_idle` event containing `stop_reason: requires_action`. The blocking event IDs are in the `stop_reason.requires_action.event_ids` array. +3. Send a `user.tool_confirmation` event for each, passing the event ID in the `tool_use_id` param. Set `result` to `"allow"` or `"deny"`. Use `deny_message` to explain a denial. +4. Once all blocking events are resolved, the session transitions back to `running`. + + +```bash curl +exec {fd}< <(curl -sS -N --fail-with-body \ + "https://api.anthropic.com/v1/sessions/$SESSION_ID/stream?beta=true" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -H "Accept: text/event-stream") + +while IFS= read -r -u "$fd" line; do + [[ $line == data:* ]] || continue + data="${line#data: }" + [[ $(jq -r '.type' <<<"$data") == "session.status_idle" ]] || continue + case $(jq -r '.stop_reason.type // empty' <<<"$data") in + requires_action) + while IFS= read -r event_id; do + # Approve the pending tool call + jq -n --arg id "$event_id" \ + '{events: [{type: "user.tool_confirmation", tool_use_id: $id, result: "allow"}]}' | + curl -sS --fail-with-body \ + "https://api.anthropic.com/v1/sessions/$SESSION_ID/events?beta=true" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -d @- + done < <(jq -r '.stop_reason.event_ids[]' <<<"$data") + ;; + end_turn) + break + ;; + esac +done +exec {fd}<&- +``` + +```python Python +with client.beta.sessions.events.stream(session.id) as stream: + for event in stream: + if event.type == "session.status_idle" and (stop := event.stop_reason): + match stop.type: + case "requires_action": + for event_id in stop.event_ids: + # Approve the pending tool call + client.beta.sessions.events.send( + session.id, + events=[ + { + "type": "user.tool_confirmation", + "tool_use_id": event_id, + "result": "allow", + }, + ], + ) + case "end_turn": + break +``` + +```typescript TypeScript +const stream = await client.beta.sessions.events.stream(session.id); + +for await (const event of stream) { + if (event.type === "session.status_idle") { + if (event.stop_reason?.type === "requires_action") { + for (const eventId of event.stop_reason.event_ids) { + // Approve the pending tool call + await client.beta.sessions.events.send(session.id, { + events: [ + { + type: "user.tool_confirmation", + tool_use_id: eventId, + result: "allow" + } + ] + }); + } + } else if (event.stop_reason?.type === "end_turn") { + break; + } + } +} +``` + +```csharp C# +await foreach (var streamEvent in client.Beta.Sessions.Events.StreamStreaming(session.ID)) +{ + if (streamEvent.Value is BetaManagedAgentsSessionStatusIdleEvent idle) + { + if (idle.StopReason?.Value is BetaManagedAgentsSessionRequiresAction requiresAction) + { + foreach (var eventId in requiresAction.EventIds) + { + // Approve the pending tool call + await client.Beta.Sessions.Events.Send(session.ID, new() + { + Events = + [ + new BetaManagedAgentsUserToolConfirmationEventParams + { + Type = BetaManagedAgentsUserToolConfirmationEventParamsType.UserToolConfirmation, + ToolUseID = eventId, + Result = BetaManagedAgentsUserToolConfirmationEventParamsResult.Allow, + }, + ], + }); + } + } + else if (idle.StopReason?.Value is BetaManagedAgentsSessionEndTurn) + { + break; + } + } +} +``` + +```go Go +stream := client.Beta.Sessions.Events.StreamEvents(ctx, session.ID, anthropic.BetaSessionEventStreamParams{}) +defer stream.Close() + +loop: +for stream.Next() { + event, ok := stream.Current().AsAny().(anthropic.BetaManagedAgentsSessionStatusIdleEvent) + if !ok { + continue + } + switch stopReason := event.StopReason.AsAny().(type) { + case anthropic.BetaManagedAgentsSessionRequiresAction: + for _, eventID := range stopReason.EventIDs { + // Approve the pending tool call + if _, err := client.Beta.Sessions.Events.Send(ctx, session.ID, anthropic.BetaSessionEventSendParams{ + Events: []anthropic.SendEventsParamsUnion{{ + OfUserToolConfirmation: &anthropic.BetaManagedAgentsUserToolConfirmationEventParams{ + Type: anthropic.BetaManagedAgentsUserToolConfirmationEventParamsTypeUserToolConfirmation, + ToolUseID: eventID, + Result: anthropic.BetaManagedAgentsUserToolConfirmationEventParamsResultAllow, + }, + }}, + }); err != nil { + panic(err) + } + } + case anthropic.BetaManagedAgentsSessionEndTurn: + break loop + } +} +if err := stream.Err(); err != nil { + panic(err) +} +``` + +```java Java +try (var stream = client.beta().sessions().events().streamStreaming(session.id())) { + for (var event : (Iterable) stream.stream()::iterator) { + if (!event.isSessionStatusIdle()) continue; + var stopReason = event.asSessionStatusIdle().stopReason().orElseThrow(); + if (stopReason.isRequiresAction()) { + for (var eventId : stopReason.asRequiresAction().eventIds()) { + // Approve the pending tool call + client.beta().sessions().events().send( + session.id(), + EventSendParams.builder() + .addEvent(BetaManagedAgentsUserToolConfirmationEventParams.builder() + .type(BetaManagedAgentsUserToolConfirmationEventParams.Type.USER_TOOL_CONFIRMATION) + .toolUseId(eventId) + .result(BetaManagedAgentsUserToolConfirmationEventParams.Result.ALLOW) + .build()) + .build()); + } + } else if (stopReason.isEndTurn()) { + break; + } + } +} +``` + +```php PHP +$stream = $client->beta->sessions->events->streamStream( + $session->id, + requestOptions: ['transporter' => $streamingClient], +); + +foreach ($stream as $event) { + if ($event->type === 'session.status_idle' && $event->stopReason) { + if ($event->stopReason->type === 'requires_action') { + foreach ($event->stopReason->eventIDs as $eventId) { + // Approve the pending tool call + $client->beta->sessions->events->send( + $session->id, + events: [ + [ + 'type' => 'user.tool_confirmation', + 'tool_use_id' => $eventId, + 'result' => 'allow', + ], + ], + ); + } + } elseif ($event->stopReason->type === 'end_turn') { + break; + } + } +} +``` + +```ruby Ruby +client.beta.sessions.events.stream_events(session.id).each do |event| + case event + in {type: :"session.status_idle", stop_reason: {type: :requires_action, event_ids:}} + event_ids.each do |event_id| + # Approve the pending tool call + client.beta.sessions.events.send_( + session.id, + events: [ + {type: "user.tool_confirmation", tool_use_id: event_id, result: "allow"} + ] + ) + end + in {type: :"session.status_idle", stop_reason: {type: :end_turn}} + break + else + end +end +``` + + +### Tracking usage + +The session object includes a `usage` field with cumulative token statistics. Fetch the session after it goes idle to read the latest totals, and use them to track costs, enforce budgets, or monitor consumption. + +```json +{ + "id": "sesn_01...", + "status": "idle", + "usage": { + "input_tokens": 5000, + "output_tokens": 3200, + "cache_creation_input_tokens": 2000, + "cache_read_input_tokens": 20000 + } +} +``` + +`input_tokens` reports uncached input tokens and `output_tokens` reports total output tokens across all model calls in the session. The `cache_creation_input_tokens` and `cache_read_input_tokens` fields reflect prompt caching activity. Cache entries use a 5-minute TTL, so back-to-back turns within that window benefit from cache reads, which reduce per-token cost. \ No newline at end of file diff --git a/content/en/managed-agents/files.md b/content/en/managed-agents/files.md new file mode 100644 index 000000000..ab818818b --- /dev/null +++ b/content/en/managed-agents/files.md @@ -0,0 +1,695 @@ +# Adding files + +Upload files and mount them in your container for reading and processing. + +--- + +You can provide files to your agent by uploading them via the Files API and mounting them in the session's container. + + +All Managed Agents API requests require the `managed-agents-2026-04-01` beta header. The SDK sets the beta header automatically. + + +## Uploading files + +First, upload a file using the [Files API](/docs/en/build-with-claude/files): + + + +````bash +file=$(curl --fail-with-body -sS "${auth[@]}" \ + "${base_url}/files" \ + -F file=@data.csv) +file_id=$(jq -er '.id' <<<"${file}") +printf 'File ID: %s\n' "${file_id}" +```` + + +````bash +FILE_ID=$(ant beta:files upload \ + --file data.csv \ + --transform id --format yaml) +```` + + +````python +file = client.beta.files.upload(file=Path("data.csv")) +print(f"File ID: {file.id}") +```` + + +````typescript +const file = await client.beta.files.upload({ + file: await toFile(readFile("data.csv"), "data.csv", { type: "text/csv" }), +}); +console.log(`File ID: ${file.id}`); +```` + + +````csharp +await using var stream = File.OpenRead(csvPath); +var file = await client.Beta.Files.Upload(new() { File = stream }); +Console.WriteLine($"File ID: {file.ID}"); +```` + + +````go +csvFile, err := os.Open("data.csv") +if err != nil { + panic(err) +} +defer csvFile.Close() + +file, err := client.Beta.Files.Upload(ctx, anthropic.BetaFileUploadParams{ + File: csvFile, +}) +if err != nil { + panic(err) +} +fmt.Printf("File ID: %s\n", file.ID) +```` + + +````java +var file = client.beta().files().upload( + FileUploadParams.builder().file(dataCsv).build() +); +IO.println("File ID: " + file.id()); +```` + + +````php +$ch = curl_init('https://api.anthropic.com/v1/files'); +curl_setopt_array($ch, [ + CURLOPT_RETURNTRANSFER => true, + CURLOPT_POST => true, + CURLOPT_HTTPHEADER => [ + 'x-api-key: ' . getenv('ANTHROPIC_API_KEY'), + 'anthropic-version: 2023-06-01', + 'anthropic-beta: files-api-2025-04-14', + ], + CURLOPT_POSTFIELDS => ['file' => new CURLFile($csvPath, 'text/csv', 'data.csv')], +]); +$file = json_decode(curl_exec($ch)); +echo "File ID: {$file->id}\n"; +```` + + +````ruby +file = client.beta.files.upload(file: Pathname(csv_path)) +puts "File ID: #{file.id}" +```` + + + +## Mounting files in a session + +Mount uploaded files into the container by adding them to the `resources` array when creating a session: + + +The `mount_path` is optional, but make sure the uploaded file has a descriptive name so the agent knows what it is looking for. + + + + +````bash +session=$( + jq -n \ + --arg agent_id "${agent_id}" \ + --arg environment_id "${environment_id}" \ + --arg file_id "${file_id}" \ + '{ + agent: $agent_id, + environment_id: $environment_id, + resources: [ + { + type: "file", + file_id: $file_id, + mount_path: "/workspace/data.csv" + } + ] + }' | curl --fail-with-body -sS "${auth[@]}" "${base_url}/sessions" --json @- +) +session_id=$(jq -er '.id' <<<"${session}") +```` + + +````bash +SESSION_ID=$(ant beta:sessions create \ + --agent "$AGENT_ID" \ + --environment "$ENVIRONMENT_ID" \ + --transform id --format yaml <beta->sessions->create( + agent: $agent->id, + environmentID: $environment->id, + resources: [ + BetaManagedAgentsFileResourceParams::with( + type: 'file', + fileID: $file->id, + mountPath: '/workspace/data.csv', + ), + ], +); +```` + + +````ruby +session = client.beta.sessions.create( + agent: agent.id, + environment_id: environment.id, + resources: [ + { + type: "file", + file_id: file.id, + mount_path: "/workspace/data.csv" + } + ] +) +```` + + + +A new `file_id` will be created that references the instance of the file in the session. These copies do not count against your [storage limits](/docs/en/build-with-claude/files). + +## Multiple files + +Mount multiple files by adding entries to the `resources` array: + + +```json curl hidelines={1,-1} +{ + "resources": [ + { "type": "file", "file_id": "file_abc123", "mount_path": "/workspace/data.csv" }, + { "type": "file", "file_id": "file_def456", "mount_path": "/workspace/config.json" }, + { "type": "file", "file_id": "file_ghi789", "mount_path": "/workspace/src/main.py" } + ] +} +``` + +```python Python +resources = [ + {"type": "file", "file_id": "file_abc123", "mount_path": "/workspace/data.csv"}, + {"type": "file", "file_id": "file_def456", "mount_path": "/workspace/config.json"}, + {"type": "file", "file_id": "file_ghi789", "mount_path": "/workspace/src/main.py"}, +] +``` + +```typescript TypeScript hidenlines={1,-1} +const _ = { + resources: [ + { type: "file", file_id: "file_abc123", mount_path: "/workspace/data.csv" }, + { type: "file", file_id: "file_def456", mount_path: "/workspace/config.json" }, + { type: "file", file_id: "file_ghi789", mount_path: "/workspace/src/main.py" } + ] +}; +``` + +```csharp C# +var resources = new[] +{ + new BetaManagedAgentsFileResourceParams { Type = BetaManagedAgentsFileResourceParamsType.File, FileID = "file_abc123", MountPath = "/workspace/data.csv" }, + new BetaManagedAgentsFileResourceParams { Type = BetaManagedAgentsFileResourceParamsType.File, FileID = "file_def456", MountPath = "/workspace/config.json" }, + new BetaManagedAgentsFileResourceParams { Type = BetaManagedAgentsFileResourceParamsType.File, FileID = "file_ghi789", MountPath = "/workspace/src/main.py" }, +}; +``` + +```go Go +resources := []anthropic.BetaSessionNewParamsResourceUnion{ + {OfFile: &anthropic.BetaManagedAgentsFileResourceParams{Type: "file", FileID: "file_abc123", MountPath: anthropic.String("/workspace/data.csv")}}, + {OfFile: &anthropic.BetaManagedAgentsFileResourceParams{Type: "file", FileID: "file_def456", MountPath: anthropic.String("/workspace/config.json")}}, + {OfFile: &anthropic.BetaManagedAgentsFileResourceParams{Type: "file", FileID: "file_ghi789", MountPath: anthropic.String("/workspace/src/main.py")}}, +} +``` + +```java Java +var resources = List.of( + BetaManagedAgentsFileResourceParams.builder() + .type(BetaManagedAgentsFileResourceParams.Type.FILE).fileId("file_abc123").mountPath("/workspace/data.csv").build(), + BetaManagedAgentsFileResourceParams.builder() + .type(BetaManagedAgentsFileResourceParams.Type.FILE).fileId("file_def456").mountPath("/workspace/config.json").build(), + BetaManagedAgentsFileResourceParams.builder() + .type(BetaManagedAgentsFileResourceParams.Type.FILE).fileId("file_ghi789").mountPath("/workspace/src/main.py").build() +); +``` + +```php PHP +$resources = [ + ['type' => 'file', 'file_id' => 'file_abc123', 'mount_path' => '/workspace/data.csv'], + ['type' => 'file', 'file_id' => 'file_def456', 'mount_path' => '/workspace/config.json'], + ['type' => 'file', 'file_id' => 'file_ghi789', 'mount_path' => '/workspace/src/main.py'], +]; +``` + +```ruby Ruby +resources = [ + {type: "file", file_id: "file_abc123", mount_path: "/workspace/data.csv"}, + {type: "file", file_id: "file_def456", mount_path: "/workspace/config.json"}, + {type: "file", file_id: "file_ghi789", mount_path: "/workspace/src/main.py"} +] +``` + + +A maximum of 100 files is supported per session. + +## Managing files on a running session + +You can add or remove files from a session after creation using the session resources API. Each resource has an `id` returned when it is added (or listed), which you use for deletes. + + + +````bash +resource=$( + jq -n --arg file_id "${file_id}" '{type: "file", file_id: $file_id}' \ + | curl --fail-with-body -sS "${auth[@]}" \ + "${base_url}/sessions/${session_id}/resources" --json @- +) +resource_id=$(jq -er '.id' <<<"${resource}") +printf '%s\n' "${resource_id}" # "sesrsc_01ABC..." +```` + + +````bash +RESOURCE_ID=$(ant beta:sessions:resources create \ + --session-id "$SESSION_ID" \ + --type file \ + --file-id "$FILE_ID" \ + --transform id --format yaml) +```` + + +````python +resource = client.beta.sessions.resources.add( + session.id, + type="file", + file_id=file.id, +) +print(resource.id) # "sesrsc_01ABC..." +```` + + +````typescript +const resource = await client.beta.sessions.resources.add(session.id, { + type: "file", + file_id: file.id, +}); +console.log(resource.id); // "sesrsc_01ABC..." +```` + + +````csharp +var resource = await client.Beta.Sessions.Resources.Add(session.ID, new() +{ + Type = "file", + FileID = file.ID, +}); +Console.WriteLine(resource.ID); // "sesrsc_01ABC..." +```` + + +````go +resource, err := client.Beta.Sessions.Resources.Add(ctx, session.ID, anthropic.BetaSessionResourceAddParams{ + BetaManagedAgentsFileResourceParams: anthropic.BetaManagedAgentsFileResourceParams{ + Type: anthropic.BetaManagedAgentsFileResourceParamsTypeFile, + FileID: file.ID, + }, +}) +if err != nil { + panic(err) +} +fmt.Println(resource.ID) // "sesrsc_01ABC..." +```` + + +````java +var resource = client.beta().sessions().resources().add( + session.id(), + ResourceAddParams.builder() + .betaManagedAgentsFileResourceParams( + BetaManagedAgentsFileResourceParams.builder() + .type(BetaManagedAgentsFileResourceParams.Type.FILE) + .fileId(file.id()) + .build() + ) + .build() +); +IO.println(resource.id()); // "sesrsc_01ABC..." +```` + + +````php +$resource = $client->beta->sessions->resources->add( + $session->id, + type: 'file', + fileID: $file->id, +); +echo "{$resource->id}\n"; // "sesrsc_01ABC..." +```` + + +````ruby +resource = client.beta.sessions.resources.add( + session.id, + type: "file", + file_id: file.id +) +puts resource.id # "sesrsc_01ABC..." +```` + + + +List all resources on a session with `resources.list`. To remove a file, call `resources.delete` with the resource ID: + + + +````bash +curl --fail-with-body -sS "${auth[@]}" \ + "${base_url}/sessions/${session_id}/resources" \ + | jq -r '.data[] | "\(.id) \(.type)"' + +curl --fail-with-body -sS "${auth[@]}" -X DELETE \ + "${base_url}/sessions/${session_id}/resources/${resource_id}" >/dev/null +```` + + +````bash +ant beta:sessions:resources list --session-id "$SESSION_ID" + +ant beta:sessions:resources delete \ + --session-id "$SESSION_ID" \ + --resource-id "$RESOURCE_ID" +```` + + +````python +listed = client.beta.sessions.resources.list(session.id) +for entry in listed.data: + print(entry.id, entry.type) + +client.beta.sessions.resources.delete(resource.id, session_id=session.id) +```` + + +````typescript +const listed = await client.beta.sessions.resources.list(session.id); +for (const entry of listed.data) { + console.log(entry.id, entry.type); +} + +await client.beta.sessions.resources.delete(resource.id, { + session_id: session.id, +}); +```` + + +````csharp +var listed = await client.Beta.Sessions.Resources.List(session.ID); +foreach (var entry in listed.Data) +{ + var type = entry.Match(repository => repository.Type, fileResource => fileResource.Type); + Console.WriteLine($"{entry.ID} {type}"); +} + +await client.Beta.Sessions.Resources.Delete(resource.ID, new() { SessionID = session.ID }); +```` + + +````go +listed, err := client.Beta.Sessions.Resources.List(ctx, session.ID, anthropic.BetaSessionResourceListParams{}) +if err != nil { + panic(err) +} +for _, entry := range listed.Data { + fmt.Println(entry.ID, entry.Type) +} + +if _, err := client.Beta.Sessions.Resources.Delete(ctx, resource.ID, anthropic.BetaSessionResourceDeleteParams{ + SessionID: session.ID, +}); err != nil { + panic(err) +} +```` + + +````java +var listed = client.beta().sessions().resources().list(session.id()); +for (var entry : listed.data()) { + if (entry.isFile()) { + var fileResource = entry.asFile(); + IO.println(fileResource.id() + " " + fileResource.type()); + } else if (entry.isGitHubRepository()) { + var repoResource = entry.asGitHubRepository(); + IO.println(repoResource.id() + " " + repoResource.type()); + } +} + +client.beta().sessions().resources().delete( + resource.id(), + ResourceDeleteParams.builder().sessionId(session.id()).build() +); +```` + + +````php +$listed = $client->beta->sessions->resources->list($session->id); +foreach ($listed->data as $entry) { + echo "{$entry->id} {$entry->type}\n"; +} + +$client->beta->sessions->resources->delete($resource->id, sessionID: $session->id); +```` + + +````ruby +listed = client.beta.sessions.resources.list(session.id) +listed.data.each { puts "#{it.id} #{it.type}" } + +client.beta.sessions.resources.delete(resource.id, session_id: session.id) +```` + + + +## Listing and downloading session files + +Use the [Files API](/docs/en/build-with-claude/files) to list files scoped to a session and download them. + + +```bash curl +# List files associated with a session +curl -fsSL "https://api.anthropic.com/v1/files?scope_id=sess_abc123" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: files-api-2025-04-14" + +# Download a file +curl -fsSL "https://api.anthropic.com/v1/files/$FILE_ID/content" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: files-api-2025-04-14" \ + -o output.txt +``` + +```python Python +# List files associated with a session +files = client.beta.files.list(scope_id="sess_abc123") +for f in files: + print(f.id, f.filename) + +# Download a file +content = client.beta.files.download(files.data[0].id) +content.write_to_file("output.txt") +``` + +```typescript TypeScript +// List files associated with a session +const files = await client.beta.files.list({ scope_id: "sess_abc123" }); +for (const f of files.data) { + console.log(f.id, f.filename); +} + +// Download a file +const content = await client.beta.files.download(files.data[0].id); +await content.writeToFile("output.txt"); +``` + +```csharp C# +// List files associated with a session +var files = await client.Beta.Files.List(new FileListParams +{ + ScopeID = "sess_abc123", +}); + +// Download a file +byte[] content = await client.Beta.Files.Download(files.Data[0].ID); +await File.WriteAllBytesAsync("output.txt", content); +``` + +```go Go +// List files associated with a session +files, err := client.Beta.Files.List(ctx, anthropic.BetaFileListParams{ + ScopeID: anthropic.String("sess_abc123"), +}) +if err != nil { + panic(err) +} + +// Download a file +resp, err := client.Beta.Files.Download(ctx, files.Data[0].ID, anthropic.BetaFileDownloadParams{}) +if err != nil { + panic(err) +} +defer resp.Body.Close() +fileContent, _ := io.ReadAll(resp.Body) +os.WriteFile("output.txt", fileContent, 0644) +``` + +```java Java +// List files associated with a session +var files = client.beta().files().list(FileListParams.builder() + .scopeId("sess_abc123") + .build()); + +// Download a file +try (HttpResponse response = client.beta().files().download(files.data().get(0).id())) { + try (InputStream body = response.body()) { + Files.copy(body, Path.of("output.txt"), StandardCopyOption.REPLACE_EXISTING); + } +} +``` + +```php PHP +// List files associated with a session +$files = $client->beta->files->list( + scopeID: 'sess_abc123', +); + +// Download a file +$content = $client->beta->files->download($files->data[0]->id); +file_put_contents('output.txt', $content); +``` + +```ruby Ruby +# List files associated with a session +files = client.beta.files.list( + scope_id: "sess_abc123" +) + +# Download a file +content = client.beta.files.download(files.data[0].id) +File.binwrite("output.txt", content.read) +``` + + +## Supported file types + +The agent can work with any file type, including: + +- Source code (`.py`, `.js`, `.ts`, `.go`, `.rs`, etc.) +- Data files (`.csv`, `.json`, `.xml`, `.yaml`) +- Documents (`.txt`, `.md`) +- Archives (`.zip`, `.tar.gz`) - the agent can extract these using bash +- Binary files - the agent can process these with appropriate tools + +## File paths + + +Files mounted in the container are read-only copies. The agent can read them but cannot modify the original uploaded file. To work with modified versions, the agent writes to new paths within the container. + + +- Files are mounted at the exact path you specify +- Parent directories are created automatically +- Paths should be absolute (starting with `/`) \ No newline at end of file diff --git a/content/en/managed-agents/github.md b/content/en/managed-agents/github.md new file mode 100644 index 000000000..e57c00f46 --- /dev/null +++ b/content/en/managed-agents/github.md @@ -0,0 +1,915 @@ +# Accessing GitHub + +Connect your agent to GitHub repositories for cloning, reading, and creating pull requests. + +--- + +You can mount a GitHub repository to your session container and connect to the GitHub MCP for making pull requests. + +GitHub repositories are cached, so future sessions that use the same repository start faster. + + +All Managed Agents API requests require the `managed-agents-2026-04-01` beta header. The SDK sets the beta header automatically. + + +## GitHub MCP and Session Resources + +First, create an agent that declares the GitHub MCP server. The agent definition holds the server URL but no auth token: + + + +````bash +agent_id=$(curl -fsS https://api.anthropic.com/v1/agents \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + --data @- <beta->agents->create( + name: 'Code Reviewer', + model: 'claude-sonnet-4-6', + system: 'You are a code review assistant with access to GitHub.', + mcpServers: [ + [ + 'type' => 'url', + 'name' => 'github', + 'url' => 'https://api.githubcopilot.com/mcp/', + ], + ], + tools: [ + ['type' => 'agent_toolset_20260401'], + [ + 'type' => 'mcp_toolset', + 'mcpServerName' => 'github', + ], + ], +); +```` + + +````ruby +agent = client.beta.agents.create( + name: "Code Reviewer", + model: "claude-sonnet-4-6", + system_: "You are a code review assistant with access to GitHub.", + mcp_servers: [ + { + type: "url", + name: "github", + url: "https://api.githubcopilot.com/mcp/" + } + ], + tools: [ + {type: "agent_toolset_20260401"}, + { + type: "mcp_toolset", + mcp_server_name: "github" + } + ] +) +```` + + + +Then create a session that mounts the GitHub repository: + + + +````bash +session_id=$(curl -fsS https://api.anthropic.com/v1/sessions \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + --data @- <beta->sessions->create( + agent: $agent->id, + environmentID: $environment->id, + resources: [ + [ + 'type' => 'github_repository', + 'url' => 'https://github.com/org/repo', + 'mountPath' => '/workspace/repo', + 'authorizationToken' => 'ghp_your_github_token', + ], + ], +); +```` + + +````ruby +session = client.beta.sessions.create( + agent: agent.id, + environment_id: environment.id, + resources: [ + { + type: "github_repository", + url: "https://github.com/org/repo", + mount_path: "/workspace/repo", + authorization_token: "ghp_your_github_token" + } + ] +) +```` + + + +The `resources[].authorization_token` authenticates the repository clone operation and is not echoed in API responses. + +## Token permissions + +When providing a GitHub token, use the minimum required permissions: + +| Action | Required scopes | +|--------|----------------| +| Clone private repos | `repo` | +| Create PRs | `repo` | +| Read issues | `repo` (private) or `public_repo` | +| Create issues | `repo` (private) or `public_repo` | + + +Use fine-grained personal access tokens with minimum required permissions. Avoid using tokens with broad access to your GitHub account. + + +## Multiple repositories + +Mount multiple repositories by adding entries to the `resources` array: + + + +````bash +resources='[ + { + "type": "github_repository", + "url": "https://github.com/org/frontend", + "mount_path": "/workspace/frontend", + "authorization_token": "ghp_your_github_token" + }, + { + "type": "github_repository", + "url": "https://github.com/org/backend", + "mount_path": "/workspace/backend", + "authorization_token": "ghp_your_github_token" + } +]' +```` + + +````bash +RESOURCES_BODY=$(cat <<'EOF' +resources: + - type: github_repository + url: https://github.com/org/frontend + mount_path: /workspace/frontend + authorization_token: ghp_your_github_token + - type: github_repository + url: https://github.com/org/backend + mount_path: /workspace/backend + authorization_token: ghp_your_github_token +EOF +) +```` + + +````python +resources = [ + { + "type": "github_repository", + "url": "https://github.com/org/frontend", + "mount_path": "/workspace/frontend", + "authorization_token": "ghp_your_github_token", + }, + { + "type": "github_repository", + "url": "https://github.com/org/backend", + "mount_path": "/workspace/backend", + "authorization_token": "ghp_your_github_token", + }, +] +```` + + +````typescript +const resources = [ + { + type: "github_repository", + url: "https://github.com/org/frontend", + mount_path: "/workspace/frontend", + authorization_token: "ghp_your_github_token", + }, + { + type: "github_repository", + url: "https://github.com/org/backend", + mount_path: "/workspace/backend", + authorization_token: "ghp_your_github_token", + }, +]; +```` + + +````csharp +BetaManagedAgentsGitHubRepositoryResourceParams[] resources = +[ + new() + { + Type = "github_repository", + Url = "https://github.com/org/frontend", + MountPath = "/workspace/frontend", + AuthorizationToken = "ghp_your_github_token", + }, + new() + { + Type = "github_repository", + Url = "https://github.com/org/backend", + MountPath = "/workspace/backend", + AuthorizationToken = "ghp_your_github_token", + }, +]; +```` + + +````go +resources := []anthropic.BetaSessionNewParamsResourceUnion{ + { + OfGitHubRepository: &anthropic.BetaManagedAgentsGitHubRepositoryResourceParams{ + Type: anthropic.BetaManagedAgentsGitHubRepositoryResourceParamsTypeGitHubRepository, + URL: "https://github.com/org/frontend", + MountPath: anthropic.String("/workspace/frontend"), + AuthorizationToken: "ghp_your_github_token", + }, + }, + { + OfGitHubRepository: &anthropic.BetaManagedAgentsGitHubRepositoryResourceParams{ + Type: anthropic.BetaManagedAgentsGitHubRepositoryResourceParamsTypeGitHubRepository, + URL: "https://github.com/org/backend", + MountPath: anthropic.String("/workspace/backend"), + AuthorizationToken: "ghp_your_github_token", + }, + }, +} +```` + + +````java +var resources = List.of( + BetaManagedAgentsGitHubRepositoryResourceParams.builder() + .type(BetaManagedAgentsGitHubRepositoryResourceParams.Type.GITHUB_REPOSITORY) + .url("https://github.com/org/frontend") + .mountPath("/workspace/frontend") + .authorizationToken("ghp_your_github_token") + .build(), + BetaManagedAgentsGitHubRepositoryResourceParams.builder() + .type(BetaManagedAgentsGitHubRepositoryResourceParams.Type.GITHUB_REPOSITORY) + .url("https://github.com/org/backend") + .mountPath("/workspace/backend") + .authorizationToken("ghp_your_github_token") + .build()); +```` + + +````php +$resources = [ + [ + 'type' => 'github_repository', + 'url' => 'https://github.com/org/frontend', + 'mountPath' => '/workspace/frontend', + 'authorizationToken' => 'ghp_your_github_token', + ], + [ + 'type' => 'github_repository', + 'url' => 'https://github.com/org/backend', + 'mountPath' => '/workspace/backend', + 'authorizationToken' => 'ghp_your_github_token', + ], +]; +```` + + +````ruby +resources = [ + { + type: "github_repository", + url: "https://github.com/org/frontend", + mount_path: "/workspace/frontend", + authorization_token: "ghp_your_github_token" + }, + { + type: "github_repository", + url: "https://github.com/org/backend", + mount_path: "/workspace/backend", + authorization_token: "ghp_your_github_token" + } +] +```` + + + +## Managing repositories on a running session + +After a session is created, you can list its repository resources and rotate their authorization tokens. Each resource has an `id` returned at session creation time (or via `resources.list`) that you use for updates. Repositories are attached for the lifetime of the session; to change which repositories are mounted, create a new session. + + + +````bash +# List resources on the session +repo_resource_id=$(curl -fsS "https://api.anthropic.com/v1/sessions/$session_id/resources" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" | jq -r '.data[0].id') +echo "$repo_resource_id" # "sesrsc_01ABC..." + +# Rotate the authorization token +curl -fsS "https://api.anthropic.com/v1/sessions/$session_id/resources/$repo_resource_id" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -o /dev/null \ + --data @- <beta->sessions->resources->list($session->id); +$repoResourceId = $listed->data[0]->id; +echo $repoResourceId, PHP_EOL; // "sesrsc_01ABC..." + +// Rotate the authorization token +$client->beta->sessions->resources->update( + $repoResourceId, + sessionID: $session->id, + authorizationToken: 'ghp_your_new_github_token', +); +```` + + +````ruby +# List resources on the session +listed = client.beta.sessions.resources.list(session.id) +repo_resource_id = listed.data.first.id +puts repo_resource_id # "sesrsc_01ABC..." + +# Rotate the authorization token +client.beta.sessions.resources.update( + repo_resource_id, + session_id: session.id, + authorization_token: "ghp_your_new_github_token" +) +```` + + + +## Creating pull requests + +With the GitHub MCP server, the agent can create branches, commit changes, and push them: + + + +````bash +curl -fsS "https://api.anthropic.com/v1/sessions/$session_id/events" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -o /dev/null \ + --data @- < /dev/null <<'EOF' +events: + - type: user.message + content: + - type: text + text: Fix the type error in src/utils.ts, commit it to a new branch, and push it. +EOF +```` + + +````python +client.beta.sessions.events.send( + session.id, + events=[ + { + "type": "user.message", + "content": [ + { + "type": "text", + "text": "Fix the type error in src/utils.ts, commit it to a new branch, and push it.", + }, + ], + }, + ], +) +```` + + +````typescript +await client.beta.sessions.events.send(session.id, { + events: [ + { + type: "user.message", + content: [ + { + type: "text", + text: "Fix the type error in src/utils.ts, commit it to a new branch, and push it.", + }, + ], + }, + ], +}); +```` + + +````csharp +await client.Beta.Sessions.Events.Send(session.ID, new() +{ + Events = + [ + new BetaManagedAgentsUserMessageEventParams + { + Type = "user.message", + Content = + [ + new BetaManagedAgentsTextBlock + { + Type = "text", + Text = "Fix the type error in src/utils.ts, commit it to a new branch, and push it.", + }, + ], + }, + ], +}); +```` + + +````go +_, err = client.Beta.Sessions.Events.Send(ctx, session.ID, anthropic.BetaSessionEventSendParams{ + Events: []anthropic.SendEventsParamsUnion{ + { + OfUserMessage: &anthropic.BetaManagedAgentsUserMessageEventParams{ + Type: anthropic.BetaManagedAgentsUserMessageEventParamsTypeUserMessage, + Content: []anthropic.BetaManagedAgentsUserMessageEventParamsContentUnion{ + { + OfText: &anthropic.BetaManagedAgentsTextBlockParam{ + Type: anthropic.BetaManagedAgentsTextBlockTypeText, + Text: "Fix the type error in src/utils.ts, commit it to a new branch, and push it.", + }, + }, + }, + }, + }, + }, +}) +if err != nil { + panic(err) +} +```` + + +````java +client.beta().sessions().events().send(session.id(), EventSendParams.builder() + .addEvent(BetaManagedAgentsUserMessageEventParams.builder() + .type(BetaManagedAgentsUserMessageEventParams.Type.USER_MESSAGE) + .addContent(BetaManagedAgentsTextBlock.builder() + .type(BetaManagedAgentsTextBlock.Type.TEXT) + .text("Fix the type error in src/utils.ts, commit it to a new branch, and push it.") + .build()) + .build()) + .build()); +```` + + +````php +$client->beta->sessions->events->send( + $session->id, + events: [ + [ + 'type' => 'user.message', + 'content' => [ + [ + 'type' => 'text', + 'text' => 'Fix the type error in src/utils.ts, commit it to a new branch, and push it.', + ], + ], + ], + ], +); +```` + + +````ruby +client.beta.sessions.events.send_( + session.id, + events: [ + { + type: "user.message", + content: [ + { + type: "text", + text: "Fix the type error in src/utils.ts, commit it to a new branch, and push it." + } + ] + } + ] +) +```` + + \ No newline at end of file diff --git a/content/en/managed-agents/mcp-connector.md b/content/en/managed-agents/mcp-connector.md new file mode 100644 index 000000000..8b7d892be --- /dev/null +++ b/content/en/managed-agents/mcp-connector.md @@ -0,0 +1,343 @@ +# MCP connector + +Connect MCP servers to your agents for access to external tools and data sources. + +--- + +Claude Managed Agents supports connecting [Model Context Protocol (MCP)](https://modelcontextprotocol.io) servers to your agents. This gives the agent access to external tools, data sources, and services through a standardized protocol. + +MCP configuration is split across two steps: + +1. **Agent creation** declares which MCP servers the agent connects to, by name and URL. +2. **Session creation** supplies auth for those servers by referencing a pre-registered [vault](/docs/en/managed-agents/vaults). + +This separation keeps secrets out of reusable agent definitions while letting each session authenticate with its own credentials. + + +All Managed Agents API requests require the `managed-agents-2026-04-01` beta header. The SDK sets the beta header automatically. + + +## Declare MCP servers on the agent + +Specify MCP servers in the `mcp_servers` array when creating an agent. Each server needs a `type`, a unique `name`, and a `url`. No auth tokens are provided at this stage. + +The `name` you assign in the MCP server array is used to reference the `mcp_toolset` entries in the tools array. + + + +````bash +agent_response=$(curl -sS --fail-with-body https://api.anthropic.com/v1/agents \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -d @- <<'EOF' +{ + "name": "GitHub Assistant", + "model": "claude-sonnet-4-6", + "mcp_servers": [ + { + "type": "url", + "name": "github", + "url": "https://api.githubcopilot.com/mcp/" + } + ], + "tools": [ + {"type": "agent_toolset_20260401"}, + {"type": "mcp_toolset", "mcp_server_name": "github"} + ] +} +EOF +) +agent_id=$(jq -r '.id' <<<"$agent_response") +```` + + +````bash +AGENT_ID=$(ant beta:agents create \ + --name "GitHub Assistant" \ + --model claude-sonnet-4-6 \ + --mcp-server '{type: url, name: github, url: "https://api.githubcopilot.com/mcp/"}' \ + --tool '{type: agent_toolset_20260401}' \ + --tool '{type: mcp_toolset, mcp_server_name: github}' \ + --transform id --format yaml) +```` + + +````python +agent = client.beta.agents.create( + name="GitHub Assistant", + model="claude-sonnet-4-6", + mcp_servers=[ + { + "type": "url", + "name": "github", + "url": "https://api.githubcopilot.com/mcp/", + }, + ], + tools=[ + {"type": "agent_toolset_20260401"}, + {"type": "mcp_toolset", "mcp_server_name": "github"}, + ], +) +```` + + +````typescript +const agent = await client.beta.agents.create({ + name: "GitHub Assistant", + model: "claude-sonnet-4-6", + mcp_servers: [ + { + type: "url", + name: "github", + url: "https://api.githubcopilot.com/mcp/", + }, + ], + tools: [ + { type: "agent_toolset_20260401" }, + { type: "mcp_toolset", mcp_server_name: "github" }, + ], +}); +```` + + +````csharp +var agent = await client.Beta.Agents.Create(new() +{ + Name = "GitHub Assistant", + Model = BetaManagedAgentsModel.ClaudeSonnet4_6, + McpServers = + [ + new() { Type = "url", Name = "github", Url = "https://api.githubcopilot.com/mcp/" }, + ], + Tools = + [ + new BetaManagedAgentsAgentToolset20260401Params + { + Type = "agent_toolset_20260401", + }, + new BetaManagedAgentsMcpToolsetParams { Type = "mcp_toolset", McpServerName = "github" }, + ], +}); +```` + + +````go +agent, err := client.Beta.Agents.New(ctx, anthropic.BetaAgentNewParams{ + Name: "GitHub Assistant", + Model: anthropic.BetaManagedAgentsModelConfigParams{ + ID: anthropic.BetaManagedAgentsModelClaudeSonnet4_6, + Type: anthropic.BetaManagedAgentsModelConfigParamsTypeModelConfig, + }, + MCPServers: []anthropic.BetaManagedAgentsUrlmcpServerParams{{ + Type: anthropic.BetaManagedAgentsUrlmcpServerParamsTypeURL, + Name: "github", + URL: "https://api.githubcopilot.com/mcp/", + }}, + Tools: []anthropic.BetaAgentNewParamsToolUnion{ + { + OfAgentToolset20260401: &anthropic.BetaManagedAgentsAgentToolset20260401Params{ + Type: anthropic.BetaManagedAgentsAgentToolset20260401ParamsTypeAgentToolset20260401, + }, + }, + { + OfMCPToolset: &anthropic.BetaManagedAgentsMCPToolsetParams{ + Type: anthropic.BetaManagedAgentsMCPToolsetParamsTypeMCPToolset, + MCPServerName: "github", + }, + }, + }, +}) +if err != nil { + panic(err) +} +```` + + +````java +var agent = client.beta().agents().create( + AgentCreateParams.builder() + .name("GitHub Assistant") + .model(BetaManagedAgentsModel.CLAUDE_SONNET_4_6) + .addMcpServer( + BetaManagedAgentsUrlmcpServerParams.builder() + .type(BetaManagedAgentsUrlmcpServerParams.Type.URL) + .name("github") + .url("https://api.githubcopilot.com/mcp/") + .build() + ) + .addTool( + BetaManagedAgentsAgentToolset20260401Params.builder() + .type(BetaManagedAgentsAgentToolset20260401Params.Type.AGENT_TOOLSET_20260401) + .build() + ) + .addTool( + BetaManagedAgentsMcpToolsetParams.builder() + .type(BetaManagedAgentsMcpToolsetParams.Type.MCP_TOOLSET) + .mcpServerName("github") + .build() + ) + .build() +); +```` + + +````php +$agent = $client->beta->agents->create( + name: 'GitHub Assistant', + model: 'claude-sonnet-4-6', + mcpServers: [ + BetaManagedAgentsUrlmcpServerParams::with( + type: 'url', + name: 'github', + url: 'https://api.githubcopilot.com/mcp/', + ), + ], + tools: [ + BetaManagedAgentsAgentToolset20260401Params::with( + type: 'agent_toolset_20260401', + ), + BetaManagedAgentsMCPToolsetParams::with( + type: 'mcp_toolset', + mcpServerName: 'github', + ), + ], +); +```` + + +````ruby +agent = client.beta.agents.create( + name: "GitHub Assistant", + model: "claude-sonnet-4-6", + mcp_servers: [ + { + type: "url", + name: "github", + url: "https://api.githubcopilot.com/mcp/" + } + ], + tools: [ + {type: "agent_toolset_20260401"}, + {type: "mcp_toolset", mcp_server_name: "github"} + ] +) +```` + + + + +The MCP toolset defaults to a permission policy of `always_ask`, which requires user approval before each tool call. See [permission policies](/docs/en/managed-agents/permission-policies) to configure this behavior. + + +## Provide auth at session creation + +When starting a session, pass `vault_ids` to provide credentials for your MCP servers. Vaults are collections of credentials that you register once and reference by ID. See [Authenticate with vaults](/docs/en/managed-agents/vaults) for how to create vaults and manage credentials. + + + +````bash +session_response=$(curl -sS --fail-with-body https://api.anthropic.com/v1/sessions \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -d @- <beta->sessions->create( + agent: $agent->id, + environmentID: $environment->id, + vaultIDs: [$vault->id], +); +```` + + +````ruby +session = client.beta.sessions.create( + agent: agent.id, + environment_id: environment.id, + vault_ids: [vault.id] +) +```` + + + +If the authorization credentials supplied in the vault are invalid, session creation will succeed and interaction is still possible. A `session.error` event is emitted describing the MCP auth failure. You can decide whether to block further interactions on this error, trigger a credential update, or allow the session to continue without the MCP. Authentication retries will happen on the following `session.status_idle` to `session.status_running` transition. See [Session event stream](/docs/en/managed-agents/events-and-streaming) for details on consuming `session.error` and other events. + +## Supported MCP server types + +Claude Managed Agents connects to [remote MCP servers](/docs/en/agents-and-tools/remote-mcp-servers) that expose an HTTP endpoint. The server must support the MCP protocol's streamable HTTP transport. + +For more information on MCP and building MCP servers, see the [MCP documentation](https://modelcontextprotocol.io). \ No newline at end of file diff --git a/content/en/managed-agents/memory.md b/content/en/managed-agents/memory.md new file mode 100644 index 000000000..e56ca867d --- /dev/null +++ b/content/en/managed-agents/memory.md @@ -0,0 +1,1142 @@ +# Using memory + +Give your agents persistent memory that survives across sessions using memory stores. + +--- + + +Agent Memory is a Research Preview feature. [Request access](https://claude.com/form/claude-managed-agents) to try it. + + +Agent API sessions are ephemeral by default. When a session ends, anything the agent learned is gone. Memory stores let the agent carry learnings across sessions: user preferences, project conventions, prior mistakes, and domain context. + + +All Managed Agents API requests require the `managed-agents-2026-04-01` beta header. An additional beta header is needed for research preview features. The SDK sets these beta headers automatically. + + +## Overview +A **memory store** is a workspace-scoped collection of text documents optimized for Claude. When one or more memory stores are attached to a session, the agent automatically checks the stores before starting a task and writes durable learnings when done - no additional prompting or configuration is needed on your side. + +Each **memory** in a store can be accessed and edited directly via the API or Console, allowing for tuning, importing, and exporting memories. + +Every change to a memory creates an immutable **memory_version** to support auditing and rolling back memory changes. + +## Create a memory store + +Give the store a `name` and a `description`. The description is passed to the agent, telling it what the store contains. + + + ```bash curl + store=$(curl -fsS https://api.anthropic.com/v1/memory_stores \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + --data @- <beta->memoryStores->create( + name: 'User Preferences', + description: 'Per-user preferences and project context.', + ); + echo "{$store->id}\n"; // memstore_01Hx... + ``` + ```ruby Ruby + store = client.beta.memory_stores.create( + name: "User Preferences", + description: "Per-user preferences and project context." + ) + puts store.id # memstore_01Hx... + ``` + + +The memory store `id` (`memstore_...`) is what you pass when attaching the store to a session. + +### Seed it with content (optional) + +Pre-load a store with reference material before any agent runs: + + + + ```bash curl + curl -fsS "https://api.anthropic.com/v1/memory_stores/$store_id/memories" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + --data @- > /dev/null < /dev/null + ``` + ```python Python + client.beta.memory_stores.memories.write( + memory_store_id=store.id, + path="/formatting_standards.md", + content="All reports use GAAP formatting. Dates are ISO-8601...", + ) + ``` + ```typescript TypeScript + await client.beta.memoryStores.memories.write(store.id, { + path: "/formatting_standards.md", + content: "All reports use GAAP formatting. Dates are ISO-8601..." + }); + ``` + ```csharp C# + await client.Beta.MemoryStores.Memories.Create(store.ID, new() + { + Path = "/formatting_standards.md", + Content = "All reports use GAAP formatting. Dates are ISO-8601...", + }); + ``` + ```go Go + _, err = client.Beta.MemoryStores.Memories.New(ctx, store.ID, anthropic.BetaMemoryStoreMemoryNewParams{ + Path: "/formatting_standards.md", + Content: "All reports use GAAP formatting. Dates are ISO-8601...", + }) + if err != nil { + panic(err) + } + ``` + ```java Java + client.beta().memoryStores().memories().create( + store.id(), + MemoryCreateParams.builder() + .path("/formatting_standards.md") + .content("All reports use GAAP formatting. Dates are ISO-8601...") + .build() + ); + ``` + ```php PHP + $client->beta->memoryStores->memories->create( + $store->id, + path: '/formatting_standards.md', + content: 'All reports use GAAP formatting. Dates are ISO-8601...', + ); + ``` + ```ruby Ruby + client.beta.memory_stores.memories.create( + store.id, + path: "/formatting_standards.md", + content: "All reports use GAAP formatting. Dates are ISO-8601..." + ) + ``` + + + +Individual memories within the store are capped at 100KB (~25K tokens). Structure memory as many small focused files, not a few large ones. + + +## Attach memory to a session + +Memory stores are attached in the session's `resources[]` array. + +Optionally include a `prompt` if you want to provide session-specific instructions to Claude for how to use this memory store. It is provided to Claude in addition to the memory store's `name` and `description`, and is capped at 4,096 characters. + +You can configure `access` as well. It defaults to `read_write`, but `read_only` is also supported (shown explicitly in the example below). + + + + ```bash curl + session=$(curl -fsS https://api.anthropic.com/v1/sessions \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + --data @- <beta->sessions->create( + agent: $agent->id, + environmentID: $environment->id, + resources: [ + [ + 'type' => 'memory_store', + 'memory_store_id' => $store->id, + 'access' => 'read_write', + 'prompt' => 'User preferences and project context. Check before starting any task.', + ], + ], + ); + ``` + ```ruby Ruby + session = client.beta.sessions.create( + agent: agent.id, + environment_id: environment.id, + resources: [ + { + type: "memory_store", + memory_store_id: store.id, + access: "read_write", + prompt: "User preferences and project context. Check before starting any task." + } + ] + ) + ``` + + +A maximum of **8 memory stores** are supported per session. Attach multiple stores when different parts of memory have different owners or access rules. Common reasons: + +- **Shared reference material** - one read-only store attached to many sessions (standards, conventions, domain knowledge), kept separate from each session's own read-write learnings. +- **Mapping to your product's structure** - one store per end-user, per-team, or per-project, while sharing a single agent configuration. +- **Different lifecycles** - a store that outlives any single session, or one you want to archive on its own schedule. + +### Memory tools +When memory stores are attached to a session, the agent automatically gains access to memory tools. The agent's interactions with memory stores are registered as `agent.tool_use` events in the [event stream](/docs/en/managed-agents/events-and-streaming). + +| Tool | Description | +| --- | --- | +| `memory_list` | List documents in a store, optionally filtered by path prefix. | +| `memory_search` | Full-text search across document contents. | +| `memory_read` | Read a document's contents. | +| `memory_write` | Create or overwrite a document at a path. | +| `memory_edit` | Modify an existing document. | +| `memory_delete` | Remove a document. | + +## Inspect and correct memory + +Memory stores can be managed directly via the API. Use this for building review workflows, correcting bad memories, or seeding stores before any session runs. + +### List memories +List does not return memory content, just object metadata. Use `path_prefix` for directory-scoped lists (include a trailing slash: `/notes/` matches `/notes/a.md` but not `/notes_backup/old.md`). + + + + ```bash curl + page=$(curl -fsS "https://api.anthropic.com/v1/memory_stores/$store_id/memories?path_prefix=/" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01") + jq -r '.data[] | "\(.path) (\(.size_bytes) bytes, sha=\(.content_sha256[0:8]))"' <<< "$page" + ``` + + ```bash CLI + ant beta:memory-stores:memories list \ + --memory-store-id "$store_id" \ + --path-prefix "/" + ``` + ```python Python + page = client.beta.memory_stores.memories.list( + store.id, + path_prefix="/", + ) + for memory in page.data: + print( + f"{memory.path} ({memory.size_bytes} bytes, sha={memory.content_sha256[:8]})" + ) + ``` + ```typescript TypeScript + const page = await client.beta.memoryStores.memories.list(store.id, { + path_prefix: "/" + }); + for (const memory of page.data) { + console.log( + `${memory.path} (${memory.size_bytes} bytes, sha=${memory.content_sha256.slice(0, 8)})` + ); + } + ``` + ```csharp C# + var page = await client.Beta.MemoryStores.Memories.List(store.ID, new() { PathPrefix = "/" }); + foreach (var memory in page.Data) + { + Console.WriteLine($"{memory.Path} ({memory.SizeBytes} bytes, sha={memory.ContentSha256[..8]})"); + } + ``` + ```go Go + page, err := client.Beta.MemoryStores.Memories.List(ctx, store.ID, anthropic.BetaMemoryStoreMemoryListParams{ + PathPrefix: anthropic.String("/"), + }) + if err != nil { + panic(err) + } + for _, memory := range page.Data { + fmt.Printf("%s (%d bytes, sha=%s)\n", memory.Path, memory.SizeBytes, memory.ContentSha256[:8]) + } + ``` + ```java Java + var page = client.beta().memoryStores().memories().list( + store.id(), + MemoryListParams.builder().pathPrefix("/").build() + ); + for (var memory : page.data()) { + IO.println("%s (%d bytes, sha=%s)".formatted( + memory.path(), memory.sizeBytes(), memory.contentSha256().substring(0, 8) + )); + } + ``` + ```php PHP + $page = $client->beta->memoryStores->memories->list($store->id, pathPrefix: '/'); + foreach ($page->data as $memory) { + printf("%s (%d bytes, sha=%s)\n", $memory->path, $memory->sizeBytes, substr($memory->contentSha256, 0, 8)); + } + ``` + ```ruby Ruby + page = client.beta.memory_stores.memories.list( + store.id, + path_prefix: "/" + ) + page.data.each do + puts "#{it.path} (#{it.size_bytes} bytes, sha=#{it.content_sha256[0, 8]})" + end + ``` + + +### Read a memory +Fetching an individual memory returns the full document content. + + + + ```bash curl + mem=$(curl -fsS "https://api.anthropic.com/v1/memory_stores/$store_id/memories/$memory_id" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01") + jq -r '.content' <<< "$mem" + ``` + + ```bash CLI + ant beta:memory-stores:memories retrieve \ + --memory-store-id "$store_id" \ + --memory-id "$memory_id" + ``` + ```python Python + mem = client.beta.memory_stores.memories.retrieve( + memory_id, + memory_store_id=store.id, + ) + print(mem.content) + ``` + ```typescript TypeScript + const memory = await client.beta.memoryStores.memories.retrieve(memoryId, { + memory_store_id: store.id + }); + console.log(memory.content); + ``` + ```csharp C# + var mem = await client.Beta.MemoryStores.Memories.Retrieve(memoryId, new() + { + MemoryStoreID = store.ID, + }); + Console.WriteLine(mem.Content); + ``` + ```go Go + memory, err := client.Beta.MemoryStores.Memories.Get(ctx, memoryID, anthropic.BetaMemoryStoreMemoryGetParams{ + MemoryStoreID: store.ID, + }) + if err != nil { + panic(err) + } + fmt.Println(memory.Content) + ``` + ```java Java + var mem = client.beta().memoryStores().memories().retrieve( + memoryId, + MemoryRetrieveParams.builder().memoryStoreId(store.id()).build() + ); + IO.println(mem.content()); + ``` + ```php PHP + $memory = $client->beta->memoryStores->memories->retrieve($memoryId, memoryStoreID: $store->id); + echo "{$memory->content}\n"; + ``` + ```ruby Ruby + mem = client.beta.memory_stores.memories.retrieve( + memory_id, + memory_store_id: store.id + ) + puts mem.content + ``` + + +### Write a document + +Use `memories.write` to upsert a document **by path**. If nothing exists at the path, it is created; if a document already exists there, its content is replaced. To mutate an existing document **by `mem_...` ID** (for example, to rename its path or safely apply a content edit), use `memories.update` instead (see [Update](#update) below). + + + + ```bash curl + mem=$(curl -fsS "https://api.anthropic.com/v1/memory_stores/$store_id/memories" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + --data @- <beta->memoryStores->memories->create( + $store->id, + path: '/preferences/formatting.md', + content: 'Always use tabs, not spaces.', + ); + ``` + ```ruby Ruby + mem = client.beta.memory_stores.memories.create( + store.id, + path: "/preferences/formatting.md", + content: "Always use tabs, not spaces." + ) + ``` + + +### Create only if the path is free + +Pass `precondition={"type": "not_exists"}` to `memories.write` to make it a create-only guard. If a document already exists at the path, the write returns `409 memory_precondition_failed` instead of replacing it. Use this when seeding a store and you want to avoid clobbering existing content. + + + + ```bash curl + curl -fsS "https://api.anthropic.com/v1/memory_stores/$store_id/memories" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + --data @- > /dev/null < /dev/null <beta->memoryStores->memories->create( + $store->id, + path: '/preferences/formatting.md', + content: 'Always use 2-space indentation.', + precondition: ['type' => 'not_exists'], + ); + ``` + ```ruby Ruby + client.beta.memory_stores.memories.create( + store.id, + path: "/preferences/formatting.md", + content: "Always use 2-space indentation.", + precondition: {type: "not_exists"} + ) + ``` + + +To safely edit an existing document (read, modify, write back without clobbering a concurrent change), use `memories.update` with a `content_sha256` precondition instead. See [Update](#update) below. + +### Update + +`memories.update()` modifies an existing document by its `mem_...` ID. You can change `content`, `path` (a rename), or both in one call. + +Renaming onto an occupied path returns `409 conflict`. The caller must delete or rename the blocker first, or pass `precondition={"type": "not_exists"}` to make the rename a no-op if anything already exists at the target. + +The example below renames a document to an archive path: + + + + ```bash curl + curl -fsS -X PATCH "https://api.anthropic.com/v1/memory_stores/$store_id/memories/$mem_id" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -d '{"path": "/archive/2026_q1_formatting.md"}' > /dev/null + ``` + + ```bash CLI + ant beta:memory-stores:memories update \ + --memory-store-id "$store_id" \ + --memory-id "$mem_id" \ + --path "/archive/2026_q1_formatting.md" \ + > /dev/null + ``` + ```python Python + client.beta.memory_stores.memories.update( + mem.id, + memory_store_id=store.id, + path="/archive/2026_q1_formatting.md", + ) + ``` + ```typescript TypeScript + await client.beta.memoryStores.memories.update(mem.id, { + memory_store_id: store.id, + path: "/archive/2026_q1_formatting.md" + }); + ``` + ```csharp C# + await client.Beta.MemoryStores.Memories.Update(mem.ID, new() + { + MemoryStoreID = store.ID, + Path = "/archive/2026_q1_formatting.md", + }); + ``` + ```go Go + _, err = client.Beta.MemoryStores.Memories.Update(ctx, mem.ID, anthropic.BetaMemoryStoreMemoryUpdateParams{ + MemoryStoreID: store.ID, + Path: anthropic.String("/archive/2026_q1_formatting.md"), + }) + if err != nil { + panic(err) + } + ``` + ```java Java + client.beta().memoryStores().memories().update( + mem.id(), + MemoryUpdateParams.builder() + .memoryStoreId(store.id()) + .path("/archive/2026_q1_formatting.md") + .build() + ); + ``` + ```php PHP + $client->beta->memoryStores->memories->update( + $mem->id, + memoryStoreID: $store->id, + path: '/archive/2026_q1_formatting.md', + ); + ``` + ```ruby Ruby + client.beta.memory_stores.memories.update( + mem.id, + memory_store_id: store.id, + path: "/archive/2026_q1_formatting.md" + ) + ``` + + +#### Safe content edits (optimistic concurrency) + +To edit a document's content without clobbering a concurrent write, pass a `content_sha256` precondition. The update only applies if the stored hash still matches the one you read; on mismatch it returns `409 memory_precondition_failed`, at which point you re-read the document and retry against the fresh state. + + + ```bash curl + curl -fsS -X PATCH "https://api.anthropic.com/v1/memory_stores/$store_id/memories/$mem_id" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + --data @- > /dev/null <beta->memoryStores->memories->update( + $mem->id, + memoryStoreID: $store->id, + content: 'CORRECTED: Always use 2-space indentation.', + precondition: ['type' => 'content_sha256', 'content_sha256' => $mem->contentSha256], + ); + ``` + ```ruby Ruby + client.beta.memory_stores.memories.update( + mem.id, + memory_store_id: store.id, + content: "CORRECTED: Always use 2-space indentation.", + precondition: {type: "content_sha256", content_sha256: mem.content_sha256} + ) + ``` + + +### Delete a document + + + + ```bash curl + curl -fsS -X DELETE "https://api.anthropic.com/v1/memory_stores/$store_id/memories/$mem_id" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" > /dev/null + ``` + + ```bash CLI + ant beta:memory-stores:memories delete \ + --memory-store-id "$store_id" \ + --memory-id "$mem_id" \ + > /dev/null + ``` + ```python Python + client.beta.memory_stores.memories.delete( + mem.id, + memory_store_id=store.id, + ) + ``` + ```typescript TypeScript + await client.beta.memoryStores.memories.delete(mem.id, { + memory_store_id: store.id + }); + ``` + ```csharp C# + await client.Beta.MemoryStores.Memories.Delete(mem.ID, new() + { + MemoryStoreID = store.ID, + }); + ``` + ```go Go + _, err = client.Beta.MemoryStores.Memories.Delete(ctx, mem.ID, anthropic.BetaMemoryStoreMemoryDeleteParams{ + MemoryStoreID: store.ID, + }) + if err != nil { + panic(err) + } + ``` + ```java Java + client.beta().memoryStores().memories().delete( + mem.id(), + MemoryDeleteParams.builder().memoryStoreId(store.id()).build() + ); + ``` + ```php PHP + $client->beta->memoryStores->memories->delete($mem->id, memoryStoreID: $store->id); + ``` + ```ruby Ruby + client.beta.memory_stores.memories.delete( + mem.id, + memory_store_id: store.id + ) + ``` + + +Optionally pass `expected_content_sha256` for a conditional delete. + +## Memory versions + +Every mutation to a memory creates an immutable **memory version** (`memver_...`). Versions accumulate for the lifetime of the parent memory and form the audit and rollback surface underneath it. The live `memories.retrieve` call always returns the current head; the version endpoints give you the full history. + +A new version is written on every mutation: + +- The first `memories.write` to a path creates a version with `operation: "created"`. +- `memories.update` that changes `content`, `path`, or both creates a version with `operation: "modified"`. +- `memories.delete` creates a version with `operation: "deleted"`. + +Use the version endpoints to audit which user or agent changed what and when, to inspect or restore a prior snapshot, and to scrub sensitive content out of history with redact. + +### List versions + +List paginated version metadata for a store, newest-first. Filter by `memory_id`, `operation` (`created`, `modified`, or `deleted`), `session_id`, `api_key_id`, or a `created_at_gte`/`created_at_lte` time range. The list response does not include the `content` body; fetch individual versions with `retrieve` when you need the full content. + + + ```bash curl + curl -fsS "https://api.anthropic.com/v1/memory_stores/$store_id/memory_versions?memory_id=$mem_id" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + | jq -r '.data[] | "\(.id): \(.operation)"' + ``` + ```python Python + for v in client.beta.memory_stores.memory_versions.list( + store.id, + memory_id=mem.id, + ): + print(f"{v.id}: {v.operation}") + ``` + ```typescript TypeScript + const versions = await client.beta.memoryStores.memoryVersions.list(store.id, { + memory_id: mem.id + }); + for await (const v of versions) { + console.log(`${v.id}: ${v.operation}`); + } + ``` + ```csharp C# + var versions = await client.Beta.MemoryStores.MemoryVersions.List(store.ID, new() + { + MemoryID = mem.ID, + }); + await foreach (var v in versions.Paginate()) + { + Console.WriteLine($"{v.ID}: {v.Operation.Raw()}"); + } + ``` + ```go Go + page := client.Beta.MemoryStores.MemoryVersions.ListAutoPaging(ctx, store.ID, anthropic.BetaMemoryStoreMemoryVersionListParams{ + MemoryID: anthropic.String(mem.ID), + }) + for page.Next() { + v := page.Current() + fmt.Printf("%s: %s\n", v.ID, v.Operation) + } + if err := page.Err(); err != nil { + panic(err) + } + ``` + ```java Java + for (var v : client.beta().memoryStores().memoryVersions().list( + store.id(), + MemoryVersionListParams.builder().memoryId(mem.id()).build() + ).autoPager()) { + IO.println(v.id() + ": " + v.operation()); + } + ``` + ```php PHP + foreach ($client->beta->memoryStores->memoryVersions->list( + $store->id, + memoryID: $mem->id, + )->pagingEachItem() as $v) { + echo "{$v->id}: {$v->operation}\n"; + } + ``` + ```ruby Ruby + client.beta.memory_stores.memory_versions.list( + store.id, + memory_id: mem.id + ).auto_paging_each do |v| + puts "#{v.id}: #{v.operation}" + end + ``` + + +### Retrieve a version + +Fetching an individual version returns the same fields as the list response plus the full `content` body. + + + ```bash curl + curl -fsS "https://api.anthropic.com/v1/memory_stores/$store_id/memory_versions/$version_id" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" + ``` + ```python Python + version = client.beta.memory_stores.memory_versions.retrieve( + version_id, + memory_store_id=store.id, + ) + print(version.content) + ``` + ```typescript TypeScript + const version = await client.beta.memoryStores.memoryVersions.retrieve(versionId, { + memory_store_id: store.id + }); + console.log(version.content); + ``` + ```csharp C# + var version = await client.Beta.MemoryStores.MemoryVersions.Retrieve(versionId, new() + { + MemoryStoreID = store.ID, + }); + Console.WriteLine(version.Content); + ``` + ```go Go + version, err := client.Beta.MemoryStores.MemoryVersions.Get(ctx, versionID, anthropic.BetaMemoryStoreMemoryVersionGetParams{ + MemoryStoreID: store.ID, + }) + if err != nil { + panic(err) + } + fmt.Println(version.Content) + ``` + ```java Java + var version = client.beta().memoryStores().memoryVersions().retrieve( + versionId, + MemoryVersionRetrieveParams.builder().memoryStoreId(store.id()).build() + ); + IO.println(version.content()); + ``` + ```php PHP + $version = $client->beta->memoryStores->memoryVersions->retrieve( + $versionId, + memoryStoreID: $store->id, + ); + echo "{$version->content}\n"; + ``` + ```ruby Ruby + version = client.beta.memory_stores.memory_versions.retrieve( + version_id, + memory_store_id: store.id + ) + puts version.content + ``` + + +### Redact a version + +Redact scrubs content out of a historical version while preserving the audit trail (who did what, when). Use it for compliance workflows such as removing leaked secrets, PII, or user deletion requests. Redact hard clears `content`, `content_sha256`, `content_size_bytes`, and `path`; all other fields, including the actor and timestamps, are preserved. + + + ```bash curl + curl -fsS -X POST "https://api.anthropic.com/v1/memory_stores/$store_id/memory_versions/$version_id/redact" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -d '{}' + ``` + ```python Python + client.beta.memory_stores.memory_versions.redact( + version_id, + memory_store_id=store.id, + ) + ``` + ```typescript TypeScript + await client.beta.memoryStores.memoryVersions.redact(versionId, { + memory_store_id: store.id + }); + ``` + ```csharp C# + await client.Beta.MemoryStores.MemoryVersions.Redact(versionId, new() + { + MemoryStoreID = store.ID, + }); + ``` + ```go Go + _, err = client.Beta.MemoryStores.MemoryVersions.Redact(ctx, versionID, anthropic.BetaMemoryStoreMemoryVersionRedactParams{ + MemoryStoreID: store.ID, + }) + if err != nil { + panic(err) + } + ``` + ```java Java + client.beta().memoryStores().memoryVersions().redact( + versionId, + MemoryVersionRedactParams.builder().memoryStoreId(store.id()).build() + ); + ``` + ```php PHP + $client->beta->memoryStores->memoryVersions->redact( + $versionId, + memoryStoreID: $store->id, + ); + ``` + ```ruby Ruby + client.beta.memory_stores.memory_versions.redact( + version_id, + memory_store_id: store.id + ) + ``` + \ No newline at end of file diff --git a/content/en/managed-agents/migration.md b/content/en/managed-agents/migration.md new file mode 100644 index 000000000..ec0137de1 --- /dev/null +++ b/content/en/managed-agents/migration.md @@ -0,0 +1,827 @@ +# Migration + +Move an existing agent built on the Messages API or the Claude Agent SDK to Claude Managed Agents. + +--- + +Claude Managed Agents replaces your hand-written agent loop with managed infrastructure. This page covers what changes when you migrate from a custom loop built on the [Messages API](/docs/en/build-with-claude/working-with-messages) or from the [Claude Agent SDK](/docs/en/agent-sdk/overview). + + +All Managed Agents API requests require the `managed-agents-2026-04-01` beta header. The SDK sets the beta header automatically. + + +## From a Messages API agent loop + +If you built an agent by calling `messages.create` in a `while` loop, executing tool calls yourself, and appending results to the conversation history, most of that code goes away. + +### What you stop managing + +| Before | After | +| --- | --- | +| You maintain the conversation history array and pass it back on every turn. | The session stores history server-side. Send events, receive events. | +| You parse `stop_reason: "tool_use"`, execute the tool, and loop back with a `tool_result` message. | Pre-built tools execute inside the container automatically. You only handle custom tools via `agent.custom_tool_use` events. | +| You provision your own sandbox for running agent-generated code. | The session container handles code execution, file operations, and bash. | +| You decide when the loop is done. | The session emits `session.status_idle` when the agent has nothing more to do. | + +### Code comparison + +**Before** (Messages API loop, simplified): + + + +```python Python +messages = [{"role": "user", "content": task}] +while True: + response = client.messages.create( + model="claude-sonnet-4-6", + max_tokens=1024, + messages=messages, + tools=tools, + ) + messages.append({"role": "assistant", "content": response.content}) + if response.stop_reason == "end_turn": + break + for block in response.content: + if block.type == "tool_use": + result = execute_tool(block.name, block.input) + messages.append( + { + "role": "user", + "content": [ + { + "type": "tool_result", + "tool_use_id": block.id, + "content": result, + } + ], + } + ) +``` + +```typescript TypeScript +const messages: Anthropic.MessageParam[] = [{ role: "user", content: task }]; +while (true) { + const response = await client.messages.create({ + model: "claude-sonnet-4-6", + max_tokens: 1024, + messages, + tools + }); + messages.push({ role: "assistant", content: response.content }); + if (response.stop_reason === "end_turn") { + break; + } + for (const block of response.content) { + if (block.type === "tool_use") { + const result = executeTool(block.name, block.input); + messages.push({ + role: "user", + content: [ + { + type: "tool_result", + tool_use_id: block.id, + content: result + } + ] + }); + } + } +} +``` + +```csharp C# +List messages = [new() { Role = Role.User, Content = task }]; +while (true) +{ + var response = await client.Messages.Create(new() + { + Model = Model.ClaudeSonnet4_6, + MaxTokens = 1024, + Messages = messages, + Tools = tools, + }); + messages.Add(new() + { + Role = Role.Assistant, + Content = new([.. response.Content.Select(block => new ContentBlockParam(block.Json))]), + }); + if (response.StopReason == StopReason.EndTurn) + { + break; + } + foreach (var block in response.Content) + { + if (block.Value is ToolUseBlock toolUse) + { + var result = ExecuteTool(toolUse.Name, toolUse.Input); + messages.Add(new() + { + Role = Role.User, + Content = new([new ToolResultBlockParam { ToolUseID = toolUse.ID, Content = result }]), + }); + } + } +} +``` + +```go Go +messages := []anthropic.MessageParam{ + anthropic.NewUserMessage(anthropic.NewTextBlock(task)), +} +for { + response, err := client.Messages.New(ctx, anthropic.MessageNewParams{ + Model: anthropic.ModelClaudeSonnet4_6, + MaxTokens: 1024, + Messages: messages, + Tools: tools, + }) + if err != nil { + log.Fatal(err) + } + messages = append(messages, response.ToParam()) + if response.StopReason == anthropic.StopReasonEndTurn { + break + } + for _, block := range response.Content { + if toolUse, ok := block.AsAny().(anthropic.ToolUseBlock); ok { + result := executeTool(toolUse.Name, toolUse.Input) + messages = append(messages, anthropic.NewUserMessage( + anthropic.NewToolResultBlock(toolUse.ID, result, false), + )) + } + } +} +``` + +```java Java +var messages = new ArrayList(); +messages.add(MessageParam.builder() + .role(MessageParam.Role.USER) + .content(task) + .build()); +while (true) { + var response = client.messages().create(MessageCreateParams.builder() + .model(Model.CLAUDE_SONNET_4_6) + .maxTokens(1024) + .messages(messages) + .tools(tools) + .build()); + messages.add(response.toParam()); + if (StopReason.END_TURN.equals(response.stopReason().orElse(null))) { + break; + } + for (var block : response.content()) { + block.toolUse().ifPresent(toolUse -> { + var result = executeTool(toolUse.name(), toolUse._input()); + messages.add(MessageParam.builder() + .role(MessageParam.Role.USER) + .contentOfBlockParams(List.of( + ContentBlockParam.ofToolResult(ToolResultBlockParam.builder() + .toolUseId(toolUse.id()) + .content(result) + .build()))) + .build()); + }); + } +} +``` + +```php PHP +$messages = [['role' => 'user', 'content' => $task]]; +while (true) { + $response = $client->messages->create( + model: 'claude-sonnet-4-6', + maxTokens: 1024, + messages: $messages, + tools: $tools, + ); + $messages[] = ['role' => 'assistant', 'content' => $response->content]; + if ($response->stopReason === 'end_turn') { + break; + } + foreach ($response->content as $block) { + if ($block->type === 'tool_use') { + $result = executeTool($block->name, $block->input); + $messages[] = [ + 'role' => 'user', + 'content' => [ + [ + 'type' => 'tool_result', + 'tool_use_id' => $block->id, + 'content' => $result, + ], + ], + ]; + } + } +} +``` + +```ruby Ruby +messages = [{ role: "user", content: task }] +loop do + response = client.messages.create( + model: "claude-sonnet-4-6", + max_tokens: 1024, + messages: messages, + tools: tools + ) + messages << { role: "assistant", content: response.content } + break if response.stop_reason == :end_turn + response.content.each do |block| + next unless block.type == :tool_use + result = execute_tool(block.name, block.input) + messages << { + role: "user", + content: [ + { + type: "tool_result", + tool_use_id: block.id, + content: result + } + ] + } + end +end +``` + + +**After** (Claude Managed Agents): + + + ```bash curl + agent=$( + curl --fail-with-body -sS "https://api.anthropic.com/v1/agents?beta=true" \ + -H "x-api-key: ${ANTHROPIC_API_KEY}" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + --json '{ + "name": "Task Runner", + "model": "claude-sonnet-4-6", + "tools": [{"type": "agent_toolset_20260401"}] + }' + ) + agent_id=$(jq -r '.id' <<< "${agent}") + + session_id=$( + curl --fail-with-body -sS "https://api.anthropic.com/v1/sessions?beta=true" \ + -H "x-api-key: ${ANTHROPIC_API_KEY}" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + --json "$(jq -n --argjson a "${agent}" --arg env "${environment_id}" \ + '{agent: {type: "agent", id: $a.id, version: $a.version}, environment_id: $env}')" \ + | jq -r '.id' + ) + + # Open the SSE stream in the background, then send the user message. + stream_log=$(mktemp) + curl --fail-with-body -sS -N \ + "https://api.anthropic.com/v1/sessions/${session_id}/stream?beta=true" \ + -H "x-api-key: ${ANTHROPIC_API_KEY}" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + > "${stream_log}" & + stream_pid=$! + + curl --fail-with-body -sS \ + "https://api.anthropic.com/v1/sessions/${session_id}/events?beta=true" \ + -H "x-api-key: ${ANTHROPIC_API_KEY}" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + --json "$(jq -n --arg text "${task}" \ + '{events: [{type: "user.message", content: [{type: "text", text: $text}]}]}')" \ + > /dev/null + + # Read events until the session goes idle. + while IFS= read -r line; do + [[ ${line} == data:* ]] || continue + event_type=$(jq -r '.type // empty' 2>/dev/null <<< "${line#data: }" || true) + [[ ${event_type} == "session.status_idle" ]] && break + done < <(tail -f -n +1 "${stream_log}") + + kill "${stream_pid}" 2>/dev/null || true + ``` + ```bash CLI + { read -r _ agent_id; read -r _ agent_version; } < <(ant beta:agents create \ + --name "Task Runner" \ + --model claude-sonnet-4-6 \ + --tool '{type: agent_toolset_20260401}' \ + --transform '{id,version}' --format yaml) + + session_id=$(ant beta:sessions create \ + --agent "{type: agent, id: $agent_id, version: $agent_version}" \ + --environment "$environment_id" \ + --transform id --format yaml) + + # Open the stream first, then send the user message + exec {stream}< <(ant beta:sessions stream \ + --session-id "$session_id" \ + --transform type --format yaml) + + ant beta:sessions:events send \ + --session-id "$session_id" \ + --event "{type: user.message, content: [{type: text, text: \"$task\"}]}" \ + > /dev/null + + while IFS= read -r -u "$stream" type; do + [[ $type == session.status_idle ]] && break + done + exec {stream}<&- + ``` + ```python Python + agent = client.beta.agents.create( + name="Task Runner", + model="claude-sonnet-4-6", + tools=[{"type": "agent_toolset_20260401"}], + ) + + session = client.beta.sessions.create( + agent={"type": "agent", "id": agent.id, "version": agent.version}, + environment_id=environment.id, + ) + + with client.beta.sessions.events.stream(session.id) as stream: + client.beta.sessions.events.send( + session.id, + events=[{"type": "user.message", "content": [{"type": "text", "text": task}]}], + ) + for event in stream: + if event.type == "session.status_idle": + break + ``` + ```typescript TypeScript + const agent = await client.beta.agents.create({ + name: "Task Runner", + model: "claude-sonnet-4-6", + tools: [{ type: "agent_toolset_20260401" }] + }); + + const session = await client.beta.sessions.create({ + agent: { type: "agent", id: agent.id, version: agent.version }, + environment_id: environment.id + }); + + const stream = await client.beta.sessions.events.stream(session.id); + + await client.beta.sessions.events.send(session.id, { + events: [ + { + type: "user.message", + content: [{ type: "text", text: task }] + } + ] + }); + + for await (const event of stream) { + if (event.type === "session.status_idle") { + break; + } + } + ``` + ```csharp C# + var agent = await client.Beta.Agents.Create(new() + { + Name = "Task Runner", + Model = BetaManagedAgentsModel.ClaudeSonnet4_6, + Tools = + [ + new BetaManagedAgentsAgentToolset20260401Params + { + Type = "agent_toolset_20260401", + }, + ], + }); + + var session = await client.Beta.Sessions.Create(new() + { + Agent = new BetaManagedAgentsAgentParams + { + Type = "agent", + ID = agent.ID, + Version = agent.Version, + }, + EnvironmentID = environment.ID, + }); + + var stream = client.Beta.Sessions.Events.StreamStreaming(session.ID); + + await client.Beta.Sessions.Events.Send(session.ID, new() + { + Events = + [ + new BetaManagedAgentsUserMessageEventParams + { + Type = "user.message", + Content = [new BetaManagedAgentsTextBlock { Type = "text", Text = task }], + }, + ], + }); + + await foreach (var streamEvent in stream) + { + if (streamEvent.Value is BetaManagedAgentsSessionStatusIdleEvent) + { + break; + } + } + ``` + ```go Go + agent, err := client.Beta.Agents.New(ctx, anthropic.BetaAgentNewParams{ + Name: "Task Runner", + Model: anthropic.BetaManagedAgentsModelConfigParams{ + ID: "claude-sonnet-4-6", + Type: anthropic.BetaManagedAgentsModelConfigParamsTypeModelConfig, + }, + Tools: []anthropic.BetaAgentNewParamsToolUnion{{ + OfAgentToolset20260401: &anthropic.BetaManagedAgentsAgentToolset20260401Params{ + Type: anthropic.BetaManagedAgentsAgentToolset20260401ParamsTypeAgentToolset20260401, + }, + }}, + }) + if err != nil { + log.Fatal(err) + } + + session, err := client.Beta.Sessions.New(ctx, anthropic.BetaSessionNewParams{ + Agent: anthropic.BetaSessionNewParamsAgentUnion{ + OfBetaManagedAgentsAgents: &anthropic.BetaManagedAgentsAgentParams{ + Type: anthropic.BetaManagedAgentsAgentParamsTypeAgent, + ID: agent.ID, + Version: anthropic.Int(agent.Version), + }, + }, + EnvironmentID: environment.ID, + }) + if err != nil { + log.Fatal(err) + } + + stream := client.Beta.Sessions.Events.StreamEvents(ctx, session.ID, anthropic.BetaSessionEventStreamParams{}) + defer stream.Close() + + _, err = client.Beta.Sessions.Events.Send(ctx, session.ID, anthropic.BetaSessionEventSendParams{ + Events: []anthropic.SendEventsParamsUnion{{ + OfUserMessage: &anthropic.BetaManagedAgentsUserMessageEventParams{ + Type: anthropic.BetaManagedAgentsUserMessageEventParamsTypeUserMessage, + Content: []anthropic.BetaManagedAgentsUserMessageEventParamsContentUnion{{ + OfText: &anthropic.BetaManagedAgentsTextBlockParam{ + Type: anthropic.BetaManagedAgentsTextBlockTypeText, + Text: task, + }, + }}, + }, + }}, + }) + if err != nil { + log.Fatal(err) + } + + for stream.Next() { + event := stream.Current() + if event.Type == "session.status_idle" { + break + } + } + if err := stream.Err(); err != nil { + log.Fatal(err) + } + ``` + ```java Java + var agent = client.beta().agents().create( + AgentCreateParams.builder() + .name("Task Runner") + .model(BetaManagedAgentsModel.CLAUDE_SONNET_4_6) + .addTool( + BetaManagedAgentsAgentToolset20260401Params.builder() + .type(BetaManagedAgentsAgentToolset20260401Params.Type.AGENT_TOOLSET_20260401) + .build() + ) + .build() + ); + + var session = client.beta().sessions().create( + SessionCreateParams.builder() + .agent( + BetaManagedAgentsAgentParams.builder() + .type(BetaManagedAgentsAgentParams.Type.AGENT) + .id(agent.id()) + .version(agent.version()) + .build() + ) + .environmentId(environment.id()) + .build() + ); + + try (var stream = client.beta().sessions().events().streamStreaming(session.id())) { + client.beta().sessions().events().send( + session.id(), + EventSendParams.builder() + .addEvent( + BetaManagedAgentsUserMessageEventParams.builder() + .type(BetaManagedAgentsUserMessageEventParams.Type.USER_MESSAGE) + .addTextContent(task) + .build() + ) + .build() + ); + stream.stream() + .takeWhile(event -> !event.isSessionStatusIdle()) + .forEach(_ -> {}); + } + ``` + ```php PHP + $agent = $client->beta->agents->create( + name: 'Task Runner', + model: 'claude-sonnet-4-6', + tools: [ + BetaManagedAgentsAgentToolset20260401Params::with( + type: 'agent_toolset_20260401', + ), + ], + ); + + $session = $client->beta->sessions->create( + agent: BetaManagedAgentsAgentParams::with( + type: 'agent', + id: $agent->id, + version: $agent->version, + ), + environmentID: $environment->id, + ); + + $stream = $client->beta->sessions->events->streamStream($session->id); + + $client->beta->sessions->events->send( + $session->id, + events: [ + ManagedAgentsUserMessageEventParams::with( + type: 'user.message', + content: [ManagedAgentsTextBlock::with(type: 'text', text: $task)], + ), + ], + ); + + foreach ($stream as $event) { + if ($event->type === 'session.status_idle') { + break; + } + } + ``` + ```ruby Ruby + agent = client.beta.agents.create( + name: "Task Runner", + model: "claude-sonnet-4-6", + tools: [{type: "agent_toolset_20260401"}] + ) + + session = client.beta.sessions.create( + agent: {type: "agent", id: agent.id, version: agent.version}, + environment_id: environment.id + ) + + stream = client.beta.sessions.events.stream_events(session.id) + client.beta.sessions.events.send_( + session.id, + events: [{type: "user.message", content: [{type: "text", text: task}]}] + ) + stream.each do + break if it.type == :"session.status_idle" + end + ``` + + +### What you still control + +- **System prompt and model:** Same fields, now on the agent definition. +- **Custom tools:** Still declared with JSON Schema. Execution moves from inline handling to responding to `agent.custom_tool_use` events. See [Session event stream](/docs/en/managed-agents/events-and-streaming). +- **Context:** You can still inject context via the system prompt, [file resources](/docs/en/managed-agents/files), or [skills](/docs/en/managed-agents/skills). + +## From the Claude Agent SDK + +If you built with the [Claude Agent SDK](/docs/en/agent-sdk/overview), you're already working with agents, tools, and sessions as concepts. The difference is where they run: the SDK executes in a process you operate, while Managed Agents runs in Anthropic's infrastructure. Most of the migration is mapping SDK configuration objects to their API-side equivalents. + +### What changes + +| Agent SDK | Managed Agents | +| --- | --- | +| `ClaudeAgentOptions(...)` constructed per run | `client.beta.agents.create(...)` once; the Agent is persisted and versioned server-side. See [Agent setup](/docs/en/managed-agents/agent-setup). | +| `async with ClaudeSDKClient(...)` or `query(...)` | `client.beta.sessions.create(...)` then send and receive [events](/docs/en/managed-agents/events-and-streaming). | +| `@tool`-decorated functions dispatched automatically by the SDK | Declare as `{"type": "custom", ...}` on the Agent; your client handles `agent.custom_tool_use` events and replies with `user.custom_tool_result`. See [Tools](/docs/en/managed-agents/tools). | +| Built-in tools run in your process against your filesystem | `{"type": "agent_toolset_20260401"}` runs the same tools inside the session container against `/workspace`. | +| `cwd`, `add_dirs` point at local paths | Upload or mount [files](/docs/en/managed-agents/files) as session resources. | +| `system_prompt` and the `CLAUDE.md` hierarchy | A single `system` string on the Agent. Each update produces a new server-side version; pin sessions to a specific version to promote or roll back without a deploy. See [Agent setup](/docs/en/managed-agents/agent-setup). | +| `mcp_servers` configured and authenticated in one place | Declare servers on the Agent; provide credentials through a [Vault](/docs/en/managed-agents/vaults) on the Session. | +| `permission_mode`, `can_use_tool` | Per-tool [`permission_policy`](/docs/en/managed-agents/permission-policies); respond to `user.tool_confirmation` events for `always_ask` tools. | + +### Code comparison + +**Before** (Agent SDK): + +```python +from claude_agent_sdk import ( + ClaudeAgentOptions, + ClaudeSDKClient, + create_sdk_mcp_server, + tool, +) + + +@tool("get_weather", "Get the current weather for a city.", {"city": str}) +async def get_weather(args: dict) -> dict: + return {"content": [{"type": "text", "text": f"{args['city']}: 18°C, clear"}]} + + +options = ClaudeAgentOptions( + model="claude-sonnet-4-6", + system_prompt="You are a concise weather assistant.", + mcp_servers={ + "weather": create_sdk_mcp_server("weather", "1.0", tools=[get_weather]) + }, +) + +async with ClaudeSDKClient(options=options) as agent: + await agent.query("What's the weather in Tokyo?") + async for msg in agent.receive_response(): + print(msg) +``` + +**After** (Managed Agents): + +```python +from anthropic import Anthropic + +client = Anthropic() + +agent = client.beta.agents.create( + name="weather-agent", + model="claude-sonnet-4-6", + system="You are a concise weather assistant.", + tools=[ + { + "type": "custom", + "name": "get_weather", + "description": "Get the current weather for a city.", + "input_schema": { + "type": "object", + "properties": {"city": {"type": "string"}}, + "required": ["city"], + }, + } + ], +) +environment = client.beta.environments.create( + name="weather-env", + config={"type": "cloud", "networking": {"type": "unrestricted"}}, +) + +session = client.beta.sessions.create( + agent={"type": "agent", "id": agent.id, "version": agent.version}, + environment_id=environment.id, +) + + +def get_weather(city: str) -> str: + return f"{city}: 18°C, clear" + + +with client.beta.sessions.events.stream(session.id) as stream: + client.beta.sessions.events.send( + session.id, + events=[ + { + "type": "user.message", + "content": [{"type": "text", "text": "What's the weather in Tokyo?"}], + } + ], + ) + for ev in stream: + if ev.type == "agent.message": + print("".join(b.text for b in ev.content)) + elif ev.type == "agent.custom_tool_use": + result = get_weather(**ev.input) + client.beta.sessions.events.send( + session.id, + events=[ + { + "type": "user.custom_tool_result", + "custom_tool_use_id": ev.id, + "content": [{"type": "text", "text": result}], + } + ], + ) + elif ev.type == "session.status_idle" and ev.stop_reason.type == "end_turn": + break +``` + +The Agent and Environment are created once and reused across sessions. The tool function still runs in your process; the difference is that you read the `agent.custom_tool_use` event and send the result explicitly instead of the SDK dispatching it for you. + +### Features that move to your client + +The tradeoff for Anthropic running the agent loop is that a few things the SDK handled automatically become your client's responsibility. + +| SDK feature | Managed Agents approach | +| --- | --- | +| Plan mode | Run a planning-only session first, then a second session to execute. | +| Output styles, slash commands | Apply in your client before sending `user.message` or after receiving `agent.message`. | +| `PreToolUse` / `PostToolUse` hooks | Your client already sees every `agent.custom_tool_use` event before responding; put the logic there. For built-in tools, use `permission_policy: always_ask`. | +| `max_turns` | Count turns client-side. | + +## Migration checklist + +1. [Create an environment](/docs/en/managed-agents/environments) with the networking and runtimes your agent needs. +2. Port your system prompt and tool selection to an [agent definition](/docs/en/managed-agents/agent-setup). +3. Replace your loop with [`sessions.create`](/docs/en/managed-agents/sessions) and [`sessions.stream`](/docs/en/managed-agents/events-and-streaming). +4. For any local files the agent reads, upload them via the [Files API](/docs/en/managed-agents/files) and mount them as `resources`. +5. For any custom tool handlers, move execution into your event loop as responses to `agent.custom_tool_use` events. +6. Verify with a test session before pointing production traffic at the new flow. + +## Migrating between model versions + +When a new Claude model is released, migrating a Claude Managed Agents integration is typically a one-field change: update `model` on your [agent definition](/docs/en/managed-agents/agent-setup) and the change takes effect on the next session you create. + + +```bash curl +curl -sS --fail-with-body "https://api.anthropic.com/v1/agents/$AGENT_ID?beta=true" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + --json "$(jq -n --argjson version "$AGENT_VERSION" '{version: $version, model: "claude-sonnet-4-6"}')" +``` + +```bash CLI +ant beta:agents update \ + --agent-id "$AGENT_ID" \ + --version "$AGENT_VERSION" \ + --model claude-sonnet-4-6 +``` + +```python Python +client.beta.agents.update( + agent.id, + version=agent.version, + model="claude-sonnet-4-6", +) +``` + +```typescript TypeScript +await client.beta.agents.update(agent.id, { + version: agent.version, + model: "claude-sonnet-4-6" +}); +``` + +```csharp C# +await client.Beta.Agents.Update(agent.ID, new() +{ + Version = agent.Version, + Model = BetaManagedAgentsModel.ClaudeSonnet4_6, +}); +``` + +```go Go +_, err = client.Beta.Agents.Update(ctx, agent.ID, anthropic.BetaAgentUpdateParams{ + Version: agent.Version, + Model: anthropic.BetaManagedAgentsModelConfigParams{ + ID: anthropic.BetaManagedAgentsModelClaudeSonnet4_6, + Type: anthropic.BetaManagedAgentsModelConfigParamsTypeModelConfig, + }, +}) +if err != nil { + panic(err) +} +``` + +```java Java +client.beta().agents().update( + agent.id(), + AgentUpdateParams.builder() + .version(agent.version()) + .model(BetaManagedAgentsModel.CLAUDE_SONNET_4_6) + .build() +); +``` + +```php PHP +$client->beta->agents->update( + $agent->id, + version: $agent->version, + model: 'claude-sonnet-4-6', +); +``` + +```ruby Ruby +client.beta.agents.update( + agent.id, + version: agent.version, + model: "claude-sonnet-4-6" +) +``` + + +Most model-level behavior changes documented in the [Messages API migration guide](/docs/en/about-claude/models/migration-guide) do not require action on your side: + +- **Request parameter changes** (`max_tokens` defaults, `thinking` configuration) are handled by the Claude Managed Agents runtime. These fields are not exposed on the agent definition. +- **Assistant message prefilling** does not exist in the event-based session model, so its removal on newer models is a no-op. +- **Tool argument JSON escaping** is parsed by the runtime before you receive `agent.custom_tool_use` events. You see structured data, not raw strings. + +The behavior descriptions in the Messages API guide (what the model does differently) still apply. The migration steps (how to change your request code) do not. \ No newline at end of file diff --git a/content/en/managed-agents/multi-agent.md b/content/en/managed-agents/multi-agent.md new file mode 100644 index 000000000..e71e7d38c --- /dev/null +++ b/content/en/managed-agents/multi-agent.md @@ -0,0 +1,743 @@ +# Multiagent sessions + +Coordinate multiple agents within a single session. + +--- + + +Multiagent is a Research Preview feature. [Request access](https://claude.com/form/claude-managed-agents) to try it. + + +Multi-agent orchestration lets one agent coordinate with others to complete complex work. Agents can act in parallel with their own isolated context, which helps improve output quality and improve time to completion. + + +All Managed Agents API requests require the `managed-agents-2026-04-01` beta header. An additional beta header is needed for research preview features. The SDK sets these beta headers automatically. + + +## How it works + +All agents share the same container and filesystem, but each agent runs in its own session **thread**, a context-isolated event stream with its own conversation history. The coordinator reports activity in the **primary thread** (which is the same as the session-level event stream); additional threads are spawned at runtime when the coordinator decides to delegate. + +Threads are persistent: the coordinator can send a follow-up to an agent it called earlier, and that agent retains everything from its previous turns. + +Each agent uses its own configuration (model, system prompt, tools, MCP servers, and skills) as defined when that agent was created. Tools and context are not shared. + +### What to delegate + +Multiagent sessions work best when there are multiple well-scoped, specialized tasks in an overall goal: + +- **Code review:** A reviewer agent with a focused system prompt and read-only tools. +- **Test generation:** A test agent that writes and runs tests without touching production code. +- **Research:** A search agent with web tools that summarizes findings back to the coordinator. + +## Declare callable agents + +When [defining your agent](/docs/en/managed-agents/agent-setup), list additional IDs of agents it is permitted to call: + + +```bash curl +orchestrator=$(curl -fsS https://api.anthropic.com/v1/agents \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -d @- <beta->agents->create( + name: 'Engineering Lead', + model: 'claude-sonnet-4-6', + system: 'You coordinate engineering work. Delegate code review to the reviewer agent and test writing to the test agent.', + tools: [ + ['type' => 'agent_toolset_20260401'], + ], + callableAgents: [ + ['type' => 'agent', 'id' => $reviewerAgent->id, 'version' => $reviewerAgent->version], + ['type' => 'agent', 'id' => $testWriterAgent->id, 'version' => $testWriterAgent->version], + ], +); +``` + +```ruby Ruby +orchestrator = client.beta.agents.create( + name: "Engineering Lead", + model: "claude-sonnet-4-6", + system: "You coordinate engineering work. Delegate code review to the reviewer agent and test writing to the test agent.", + tools: [ + {type: "agent_toolset_20260401"} + ], + callable_agents: [ + {type: "agent", id: reviewer_agent.id, version: reviewer_agent.version}, + {type: "agent", id: test_writer_agent.id, version: test_writer_agent.version} + ] +) +``` + + +Each entry in `callable_agents` must be the ID of an existing agent. Only one level of delegation is supported: the coordinator can call other agents, but those agents cannot call agents of their own. + +Then create a session referencing the orchestrator: + + +```bash curl +session=$(curl -fsS https://api.anthropic.com/v1/sessions \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -d '{"agent": "'$ORCHESTRATOR_ID'", "environment_id": "'$ENVIRONMENT_ID'"}') +``` + +```bash CLI +ant beta:sessions create \ + --agent "$ORCHESTRATOR_ID" \ + --environment "$ENVIRONMENT_ID" +``` + +```python Python +session = client.beta.sessions.create( + agent=orchestrator.id, + environment_id=environment.id, +) +``` + +```typescript TypeScript +const session = await client.beta.sessions.create({ + agent: orchestrator.id, + environment_id: environment.id +}); +``` + + +The callable agents are resolved from the orchestrator's configuration. You don't need to reference them at session creation. + +## Session threads + +The **session-level event stream** (`/v1/sessions/:id/stream`) is considered the **primary thread**, containing an condensed view of all activity across all threads. You won't see called agents' individual traces, but you will see the start and end of their work. **Session threads** are where you drill into a specific agent's reasoning and tool calls. + +The session status also is an aggregation of all agent activity; if at least one thread is `running`, then the overall session status will be `running` as well. + +List all threads in a session as follows: + +```bash curl +curl -fsS "https://api.anthropic.com/v1/sessions/$SESSION_ID/threads" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + | jq -r '.data[] | "[\(.agent_name)] \(.status)"' +``` + +```bash CLI +ant beta:sessions:threads list --session-id "$SESSION_ID" +``` + +```python Python +for thread in client.beta.sessions.threads.list(session.id): + print(f"[{thread.agent_name}] {thread.status}") +``` + +```typescript TypeScript +for await (const thread of client.beta.sessions.threads.list(session.id)) { + console.log(`[${thread.agent_name}] ${thread.status}`); +} +``` + +```csharp C# +await foreach (var thread in (await client.Beta.Sessions.Threads.List(session.ID)).Paginate()) +{ + Console.WriteLine($"[{thread.AgentName}] {thread.Status}"); +} +``` + +```go Go +threads := client.Beta.Sessions.Threads.ListAutoPaging(ctx, session.ID, anthropic.BetaSessionThreadListParams{}) +for threads.Next() { + thread := threads.Current() + fmt.Printf("[%s] %s\n", thread.AgentName, thread.Status) +} +if err := threads.Err(); err != nil { + panic(err) +} +``` + +```java Java +for (var thread : client.beta().sessions().threads().list(session.id()).autoPager()) { + IO.println("[" + thread.agentName() + "] " + thread.status()); +} +``` + +```php PHP +foreach ($client->beta->sessions->threads->list($session->id)->pagingEachItem() as $thread) { + echo "[{$thread->agentName}] {$thread->status}\n"; +} +``` + +```ruby Ruby +client.beta.sessions.threads.list(session.id).auto_paging_each do |thread| + puts "[#{thread.agent_name}] #{thread.status}" +end +``` + + +Stream events from a specific thread: + + +```bash curl +curl -fsSN "https://api.anthropic.com/v1/sessions/$SESSION_ID/threads/$THREAD_ID/stream" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" | + while IFS= read -r line; do + [[ $line == data:* ]] || continue + json=${line#data: } + case $(jq -r '.type' <<<"$json") in + agent.message) + printf '%s' "$(jq -j '.content[] | select(.type == "text") | .text' <<<"$json")" + ;; + session.thread_idle) + break + ;; + esac + done +``` + +```bash CLI +ant beta:sessions:threads stream \ + --session-id "$SESSION_ID" \ + --thread-id "$THREAD_ID" +``` + +```python Python +with client.beta.sessions.threads.stream( + thread.id, + session_id=session.id, +) as stream: + for event in stream: + match event.type: + case "agent.message": + for block in event.content: + if block.type == "text": + print(block.text, end="") + case "session.thread_idle": + break +``` + +```typescript TypeScript +const stream = await client.beta.sessions.threads.stream(thread.id, { + session_id: session.id +}); + +for await (const event of stream) { + if (event.type === "agent.message") { + for (const block of event.content) { + if (block.type === "text") { + process.stdout.write(block.text); + } + } + } else if (event.type === "session.thread_idle") { + break; + } +} +``` + +```csharp C# +await foreach (var evt in client.Beta.Sessions.Threads.Stream(thread.ID, new() { SessionID = session.ID })) +{ + if (evt.Value is BetaManagedAgentsAgentMessageEvent message) + { + foreach (var block in message.Content) + { + if (block.Type == "text") + { + Console.Write(block.Text); + } + } + } + else if (evt.Value is BetaManagedAgentsSessionThreadIdleEvent) + { + break; + } +} +``` + +```go Go +stream := client.Beta.Sessions.Threads.StreamEvents(ctx, thread.ID, anthropic.BetaSessionThreadStreamParams{ + SessionID: session.ID, +}) +defer stream.Close() + +loop: +for stream.Next() { + event := stream.Current() + switch event.Type { + case "agent.message": + for _, block := range event.AsAgentMessage().Content { + if block.Type == "text" { + fmt.Print(block.Text) + } + } + case "session.thread_idle": + break loop + } +} +if err := stream.Err(); err != nil { + panic(err) +} +``` + +```java Java +try (var streamResponse = client.beta().sessions().threads().streamStreaming( + thread.id(), + ThreadStreamParams.builder().sessionId(session.id()).build() +)) { + for (var event : (Iterable) streamResponse.stream()::iterator) { + if (event.isAgentMessage()) { + for (var block : event.asAgentMessage().content()) { + IO.print(block.text()); + } + } else if (event.isSessionThreadIdle()) { + break; + } + } +} +``` + +```php PHP +$stream = $client->beta->sessions->threads->stream( + $thread->id, + sessionID: $session->id, +); + +foreach ($stream as $event) { + if ($event->type === 'agent.message') { + foreach ($event->content as $block) { + if ($block->type === 'text') { + echo $block->text; + } + } + } elseif ($event->type === 'session.thread_idle') { + break; + } +} +``` + +```ruby Ruby +client.beta.sessions.threads.stream(thread.id, session_id: session.id).each do |event| + case event.type + when :"agent.message" + event.content.each do |block| + print block.text if block.type == :text + end + when :"session.thread_idle" + break + end +end +``` + + +List past events for a thread: + + +```bash curl +curl -fsS "https://api.anthropic.com/v1/sessions/$SESSION_ID/threads/$THREAD_ID/events" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + | jq -r '.data[] | "[\(.type)] \(.processed_at)"' +``` + +```bash CLI +ant beta:sessions:threads:events list \ + --session-id "$SESSION_ID" \ + --thread-id "$THREAD_ID" +``` + +```python Python +for event in client.beta.sessions.threads.events.list( + thread.id, + session_id=session.id, +): + print(f"[{event.type}] {event.processed_at}") +``` + +```typescript TypeScript +for await (const event of client.beta.sessions.threads.events.list(thread.id, { + session_id: session.id +})) { + console.log(`[${event.type}] ${event.processed_at}`); +} +``` + +```csharp C# +var page = await client.Beta.Sessions.Threads.Events.List(thread.ID, new() { SessionID = session.ID }); +await foreach (var evt in page.Paginate()) +{ + Console.WriteLine($"[{evt.Type}] {evt.ProcessedAt}"); +} +``` + +```go Go +pager := client.Beta.Sessions.Threads.Events.ListAutoPaging(ctx, thread.ID, anthropic.BetaSessionThreadEventListParams{ + SessionID: session.ID, +}) +for pager.Next() { + event := pager.Current() + fmt.Printf("[%s] %s\n", event.Type, event.ProcessedAt) +} +if err := pager.Err(); err != nil { + panic(err) +} +``` + +```java Java +for (var event : client.beta().sessions().threads().events().list( + thread.id(), + EventListParams.builder().sessionId(session.id()).build() + ).autoPager()) { + IO.println("[" + event.type() + "] " + event.processedAt()); +} +``` + +```php PHP +foreach ( + $client->beta->sessions->threads->events->list( + $thread->id, + sessionID: $session->id, + )->pagingEachItem() as $event +) { + echo "[{$event->type}] {$event->processedAt->format(DATE_RFC3339)}\n"; +} +``` + +```ruby Ruby +client.beta.sessions.threads.events.list( + thread.id, + session_id: session.id +).auto_paging_each do |event| + puts "[#{event.type}] #{event.processed_at}" +end +``` + + +## Multiagent event types + +These events surface multiagent activity on the top-level session stream. + +| Type | Description | +| --- | --- | +| `session.thread_created` | The coordinator spawned a new thread. Includes the `session_thread_id` and `model`. | +| `session.thread_idle` | An agent thread finished its current work. | +| `agent.thread_message_sent` | An agent sent a message to another thread. Includes `to_thread_id` and `content`. | +| `agent.thread_message_received` | An agent received a message from another thread. Includes `from_thread_id` and `content`. | + +## Tool permissions and custom tools in threads + +When a `callable_agent` thread needs something from your client ([permission](/docs/en/managed-agents/events-and-streaming#tool-confirmation) to run an `always_ask` tool, or the [result of a custom tool](/docs/en/managed-agents/events-and-streaming#handling-custom-tool-calls)) the request surfaces on the **session stream** with a `session_thread_id` field. Include the same `session_thread_id` when you post your response so the platform routes it back to the waiting thread. + +- **`session_thread_id` is present:** the event originated in a subagent thread. Echo it on your reply. +- **`session_thread_id` is absent:** the event came from the primary thread. Reply without the field. +- Match on `tool_use_id` to pair requests with responses. + +The example below extends the [tool confirmation handler](/docs/en/managed-agents/events-and-streaming#tool-confirmation) to route replies. The same pattern applies to `user.custom_tool_result`. + + +```bash curl +while IFS= read -r event_id; do + pending=$(jq -r --arg id "$event_id" '.[$id]' <<<"$events_by_id") + thread_id=$(jq -r '.session_thread_id // empty' <<<"$pending") + jq -n --arg id "$event_id" --arg thread "$thread_id" ' + {events: [ + {type: "user.tool_confirmation", tool_use_id: $id, result: "allow"} + + (if $thread != "" then {session_thread_id: $thread} else {} end) + ]}' | + curl -fsS "https://api.anthropic.com/v1/sessions/$SESSION_ID/events?beta=true" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -d @- +done < <(jq -r '.stop_reason.event_ids[]' <<<"$data") +``` + +```bash CLI +while IFS= read -r event_id; do + pending=$(jq -r --arg id "$event_id" '.[$id]' <<<"$events_by_id") + thread_id=$(jq -r '.session_thread_id // empty' <<<"$pending") + event="type: user.tool_confirmation, tool_use_id: $event_id, result: allow" + # Echo session_thread_id when the request came from a subagent thread + if [[ -n $thread_id ]]; then + event+=", session_thread_id: $thread_id" + fi + ant beta:sessions:events send \ + --session-id "$SESSION_ID" \ + --event "{$event}" \ + stopReason->eventIDs as $eventId) { + $pending = $eventsById[$eventId]; + $confirmation = [ + 'type' => 'user.tool_confirmation', + 'tool_use_id' => $eventId, + 'result' => 'allow', + ]; + // Echo session_thread_id when the request came from a subagent thread + if ($pending->sessionThreadID !== null) { + $confirmation['session_thread_id'] = $pending->sessionThreadID; + } + $client->beta->sessions->events->send($session->id, events: [$confirmation]); +} +``` + +```ruby Ruby +event_ids.each do |event_id| + pending = events_by_id[event_id] + confirmation = { + type: "user.tool_confirmation", + tool_use_id: event_id, + result: "allow" + } + # Echo session_thread_id when the request came from a subagent thread + confirmation[:session_thread_id] = pending.session_thread_id if pending.session_thread_id + client.beta.sessions.events.send_(session.id, events: [confirmation]) +end +``` + \ No newline at end of file diff --git a/content/en/managed-agents/observability.md b/content/en/managed-agents/observability.md new file mode 100644 index 000000000..f64f10da1 --- /dev/null +++ b/content/en/managed-agents/observability.md @@ -0,0 +1,384 @@ +# Session tracing + +Monitor and debug your sessions using the Console timeline and raw event views. + +--- + +Claude Managed Agents provides observability tools in the [Claude Console](/) to help you monitor, debug, and understand your agent sessions. + +## Console observability + +The Console provides a visual timeline view of your agent sessions. Navigate to the Claude Managed Agents section in the Console to see: + +- **Session list** - All sessions with their status, creation time, and model +- **Tracing view** - A chronological view of events (content, timestamps, token usage) within a session. These are only accessible to Developers and Admins. +- **Tool execution** - Details of each tool call and its result + +## Raw events + +For programmatic debugging, retrieve raw events via the API: + + + +```bash curl +curl -fsSL "https://api.anthropic.com/v1/sessions/$SESSION_ID/events" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ +| jq -r ' + .data[] + | "Type: \(.type)", + "Processed: \(.processed_at)", + ( if .type | IN("user.message", "agent.message") then + .content[] + | " Block: \(.type)", + (select(.type == "text") | " Text: \(.text[:100])...") + elif .type | IN("agent.tool_use", "agent.custom_tool_use", "agent.mcp_tool_use") then + " Tool: \(.name)" + else empty end ), + "---" +' +``` + +```bash CLI +ant beta:sessions:events list --session-id "$SESSION_ID" +``` + +```python Python +events = client.beta.sessions.events.list(session.id) + +for event in events: + print(f"Type: {event.type}") + print(f"Processed: {event.processed_at}") + match event.type: + case "user.message" | "agent.message": + for block in event.content: + print(f" Block: {block.type}") + if block.type == "text": + print(f" Text: {block.text[:100]}...") + case "agent.tool_use" | "agent.custom_tool_use" | "agent.mcp_tool_use": + print(f" Tool: {event.name}") + print("---") +``` + +```typescript TypeScript +for await (const event of client.beta.sessions.events.list(session.id)) { + console.log(`Type: ${event.type}`); + console.log(`Processed: ${event.processed_at}`); + switch (event.type) { + case "user.message": + case "agent.message": + for (const block of event.content) { + console.log(` Block: ${block.type}`); + if (block.type === "text") { + console.log(` Text: ${block.text.slice(0, 100)}...`); + } + } + break; + case "agent.tool_use": + case "agent.custom_tool_use": + case "agent.mcp_tool_use": + console.log(` Tool: ${event.name}`); + break; + } + console.log("---"); +} +``` + +```csharp C# +var events = await client.Beta.Sessions.Events.List(session.ID); + +await foreach (var evt in events.Paginate()) +{ + Console.WriteLine($"Type: {evt.Json.GetProperty("type").GetString()}"); + Console.WriteLine($"Processed: {evt.ProcessedAt}"); + switch (evt.Value) + { + case BetaManagedAgentsUserMessageEvent userMessage: + foreach (var block in userMessage.Content) + { + Console.WriteLine($" Block: {block.Json.GetProperty("type").GetString()}"); + if (block.Value is BetaManagedAgentsTextBlock textBlock) + { + Console.WriteLine($" Text: {textBlock.Text[..Math.Min(100, textBlock.Text.Length)]}..."); + } + } + break; + case BetaManagedAgentsAgentMessageEvent agentMessage: + foreach (var block in agentMessage.Content) + { + Console.WriteLine($" Block: {block.Type.Raw()}"); + Console.WriteLine($" Text: {block.Text[..Math.Min(100, block.Text.Length)]}..."); + } + break; + case BetaManagedAgentsAgentToolUseEvent or BetaManagedAgentsAgentCustomToolUseEvent or BetaManagedAgentsAgentMcpToolUseEvent: + Console.WriteLine($" Tool: {evt.Name}"); + break; + } + Console.WriteLine("---"); +} +``` + +```go Go +events := client.Beta.Sessions.Events.ListAutoPaging(ctx, session.ID, anthropic.BetaSessionEventListParams{}) + +for events.Next() { + event := events.Current() + fmt.Printf("Type: %s\n", event.Type) + fmt.Printf("Processed: %s\n", event.ProcessedAt) + switch event.Type { + case "user.message": + for _, block := range event.AsUserMessage().Content { + fmt.Printf(" Block: %s\n", block.Type) + if block.Type == "text" { + fmt.Printf(" Text: %s...\n", block.Text[:min(100, len(block.Text))]) + } + } + case "agent.message": + for _, block := range event.AsAgentMessage().Content { + fmt.Printf(" Block: %s\n", block.Type) + if block.Type == "text" { + fmt.Printf(" Text: %s...\n", block.Text[:min(100, len(block.Text))]) + } + } + case "agent.tool_use", "agent.custom_tool_use", "agent.mcp_tool_use": + fmt.Printf(" Tool: %s\n", event.Name) + } + fmt.Println("---") +} +if err := events.Err(); err != nil { + panic(err) +} +``` + +```java Java +var events = client.beta().sessions().events() + .list(EventListParams.builder().sessionId(session.id()).build()); + +for (var event : events.autoPager()) { + var json = (Map) event._json().orElseThrow().asObject().orElseThrow(); + var type = json.get("type").asStringOrThrow(); + IO.println("Type: " + type); + IO.println("Processed: " + json.get("processed_at")); + if (event.isUserMessage() || event.isAgentMessage()) { + for (var block : (List) json.get("content").asArray().orElseThrow()) { + var blockJson = (Map) block.asObject().orElseThrow(); + var blockType = blockJson.get("type").asStringOrThrow(); + IO.println(" Block: " + blockType); + if (blockType.equals("text")) { + var text = blockJson.get("text").asStringOrThrow(); + IO.println(" Text: " + text.substring(0, Math.min(100, text.length())) + "..."); + } + } + } else if (event.isAgentToolUse() || event.isAgentCustomToolUse() || event.isAgentMcpToolUse()) { + IO.println(" Tool: " + json.get("name").asStringOrThrow()); + } + IO.println("---"); +} +``` + +```php PHP +foreach ($client->beta->sessions->events->list($session->id)->pagingEachItem() as $event) { + echo "Type: {$event->type}\n"; + $processedAt = ($event->processedAt ?? null)?->format(DATE_RFC3339) ?? 'pending'; + echo "Processed: {$processedAt}\n"; + if (in_array($event->type, ['user.message', 'agent.message'], true)) { + foreach ($event->content as $block) { + echo " Block: {$block->type}\n"; + if ($block->type === 'text') { + echo ' Text: ' . mb_substr($block->text, 0, 100) . "...\n"; + } + } + } elseif (in_array($event->type, ['agent.tool_use', 'agent.custom_tool_use', 'agent.mcp_tool_use'], true)) { + echo " Tool: {$event->name}\n"; + } + echo "---\n"; +} +``` + +```ruby Ruby +client.beta.sessions.events.list(session.id).auto_paging_each do |event| + puts "Type: #{event.type}" + puts "Processed: #{event.processed_at}" + case event.type + when :"user.message", :"agent.message" + event.content.each do |block| + puts " Block: #{block.type}" + puts " Text: #{block.text[0, 100]}..." if block.type == :text + end + when :"agent.tool_use", :"agent.custom_tool_use", :"agent.mcp_tool_use" + puts " Tool: #{event.name}" + end + puts "---" +end +``` + + +Use the same event stream to surface errors and track token consumption: + + + +```bash curl +curl -fsSL "https://api.anthropic.com/v1/sessions/$SESSION_ID/events" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ +| jq -r ' + (.data[] | select(.type == "session.error") | "[\(.error.type)] \(.error.message)"), + (reduce (.data[] | select(.type == "span.model_request_end") | .model_usage) as $u + ({input: 0, output: 0}; .input += $u.input_tokens | .output += $u.output_tokens) + | "Total input tokens: \(.input), output tokens: \(.output)") +' +``` + +```bash CLI +ant beta:sessions:events list \ + --session-id "$SESSION_ID" \ + --format jsonl \ +| jq -sr ' + (.[] | select(.type == "session.error") | "[\(.error.type)] \(.error.message)"), + (reduce (.[] | select(.type == "span.model_request_end") | .model_usage) as $u + ({input: 0, output: 0}; .input += $u.input_tokens | .output += $u.output_tokens) + | "Total input tokens: \(.input), output tokens: \(.output)") +' +``` + +```python Python +events = client.beta.sessions.events.list(session.id) + +input_tokens, output_tokens = 0, 0 +for event in events: + match event.type: + case "session.error": + print(f"[{event.error.type}] {event.error.message}") + case "span.model_request_end": + input_tokens += event.model_usage.input_tokens + output_tokens += event.model_usage.output_tokens + +print(f"Total input tokens: {input_tokens}, output tokens: {output_tokens}") +``` + +```typescript TypeScript +let inputTokens = 0; +let outputTokens = 0; +for await (const event of client.beta.sessions.events.list(session.id)) { + switch (event.type) { + case "session.error": + console.log(`[${event.error?.type}] ${event.error?.message}`); + break; + case "span.model_request_end": + inputTokens += event.model_usage.input_tokens; + outputTokens += event.model_usage.output_tokens; + break; + } +} + +console.log(`Total input tokens: ${inputTokens}, output tokens: ${outputTokens}`); +``` + +```csharp C# +var events = await client.Beta.Sessions.Events.List(session.ID); + +var inputTokens = 0; +var outputTokens = 0; +await foreach (var evt in events.Paginate()) +{ + switch (evt.Value) + { + case BetaManagedAgentsSessionErrorEvent { Error: { } error }: + Console.WriteLine($"[{error.Json.GetProperty("type").GetString()}] {error.Message}"); + break; + case BetaManagedAgentsSpanModelRequestEndEvent spanEnd: + inputTokens += spanEnd.ModelUsage.InputTokens; + outputTokens += spanEnd.ModelUsage.OutputTokens; + break; + } +} + +Console.WriteLine($"Total input tokens: {inputTokens}, output tokens: {outputTokens}"); +``` + +```go Go +events := client.Beta.Sessions.Events.ListAutoPaging(ctx, session.ID, anthropic.BetaSessionEventListParams{}) + +var inputTokens, outputTokens int64 +for events.Next() { + event := events.Current() + switch event.Type { + case "session.error": + e := event.AsSessionError().Error + fmt.Printf("[%s] %s\n", e.Type, e.Message) + case "span.model_request_end": + usage := event.AsSpanModelRequestEnd().ModelUsage + inputTokens += usage.InputTokens + outputTokens += usage.OutputTokens + } +} +if err := events.Err(); err != nil { + panic(err) +} + +fmt.Printf("Total input tokens: %d, output tokens: %d\n", inputTokens, outputTokens) +``` + +```java Java +var events = client.beta().sessions().events() + .list(EventListParams.builder().sessionId(session.id()).build()); + +var inputTokens = 0; +var outputTokens = 0; +for (var event : events.autoPager()) { + if (event.isError()) { + var json = (Map) event._json().orElseThrow().asObject().orElseThrow(); + var error = (Map) json.get("error").asObject().orElseThrow(); + IO.println("[" + error.get("type").asStringOrThrow() + "] " + + error.get("message").asStringOrThrow()); + } else if (event.isSpanModelRequestEnd()) { + var usage = event.asSpanModelRequestEnd().modelUsage(); + inputTokens += usage.inputTokens(); + outputTokens += usage.outputTokens(); + } +} + +IO.println("Total input tokens: " + inputTokens + ", output tokens: " + outputTokens); +``` + +```php PHP +$inputTokens = 0; +$outputTokens = 0; +foreach ($client->beta->sessions->events->list($session->id)->pagingEachItem() as $event) { + match ($event->type) { + 'session.error' => printf("[%s] %s\n", $event->error->type, $event->error->message), + 'span.model_request_end' => [ + $inputTokens += $event->modelUsage->inputTokens, + $outputTokens += $event->modelUsage->outputTokens, + ], + default => null, + }; +} + +echo "Total input tokens: {$inputTokens}, output tokens: {$outputTokens}\n"; +``` + +```ruby Ruby +input_tokens, output_tokens = 0, 0 +client.beta.sessions.events.list(session.id).auto_paging_each do |event| + case event.type + when :"session.error" + puts "[#{event.error.type}] #{event.error.message}" + when :"span.model_request_end" + input_tokens += event.model_usage.input_tokens + output_tokens += event.model_usage.output_tokens + end +end + +puts "Total input tokens: #{input_tokens}, output tokens: #{output_tokens}" +``` + + +## Debugging tips + +- **Check session events** - Session errors are conveyed through the `session.error` event +- **Review tool results** - Tool execution failures often explain unexpected agent behavior +- **Track token usage** - Monitor token consumption to optimize prompts and reduce costs +- **Use system prompts** - Add logging instructions to the system prompt to make the agent explain its reasoning \ No newline at end of file diff --git a/content/en/managed-agents/onboarding.md b/content/en/managed-agents/onboarding.md new file mode 100644 index 000000000..2632a0828 --- /dev/null +++ b/content/en/managed-agents/onboarding.md @@ -0,0 +1,125 @@ +# Prototype in Console + +Create and test agents visually in Console without writing API calls. + +--- + +[Console](https://platform.claude.com/workspaces/default/agent-quickstart/) provides a visual interface for creating and configuring agents. It produces the same `/v1/agents` and `/v1/sessions` resources as the API but lets you iterate on configuration interactively before writing code. + + +All Managed Agents API requests require the `managed-agents-2026-04-01` beta header. The SDK sets the beta header automatically. + + +## How to build an agent + +The [visual interface](https://platform.claude.com/workspaces/default/agent-quickstart/) walks you through each field of an agent definition: + +- **Model and system prompt:** Pick a model and write the system prompt in a full-width editor. +- **MCP servers:** Add remote MCP servers by URL and authenticate your agent to take action on your behalf. +- **Tools:** Extend your agent's capabilities using a pre-built agent toolset and MCP tools. +- **Skills:** Attach Anthropic or custom skills from your organization's library. + +As you configure, Console shows the equivalent API request so you can copy it into your code once you're satisfied. + +## Testing an agent + +Console includes an inline session runner. After configuring your agent, you can start a test session directly, send messages, and watch the event stream without leaving the page. This is the fastest way to check that your system prompt and tool selection produce the behavior you expect. + +## From prototype to code + +Once your agent works as expected: + +1. Copy the agent ID from Console output. +2. Reference it in your code when [creating sessions](/docs/en/managed-agents/sessions): + + + +```bash curl +session=$(curl -fsSL https://api.anthropic.com/v1/sessions \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -d '{ + "agent": "agent_01XXXXXXXXXXXXXXXXXXXXXX", + "environment_id": "env_01XXXXXXXXXXXXXXXXXXXXXX", + "title": "My first session" + }') +``` + +```bash CLI +ant beta:sessions create \ + --agent agent_01XXXXXXXXXXXXXXXXXXXXXX \ + --environment env_01XXXXXXXXXXXXXXXXXXXXXX \ + --title "My first session" +``` + +```python Python +session = client.beta.sessions.create( + agent="agent_01XXXXXXXXXXXXXXXXXXXXXX", + environment_id="env_01XXXXXXXXXXXXXXXXXXXXXX", + title="My first session", +) +``` + +```typescript TypeScript +const session = await client.beta.sessions.create({ + agent: "agent_01XXXXXXXXXXXXXXXXXXXXXX", + environment_id: "env_01XXXXXXXXXXXXXXXXXXXXXX", + title: "My first session" +}); +``` + +```csharp C# +var session = await client.Beta.Sessions.Create(new() +{ + Agent = "agent_01XXXXXXXXXXXXXXXXXXXXXX", + EnvironmentID = "env_01XXXXXXXXXXXXXXXXXXXXXX", + Title = "My first session", +}); +``` + +```go Go +session, err := client.Beta.Sessions.New(ctx, anthropic.BetaSessionNewParams{ + Agent: anthropic.BetaSessionNewParamsAgentUnion{ + OfBetaManagedAgentsAgents: &anthropic.BetaManagedAgentsAgentParams{ + Type: anthropic.BetaManagedAgentsAgentParamsTypeAgent, + ID: "agent_01XXXXXXXXXXXXXXXXXXXXXX", + Version: anthropic.Int(1), + }, + }, + EnvironmentID: "env_01XXXXXXXXXXXXXXXXXXXXXX", + Title: anthropic.String("My first session"), +}) +if err != nil { + panic(err) +} +_ = session +``` + +```java Java +var session = client.beta().sessions().create( + SessionCreateParams.builder() + .agent("agent_01XXXXXXXXXXXXXXXXXXXXXX") + .environmentId("env_01XXXXXXXXXXXXXXXXXXXXXX") + .title("My first session") + .build() +); +``` + +```php PHP +$session = $client->beta->sessions->create( + agent: 'agent_01XXXXXXXXXXXXXXXXXXXXXX', + environmentID: 'env_01XXXXXXXXXXXXXXXXXXXXXX', + title: 'My first session', +); +``` + +```ruby Ruby +session = client.beta.sessions.create( + agent: "agent_01XXXXXXXXXXXXXXXXXXXXXX", + environment_id: "env_01XXXXXXXXXXXXXXXXXXXXXX", + title: "My first session" +) +``` + \ No newline at end of file diff --git a/content/en/managed-agents/overview.md b/content/en/managed-agents/overview.md new file mode 100644 index 000000000..98c1c26c2 --- /dev/null +++ b/content/en/managed-agents/overview.md @@ -0,0 +1,115 @@ +# Claude Managed Agents overview + +Pre-built, configurable agent harness that runs in managed infrastructure. Best for long-running tasks and asynchronous work. + +--- + +Anthropic offers two ways to build with Claude, each suited to different use cases: + +| | Messages API | Claude Managed Agents | +|---|---|---| +| **What it is** | Direct model prompting access | Pre-built, configurable agent harness that runs in managed infrastructure | +| **Best for** | Custom agent loops and fine-grained control | Long-running tasks and asynchronous work | +| **Learn more** | [Messages API docs](/docs/en/build-with-claude/working-with-messages) | [Claude Managed Agents docs](/docs/en/managed-agents/overview) | + +Claude Managed Agents provides the harness and infrastructure for running Claude as an autonomous agent. Instead of building your own agent loop, tool execution, and runtime, you get a fully managed environment where Claude can read files, run commands, browse the web, and execute code securely. The harness supports built in prompt caching, compaction, and other performance optimizations for high quality, efficient agent outputs. + + + + Create your first agent session + + + Full endpoint documentation + + + +## Core concepts + +Claude Managed Agents is built around four concepts: + +| Concept | Description | +|---------|-------------| +| **Agent** | The model, system prompt, tools, MCP servers, and skills | +| **Environment** | A configured container template (packages, network access) | +| **Session** | A running agent instance within an environment, performing a specific task and generating outputs | +| **Events** | Messages exchanged between your application and the agent (user turns, tool results, status updates) | + +## How it works + + + + Define the model, system prompt, tools, MCP servers, and skills. Create the agent once and reference it by ID across sessions. + + + Configure a cloud container with pre-installed packages (Python, Node.js, Go, etc.), network access rules, and mounted files. + + + Launch a session that references your agent and environment configuration. + + + Send user messages as events. Claude autonomously executes tools and streams back results via server-sent events (SSE). Event history is persisted server-side and can be fetched in full. + + + Send additional user events to guide the agent mid-execution, or interrupt it to change direction. + + + +## When to use Claude Managed Agents + +Claude Managed Agents is best for workloads that need: + +- **Long-running execution** - Tasks that run for minutes or hours with multiple tool calls +- **Cloud infrastructure** - Secure containers with pre-installed packages and network access +- **Minimal infrastructure** - No need to build your own agent loop, sandbox, or tool execution layer +- **Stateful sessions** - Persistent file systems and conversation history across multiple interactions + +## Supported tools + +Claude Managed Agents gives Claude access to a comprehensive set of built-in tools: + +- **Bash** - Run shell commands in the container +- **File operations** - Read, write, edit, glob, and grep files in the container +- **Web search and fetch** - Search the web and retrieve content from URLs +- **MCP servers** - Connect to external tool providers + +See [Tools](/docs/en/managed-agents/tools) for the full list and configuration options. + +## Beta access + +Claude Managed Agents is currently in beta. All Managed Agents endpoints require the `managed-agents-2026-04-01` beta header. The SDK sets the beta header automatically. Behaviors may be refined between releases to improve outputs. + + +To get started, you need: + +1. A [Claude API key](/settings/keys) +2. The beta header above on all requests +3. Access to Claude Managed Agents (enabled by default for all API accounts) + +Certain features ([outcomes](/docs/en/managed-agents/define-outcomes), [multiagent](/docs/en/managed-agents/multi-agent), and [memory](/docs/en/managed-agents/memory)) are in research preview. [Request access](https://claude.com/form/claude-managed-agents) to try them. + +## Rate limits + +Managed Agents endpoints are rate-limited per organization: + +| Operation | Limit | +| --- | --- | +| Create endpoints (agents, sessions, environments, etc.) | 60 requests per minute | +| Read endpoints (retrieve, list, stream, etc.) | 600 requests per minute | + +Organization-level [spend limits and tier-based rate limits](/docs/en/api/rate-limits) also apply. + +## Branding guidelines + +For partners integrating Claude Managed Agents, use of Claude branding is optional. When referencing Claude in your product: + +**Allowed:** +- "Claude Agent" (preferred for dropdown menus) +- "Claude" (when within a menu already labeled "Agents") +- "{YourAgentName} Powered by Claude" (if you have an existing agent name) + +**Not permitted:** +- "Claude Code" or "Claude Code Agent" +- "Claude Cowork" or "Claude Cowork Agent" +- Claude Code-branded ASCII art or visual elements that mimic Claude Code + +Your product should maintain its own branding and not appear to be Claude Code, Claude Cowork, or any other Anthropic product. For questions about branding compliance, contact the Anthropic [sales team](https://www.anthropic.com/contact-sales). \ No newline at end of file diff --git a/content/en/managed-agents/permission-policies.md b/content/en/managed-agents/permission-policies.md new file mode 100644 index 000000000..545239fe7 --- /dev/null +++ b/content/en/managed-agents/permission-policies.md @@ -0,0 +1,877 @@ +# Permission policies + +Control when agent and MCP tools execute. + +--- + +Permission policies control whether server-executed tools (the pre-built agent toolset and MCP toolset) run automatically or wait for your approval. Custom tools are executed by your application and controlled by you, so they are not governed by permission policies. + + +All Managed Agents API requests require the `managed-agents-2026-04-01` beta header. The SDK sets the beta header automatically. + + +## Permission policy types + +| Policy | Behavior | +| --- | --- | +| `always_allow` | The tool executes automatically with no confirmation. | +| `always_ask` | The session emits a `session.status_idle` event and waits for a `user.tool_confirmation` event before executing. | + +## Set a policy for a toolset + +### Agent toolset permissions +When creating an agent, you may optionally apply a policy to every tool in `agent_toolset_20260401` using `default_config.permission_policy`: + + +```bash curl +agent=$(curl -fsSL https://api.anthropic.com/v1/agents \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -d '{ + "name": "Coding Assistant", + "model": "claude-sonnet-4-6", + "tools": [ + { + "type": "agent_toolset_20260401", + "default_config": { + "permission_policy": {"type": "always_ask"} + } + } + ] + }') +``` + +```bash CLI +ant beta:agents create <<'YAML' +name: Coding Assistant +model: claude-sonnet-4-6 +tools: + - type: agent_toolset_20260401 + default_config: + permission_policy: + type: always_ask +YAML +``` + +```python Python +agent = client.beta.agents.create( + name="Coding Assistant", + model="claude-sonnet-4-6", + tools=[ + { + "type": "agent_toolset_20260401", + "default_config": { + "permission_policy": {"type": "always_ask"}, + }, + }, + ], +) +``` + +```typescript TypeScript +const agent = await client.beta.agents.create({ + name: "Coding Assistant", + model: "claude-sonnet-4-6", + tools: [ + { + type: "agent_toolset_20260401", + default_config: { + permission_policy: { type: "always_ask" } + } + } + ] +}); +``` + +```csharp C# +var agent = await client.Beta.Agents.Create(new() +{ + Name = "Coding Assistant", + Model = new("claude-sonnet-4-6"), + Tools = + [ + new BetaManagedAgentsAgentToolset20260401Params + { + Type = "agent_toolset_20260401", + DefaultConfig = new() + { + PermissionPolicy = new BetaManagedAgentsAlwaysAskPolicy { Type = "always_ask" }, + }, + }, + ], +}); +``` + +```go Go +agent, err := client.Beta.Agents.New(ctx, anthropic.BetaAgentNewParams{ + Name: "Coding Assistant", + Model: anthropic.BetaManagedAgentsModelConfigParams{ + ID: "claude-sonnet-4-6", + Type: anthropic.BetaManagedAgentsModelConfigParamsTypeModelConfig, + }, + Tools: []anthropic.BetaAgentNewParamsToolUnion{{ + OfAgentToolset20260401: &anthropic.BetaManagedAgentsAgentToolset20260401Params{ + Type: anthropic.BetaManagedAgentsAgentToolset20260401ParamsTypeAgentToolset20260401, + DefaultConfig: anthropic.BetaManagedAgentsAgentToolsetDefaultConfigParams{ + PermissionPolicy: anthropic.BetaManagedAgentsAgentToolsetDefaultConfigParamsPermissionPolicyUnion{ + OfAlwaysAsk: &anthropic.BetaManagedAgentsAlwaysAskPolicyParam{ + Type: anthropic.BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk, + }, + }, + }, + }, + }}, +}) +if err != nil { + panic(err) +} +``` + +```java Java +var agent = client.beta().agents().create( + AgentCreateParams.builder() + .name("Coding Assistant") + .model(BetaManagedAgentsModel.CLAUDE_SONNET_4_6) + .addTool( + BetaManagedAgentsAgentToolset20260401Params.builder() + .type(BetaManagedAgentsAgentToolset20260401Params.Type.AGENT_TOOLSET_20260401) + .defaultConfig( + BetaManagedAgentsAgentToolsetDefaultConfigParams.builder() + .permissionPolicy( + BetaManagedAgentsAlwaysAskPolicy.builder() + .type(BetaManagedAgentsAlwaysAskPolicy.Type.ALWAYS_ASK) + .build() + ) + .build() + ) + .build() + ) + .build() +); +``` + +```php PHP + +$agent = $client->beta->agents->create( + name: 'Coding Assistant', + model: 'claude-sonnet-4-6', + tools: [ + BetaManagedAgentsAgentToolset20260401Params::with( + type: 'agent_toolset_20260401', + defaultConfig: BetaManagedAgentsAgentToolsetDefaultConfigParams::with( + permissionPolicy: BetaManagedAgentsAlwaysAskPolicy::with(type: 'always_ask'), + ), + ), + ], +); +``` + +```ruby Ruby +agent = client.beta.agents.create( + name: "Coding Assistant", + model: "claude-sonnet-4-6", + tools: [ + { + type: "agent_toolset_20260401", + default_config: { + permission_policy: {type: "always_ask"} + } + } + ] +) +``` + + +`default_config` is an optional setting. If you omit it, the agent toolset will be enabled with the default permission policy, `always_allow`. + +### MCP toolset permissions + +MCP toolsets default to `always_ask`. This ensures that new tools that are added to an MCP server do not execute in your application without approval. To auto-approve tools from a trusted MCP server, set `permission_policy` on the `mcp_toolset` entry. + +The `mcp_server_name` must match the `name` referenced in the `mcp_servers` array. + +This example connects a GitHub MCP server and allows its tools to run without confirmation: + + +```bash curl +agent=$(curl -fsSL https://api.anthropic.com/v1/agents \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -d '{ + "name": "Dev Assistant", + "model": "claude-sonnet-4-6", + "mcp_servers": [ + {"type": "url", "name": "github", "url": "https://mcp.example.com/github"} + ], + "tools": [ + {"type": "agent_toolset_20260401"}, + { + "type": "mcp_toolset", + "mcp_server_name": "github", + "default_config": { + "permission_policy": {"type": "always_allow"} + } + } + ] + }') +``` + +```bash CLI +ant beta:agents create <<'YAML' +name: Dev Assistant +model: claude-sonnet-4-6 +mcp_servers: + - type: url + name: github + url: https://mcp.example.com/github +tools: + - type: agent_toolset_20260401 + - type: mcp_toolset + mcp_server_name: github + default_config: + permission_policy: + type: always_allow +YAML +``` + +```python Python +agent = client.beta.agents.create( + name="Dev Assistant", + model="claude-sonnet-4-6", + mcp_servers=[ + {"type": "url", "name": "github", "url": "https://mcp.example.com/github"}, + ], + tools=[ + {"type": "agent_toolset_20260401"}, + { + "type": "mcp_toolset", + "mcp_server_name": "github", + "default_config": { + "permission_policy": {"type": "always_allow"}, + }, + }, + ], +) +``` + +```typescript TypeScript +const agent = await client.beta.agents.create({ + name: "Dev Assistant", + model: "claude-sonnet-4-6", + mcp_servers: [{ type: "url", name: "github", url: "https://mcp.example.com/github" }], + tools: [ + { type: "agent_toolset_20260401" }, + { + type: "mcp_toolset", + mcp_server_name: "github", + default_config: { + permission_policy: { type: "always_allow" } + } + } + ] +}); +``` + +```csharp C# +var agent = await client.Beta.Agents.Create(new() +{ + Name = "Dev Assistant", + Model = new("claude-sonnet-4-6"), + McpServers = + [ + new() { Type = "url", Name = "github", Url = "https://mcp.example.com/github" }, + ], + Tools = + [ + new BetaManagedAgentsAgentToolset20260401Params + { + Type = "agent_toolset_20260401", + }, + new BetaManagedAgentsMcpToolsetParams + { + Type = "mcp_toolset", + McpServerName = "github", + DefaultConfig = new() + { + PermissionPolicy = new BetaManagedAgentsAlwaysAllowPolicy { Type = "always_allow" }, + }, + }, + ], +}); +``` + +```go Go +agent, err := client.Beta.Agents.New(ctx, anthropic.BetaAgentNewParams{ + Name: "Dev Assistant", + Model: anthropic.BetaManagedAgentsModelConfigParams{ + ID: "claude-sonnet-4-6", + Type: anthropic.BetaManagedAgentsModelConfigParamsTypeModelConfig, + }, + MCPServers: []anthropic.BetaManagedAgentsUrlmcpServerParams{{ + Type: anthropic.BetaManagedAgentsUrlmcpServerParamsTypeURL, + Name: "github", + URL: "https://mcp.example.com/github", + }}, + Tools: []anthropic.BetaAgentNewParamsToolUnion{ + { + OfAgentToolset20260401: &anthropic.BetaManagedAgentsAgentToolset20260401Params{ + Type: anthropic.BetaManagedAgentsAgentToolset20260401ParamsTypeAgentToolset20260401, + }, + }, + { + OfMCPToolset: &anthropic.BetaManagedAgentsMCPToolsetParams{ + Type: anthropic.BetaManagedAgentsMCPToolsetParamsTypeMCPToolset, + MCPServerName: "github", + DefaultConfig: anthropic.BetaManagedAgentsMCPToolsetDefaultConfigParams{ + PermissionPolicy: anthropic.BetaManagedAgentsMCPToolsetDefaultConfigParamsPermissionPolicyUnion{ + OfAlwaysAllow: &anthropic.BetaManagedAgentsAlwaysAllowPolicyParam{ + Type: anthropic.BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow, + }, + }, + }, + }, + }, + }, +}) +if err != nil { + panic(err) +} +``` + +```java Java +var agent = client.beta().agents().create( + AgentCreateParams.builder() + .name("Dev Assistant") + .model(BetaManagedAgentsModel.CLAUDE_SONNET_4_6) + .addMcpServer( + BetaManagedAgentsUrlmcpServerParams.builder() + .type(BetaManagedAgentsUrlmcpServerParams.Type.URL) + .name("github") + .url("https://mcp.example.com/github") + .build() + ) + .addTool( + BetaManagedAgentsAgentToolset20260401Params.builder() + .type(BetaManagedAgentsAgentToolset20260401Params.Type.AGENT_TOOLSET_20260401) + .build() + ) + .addTool( + BetaManagedAgentsMcpToolsetParams.builder() + .type(BetaManagedAgentsMcpToolsetParams.Type.MCP_TOOLSET) + .mcpServerName("github") + .defaultConfig( + BetaManagedAgentsMcpToolsetDefaultConfigParams.builder() + .permissionPolicy( + BetaManagedAgentsAlwaysAllowPolicy.builder() + .type(BetaManagedAgentsAlwaysAllowPolicy.Type.ALWAYS_ALLOW) + .build() + ) + .build() + ) + .build() + ) + .build() +); +``` + +```php PHP +use Anthropic\Beta\Agents\BetaManagedAgentsMCPToolsetDefaultConfigParams; +use Anthropic\Beta\Agents\BetaManagedAgentsMCPToolsetParams; +use Anthropic\Beta\Agents\BetaManagedAgentsUrlmcpServerParams; + +$agent = $client->beta->agents->create( + name: 'Dev Assistant', + model: 'claude-sonnet-4-6', + mcpServers: [ + BetaManagedAgentsUrlmcpServerParams::with( + type: 'url', + name: 'github', + url: 'https://mcp.example.com/github', + ), + ], + tools: [ + BetaManagedAgentsAgentToolset20260401Params::with( + type: 'agent_toolset_20260401', + ), + BetaManagedAgentsMCPToolsetParams::with( + type: 'mcp_toolset', + mcpServerName: 'github', + defaultConfig: BetaManagedAgentsMCPToolsetDefaultConfigParams::with( + permissionPolicy: BetaManagedAgentsAlwaysAllowPolicy::with(type: 'always_allow'), + ), + ), + ], +); +``` + +```ruby Ruby +agent = client.beta.agents.create( + name: "Dev Assistant", + model: "claude-sonnet-4-6", + mcp_servers: [ + {type: "url", name: "github", url: "https://mcp.example.com/github"} + ], + tools: [ + {type: "agent_toolset_20260401"}, + { + type: "mcp_toolset", + mcp_server_name: "github", + default_config: { + permission_policy: {type: "always_allow"} + } + } + ] +) +``` + + +## Override an individual tool policy + +Use the `configs` array to override the default for individual tools. This example allows the full agent toolset by default but requires confirmation before any bash command runs: + + +```bash curl +tools='[ + { + "type": "agent_toolset_20260401", + "default_config": { + "permission_policy": {"type": "always_allow"} + }, + "configs": [ + { + "name": "bash", + "permission_policy": {"type": "always_ask"} + } + ] + } +]' +``` + +```bash CLI +tools=$(cat <<'YAML' +- type: agent_toolset_20260401 + default_config: + permission_policy: + type: always_allow + configs: + - name: bash + permission_policy: + type: always_ask +YAML +) +``` + +```python Python +tools = [ + { + "type": "agent_toolset_20260401", + "default_config": { + "permission_policy": {"type": "always_allow"}, + }, + "configs": [ + { + "name": "bash", + "permission_policy": {"type": "always_ask"}, + }, + ], + }, +] +``` + +```typescript TypeScript +const tools = [ + { + type: "agent_toolset_20260401", + default_config: { + permission_policy: { type: "always_allow" } + }, + configs: [ + { + name: "bash", + permission_policy: { type: "always_ask" } + } + ] + } +] satisfies Anthropic.Beta.AgentCreateParams["tools"]; +``` + +```csharp C# +Tool[] tools = +[ + new BetaManagedAgentsAgentToolset20260401Params + { + Type = "agent_toolset_20260401", + DefaultConfig = new() + { + PermissionPolicy = new BetaManagedAgentsAlwaysAllowPolicy { Type = "always_allow" }, + }, + Configs = + [ + new() + { + Name = "bash", + PermissionPolicy = new BetaManagedAgentsAlwaysAskPolicy { Type = "always_ask" }, + }, + ], + }, +]; +``` + +```go Go +tools := []anthropic.BetaAgentNewParamsToolUnion{{ + OfAgentToolset20260401: &anthropic.BetaManagedAgentsAgentToolset20260401Params{ + Type: anthropic.BetaManagedAgentsAgentToolset20260401ParamsTypeAgentToolset20260401, + DefaultConfig: anthropic.BetaManagedAgentsAgentToolsetDefaultConfigParams{ + PermissionPolicy: anthropic.BetaManagedAgentsAgentToolsetDefaultConfigParamsPermissionPolicyUnion{ + OfAlwaysAllow: &anthropic.BetaManagedAgentsAlwaysAllowPolicyParam{ + Type: anthropic.BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow, + }, + }, + }, + Configs: []anthropic.BetaManagedAgentsAgentToolConfigParams{{ + Name: anthropic.BetaManagedAgentsAgentToolConfigParamsNameBash, + PermissionPolicy: anthropic.BetaManagedAgentsAgentToolConfigParamsPermissionPolicyUnion{ + OfAlwaysAsk: &anthropic.BetaManagedAgentsAlwaysAskPolicyParam{ + Type: anthropic.BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk, + }, + }, + }}, + }, +}} +``` + +```java Java +var tools = List.of( + AgentCreateParams.Tool.ofAgentToolset20260401( + BetaManagedAgentsAgentToolset20260401Params.builder() + .type(BetaManagedAgentsAgentToolset20260401Params.Type.AGENT_TOOLSET_20260401) + .defaultConfig( + BetaManagedAgentsAgentToolsetDefaultConfigParams.builder() + .permissionPolicy( + BetaManagedAgentsAlwaysAllowPolicy.builder() + .type(BetaManagedAgentsAlwaysAllowPolicy.Type.ALWAYS_ALLOW) + .build() + ) + .build() + ) + .addConfig( + BetaManagedAgentsAgentToolConfigParams.builder() + .name(BetaManagedAgentsAgentToolConfigParams.Name.BASH) + .permissionPolicy( + BetaManagedAgentsAlwaysAskPolicy.builder() + .type(BetaManagedAgentsAlwaysAskPolicy.Type.ALWAYS_ASK) + .build() + ) + .build() + ) + .build() + ) +); +``` + +```php PHP +use Anthropic\Beta\Agents\BetaManagedAgentsAlwaysAskPolicy; + +$tools = [ + BetaManagedAgentsAgentToolset20260401Params::with( + type: 'agent_toolset_20260401', + defaultConfig: BetaManagedAgentsAgentToolsetDefaultConfigParams::with( + permissionPolicy: BetaManagedAgentsAlwaysAllowPolicy::with(type: 'always_allow'), + ), + configs: [ + BetaManagedAgentsAgentToolConfigParams::with( + name: 'bash', + permissionPolicy: BetaManagedAgentsAlwaysAskPolicy::with(type: 'always_ask'), + ), + ], + ), +]; +``` + +```ruby Ruby +tools = [ + { + type: "agent_toolset_20260401", + default_config: { + permission_policy: {type: "always_allow"} + }, + configs: [ + { + name: "bash", + permission_policy: {type: "always_ask"} + } + ] + } +] +``` + + +## Respond to confirmation requests + +When the agent invokes a tool with an `always_ask` policy: + +1. The session emits an `agent.tool_use` or `agent.mcp_tool_use` event. +2. The session pauses with a `session.status_idle` event containing `stop_reason: requires_action`. The blocking event IDs are in the `stop_reason.requires_action.event_ids` array. +3. Send a `user.tool_confirmation` event for each, passing the event ID in the `tool_use_id` param. Set `result` to `"allow"` or `"deny"`. Use `deny_message` to explain a denial. +4. Once all blocking events are resolved, the session transitions back to `running`. + +Learn more about event handling in the [session event stream](/docs/en/managed-agents/events-and-streaming) guide. + + +```bash curl +# Allow the tool to execute +curl -fsSL "https://api.anthropic.com/v1/sessions/$SESSION_ID/events" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -d '{ + "events": [ + { + "type": "user.tool_confirmation", + "tool_use_id": "'$AGENT_TOOL_USE_EVENT_ID'", + "result": "allow" + } + ] + }' + +# Or deny it with an explanation +curl -fsSL "https://api.anthropic.com/v1/sessions/$SESSION_ID/events" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -d '{ + "events": [ + { + "type": "user.tool_confirmation", + "tool_use_id": "'$MCP_TOOL_USE_EVENT_ID'", + "result": "deny", + "deny_message": "Don'\''t create issues in the production project. Use the staging project." + } + ] + }' +``` + +```bash CLI +# Allow the tool to execute +ant beta:sessions:events send \ + --session-id "$SESSION_ID" \ + --event "{type: user.tool_confirmation, tool_use_id: $AGENT_TOOL_USE_EVENT_ID, result: allow}" + +# Or deny it with an explanation +ant beta:sessions:events send \ + --session-id "$SESSION_ID" \ + --event "{type: user.tool_confirmation, tool_use_id: $MCP_TOOL_USE_EVENT_ID, result: deny, + deny_message: Don't create issues in the production project. Use the staging project.}" +``` + +```python Python +# Allow the tool to execute +client.beta.sessions.events.send( + session.id, + events=[ + { + "type": "user.tool_confirmation", + "tool_use_id": agent_tool_use_event.id, + "result": "allow", + }, + ], +) + +# Or deny it with an explanation +client.beta.sessions.events.send( + session.id, + events=[ + { + "type": "user.tool_confirmation", + "tool_use_id": mcp_tool_use_event.id, + "result": "deny", + "deny_message": "Don't create issues in the production project. Use the staging project.", + }, + ], +) +``` + +```typescript TypeScript +// Allow the tool to execute +await client.beta.sessions.events.send(session.id, { + events: [ + { + type: "user.tool_confirmation", + tool_use_id: agent_tool_use_event.id, + result: "allow" + } + ] +}); + +// Or deny it with an explanation +await client.beta.sessions.events.send(session.id, { + events: [ + { + type: "user.tool_confirmation", + tool_use_id: mcp_tool_use_event.id, + result: "deny", + deny_message: "Don't create issues in the production project. Use the staging project." + } + ] +}); +``` + +```csharp C# +// Allow the tool to execute +await client.Beta.Sessions.Events.Send(session.ID, new() +{ + Events = + [ + new BetaManagedAgentsUserToolConfirmationEventParams + { + Type = "user.tool_confirmation", + ToolUseID = agentToolUseEvent.ID, + Result = "allow", + }, + ], +}); + +// Or deny it with an explanation +await client.Beta.Sessions.Events.Send(session.ID, new() +{ + Events = + [ + new BetaManagedAgentsUserToolConfirmationEventParams + { + Type = "user.tool_confirmation", + ToolUseID = mcpToolUseEvent.ID, + Result = "deny", + DenyMessage = "Don't create issues in the production project. Use the staging project.", + }, + ], +}); +``` + +```go Go +// Allow the tool to execute +_, err = client.Beta.Sessions.Events.Send(ctx, session.ID, anthropic.BetaSessionEventSendParams{ + Events: []anthropic.SendEventsParamsUnion{{ + OfUserToolConfirmation: &anthropic.BetaManagedAgentsUserToolConfirmationEventParams{ + Type: anthropic.BetaManagedAgentsUserToolConfirmationEventParamsTypeUserToolConfirmation, + ToolUseID: agentToolUseEvent.ID, + Result: anthropic.BetaManagedAgentsUserToolConfirmationEventParamsResultAllow, + }, + }}, +}) +if err != nil { + panic(err) +} + +// Or deny it with an explanation +_, err = client.Beta.Sessions.Events.Send(ctx, session.ID, anthropic.BetaSessionEventSendParams{ + Events: []anthropic.SendEventsParamsUnion{{ + OfUserToolConfirmation: &anthropic.BetaManagedAgentsUserToolConfirmationEventParams{ + Type: anthropic.BetaManagedAgentsUserToolConfirmationEventParamsTypeUserToolConfirmation, + ToolUseID: mcpToolUseEvent.ID, + Result: anthropic.BetaManagedAgentsUserToolConfirmationEventParamsResultDeny, + DenyMessage: anthropic.String("Don't create issues in the production project. Use the staging project."), + }, + }}, +}) +if err != nil { + panic(err) +} +``` + +```java Java +// Allow the tool to execute +client.beta().sessions().events().send( + session.id(), + EventSendParams.builder() + .addEvent( + BetaManagedAgentsUserToolConfirmationEventParams.builder() + .type(BetaManagedAgentsUserToolConfirmationEventParams.Type.USER_TOOL_CONFIRMATION) + .toolUseId(agentToolUseEvent.id()) + .result(BetaManagedAgentsUserToolConfirmationEventParams.Result.ALLOW) + .build() + ) + .build() +); + +// Or deny it with an explanation +client.beta().sessions().events().send( + session.id(), + EventSendParams.builder() + .addEvent( + BetaManagedAgentsUserToolConfirmationEventParams.builder() + .type(BetaManagedAgentsUserToolConfirmationEventParams.Type.USER_TOOL_CONFIRMATION) + .toolUseId(mcpToolUseEvent.id()) + .result(BetaManagedAgentsUserToolConfirmationEventParams.Result.DENY) + .denyMessage("Don't create issues in the production project. Use the staging project.") + .build() + ) + .build() +); +``` + +```php PHP +use Anthropic\Beta\Sessions\Events\ManagedAgentsUserToolConfirmationEventParams; + +// Allow the tool to execute +$client->beta->sessions->events->send( + $session->id, + events: [ + ManagedAgentsUserToolConfirmationEventParams::with( + type: 'user.tool_confirmation', + toolUseID: $agentToolUseEvent->id, + result: 'allow', + ), + ], +); + +// Or deny it with an explanation +$client->beta->sessions->events->send( + $session->id, + events: [ + ManagedAgentsUserToolConfirmationEventParams::with( + type: 'user.tool_confirmation', + toolUseID: $mcpToolUseEvent->id, + result: 'deny', + denyMessage: "Don't create issues in the production project. Use the staging project.", + ), + ], +); +``` + +```ruby Ruby +# Allow the tool to execute +client.beta.sessions.events.send_( + session.id, + events: [ + { + type: "user.tool_confirmation", + tool_use_id: agent_tool_use_event.id, + result: "allow" + } + ] +) + +# Or deny it with an explanation +client.beta.sessions.events.send_( + session.id, + events: [ + { + type: "user.tool_confirmation", + tool_use_id: mcp_tool_use_event.id, + result: "deny", + deny_message: "Don't create issues in the production project. Use the staging project." + } + ] +) +``` + + +## Custom tools + +Permission policies do not apply to custom tools. When the agent invokes a custom tool, your application receives an `agent.custom_tool_use` event and is responsible for deciding whether to execute it before sending back a `user.custom_tool_result`. See [Session event stream](/docs/en/managed-agents/events-and-streaming#handling-custom-tool-calls) for the full flow. \ No newline at end of file diff --git a/content/en/managed-agents/quickstart.md b/content/en/managed-agents/quickstart.md new file mode 100644 index 000000000..49fb87c56 --- /dev/null +++ b/content/en/managed-agents/quickstart.md @@ -0,0 +1,898 @@ +# Get started with Claude Managed Agents + +Create your first autonomous agent. + +--- + +This guide walks you through creating an agent, setting up an environment, starting a session, and streaming agent responses. + +## Core concepts + +| Concept | Description | +|---------|-------------| +| **Agent** | The model, system prompt, tools, MCP servers, and skills | +| **Environment** | A configured container template (packages, network access) | +| **Session** | A running agent instance within an environment, performing a specific task and generating outputs | +| **Events** | Messages exchanged between your application and the agent (user turns, tool results, status updates) | + +## Prerequisites + +- An Anthropic [Console account](/) +- An [API key](/settings/keys) + +## Install the CLI + + + + ```bash + brew install anthropics/tap/ant + ``` + + + Requires Go 1.22 or later. + + ```bash + go install github.com/anthropics/anthropic-cli/cmd/ant@latest + ``` + + The binary is placed in `$(go env GOPATH)/bin`. Add it to your `PATH` if it isn't already: + + ```bash + export PATH="$PATH:$(go env GOPATH)/bin" + ``` + + + For Linux, environments without Homebrew or Go, or Windows (WSL), download the release binary directly: + + ```bash + curl -fsSL \ + "https://github.com/anthropics/anthropic-cli/releases/latest/download/ant_$(uname -s)_$(uname -m).tar.gz" \ + | tar -xz -C /usr/local/bin ant + ``` + + + +Check the installation: + +```bash +ant --version +``` + +## Install the SDK + + + + ```bash + pip install anthropic + ``` + + + ```bash + npm install @anthropic-ai/sdk + ``` + + + ```groovy Gradle + implementation("com.anthropic:anthropic-java:2.20.0") + ``` + + + ```bash + go get github.com/anthropics/anthropic-sdk-go + ``` + + + ```bash + dotnet add package Anthropic + ``` + + + ```bash + bundle add anthropic + ``` + + + ```bash + composer require anthropic-ai/sdk + ``` + + + +Set your API key as an environment variable: + +```bash +export ANTHROPIC_API_KEY="your-api-key-here" +``` + +## Create your first session + + +All Managed Agents API requests require the `managed-agents-2026-04-01` beta header. The SDK sets the beta header automatically. + + + + + Create an agent that defines the model, system prompt, and available tools. + + + + +````bash +set -euo pipefail + +agent=$( + curl -sS --fail-with-body https://api.anthropic.com/v1/agents \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -d @- <<'EOF' +{ + "name": "Coding Assistant", + "model": "claude-sonnet-4-6", + "system": "You are a helpful coding assistant. Write clean, well-documented code.", + "tools": [ + {"type": "agent_toolset_20260401"} + ] +} +EOF +) + +AGENT_ID=$(jq -er '.id' <<<"$agent") +AGENT_VERSION=$(jq -er '.version' <<<"$agent") + +echo "Agent ID: $AGENT_ID, version: $AGENT_VERSION" +```` + + +````bash +ant beta:agents create \ + --name "Coding Assistant" \ + --model claude-sonnet-4-6 \ + --system "You are a helpful coding assistant. Write clean, well-documented code." \ + --tool '{type: agent_toolset_20260401}' +```` + + +````python +from anthropic import Anthropic + +client = Anthropic() + +agent = client.beta.agents.create( + name="Coding Assistant", + model="claude-sonnet-4-6", + system="You are a helpful coding assistant. Write clean, well-documented code.", + tools=[ + {"type": "agent_toolset_20260401"}, + ], +) + +print(f"Agent ID: {agent.id}, version: {agent.version}") +```` + + +````typescript +import Anthropic from "@anthropic-ai/sdk"; + +const client = new Anthropic(); + +const agent = await client.beta.agents.create({ + name: "Coding Assistant", + model: "claude-sonnet-4-6", + system: "You are a helpful coding assistant. Write clean, well-documented code.", + tools: [ + { type: "agent_toolset_20260401" }, + ], +}); + +console.log(`Agent ID: ${agent.id}, version: ${agent.version}`); +```` + + +````csharp +using Anthropic; +using Anthropic.Models.Beta.Agents; +using Anthropic.Models.Beta.Environments; +using Anthropic.Models.Beta.Sessions; +using Anthropic.Models.Beta.Sessions.Events; + +var client = new AnthropicClient(); + +var agent = await client.Beta.Agents.Create(new() +{ + Name = "Coding Assistant", + Model = BetaManagedAgentsModel.ClaudeSonnet4_6, + System = "You are a helpful coding assistant. Write clean, well-documented code.", + Tools = + [ + new BetaManagedAgentsAgentToolset20260401Params + { + Type = "agent_toolset_20260401", + }, + ], +}); + +Console.WriteLine($"Agent ID: {agent.ID}, version: {agent.Version}"); +```` + + +````go +package main + +import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" +) + +func main() { + client := anthropic.NewClient() + ctx := context.Background() + + agent, err := client.Beta.Agents.New(ctx, anthropic.BetaAgentNewParams{ + Name: "Coding Assistant", + Model: anthropic.BetaManagedAgentsModelConfigParams{ + ID: anthropic.BetaManagedAgentsModelClaudeSonnet4_6, + Type: anthropic.BetaManagedAgentsModelConfigParamsTypeModelConfig, + }, + System: anthropic.String("You are a helpful coding assistant. Write clean, well-documented code."), + Tools: []anthropic.BetaAgentNewParamsToolUnion{{ + OfAgentToolset20260401: &anthropic.BetaManagedAgentsAgentToolset20260401Params{ + Type: anthropic.BetaManagedAgentsAgentToolset20260401ParamsTypeAgentToolset20260401, + }, + }}, + }) + if err != nil { + panic(err) + } + + fmt.Printf("Agent ID: %s, version: %d\n", agent.ID, agent.Version) +```` + + +````java +import com.anthropic.client.okhttp.AnthropicOkHttpClient; +import com.anthropic.models.beta.agents.AgentCreateParams; +import com.anthropic.models.beta.agents.BetaManagedAgentsAgentToolset20260401Params; +import com.anthropic.models.beta.agents.BetaManagedAgentsModel; +import com.anthropic.models.beta.environments.BetaCloudConfigParams; +import com.anthropic.models.beta.environments.EnvironmentCreateParams; +import com.anthropic.models.beta.environments.UnrestrictedNetwork; +import com.anthropic.models.beta.sessions.SessionCreateParams; +import com.anthropic.models.beta.sessions.events.BetaManagedAgentsUserMessageEventParams; +import com.anthropic.models.beta.sessions.events.EventSendParams; +import com.anthropic.models.beta.sessions.events.StreamEvents; + +void main() { + var client = AnthropicOkHttpClient.fromEnv(); + + var agent = client.beta().agents().create(AgentCreateParams.builder() + .name("Coding Assistant") + .model(BetaManagedAgentsModel.CLAUDE_SONNET_4_6) + .system("You are a helpful coding assistant. Write clean, well-documented code.") + .addTool(BetaManagedAgentsAgentToolset20260401Params.builder() + .type(BetaManagedAgentsAgentToolset20260401Params.Type.AGENT_TOOLSET_20260401) + .build()) + .build()); + + IO.println("Agent ID: " + agent.id() + ", version: " + agent.version()); +```` + + +````php +use Anthropic\Client; + +$client = new Client(); + +$agent = $client->beta->agents->create( + name: 'Coding Assistant', + model: 'claude-sonnet-4-6', + system: 'You are a helpful coding assistant. Write clean, well-documented code.', + tools: [ + ['type' => 'agent_toolset_20260401'], + ], +); + +echo "Agent ID: {$agent->id}, version: {$agent->version}\n"; +```` + + +````ruby +require "anthropic" + +client = Anthropic::Client.new + +agent = client.beta.agents.create( + name: "Coding Assistant", + model: "claude-sonnet-4-6", + system_: "You are a helpful coding assistant. Write clean, well-documented code.", + tools: [{type: "agent_toolset_20260401"}] +) + +puts "Agent ID: #{agent.id}, version: #{agent.version}" +```` + + + + The `agent_toolset_20260401` tool type enables the full set of pre-built agent tools (bash, file operations, web search, and more). See [Tools](/docs/en/managed-agents/tools) for the complete list and per-tool configuration options. + + Save the returned `agent.id`. You'll reference it in every session you create. + + + + + An environment defines the container where your agent runs. + + + +````bash +environment=$( + curl -sS --fail-with-body https://api.anthropic.com/v1/environments \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -d @- <<'EOF' +{ + "name": "quickstart-env", + "config": { + "type": "cloud", + "networking": {"type": "unrestricted"} + } +} +EOF +) + +ENVIRONMENT_ID=$(jq -er '.id' <<<"$environment") + +echo "Environment ID: $ENVIRONMENT_ID" +```` + + +````bash +ant beta:environments create \ + --name "quickstart-env" \ + --config '{type: cloud, networking: {type: unrestricted}}' +```` + + +````python +environment = client.beta.environments.create( + name="quickstart-env", + config={ + "type": "cloud", + "networking": {"type": "unrestricted"}, + }, +) + +print(f"Environment ID: {environment.id}") +```` + + +````typescript +const environment = await client.beta.environments.create({ + name: "quickstart-env", + config: { + type: "cloud", + networking: { type: "unrestricted" }, + }, +}); + +console.log(`Environment ID: ${environment.id}`); +```` + + +````csharp +var environment = await client.Beta.Environments.Create(new() +{ + Name = "quickstart-env", + Config = new() { Networking = new UnrestrictedNetwork() }, +}); + +Console.WriteLine($"Environment ID: {environment.ID}"); +```` + + +````go +environment, err := client.Beta.Environments.New(ctx, anthropic.BetaEnvironmentNewParams{ + Name: "quickstart-env", + Config: anthropic.BetaCloudConfigParams{ + Networking: anthropic.BetaCloudConfigParamsNetworkingUnion{ + OfUnrestricted: &anthropic.UnrestrictedNetworkParam{}, + }, + }, +}) +if err != nil { + panic(err) +} + +fmt.Printf("Environment ID: %s\n", environment.ID) +```` + + +````java +var environment = client.beta().environments().create(EnvironmentCreateParams.builder() + .name("quickstart-env") + .config(BetaCloudConfigParams.builder() + .networking(UnrestrictedNetwork.builder().build()) + .build()) + .build()); + +IO.println("Environment ID: " + environment.id()); +```` + + +````php +$environment = $client->beta->environments->create( + name: 'quickstart-env', + config: ['type' => 'cloud', 'networking' => ['type' => 'unrestricted']], +); + +echo "Environment ID: {$environment->id}\n"; +```` + + +````ruby +environment = client.beta.environments.create( + name: "quickstart-env", + config: {type: "cloud", networking: {type: "unrestricted"}} +) + +puts "Environment ID: #{environment.id}" +```` + + + + Save the returned `environment.id`. You'll reference it in every session you create. + + + + Create a session that references your agent and environment. + + + +````bash +session=$( + curl -sS --fail-with-body https://api.anthropic.com/v1/sessions \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -d @- <beta->sessions->create( + agent: $agent->id, + environmentID: $environment->id, + title: 'Quickstart session', +); + +echo "Session ID: {$session->id}\n"; +```` + + +````ruby +session = client.beta.sessions.create( + agent: agent.id, + environment_id: environment.id, + title: "Quickstart session" +) + +puts "Session ID: #{session.id}" +```` + + + + + + Open a stream, send a user event, then process events as they arrive: + + + +````bash +# Send the user message first; the API buffers events until the stream attaches +curl -sS --fail-with-body \ + "https://api.anthropic.com/v1/sessions/$SESSION_ID/events" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -d @- >/dev/null <<'EOF' +{ + "events": [ + { + "type": "user.message", + "content": [ + { + "type": "text", + "text": "Create a Python script that generates the first 20 Fibonacci numbers and saves them to fibonacci.txt" + } + ] + } + ] +} +EOF + +# Open the SSE stream and process events as they arrive +while IFS= read -r line; do + [[ $line == data:* ]] || continue + json=${line#data: } + case $(jq -r '.type' <<<"$json") in + agent.message) + jq -j '.content[] | select(.type == "text") | .text' <<<"$json" + ;; + agent.tool_use) + printf '\n[Using tool: %s]\n' "$(jq -r '.name' <<<"$json")" + ;; + session.status_idle) + printf '\n\nAgent finished.\n' + break + ;; + esac +done < <( + curl -sS -N --fail-with-body \ + "https://api.anthropic.com/v1/sessions/$SESSION_ID/stream" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "Accept: text/event-stream" +) +```` + + +````python +with client.beta.sessions.events.stream(session.id) as stream: + # Send the user message after the stream opens + client.beta.sessions.events.send( + session.id, + events=[ + { + "type": "user.message", + "content": [ + { + "type": "text", + "text": "Create a Python script that generates the first 20 Fibonacci numbers and saves them to fibonacci.txt", + }, + ], + }, + ], + ) + + # Process streaming events + for event in stream: + match event.type: + case "agent.message": + for block in event.content: + print(block.text, end="") + case "agent.tool_use": + print(f"\n[Using tool: {event.name}]") + case "session.status_idle": + print("\n\nAgent finished.") + break +```` + + +````typescript +const stream = await client.beta.sessions.events.stream(session.id); + +// Send the user message after the stream opens +await client.beta.sessions.events.send(session.id, { + events: [ + { + type: "user.message", + content: [ + { + type: "text", + text: "Create a Python script that generates the first 20 Fibonacci numbers and saves them to fibonacci.txt", + }, + ], + }, + ], +}); + +// Process streaming events +for await (const event of stream) { + if (event.type === "agent.message") { + for (const block of event.content) { + process.stdout.write(block.text); + } + } else if (event.type === "agent.tool_use") { + console.log(`\n[Using tool: ${event.name}]`); + } else if (event.type === "session.status_idle") { + console.log("\n\nAgent finished."); + break; + } +} +```` + + +````csharp +var stream = client.Beta.Sessions.Events.StreamStreaming(session.ID); + +// Send the user message after the stream opens +await client.Beta.Sessions.Events.Send(session.ID, new() +{ + Events = + [ + new BetaManagedAgentsUserMessageEventParams + { + Type = "user.message", + Content = + [ + new BetaManagedAgentsTextBlock + { + Type = "text", + Text = "Create a Python script that generates the first 20 Fibonacci numbers and saves them to fibonacci.txt", + }, + ], + }, + ], +}); + +// Process streaming events +await foreach (var ev in stream) +{ + if (ev.Value is BetaManagedAgentsAgentMessageEvent message) + { + foreach (var block in message.Content) + { + Console.Write(block.Text); + } + } + else if (ev.Value is BetaManagedAgentsAgentToolUseEvent toolUse) + { + Console.WriteLine($"\n[Using tool: {toolUse.Name}]"); + } + else if (ev.Value is BetaManagedAgentsSessionStatusIdleEvent) + { + Console.WriteLine("\n\nAgent finished."); + break; + } +} +```` + + +````go + stream := client.Beta.Sessions.Events.StreamEvents(ctx, session.ID, anthropic.BetaSessionEventStreamParams{}) + defer stream.Close() + + // Send the user message after the stream opens + _, err = client.Beta.Sessions.Events.Send(ctx, session.ID, anthropic.BetaSessionEventSendParams{ + Events: []anthropic.SendEventsParamsUnion{{ + OfUserMessage: &anthropic.BetaManagedAgentsUserMessageEventParams{ + Type: anthropic.BetaManagedAgentsUserMessageEventParamsTypeUserMessage, + Content: []anthropic.BetaManagedAgentsUserMessageEventParamsContentUnion{{ + OfText: &anthropic.BetaManagedAgentsTextBlockParam{ + Type: anthropic.BetaManagedAgentsTextBlockTypeText, + Text: "Create a Python script that generates the first 20 Fibonacci numbers and saves them to fibonacci.txt", + }, + }}, + }, + }}, + }) + if err != nil { + panic(err) + } + + // Process streaming events +loop: + for stream.Next() { + switch event := stream.Current().AsAny().(type) { + case anthropic.BetaManagedAgentsAgentMessageEvent: + for _, block := range event.Content { + fmt.Print(block.Text) + } + case anthropic.BetaManagedAgentsAgentToolUseEvent: + fmt.Printf("\n[Using tool: %s]\n", event.Name) + case anthropic.BetaManagedAgentsSessionStatusIdleEvent: + fmt.Print("\n\nAgent finished.\n") + break loop + } + } + if err := stream.Err(); err != nil { + panic(err) + } +```` + + +````java +try (var stream = client.beta().sessions().events().streamStreaming(session.id())) { + // Send the user message after the stream opens + client.beta().sessions().events().send(session.id(), EventSendParams.builder() + .addEvent(BetaManagedAgentsUserMessageEventParams.builder() + .type(BetaManagedAgentsUserMessageEventParams.Type.USER_MESSAGE) + .addTextContent("Create a Python script that generates the first 20 Fibonacci numbers and saves them to fibonacci.txt") + .build()) + .build()); + + // Process streaming events + for (var event : (Iterable) stream.stream()::iterator) { + if (event.isAgentMessage()) { + event.asAgentMessage().content().forEach(block -> IO.print(block.text())); + } else if (event.isAgentToolUse()) { + IO.println("\n[Using tool: " + event.asAgentToolUse().name() + "]"); + } else if (event.isSessionStatusIdle()) { + IO.println("\n\nAgent finished."); + break; + } + } +} +```` + + +````php +$stream = $client->beta->sessions->events->streamStream($session->id); + +// Send the user message after the stream opens +$client->beta->sessions->events->send( + $session->id, + events: [ + [ + 'type' => 'user.message', + 'content' => [ + ['type' => 'text', 'text' => 'Create a Python script that generates the first 20 Fibonacci numbers and saves them to fibonacci.txt'], + ], + ], + ], +); + +// Process streaming events +foreach ($stream as $event) { + match ($event->type) { + 'agent.message' => print(implode('', array_map(fn($block) => $block->text, $event->content))), + 'agent.tool_use' => print("\n[Using tool: {$event->name}]\n"), + 'session.status_idle' => print("\n\nAgent finished.\n"), + default => null, + }; + if ($event->type === 'session.status_idle') { + break; + } +} +```` + + +````ruby +stream = client.beta.sessions.events.stream_events(session.id) + +# Send the user message after the stream opens +client.beta.sessions.events.send_( + session.id, + events: [{ + type: "user.message", + content: [{type: "text", text: "Create a Python script that generates the first 20 Fibonacci numbers and saves them to fibonacci.txt"}] + }] +) + +# Process streaming events +stream.each do |event| + case event.type + in :"agent.message" + event.content.each { print it.text } + in :"agent.tool_use" + puts "\n[Using tool: #{event.name}]" + in :"session.status_idle" + puts "\n\nAgent finished." + break + else + # ignore other event types + end +end +```` + + + + The agent will write a Python script, execute it in the container, and verify the output file was created. Your output will look similar to this: + + ```text + I'll create a Python script that generates the first 20 Fibonacci numbers and saves them to a file. + [Using tool: write] + [Using tool: bash] + The script ran successfully. Let me verify the output file. + [Using tool: bash] + fibonacci.txt contains the first 20 Fibonacci numbers (0 through 4181). + + Agent finished. + ``` + + + +## What's happening + +When you send a user event, Claude Managed Agents: + +1. **Provisions a container:** Your environment configuration determines how it's built. +2. **Runs the agent loop:** Claude decides which tools to use based on your message +3. **Executes tools:** File writes, bash commands, and other tool calls run inside the container +4. **Streams events:** You receive real-time updates as the agent works +5. **Goes idle:** The agent emits a `session.status_idle` event when it has nothing more to do + +## Next steps + + + + Create reusable, versioned agent configurations + + + Customize networking and container settings + + + Enable specific tools for your agent + + + Handle events and steer the agent mid-execution + + \ No newline at end of file diff --git a/content/en/managed-agents/sessions.md b/content/en/managed-agents/sessions.md new file mode 100644 index 000000000..6d21d606f --- /dev/null +++ b/content/en/managed-agents/sessions.md @@ -0,0 +1,608 @@ +# Start a session + +Create a session to run your agent and begin executing tasks. + +--- + +A session is a running agent instance within an environment. Each session references an [agent](/docs/en/managed-agents/agent-setup) and an [environment](/docs/en/managed-agents/environments) (both created separately), and maintains conversation history across multiple interactions. + + +All Managed Agents API requests require the `managed-agents-2026-04-01` beta header. The SDK sets the beta header automatically. + + +## Creating a session + +A session requires an `agent` ID and an `environment` ID. Agents are versioned resources; passing in the `agent` ID as a string starts the session with the latest agent version. + + + + ```bash curl + session=$(curl -fsSL https://api.anthropic.com/v1/sessions \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -d @- <beta->sessions->create( + agent: $agent->id, + environmentID: $environment->id, + ); + ``` + ```ruby Ruby + session = client.beta.sessions.create( + agent: agent.id, + environment_id: environment.id + ) + ``` + + +To pin a session to a specific agent version, pass an object. This lets you control exactly which version runs and stage rollouts of new versions independently. + + + + ```bash curl + pinned_session=$(curl -fsSL https://api.anthropic.com/v1/sessions \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -d @- <beta->sessions->create( + agent: ['type' => 'agent', 'id' => $agent->id, 'version' => 1], + environmentID: $environment->id, + ); + ``` + ```ruby Ruby + pinned_session = client.beta.sessions.create( + agent: {type: "agent", id: agent.id, version: 1}, + environment_id: environment.id + ) + ``` + + + +The agent defines how Claude behaves within the session, including the model, system prompt, tools, and MCP servers. See [Agent setup](/docs/en/managed-agents/agent-setup) for details. + + +## MCP authentication through vaults + +If your agent uses MCP tools that require authentication, pass `vault_ids` at session creation to reference a vault containing stored OAuth credentials. Anthropic manages token refresh on your behalf. See [Authenticate with vaults](/docs/en/managed-agents/vaults) for how to create vaults and register credentials. + + + + ```bash curl + vault_session=$(curl -fsSL https://api.anthropic.com/v1/sessions \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -d @- <beta->sessions->create( + agent: $agent->id, + environmentID: $environment->id, + vaultIDs: [$vault->id], + ); + ``` + ```ruby Ruby + vault_session = client.beta.sessions.create( + agent: agent.id, + environment_id: environment.id, + vault_ids: [vault.id] + ) + ``` + + +## Starting the session + +Creating a session provisions the environment and agent but does not start any work. To delegate a task, send events to the session using a [user event](/docs/en/managed-agents/events-and-streaming#user-events). The session acts as a state machine that tracks progress while events drive the actual execution. + + + + ```bash curl + curl -fsSL "https://api.anthropic.com/v1/sessions/$SESSION_ID/events" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -d @- <<'EOF' + { + "events": [ + { + "type": "user.message", + "content": [{"type": "text", "text": "List the files in the working directory."}] + } + ] + } + EOF + ``` + + ```bash CLI + ant beta:sessions:events send \ + --session-id "$SESSION_ID" \ + <<'YAML' + events: + - type: user.message + content: + - type: text + text: List the files in the working directory. + YAML + ``` + ```python Python + client.beta.sessions.events.send( + session.id, + events=[ + { + "type": "user.message", + "content": [ + {"type": "text", "text": "List the files in the working directory."} + ], + }, + ], + ) + ``` + ```typescript TypeScript + await client.beta.sessions.events.send(session.id, { + events: [ + { + type: "user.message", + content: [{ type: "text", text: "List the files in the working directory." }] + } + ] + }); + ``` + ```csharp C# + await client.Beta.Sessions.Events.Send(session.ID, new() + { + Events = + [ + new BetaManagedAgentsUserMessageEventParams + { + Type = BetaManagedAgentsUserMessageEventParamsType.UserMessage, + Content = + [ + new BetaManagedAgentsTextBlock + { + Type = BetaManagedAgentsTextBlockType.Text, + Text = "List the files in the working directory.", + }, + ], + }, + ], + }); + ``` + ```go Go + if _, err := client.Beta.Sessions.Events.Send(ctx, session.ID, anthropic.BetaSessionEventSendParams{ + Events: []anthropic.SendEventsParamsUnion{{ + OfUserMessage: &anthropic.BetaManagedAgentsUserMessageEventParams{ + Type: anthropic.BetaManagedAgentsUserMessageEventParamsTypeUserMessage, + Content: []anthropic.BetaManagedAgentsUserMessageEventParamsContentUnion{{ + OfText: &anthropic.BetaManagedAgentsTextBlockParam{ + Type: anthropic.BetaManagedAgentsTextBlockTypeText, + Text: "List the files in the working directory.", + }, + }}, + }, + }}, + }); err != nil { + panic(err) + } + ``` + ```java Java + client.beta().sessions().events().send( + session.id(), + EventSendParams.builder() + .addEvent(BetaManagedAgentsUserMessageEventParams.builder() + .type(BetaManagedAgentsUserMessageEventParams.Type.USER_MESSAGE) + .addTextContent("List the files in the working directory.") + .build()) + .build()); + ``` + ```php PHP + $client->beta->sessions->events->send( + $session->id, + events: [ + [ + 'type' => 'user.message', + 'content' => [['type' => 'text', 'text' => 'List the files in the working directory.']], + ], + ], + ); + ``` + ```ruby Ruby + client.beta.sessions.events.send_( + session.id, + events: [ + { + type: "user.message", + content: [{type: "text", text: "List the files in the working directory."}] + } + ] + ) + ``` + + +See [Events and streaming](/docs/en/managed-agents/events-and-streaming) for how to stream the agent's responses and handle tool confirmations. + +## Session statuses + +Sessions progress through these statuses: + +| Status | Description | +|--------|-------------| +| `idle` | Agent is waiting for input, including user messages or tool confirmations. Sessions start in `idle`. | +| `running` | Agent is actively executing | +| `rescheduling` | Transient error occurred, retrying automatically | +| `terminated` | Session has ended due to an unrecoverable error | + +## Other session operations + +### Retrieving a session + + + + ```bash curl + retrieved=$(curl -fsSL "https://api.anthropic.com/v1/sessions/$SESSION_ID" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01") + echo "Status: $(jq -r '.status' <<< "$retrieved")" + ``` + + ```bash CLI + ant beta:sessions retrieve --session-id "$SESSION_ID" + ``` + ```python Python + retrieved = client.beta.sessions.retrieve(session.id) + print(f"Status: {retrieved.status}") + ``` + ```typescript TypeScript + const retrieved = await client.beta.sessions.retrieve(session.id); + console.log(`Status: ${retrieved.status}`); + ``` + ```csharp C# + var retrieved = await client.Beta.Sessions.Retrieve(session.ID); + Console.WriteLine($"Status: {retrieved.Status.Raw()}"); + ``` + ```go Go + retrieved, err := client.Beta.Sessions.Get(ctx, session.ID, anthropic.BetaSessionGetParams{}) + if err != nil { + panic(err) + } + fmt.Printf("Status: %s\n", retrieved.Status) + ``` + ```java Java + var retrieved = client.beta().sessions().retrieve(session.id()); + IO.println("Status: " + retrieved.status()); + ``` + ```php PHP + $retrieved = $client->beta->sessions->retrieve($session->id); + echo "Status: {$retrieved->status}\n"; + ``` + ```ruby Ruby + retrieved = client.beta.sessions.retrieve(session.id) + puts "Status: #{retrieved.status}" + ``` + + +### Listing sessions + + + ```bash curl + curl -fsSL https://api.anthropic.com/v1/sessions \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + | jq -r '.data[] | "\(.id): \(.status)"' + ``` + ```bash CLI + ant beta:sessions list + ``` + ```python Python + for session in client.beta.sessions.list(): + print(f"{session.id}: {session.status}") + ``` + ```typescript TypeScript + for await (const session of client.beta.sessions.list()) { + console.log(`${session.id}: ${session.status}`); + } + ``` + ```csharp C# + var sessions = await client.Beta.Sessions.List(); + await foreach (var listedSession in sessions.Paginate()) + { + Console.WriteLine($"{listedSession.ID}: {listedSession.Status.Raw()}"); + } + ``` + ```go Go + page := client.Beta.Sessions.ListAutoPaging(ctx, anthropic.BetaSessionListParams{}) + for page.Next() { + session := page.Current() + fmt.Printf("%s: %s\n", session.ID, session.Status) + } + if err := page.Err(); err != nil { + panic(err) + } + ``` + ```java Java + for (var listed : client.beta().sessions().list().autoPager()) { + IO.println(listed.id() + ": " + listed.status()); + } + ``` + ```php PHP + foreach ($client->beta->sessions->list()->pagingEachItem() as $session) { + echo "{$session->id}: {$session->status}\n"; + } + ``` + ```ruby Ruby + client.beta.sessions.list.auto_paging_each do |session| + puts "#{session.id}: #{session.status}" + end + ``` + + +### Archiving a session + +Archive a session to prevent new events from being sent while preserving its history: + + + + ```bash curl + curl -fsSL -X POST "https://api.anthropic.com/v1/sessions/$SESSION_ID/archive" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" + ``` + + ```bash CLI + ant beta:sessions archive \ + --session-id "$SESSION_ID" + ``` + ```python Python + client.beta.sessions.archive(session.id) + ``` + ```typescript TypeScript + await client.beta.sessions.archive(session.id); + ``` + ```csharp C# + await client.Beta.Sessions.Archive(session.ID); + ``` + ```go Go + _, err = client.Beta.Sessions.Archive(ctx, session.ID, anthropic.BetaSessionArchiveParams{}) + if err != nil { + panic(err) + } + ``` + ```java Java + client.beta().sessions().archive(session.id()); + ``` + ```php PHP + $client->beta->sessions->archive($session->id); + ``` + ```ruby Ruby + client.beta.sessions.archive(session.id) + ``` + + +### Deleting a session + +Delete a session to permanently remove its record, events, and associated container. A `running` session cannot be deleted; send an [interrupt event](/docs/en/managed-agents/events-and-streaming#user-events) if you need to delete it immediately. + +Files, memory stores, environments, and agents are independent resources and are not affected by session deletion. + + + + ```bash curl + curl -fsSL -X DELETE "https://api.anthropic.com/v1/sessions/$SESSION_ID" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" + ``` + + ```bash CLI + ant beta:sessions delete \ + --session-id "$SESSION_ID" + ``` + ```python Python + client.beta.sessions.delete(session.id) + ``` + ```typescript TypeScript + await client.beta.sessions.delete(session.id); + ``` + ```csharp C# + await client.Beta.Sessions.Delete(session.ID); + ``` + ```go Go + _, err = client.Beta.Sessions.Delete(ctx, session.ID, anthropic.BetaSessionDeleteParams{}) + if err != nil { + panic(err) + } + ``` + ```java Java + client.beta().sessions().delete(session.id()); + ``` + ```php PHP + $client->beta->sessions->delete($session->id); + ``` + ```ruby Ruby + client.beta.sessions.delete(session.id) + ``` + \ No newline at end of file diff --git a/content/en/managed-agents/skills.md b/content/en/managed-agents/skills.md new file mode 100644 index 000000000..1cd8197d6 --- /dev/null +++ b/content/en/managed-agents/skills.md @@ -0,0 +1,189 @@ +# Skills + +Attach reusable, filesystem-based expertise to your agent for domain-specific workflows. + +--- + +Skills are reusable, filesystem-based resources that give your agent domain-specific expertise: workflows, context, and best practices that turn a general-purpose agent into a specialist. Unlike prompts (conversation-level instructions for one-off tasks), skills load on demand, only impacting the context window when needed. + +Two types of skill are supported. Both work the same way: your agent invokes them automatically when they are relevant to the task. + +- **Pre-built Anthropic skills:** Common document tasks such as PowerPoint, Excel, Word, and PDF handling. +- **Custom skills:** Skills you author and upload to your organization. + +To learn how to author custom skills, see the [Agent Skills overview](/docs/en/agents-and-tools/agent-skills/overview) and [best practices](/docs/en/agents-and-tools/agent-skills/best-practices). This page assumes you already have skills available in your organization or are using Anthropic pre-built skills. + + +All Managed Agents API requests require the `managed-agents-2026-04-01` beta header. The SDK sets the beta header automatically. + + +## Enable skills on a session + +Attach skills when creating an agent. A maximum of 20 skills per session is supported - this includes skills across all agents for the session, if you are working with [multiple agents](/docs/en/managed-agents/multi-agent). + + +```bash curl +agent=$(curl -sS https://api.anthropic.com/v1/agents \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + --json @- <<'EOF' +{ + "name": "Financial Analyst", + "model": "claude-sonnet-4-6", + "system": "You are a financial analysis agent.", + "skills": [ + {"type": "anthropic", "skill_id": "xlsx"}, + {"type": "custom", "skill_id": "skill_abc123", "version": "latest"} + ] +} +EOF +) +``` + +```bash CLI +ant beta:agents create <<'YAML' +name: Financial Analyst +model: claude-sonnet-4-6 +system: You are a financial analysis agent. +skills: + - type: anthropic + skill_id: xlsx + - type: custom + skill_id: skill_abc123 + version: latest +YAML +``` + +```python Python +agent = client.beta.agents.create( + name="Financial Analyst", + model="claude-sonnet-4-6", + system="You are a financial analysis agent.", + skills=[ + { + "type": "anthropic", + "skill_id": "xlsx", + }, + { + "type": "custom", + "skill_id": "skill_abc123", + "version": "latest", + }, + ], +) +``` + +```typescript TypeScript +const agent = await client.beta.agents.create({ + name: "Financial Analyst", + model: "claude-sonnet-4-6", + system: "You are a financial analysis agent.", + skills: [ + { + type: "anthropic", + skill_id: "xlsx" + }, + { + type: "custom", + skill_id: "skill_abc123", + version: "latest" + } + ] +}); +``` + +```csharp C# +var agent = await client.Beta.Agents.Create(new() +{ + Name = "Financial Analyst", + Model = BetaManagedAgentsModel.ClaudeSonnet4_6, + System = "You are a financial analysis agent.", + Skills = + [ + new BetaManagedAgentsAnthropicSkillParams { Type = "anthropic", SkillID = "xlsx" }, + new BetaManagedAgentsCustomSkillParams { Type = "custom", SkillID = "skill_abc123", Version = "latest" }, + ], +}); +``` + +```go Go +agent, err := client.Beta.Agents.New(ctx, anthropic.BetaAgentNewParams{ + Name: "Financial Analyst", + Model: anthropic.BetaManagedAgentsModelConfigParams{ + ID: "claude-sonnet-4-6", + Type: anthropic.BetaManagedAgentsModelConfigParamsTypeModelConfig, + }, + System: anthropic.String("You are a financial analysis agent."), + Skills: []anthropic.ManagedAgentsSkillParamUnion{ + {OfAnthropic: &anthropic.BetaManagedAgentsAnthropicSkillParams{ + SkillID: "xlsx", + Type: anthropic.BetaManagedAgentsAnthropicSkillParamsTypeAnthropic, + }}, + {OfCustom: &anthropic.BetaManagedAgentsCustomSkillParams{ + SkillID: "skill_abc123", + Type: anthropic.BetaManagedAgentsCustomSkillParamsTypeCustom, + Version: anthropic.String("latest"), + }}, + }, +}) +if err != nil { + panic(err) +} +``` + +```java Java +var agent = client.beta().agents().create( + AgentCreateParams.builder() + .name("Financial Analyst") + .model(BetaManagedAgentsModel.CLAUDE_SONNET_4_6) + .system("You are a financial analysis agent.") + .addSkill( + BetaManagedAgentsAnthropicSkillParams.builder() + .type(BetaManagedAgentsAnthropicSkillParams.Type.ANTHROPIC) + .skillId("xlsx") + .build() + ) + .addSkill( + BetaManagedAgentsCustomSkillParams.builder() + .type(BetaManagedAgentsCustomSkillParams.Type.CUSTOM) + .skillId("skill_abc123") + .version("latest") + .build() + ) + .build() +); +``` + +```php PHP +$agent = $client->beta->agents->create( + name: 'Financial Analyst', + model: 'claude-sonnet-4-6', + system: 'You are a financial analysis agent.', + skills: [ + ['type' => 'anthropic', 'skill_id' => 'xlsx'], + ['type' => 'custom', 'skill_id' => 'skill_abc123', 'version' => 'latest'], + ], +); +``` + +```ruby Ruby +agent = client.beta.agents.create( + name: "Financial Analyst", + model: "claude-sonnet-4-6", + system_: "You are a financial analysis agent.", + skills: [ + {type: "anthropic", skill_id: "xlsx"}, + {type: "custom", skill_id: "skill_abc123", version: "latest"} + ] +) +``` + + +## Skill types + +| Field | Description | +| --- | --- | +| `type` | Either `anthropic` for pre-built skills or `custom` for organization-authored skills. | +| `skill_id` | The skill identifier. For Anthropic skills, use the short name (for example, `xlsx`). For custom skills, use the `skill_*` ID returned at creation. | +| `version` | Custom skills only. Pin to a specific version or use `latest`. | \ No newline at end of file diff --git a/content/en/managed-agents/tools.md b/content/en/managed-agents/tools.md new file mode 100644 index 000000000..e31cc4c3c --- /dev/null +++ b/content/en/managed-agents/tools.md @@ -0,0 +1,462 @@ +# Tools + +Configure tools available to your agent. + +--- + +Claude Managed Agents provides a set of built-in tools that Claude can use autonomously within a session. You control which tools are available by specifying them in the agent configuration. + +Custom, user-defined tools are also supported. Your application executes these tools separately and sends the tool results back to Claude; Claude can use the results to continue the task at hand. + + +All Managed Agents API requests require the `managed-agents-2026-04-01` beta header. The SDK sets the beta header automatically. + + +## Available tools + +The agent toolset includes the following tools. All are enabled by default when you include the toolset in your agent configuration. + +| Tool | Name | Description | +|---|---|---| +| Bash | `bash` | Execute bash commands in a shell session | +| Read | `read` | Read a file from the local filesystem | +| Write | `write` | Write a file to the local filesystem | +| Edit | `edit` | Perform string replacement in a file | +| Glob | `glob` | Fast file pattern matching using glob patterns | +| Grep | `grep` | Text search using regex patterns | +| Web fetch | `web_fetch` | Fetch content from a URL | +| Web search | `web_search` | Search the web for information | + +## Configuring the toolset + +Enable the full toolset with `agent_toolset_20260401` when creating an agent. Use the `configs` array to disable specific tools or override their settings. + + +```bash curl +agent=$(curl -fsSL https://api.anthropic.com/v1/agents \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -d @- <<'EOF' +{ + "name": "Coding Assistant", + "model": "claude-sonnet-4-6", + "tools": [ + { + "type": "agent_toolset_20260401", + "configs": [ + {"name": "web_fetch", "enabled": false} + ] + } + ] +} +EOF +) +``` + +```bash CLI +ant beta:agents create <<'YAML' +name: Coding Assistant +model: claude-sonnet-4-6 +tools: + - type: agent_toolset_20260401 + configs: + - name: web_fetch + enabled: false +YAML +``` + +```python Python +agent = client.beta.agents.create( + name="Coding Assistant", + model="claude-sonnet-4-6", + tools=[ + { + "type": "agent_toolset_20260401", + "configs": [ + {"name": "web_fetch", "enabled": False}, + ], + }, + ], +) +``` + +```typescript TypeScript +const agent = await client.beta.agents.create({ + name: "Coding Assistant", + model: "claude-sonnet-4-6", + tools: [ + { + type: "agent_toolset_20260401", + configs: [{ name: "web_fetch", enabled: false }] + } + ] +}); +``` + +```csharp C# +var agent = await client.Beta.Agents.Create(new() +{ + Name = "Coding Assistant", + Model = new("claude-sonnet-4-6"), + Tools = + [ + new BetaManagedAgentsAgentToolset20260401Params + { + Type = "agent_toolset_20260401", + Configs = + [ + new() { Name = "web_fetch", Enabled = false }, + ], + }, + ], +}); +``` + +```go Go +agent, err := client.Beta.Agents.New(ctx, anthropic.BetaAgentNewParams{ + Name: "Coding Assistant", + Model: anthropic.BetaManagedAgentsModelConfigParams{ + ID: "claude-sonnet-4-6", + Type: anthropic.BetaManagedAgentsModelConfigParamsTypeModelConfig, + }, + Tools: []anthropic.BetaAgentNewParamsToolUnion{{ + OfAgentToolset20260401: &anthropic.BetaManagedAgentsAgentToolset20260401Params{ + Type: anthropic.BetaManagedAgentsAgentToolset20260401ParamsTypeAgentToolset20260401, + Configs: []anthropic.BetaManagedAgentsAgentToolConfigParams{{ + Name: anthropic.BetaManagedAgentsAgentToolConfigParamsNameWebFetch, + Enabled: anthropic.Bool(false), + }}, + }, + }}, +}) +if err != nil { + panic(err) +} +``` + +```java Java +var agent = client.beta().agents().create(AgentCreateParams.builder() + .name("Coding Assistant") + .model(BetaManagedAgentsModel.CLAUDE_SONNET_4_6) + .addTool(BetaManagedAgentsAgentToolset20260401Params.builder() + .type(BetaManagedAgentsAgentToolset20260401Params.Type.AGENT_TOOLSET_20260401) + .addConfig(BetaManagedAgentsAgentToolConfigParams.builder() + .name(BetaManagedAgentsAgentToolConfigParams.Name.WEB_FETCH) + .enabled(false) + .build()) + .build()) + .build()); +``` + +```php PHP + +$agent = $client->beta->agents->create( + name: 'Coding Assistant', + model: 'claude-sonnet-4-6', + tools: [ + BetaManagedAgentsAgentToolset20260401Params::with( + type: 'agent_toolset_20260401', + configs: [ + BetaManagedAgentsAgentToolConfigParams::with(name: 'web_fetch', enabled: false), + ], + ), + ], +); +``` + +```ruby Ruby +agent = client.beta.agents.create( + name: "Coding Assistant", + model: "claude-sonnet-4-6", + tools: [ + { + type: :agent_toolset_20260401, + configs: [ + {name: :web_fetch, enabled: false} + ] + } + ] +) +``` + + +### Disabling specific tools + +To disable a tool, set `enabled: false` in its config entry: + +```json +{ + "type": "agent_toolset_20260401", + "configs": [ + { "name": "web_fetch", "enabled": false }, + { "name": "web_search", "enabled": false } + ] +} +``` + +### Enabling only specific tools + +To start with everything off and enable only what you need, set `default_config.enabled` to `false`: + +```json +{ + "type": "agent_toolset_20260401", + "default_config": { "enabled": false }, + "configs": [ + { "name": "bash", "enabled": true }, + { "name": "read", "enabled": true }, + { "name": "write", "enabled": true } + ] +} +``` + +## Custom tools + +In addition to built-in tools, you can define custom tools. Custom tools are analogous to [user-defined client tools](/docs/en/agents-and-tools/tool-use/how-tool-use-works#user-defined-tools-client-executed) in the Messages API. + +Custom tools allow you to extend Claude's capabilities to perform a wider variety of tasks. Each tool defines a contract: you specify what operations are available and what they return; Claude decides when and how to call them. The model never executes anything on its own. It emits a structured request, your code runs the operation, and the result flows back into the conversation. + + +```bash curl +agent=$(curl -fsSL https://api.anthropic.com/v1/agents \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -d @- <<'EOF' +{ + "name": "Weather Agent", + "model": "claude-sonnet-4-6", + "tools": [ + { + "type": "agent_toolset_20260401" + }, + { + "type": "custom", + "name": "get_weather", + "description": "Get current weather for a location", + "input_schema": { + "type": "object", + "properties": { + "location": {"type": "string", "description": "City name"} + }, + "required": ["location"] + } + } + ] +} +EOF +) +``` + +```bash CLI +ant beta:agents create <<'YAML' +name: Weather Agent +model: claude-sonnet-4-6 +tools: + - type: agent_toolset_20260401 + - type: custom + name: get_weather + description: Get current weather for a location + input_schema: + type: object + properties: + location: + type: string + description: City name + required: + - location +YAML +``` + +```python Python +agent = client.beta.agents.create( + name="Weather Agent", + model="claude-sonnet-4-6", + tools=[ + { + "type": "agent_toolset_20260401", + }, + { + "type": "custom", + "name": "get_weather", + "description": "Get current weather for a location", + "input_schema": { + "type": "object", + "properties": { + "location": {"type": "string", "description": "City name"}, + }, + "required": ["location"], + }, + }, + ], +) +``` + +```typescript TypeScript +const agent = await client.beta.agents.create({ + name: "Weather Agent", + model: "claude-sonnet-4-6", + tools: [ + { type: "agent_toolset_20260401" }, + { + type: "custom", + name: "get_weather", + description: "Get current weather for a location", + input_schema: { + type: "object", + properties: { location: { type: "string", description: "City name" } }, + required: ["location"] + } + } + ] +}); +``` + +```csharp C# + +var agent = await client.Beta.Agents.Create(new() +{ + Name = "Weather Agent", + Model = new("claude-sonnet-4-6"), + Tools = + [ + new BetaManagedAgentsAgentToolset20260401Params + { + Type = "agent_toolset_20260401", + }, + new BetaManagedAgentsCustomToolParams + { + Type = "custom", + Name = "get_weather", + Description = "Get current weather for a location", + InputSchema = new() + { + Type = "object", + Properties = new Dictionary + { + ["location"] = JsonSerializer.SerializeToElement( + new { type = "string", description = "City name" } + ), + }, + Required = ["location"], + }, + }, + ], +}); +``` + +```go Go +agent, err := client.Beta.Agents.New(ctx, anthropic.BetaAgentNewParams{ + Name: "Weather Agent", + Model: anthropic.BetaManagedAgentsModelConfigParams{ + ID: "claude-sonnet-4-6", + Type: anthropic.BetaManagedAgentsModelConfigParamsTypeModelConfig, + }, + Tools: []anthropic.BetaAgentNewParamsToolUnion{{ + OfAgentToolset20260401: &anthropic.BetaManagedAgentsAgentToolset20260401Params{ + Type: anthropic.BetaManagedAgentsAgentToolset20260401ParamsTypeAgentToolset20260401, + }, + }, { + OfCustom: &anthropic.BetaManagedAgentsCustomToolParams{ + Type: anthropic.BetaManagedAgentsCustomToolParamsTypeCustom, + Name: "get_weather", + Description: "Get current weather for a location", + InputSchema: anthropic.BetaManagedAgentsCustomToolInputSchemaParam{ + Type: anthropic.BetaManagedAgentsCustomToolInputSchemaTypeObject, + Properties: map[string]any{ + "location": map[string]any{ + "type": "string", + "description": "City name", + }, + }, + Required: []string{"location"}, + }, + }, + }}, +}) +if err != nil { + panic(err) +} +``` + +```java Java +var agent = client.beta().agents().create(AgentCreateParams.builder() + .name("Weather Agent") + .model(BetaManagedAgentsModel.CLAUDE_SONNET_4_6) + .addTool(BetaManagedAgentsAgentToolset20260401Params.builder() + .type(BetaManagedAgentsAgentToolset20260401Params.Type.AGENT_TOOLSET_20260401) + .build()) + .addTool(BetaManagedAgentsCustomToolParams.builder() + .type(BetaManagedAgentsCustomToolParams.Type.CUSTOM) + .name("get_weather") + .description("Get current weather for a location") + .inputSchema(BetaManagedAgentsCustomToolInputSchema.builder() + .type(BetaManagedAgentsCustomToolInputSchema.Type.OBJECT) + .properties(BetaManagedAgentsCustomToolInputSchema.Properties.builder() + .putAdditionalProperty("location", JsonValue.from(Map.of( + "type", "string", + "description", "City name"))) + .build()) + .addRequired("location") + .build()) + .build()) + .build()); +``` + +```php PHP +use Anthropic\Beta\Agents\BetaManagedAgentsCustomToolInputSchema; +use Anthropic\Beta\Agents\BetaManagedAgentsCustomToolParams; + +$agent = $client->beta->agents->create( + name: 'Weather Agent', + model: 'claude-sonnet-4-6', + tools: [ + BetaManagedAgentsAgentToolset20260401Params::with( + type: 'agent_toolset_20260401', + ), + BetaManagedAgentsCustomToolParams::with( + type: 'custom', + name: 'get_weather', + description: 'Get current weather for a location', + inputSchema: BetaManagedAgentsCustomToolInputSchema::with( + type: 'object', + properties: ['location' => ['type' => 'string', 'description' => 'City name']], + required: ['location'], + ), + ), + ], +); +``` + +```ruby Ruby +agent = client.beta.agents.create( + name: "Weather Agent", + model: "claude-sonnet-4-6", + tools: [ + {type: :agent_toolset_20260401}, + { + type: :custom, + name: "get_weather", + description: "Get current weather for a location", + input_schema: { + type: :object, + properties: {location: {type: "string", description: "City name"}}, + required: ["location"] + } + } + ] +) +``` + + +Once you've defined the tool at the agent level, the agent will invoke the tools through the course of a session. See [Session event stream](/docs/en/managed-agents/events-and-streaming#handling-custom-tool-calls) for the full flow. + +### Best practices for custom tool definitions + +- **Provide extremely detailed descriptions.** This is by far the most important factor in tool performance. Your descriptions should explain what the tool does, when it should be used (and when it shouldn't), what each parameter means and how it affects the tool's behavior, and any important caveats or limitations. The more context you can give Claude about your tools, the better it will be at deciding when and how to use them. Aim for at least 3-4 sentences per tool description, more if the tool is complex. +- **Consolidate related operations into fewer tools.** Rather than creating a separate tool for every action (`create_pr`, `review_pr`, `merge_pr`), group them into a single tool with an `action` parameter. Fewer, more capable tools reduce selection ambiguity and make your tool surface easier for Claude to navigate. +- **Use meaningful namespacing in tool names.** When your tools span multiple services or resources, prefix names with the resource (e.g., `db_query`, `storage_read`). This makes tool selection unambiguous as your library grows. +- **Design tool responses to return only high-signal information.** Return semantic, stable identifiers (e.g., slugs or UUIDs) rather than opaque internal references, and include only the fields Claude needs to reason about its next step. Bloated responses waste context and make it harder for Claude to extract what matters. \ No newline at end of file diff --git a/content/en/managed-agents/vaults.md b/content/en/managed-agents/vaults.md new file mode 100644 index 000000000..45e1b8c7b --- /dev/null +++ b/content/en/managed-agents/vaults.md @@ -0,0 +1,779 @@ +# Authenticate with vaults + +Register per-user credentials when creating sessions. + +--- + +Vaults and credentials are authentication primitives that let you register credentials for third-party services once and reference them by ID at session creation. This means you don't need to run your own secret store, transmit tokens on every call, or lose track of which end user an agent acted on behalf of. + +The vault reference is a per-session parameter, so you can manage your product at the agent level and your users at the session level. + + +All Managed Agents API requests require the `managed-agents-2026-04-01` beta header. The SDK sets the beta header automatically. + + +## Create a vault + + +Vaults and credentials are workspace-scoped, meaning anyone with API key access can use them for authorizing an agent to complete a task. To revoke access, delete the vault or credential. + + +A vault is the collection of `credentials` associated with an end-user. Give it a `display_name` and optionally tag it with `metadata` so you can map it back to your own user records. + + + +````bash +vault_id=$(curl --fail-with-body -sS https://api.anthropic.com/v1/vaults \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + --data @- <<'EOF' | jq -r '.id' +{ + "display_name": "Alice", + "metadata": {"external_user_id": "usr_abc123"} +} +EOF +) +echo "$vault_id" # "vlt_01ABC..." +```` + + +````bash +VAULT_ID=$(ant beta:vaults create \ + --display-name "Alice" \ + --metadata '{external_user_id: usr_abc123}' \ + --transform id --format yaml) +```` + + +````python +vault = client.beta.vaults.create( + display_name="Alice", + metadata={"external_user_id": "usr_abc123"}, +) +print(vault.id) # "vlt_01ABC..." +```` + + +````typescript +const vault = await client.beta.vaults.create({ + display_name: "Alice", + metadata: { external_user_id: "usr_abc123" }, +}); +console.log(vault.id); // "vlt_01ABC..." +```` + + +````csharp +var vault = await client.Beta.Vaults.Create(new() +{ + DisplayName = "Alice", + Metadata = new Dictionary { ["external_user_id"] = "usr_abc123" }, +}); +Console.WriteLine(vault.ID); // "vlt_01ABC..." +```` + + +````go +vault, err := client.Beta.Vaults.New(ctx, anthropic.BetaVaultNewParams{ + DisplayName: "Alice", + Metadata: map[string]string{"external_user_id": "usr_abc123"}, +}) +if err != nil { + panic(err) +} +fmt.Println(vault.ID) // "vlt_01ABC..." +```` + + +````java +var vault = client.beta().vaults().create(VaultCreateParams.builder() + .displayName("Alice") + .metadata(VaultCreateParams.Metadata.builder() + .putAdditionalProperty("external_user_id", JsonValue.from("usr_abc123")) + .build()) + .build()); +IO.println(vault.id()); // "vlt_01ABC..." +```` + + +````php +$vault = $client->beta->vaults->create( + displayName: 'Alice', + metadata: ['external_user_id' => 'usr_abc123'], +); +echo $vault->id . "\n"; // "vlt_01ABC..." +```` + + +````ruby +vault = client.beta.vaults.create( + display_name: "Alice", + metadata: {external_user_id: "usr_abc123"} +) +puts vault.id # "vlt_01ABC..." +```` + + + +The response is the full vault record: + +```json +{ + "type": "vault", + "id": "vlt_01ABC...", + "display_name": "Alice", + "metadata": { "external_user_id": "usr_abc123" }, + "created_at": "2026-03-18T10:00:00Z", + "updated_at": "2026-03-18T10:00:00Z", + "archived_at": null +} +``` + +## Add a credential + +Each credential binds to a single `mcp_server_url`. When the agent connects to an MCP server at session runtime, the API matches the server URL against active credentials on the referenced vault and injects the token. + + + + +Use `mcp_oauth` when the MCP server uses OAuth 2.0. If you supply a `refresh` block, Anthropic refreshes the access token on your behalf when it expires. + +The `refresh.token_endpoint_auth.type` field indicates how to authenticate the refresh call: +- `none`: public client +- `client_secret_basic`: HTTP Basic auth with the client secret +- `client_secret_post`: client secret in the POST body + + + +````bash +credential_id=$(curl --fail-with-body -sS "https://api.anthropic.com/v1/vaults/$vault_id/credentials" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + --data @- <<'EOF' | jq -r '.id' +{ + "display_name": "Alice's Slack", + "auth": { + "type": "mcp_oauth", + "mcp_server_url": "https://mcp.slack.com/mcp", + "access_token": "xoxp-...", + "expires_at": "2026-04-15T00:00:00Z", + "refresh": { + "token_endpoint": "https://slack.com/api/oauth.v2.access", + "client_id": "1234567890.0987654321", + "scope": "channels:read chat:write", + "refresh_token": "xoxe-1-...", + "token_endpoint_auth": {"type": "client_secret_post", "client_secret": "abc123..."} + } + } +} +EOF +) +```` + + +````bash +CREDENTIAL_ID=$(ant beta:vaults:credentials create \ + --vault-id "$VAULT_ID" \ + --display-name "Alice's Slack" \ + --transform id --format yaml <<'EOF' +auth: + type: mcp_oauth + mcp_server_url: https://mcp.slack.com/mcp + access_token: xoxp-... + expires_at: "2026-04-15T00:00:00Z" + refresh: + token_endpoint: https://slack.com/api/oauth.v2.access + client_id: "1234567890.0987654321" + scope: channels:read chat:write + refresh_token: xoxe-1-... + token_endpoint_auth: + type: client_secret_post + client_secret: abc123... +EOF +) +```` + + +````python +credential = client.beta.vaults.credentials.create( + vault_id=vault.id, + display_name="Alice's Slack", + auth={ + "type": "mcp_oauth", + "mcp_server_url": "https://mcp.slack.com/mcp", + "access_token": "xoxp-...", + "expires_at": "2026-04-15T00:00:00Z", + "refresh": { + "token_endpoint": "https://slack.com/api/oauth.v2.access", + "client_id": "1234567890.0987654321", + "scope": "channels:read chat:write", + "refresh_token": "xoxe-1-...", + "token_endpoint_auth": {"type": "client_secret_post", "client_secret": "abc123..."}, + }, + }, +) +```` + + +````typescript +const credential = await client.beta.vaults.credentials.create(vault.id, { + display_name: "Alice's Slack", + auth: { + type: "mcp_oauth", + mcp_server_url: "https://mcp.slack.com/mcp", + access_token: "xoxp-...", + expires_at: "2026-04-15T00:00:00Z", + refresh: { + token_endpoint: "https://slack.com/api/oauth.v2.access", + client_id: "1234567890.0987654321", + scope: "channels:read chat:write", + refresh_token: "xoxe-1-...", + token_endpoint_auth: { + type: "client_secret_post", + client_secret: "abc123...", + }, + }, + }, +}); +```` + + +````csharp +var credential = await client.Beta.Vaults.Credentials.Create(vault.ID, new() +{ + DisplayName = "Alice's Slack", + Auth = new BetaManagedAgentsMcpOAuthCreateParams + { + Type = "mcp_oauth", + McpServerUrl = "https://mcp.slack.com/mcp", + AccessToken = "xoxp-...", + ExpiresAt = DateTimeOffset.Parse("2026-04-15T00:00:00Z"), + Refresh = new() + { + TokenEndpoint = "https://slack.com/api/oauth.v2.access", + ClientID = "1234567890.0987654321", + Scope = "channels:read chat:write", + RefreshToken = "xoxe-1-...", + TokenEndpointAuth = new BetaManagedAgentsTokenEndpointAuthPostParam + { + Type = "client_secret_post", + ClientSecret = "abc123...", + }, + }, + }, +}); +```` + + +````go +credential, err := client.Beta.Vaults.Credentials.New(ctx, vault.ID, anthropic.BetaVaultCredentialNewParams{ + DisplayName: anthropic.String("Alice's Slack"), + Auth: anthropic.BetaVaultCredentialNewParamsAuthUnion{ + OfMCPOAuth: &anthropic.BetaManagedAgentsMCPOAuthCreateParams{ + Type: anthropic.BetaManagedAgentsMCPOAuthCreateParamsTypeMCPOAuth, + MCPServerURL: "https://mcp.slack.com/mcp", + AccessToken: "xoxp-...", + ExpiresAt: anthropic.Time(time.Date(2026, time.April, 15, 0, 0, 0, 0, time.UTC)), + Refresh: anthropic.BetaManagedAgentsMCPOAuthRefreshParams{ + TokenEndpoint: "https://slack.com/api/oauth.v2.access", + ClientID: "1234567890.0987654321", + Scope: anthropic.String("channels:read chat:write"), + RefreshToken: "xoxe-1-...", + TokenEndpointAuth: anthropic.BetaManagedAgentsMCPOAuthRefreshParamsTokenEndpointAuthUnion{ + OfClientSecretPost: &anthropic.BetaManagedAgentsTokenEndpointAuthPostParam{ + Type: anthropic.BetaManagedAgentsTokenEndpointAuthPostParamTypeClientSecretPost, + ClientSecret: "abc123...", + }, + }, + }, + }, + }, +}) +if err != nil { + panic(err) +} +```` + + +````java +var credential = client.beta().vaults().credentials().create(vault.id(), + CredentialCreateParams.builder() + .displayName("Alice's Slack") + .auth(BetaManagedAgentsMcpOAuthCreateParams.builder() + .type(BetaManagedAgentsMcpOAuthCreateParams.Type.MCP_OAUTH) + .mcpServerUrl("https://mcp.slack.com/mcp") + .accessToken("xoxp-...") + .expiresAt(OffsetDateTime.parse("2026-04-15T00:00:00Z")) + .refresh(BetaManagedAgentsMcpOAuthRefreshParams.builder() + .tokenEndpoint("https://slack.com/api/oauth.v2.access") + .clientId("1234567890.0987654321") + .scope("channels:read chat:write") + .refreshToken("xoxe-1-...") + .clientSecretPostTokenEndpointAuth("abc123...") + .build()) + .build()) + .build()); +```` + + +````php +$credential = $client->beta->vaults->credentials->create( + vaultID: $vault->id, + displayName: "Alice's Slack", + auth: [ + 'type' => 'mcp_oauth', + 'mcp_server_url' => 'https://mcp.slack.com/mcp', + 'access_token' => 'xoxp-...', + 'expires_at' => '2026-04-15T00:00:00Z', + 'refresh' => [ + 'token_endpoint' => 'https://slack.com/api/oauth.v2.access', + 'client_id' => '1234567890.0987654321', + 'scope' => 'channels:read chat:write', + 'refresh_token' => 'xoxe-1-...', + 'token_endpoint_auth' => [ + 'type' => 'client_secret_post', + 'client_secret' => 'abc123...', + ], + ], + ], +); +```` + + +````ruby +credential = client.beta.vaults.credentials.create( + vault.id, + display_name: "Alice's Slack", + auth: { + type: "mcp_oauth", + mcp_server_url: "https://mcp.slack.com/mcp", + access_token: "xoxp-...", + expires_at: "2026-04-15T00:00:00Z", + refresh: { + token_endpoint: "https://slack.com/api/oauth.v2.access", + client_id: "1234567890.0987654321", + scope: "channels:read chat:write", + refresh_token: "xoxe-1-...", + token_endpoint_auth: { + type: "client_secret_post", + client_secret: "abc123..." + } + } + } +) +```` + + + + + + +Use `static_bearer` when the MCP server accepts a fixed bearer token (API key, personal access token, or similar). No refresh flow is needed. + + +```bash curl +curl -fsSL "https://api.anthropic.com/v1/vaults/$VAULT_ID/credentials" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + -d '{ + "display_name": "Linear API key", + "auth": { + "type": "static_bearer", + "mcp_server_url": "https://mcp.linear.app/mcp", + "token": "lin_api_your_linear_key" + } + }' +``` + +```bash CLI +ant beta:vaults:credentials create --vault-id "$VAULT_ID" <<'YAML' +display_name: Linear API key +auth: + type: static_bearer + mcp_server_url: https://mcp.linear.app/mcp + token: lin_api_your_linear_key +YAML +``` + +```python Python +credential = client.beta.vaults.credentials.create( + vault_id=vault.id, + display_name="Linear API key", + auth={ + "type": "static_bearer", + "mcp_server_url": "https://mcp.linear.app/mcp", + "token": "lin_api_your_linear_key", + }, +) +``` + +```typescript TypeScript +const credential = await client.beta.vaults.credentials.create(vault.id, { + display_name: "Linear API key", + auth: { + type: "static_bearer", + mcp_server_url: "https://mcp.linear.app/mcp", + token: "lin_api_your_linear_key" + } +}); +``` + +```csharp C# +var credential = await client.Beta.Vaults.Credentials.Create(vault.ID, new() +{ + DisplayName = "Linear API key", + Auth = new BetaManagedAgentsStaticBearerCreateParams + { + Type = "static_bearer", + McpServerUrl = "https://mcp.linear.app/mcp", + Token = "lin_api_your_linear_key", + }, +}); +``` + +```go Go +credential, err := client.Beta.Vaults.Credentials.New(ctx, vault.ID, anthropic.BetaVaultCredentialNewParams{ + DisplayName: anthropic.String("Linear API key"), + Auth: anthropic.BetaVaultCredentialNewParamsAuthUnion{ + OfStaticBearer: &anthropic.BetaManagedAgentsStaticBearerCreateParams{ + Type: anthropic.BetaManagedAgentsStaticBearerCreateParamsTypeStaticBearer, + MCPServerURL: "https://mcp.linear.app/mcp", + Token: "lin_api_your_linear_key", + }, + }, +}) +if err != nil { + panic(err) +} +``` + +```java Java +var credential = client.beta().vaults().credentials().create(vault.id(), + CredentialCreateParams.builder() + .displayName("Linear API key") + .auth(BetaManagedAgentsStaticBearerCreateParams.builder() + .type(BetaManagedAgentsStaticBearerCreateParams.Type.STATIC_BEARER) + .mcpServerUrl("https://mcp.linear.app/mcp") + .token("lin_api_your_linear_key") + .build()) + .build()); +``` + +```php PHP +$credential = $client->beta->vaults->credentials->create( + vaultID: $vault->id, + displayName: 'Notion token', + auth: [ + 'type' => 'static_bearer', + 'mcp_server_url' => 'https://mcp.linear.app/mcp', + 'token' => 'lin_api_your_linear_key', + ], +); +``` + +```ruby Ruby +credential = client.beta.vaults.credentials.create( + vault.id, + display_name: "Linear API key", + auth: { + type: "static_bearer", + mcp_server_url: "https://mcp.linear.app/mcp", + token: "lin_api_your_linear_key" + } +) +``` + + + + + + +Secret fields (`token`, `access_token`, `refresh_token`, `client_secret`) are write-only. They are never returned in API responses. + + +Credentials are stored as provided and are not validated until session runtime. A bad token surfaces as an MCP auth error during the session, which is emitted but does not block the session from continuing. + +Constraints: + +- **One active credential per `mcp_server_url` per vault.** Creating a second credential for the same URL returns a 409. +- **`mcp_server_url` is immutable.** To point at a different server, archive this credential and create a new one. +- **Maximum 20 credentials per vault.** This matches the maximum amount of MCP servers per agent. + +## Rotate a credential + +Only the secret payload and a handful of metadata fields are mutable. `mcp_server_url`, `token_endpoint`, and `client_id` are locked after creation. + + + +````bash +curl --fail-with-body -sS \ + "https://api.anthropic.com/v1/vaults/$vault_id/credentials/$credential_id" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + --data @- <<'EOF' > /dev/null +{ + "auth": { + "type": "mcp_oauth", + "access_token": "xoxp-new-...", + "expires_at": "2026-05-15T00:00:00Z", + "refresh": {"refresh_token": "xoxe-1-new-..."} + } +} +EOF +```` + + +````bash +ant beta:vaults:credentials update \ + --vault-id "$VAULT_ID" \ + --credential-id "$CREDENTIAL_ID" <<'EOF' +auth: + type: mcp_oauth + access_token: xoxp-new-... + expires_at: "2026-05-15T00:00:00Z" + refresh: + refresh_token: xoxe-1-new-... +EOF +```` + + +````python +client.beta.vaults.credentials.update( + credential.id, + vault_id=vault.id, + auth={ + "type": "mcp_oauth", + "access_token": "xoxp-new-...", + "expires_at": "2026-05-15T00:00:00Z", + "refresh": {"refresh_token": "xoxe-1-new-..."}, + }, +) +```` + + +````typescript +await client.beta.vaults.credentials.update(credential.id, { + vault_id: vault.id, + auth: { + type: "mcp_oauth", + access_token: "xoxp-new-...", + expires_at: "2026-05-15T00:00:00Z", + refresh: { + refresh_token: "xoxe-1-new-...", + }, + }, +}); +```` + + +````csharp +await client.Beta.Vaults.Credentials.Update(credential.ID, new() +{ + VaultID = vault.ID, + Auth = new BetaManagedAgentsMcpOAuthUpdateParams + { + Type = "mcp_oauth", + AccessToken = "xoxp-new-...", + ExpiresAt = DateTimeOffset.Parse("2026-05-15T00:00:00Z"), + Refresh = new() { RefreshToken = "xoxe-1-new-..." }, + }, +}); +```` + + +````go +_, err = client.Beta.Vaults.Credentials.Update(ctx, credential.ID, anthropic.BetaVaultCredentialUpdateParams{ + VaultID: vault.ID, + Auth: anthropic.BetaVaultCredentialUpdateParamsAuthUnion{ + OfMCPOAuth: &anthropic.BetaManagedAgentsMCPOAuthUpdateParams{ + Type: anthropic.BetaManagedAgentsMCPOAuthUpdateParamsTypeMCPOAuth, + AccessToken: anthropic.String("xoxp-new-..."), + ExpiresAt: anthropic.Time(time.Date(2026, time.May, 15, 0, 0, 0, 0, time.UTC)), + Refresh: anthropic.BetaManagedAgentsMCPOAuthRefreshUpdateParams{ + RefreshToken: anthropic.String("xoxe-1-new-..."), + }, + }, + }, +}) +if err != nil { + panic(err) +} +```` + + +````java +client.beta().vaults().credentials().update(credential.id(), + CredentialUpdateParams.builder() + .vaultId(vault.id()) + .auth(BetaManagedAgentsMcpOAuthUpdateParams.builder() + .type(BetaManagedAgentsMcpOAuthUpdateParams.Type.MCP_OAUTH) + .accessToken("xoxp-new-...") + .expiresAt(OffsetDateTime.parse("2026-05-15T00:00:00Z")) + .refresh(BetaManagedAgentsMcpOAuthRefreshUpdateParams.builder() + .refreshToken("xoxe-1-new-...") + .build()) + .build()) + .build()); +```` + + +````php +$client->beta->vaults->credentials->update( + $credential->id, + vaultID: $vault->id, + auth: [ + 'type' => 'mcp_oauth', + 'access_token' => 'xoxp-new-...', + 'expires_at' => '2026-05-15T00:00:00Z', + 'refresh' => ['refresh_token' => 'xoxe-1-new-...'], + ], +); +```` + + +````ruby +client.beta.vaults.credentials.update( + credential.id, + vault_id: vault.id, + auth: { + type: "mcp_oauth", + access_token: "xoxp-new-...", + expires_at: "2026-05-15T00:00:00Z", + refresh: {refresh_token: "xoxe-1-new-..."} + } +) +```` + + + +## Reference the vault at session creation + +Pass `vault_ids` when creating a session: + + + +````bash +session_id=$(curl --fail-with-body -sS https://api.anthropic.com/v1/sessions \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "content-type: application/json" \ + --data @- <beta->sessions->create( + agent: $agent->id, + environmentID: $environment->id, + vaultIDs: [$vault->id], + title: "Alice's Slack digest", +); +```` + + +````ruby +session = client.beta.sessions.create( + agent: agent.id, + environment_id: environment.id, + vault_ids: [vault.id], + title: "Alice's Slack digest" +) +```` + + + +Runtime behavior: + +- Credentials are re-resolved periodically during the session, so a rotation or archive propagates to running sessions without a restart. +- When a vault has no credential for the MCP server, the connection is attempted unauthenticated and produces an error. +- When multiple vaults cover the the MCP server, the first vault with a match wins. + +## Other operations + +- **List vaults or credentials:** Paginated, newest first. Archived records are excluded by default (pass `include_archived=true` to include them). +- **Archive a vault:** `POST /v1/vaults/{id}/archive`. Cascades to all credentials. Secrets are purged; records are retained for auditing. Future sessions referencing this vault fail; running sessions continue. +- **Archive a credential:** `POST /v1/vaults/{id}/credentials/{cred_id}/archive`. Purges the secret payload; `mcp_server_url` remains visible. Frees the `mcp_server_url` for a replacement credential. +- **Delete a vault or credential:** Hard delete. The record is not retained. Use archive if you need an audit trail. \ No newline at end of file diff --git a/content/en/release-notes/overview.md b/content/en/release-notes/overview.md index 0864f0474..6471ceccb 100644 --- a/content/en/release-notes/overview.md +++ b/content/en/release-notes/overview.md @@ -10,6 +10,10 @@ For release notes on Claude Apps, see the [Release notes for Claude Apps in the For updates to Claude Code, see the [complete CHANGELOG.md](https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md) in the `claude-code` repository. +### April 8, 2026 +- We've launched **Claude Managed Agents** in public beta, a fully managed agent harness for running Claude as an autonomous agent with secure sandboxing, built-in tools, and server-sent event streaming. Create agents, configure containers, and run sessions through the API. All endpoints require the `managed-agents-2026-04-01` beta header. Learn more in [Claude Managed Agents overview](/docs/en/managed-agents/overview). +- We've launched the **`ant` CLI**, a command-line client for the Claude API that enables faster interaction with the Claude API, native integration with Claude Code, and versioning of API resources in YAML files. Learn more in the [CLI reference](/docs/en/api/sdks/cli). + ### April 7, 2026 - We announced [Claude Mythos Preview](https://anthropic.com/glasswing) is available as a gated research preview for defensive cybersecurity work as part of [Project Glasswing](https://anthropic.com/glasswing). Access is invitation-only. - The [Messages API](/docs/en/api/messages) is now available on Amazon Bedrock as a research preview. The new Claude in Amazon Bedrock endpoint at `/anthropic/v1/messages` uses the same request shape as the first-party Claude API and runs on AWS-managed infrastructure with zero operator access. Available in `us-east-1`; contact your Anthropic account executive to request access. Learn more in [Claude in Amazon Bedrock](/docs/en/build-with-claude/claude-in-amazon-bedrock). diff --git a/content/en/test-and-evaluate/strengthen-guardrails/reduce-latency.md b/content/en/test-and-evaluate/strengthen-guardrails/reduce-latency.md index 3b4514da2..b87ba1a4a 100644 --- a/content/en/test-and-evaluate/strengthen-guardrails/reduce-latency.md +++ b/content/en/test-and-evaluate/strengthen-guardrails/reduce-latency.md @@ -29,7 +29,7 @@ One of the most straightforward ways to reduce latency is to select the appropri For speed-critical applications, **Claude Haiku 4.5** offers the fastest response times while maintaining high intelligence: -```python +```python Python import anthropic client = anthropic.Anthropic() @@ -60,7 +60,7 @@ Here are some tips to help you optimize your prompts and outputs: Due to how LLMs count [tokens](/docs/en/about-claude/glossary#tokens) instead of words, asking for an exact word count or a word count limit is not as effective a strategy as asking for paragraph or sentence count limits. - **Set appropriate output limits**: Use the `max_tokens` parameter to set a hard limit on the maximum length of the generated response. This prevents Claude from generating overly long outputs. > **Note**: When the response reaches `max_tokens` tokens, the response will be cut off, perhaps midsentence or mid-word, so this is a blunt technique that may require post-processing and is usually most appropriate for multiple choice or short answer responses where the answer comes right at the beginning. -- **Experiment with temperature**: The `temperature` [parameter](/docs/en/api/messages) controls the randomness of the output. Lower values (e.g., 0.2) can sometimes lead to more focused and shorter responses, while higher values (e.g., 0.8) may result in more diverse but potentially longer outputs. +- **Experiment with temperature**: The `temperature` [parameter](/docs/en/api/messages/create) controls the randomness of the output. Lower values (e.g., 0.2) can sometimes lead to more focused and shorter responses, while higher values (e.g., 0.8) may result in more diverse but potentially longer outputs. Finding the right balance between prompt clarity, output quality, and token count may require some experimentation.